linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent Fortier <th0ma7@gmail.com>
To: linux-media@vger.kernel.org
Subject: [PATCH 1/2] media_build: CROSS_COMPILE variable environment and disable rmmod.pl
Date: Sat, 13 Mar 2021 09:51:45 -0500	[thread overview]
Message-ID: <28d6325e-9fd6-f442-bac3-4f5b2b529c48@gmail.com> (raw)

Hi all,

The current framework seems to presume the build is occurring over a 
native environment by default.  In order for it to work using 
cross-compiler toolset, calls to scripts/rmmod.pl needs to be removed 
(in lack of finding another option) as otherwise it fails over various 
insmod,rmmod command execution which are totally unecessary.  The 
following patch 1/2 disable this by adding a CROSS_COMPILE variable 
environment.  This allows calls to cross-compile the media drivers using 
the spksrc SynoCommunity framework for the various media_build stages using:

$(RUN) CROSS_COMPILE=y make allyesconfig
$(RUN) LDFLAGS="" CROSS_COMPILE=y make -j`nproc` MAKEFLAGS=
$(RUN) CROSS_COMPILE=y make install DESTDIR=$(INSTALL_DIR)/$(INSTALL_PREFIX)

Signed-off-by: Vincent Fortier<th0ma7@gmail.com>

---

diff -uprN ../linuxtv.orig/v4l/Makefile v4l/Makefile
--- ../linuxtv.orig/v4l/Makefile    2021-02-08 10:24:43.000000000 +0000
+++ v4l/Makefile    2021-03-13 14:39:19.674250245 +0000
@@ -51,13 +51,17 @@ default:: prepare
      @echo Kernel build directory is $(OUTDIR)
      $(MAKE) -C ../linux apply_patches
      $(MAKE) -C $(OUTDIR) M=$(PWD) $(MYCFLAGS) modules
+ifneq ($(strip $(CROSS_COMPILE)),y)
      ./scripts/rmmod.pl check
+endif
  #    $(MAKE) checkpatch

  mismatch:: prepare
      @echo Kernel build directory is $(OUTDIR)
      $(MAKE) -Wfatal-errors -C $(OUTDIR) M=$(PWD) $(MYCFLAGS) 
CONFIG_DEBUG_SECTION_MISMATCH=y modules
+ifneq ($(strip $(CROSS_COMPILE)),y)
      ./scripts/rmmod.pl check
+endif

  # Anything in this target shouldn't be build in parallel.
  prepare:: config-compat.h Makefile.media links
@@ -66,9 +70,16 @@ prepare:: config-compat.h Makefile.media
  # Object specific rules

  # Targets which don't need Makefile.media's rules
+ifneq ($(strip $(CROSS_COMPILE)),y)
+no-makefile-media-targets := %config clean distclean snapshot snap \
+    tarball release %links \
+    start insmod load stop rmmod unload reload \
+    card% update push %commit help debug cx88-ivtv lxdialog
+else ifeq ($(strip $(CROSS_COMPILE)),y)
  no-makefile-media-targets := %config clean distclean snapshot snap \
-    tarball release %links start insmod load stop rmmod unload reload \
+    tarball release %links \
      card% update push %commit help debug cx88-ivtv lxdialog
+endif

  # Targets which don't need .myconfig to exist, to keep us from 
including it
  no-dot-config-targets := $(no-makefile-media-targets) %install remove
@@ -188,7 +199,11 @@ ifeq ($(inst-m),)
    inst-m    := $(obj-m)
  endif

+ifneq ($(strip $(CROSS_COMPILE)),y)
  v4l_modules := $(shell /sbin/lsmod|cut -d' ' -f1 ) $(patsubst 
%.ko,%,$(inst-m))
+else ifeq ($(strip $(CROSS_COMPILE)),y)
+v4l_modules :=
+endif

  #################################################
  # locales seem to cause trouble sometimes.
@@ -416,7 +431,9 @@ old-install:: rminstall
      -install -d $(DEST)
      -install -m 644 -c $(inst-m) $(DEST)

+ifneq ($(strip $(CROSS_COMPILE)),y)
      /sbin/depmod -a ${KERNELRELEASE}
+endif

  #################################################
  # Tree management rules
diff -uprN ../linuxtv.orig/v4l/scripts/make_makefile.pl 
v4l/scripts/make_makefile.pl
--- ../linuxtv.orig/v4l/scripts/make_makefile.pl    2021-02-08 
10:24:43.000000000 +0000
+++ v4l/scripts/make_makefile.pl    2021-03-13 14:39:47.238414024 +0000
@@ -258,7 +258,10 @@ while (my ($dir, $files) = each %instdir
      print OUT "fi;\n\n";
  }
  print OUT "\t@echo\n";
-print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
\$(DESTDIR))\n\n";
+print OUT "ifneq (\$(strip \$(CROSS_COMPILE)),y)\n";
+print OUT "\t/sbin/depmod -a \$(KERNELRELEASE) \$(if \$(DESTDIR),-b 
\$(DESTDIR))\n";
+print OUT "endif\n";
+print OUT "\t@echo\n";

  # Creating Remove rule
  print OUT "media-rminstall::\n";


                 reply	other threads:[~2021-03-13 14:52 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=28d6325e-9fd6-f442-bac3-4f5b2b529c48@gmail.com \
    --to=th0ma7@gmail.com \
    --cc=linux-media@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).