multiproto-tree: build fix for kernel output dir != kernel source dir

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

most distributions use separate kernel output directories to be
able to build several kernels from the same source tree.

Building the multiproto tree in such an environment fails either
as .config is not found or some kernel source files are not found
(i. e. compiler.h).

The attached patch therefore introduces SDIR which points to the
kernel sources and passes it as an additional argument to some
scripts which need to access .config or source files for example.

The patch is still incomplete i. e. not all references to kernel
source or output directories have been adapted and tested. But
the patch is sufficient for successfully running make and make
distclean in such an environment.

Would some developers with deeper knowledge about the kernel
build system comment whether my patch is going in the right
direction and how to solve other references (e. g. the lxdialog
stuff)?

Bye.
-- 
Dipl.-Inform. (FH) Reinhard Nissl
mailto:rnissl@xxxxxx
diff --git a/v4l/Makefile b/v4l/Makefile
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -16,11 +16,14 @@ else
 
 ifneq ($(SRCDIR),)
 KDIR := $(SRCDIR)
+SDIR := $(SRCDIR)
 else
 ifneq ($(KERNELRELEASE),)
 KDIR := /lib/modules/$(KERNELRELEASE)/build
+SDIR := /lib/modules/$(KERNELRELEASE)/source
 else
 KDIR := /lib/modules/$(shell uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("%s.%s.%s%s\n",$$1,$$2,$$3,$$4); };')/build
+SDIR := /lib/modules/$(shell uname -r|perl -ne 'if (/^([0-9]*)\.([0-9])*\.([0-9]*)(.*)$$/) { printf ("%s.%s.%s%s\n",$$1,$$2,$$3,$$4); };')/source
 
 endif
 endif
@@ -239,7 +242,7 @@ oss:
 	ln -sf . oss
 
 config-compat.h:: $(obj)/.version .myconfig
-	perl scripts/make_config_compat.pl $(KDIR) $(obj)/.myconfig $(obj)/config-compat.h
+	perl scripts/make_config_compat.pl $(KDIR) $(SDIR) $(obj)/.myconfig $(obj)/config-compat.h
 
 kernel-links makelinks::
 	cd ..;	v4l/scripts/makelinks.sh $(KDIR)
@@ -309,10 +312,10 @@ endif
 $(obj)/.config: $(obj)/.version
 	@echo Updating/Creating .config
 	@if [ -e $(obj)/.config ]; then touch $(obj)/.config ; else \
-		./scripts/make_kconfig.pl $(KDIR) ; fi
+		./scripts/make_kconfig.pl $(KDIR) $(SDIR) ; fi
 
 $(obj)/Kconfig: $(obj)/.version
-	./scripts/make_kconfig.pl $(KDIR)
+	./scripts/make_kconfig.pl $(KDIR) $(SDIR)
 
 # With make -j, it's possible that both the .config and Kconfig rules
 # will run at the same time, running make_kconfig.pl twice.  There
@@ -332,7 +335,7 @@ menuconfig:: $(MCONF) lxdialog $(obj)/Kc
 	$(MCONF) $(obj)/Kconfig
 
 allyesconfig allmodconfig:: $(obj)/.version
-	./scripts/make_kconfig.pl $(KDIR) 1
+	./scripts/make_kconfig.pl $(KDIR) $(SDIR) 1
 
 # rule to build kernel conf programs
 KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0
diff --git a/v4l/scripts/make_config_compat.pl b/v4l/scripts/make_config_compat.pl
--- a/v4l/scripts/make_config_compat.pl
+++ b/v4l/scripts/make_config_compat.pl
@@ -1,7 +1,8 @@
 #!/usr/bin/perl
 use strict;
 
-my $kdir=shift or die "should specify a kernel dir";
+my $kdir=shift or die "should specify a kernel output dir";
+my $sdir=shift or die "should specify a kernel source dir";
 my $infile=shift or die "should specify an input config file";
 my $outfile=shift or die "should specify an output config file";
 
@@ -9,7 +10,7 @@ my $out;
 
 sub check_spin_lock()
 {
-	my $file = "$kdir/include/linux/netdevice.h";
+	my $file = "$sdir/include/linux/netdevice.h";
 	my $old_syntax = 1;
 
 	open INNET, "<$file" or die "File not found: $file";
diff --git a/v4l/scripts/make_kconfig.pl b/v4l/scripts/make_kconfig.pl
--- a/v4l/scripts/make_kconfig.pl
+++ b/v4l/scripts/make_kconfig.pl
@@ -13,7 +13,8 @@ my %depmods = ();
 my %depmods = ();
 my ($version, $level, $sublevel, $kernver);
 
-my $kernel = shift;
+my $kdir = shift;
+my $sdir = shift;
 my $force_kconfig = shift;
 
 my $debug=0;
@@ -480,7 +481,7 @@ print "Preparing to compile for kernel v
 print "Preparing to compile for kernel version $kernver\n";
 
 # Get Kernel's config settings
-%kernopts = process_config("$kernel/.config");
+%kernopts = process_config("$kdir/.config");
 
 # Modules must be on, or building out of tree drivers makes no sense
 if(!$kernopts{MODULES}) {
@@ -542,7 +543,7 @@ disable_config('VIDEO_HELPER_CHIPS_AUTO'
 disable_config('VIDEO_HELPER_CHIPS_AUTO');
 
 # ACI needs some kernel includes that might not be there
-disable_config('SOUND_ACI_MIXER') if (! -e "$kernel/sound/oss/sound_config.h");
+disable_config('SOUND_ACI_MIXER') if (! -e "$sdir/sound/oss/sound_config.h");
 
 # Check dependencies
 my %newconfig = checkdeps();
@@ -595,7 +596,7 @@ if ($force_kconfig==1 || !-e '.config') 
 # Check for full kernel sources and print a warning
 sub kernelcheck()
 {
-	my $fullkernel="$kernel/fs/fcntl.c";
+	my $fullkernel="$sdir/fs/fcntl.c";
 	if (! -e $fullkernel) {
 		print <<"EOF2";
 
_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux