Re: [PATCH] Building of kernel's config programs

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

 



I always forget to attach my patches

On Thu, 1 Jun 2006, Trent Piepho wrote:
> This patch uses a different way to build these programs.  In a nutshell, it
> adds a new makefile, v4l/Makefile.kernel, that includes the kernel's top level
> makefile, then adds some more targets to it.  This interfaces to the kernel
> build system at a higher level, and so avoids problems created by low level
> changes in kernel building.  It builds the config programs exactly the same
> way the kernel would.
>
> It should work for all 2.6 kernels so far, from 2.6.0 to 2.6.17.
>
# HG changeset patch
# User Trent Piepho <xyzzy@xxxxxxxxxxxxx>
# Node ID f13ca4ca086e0a8d3e95785d3884614062aa4c73
# Parent  e7ff160f2e38df81230c8f79bc2b0c532678e7b1
New system for building kernel's config programs

From: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

Since v4l-dvb now uses the kernel's config system, it needs certain kernel
binaries like qconf, mconf, and lxdialog to run the config targets.  The
kernel's Makefile is not kind enough to give us a target to just build these
programs.  What this patch does is introduce a new makefile,
Makefile.kernel, which includes the kernel's top-level Makefile.  Then adds
some new "v4l-*" targets which just build the kernel config programs.

The main v4l Makefile is patched to add the necessary kernel conf programs
as dependencies to their respective config targets.  Rules to build the
kernel conf programs are added which invoke a sub-make with the new
Makefile.kernel.  These rules are only invoked when the kernel conf programs
needed don't yet exist.  If they already exist, no write access to the
kernel source tree is needed.

Signed-off-by: Trent Piepho <xyzzy@xxxxxxxxxxxxx>

diff -r e7ff160f2e38 -r f13ca4ca086e v4l/Makefile
--- a/v4l/Makefile	Tue May 30 12:08:12 2006 -0300
+++ b/v4l/Makefile	Thu Jun  1 17:24:50 2006 -0700
@@ -244,65 +244,55 @@ reload::
 #################################################
 # Configuration rules
 
-# SHELL used by kbuild
-CONFIG_SHELL := $(shell if [ -x "$$BASH" ]; then echo $$BASH; \
-          else if [ -x /bin/bash ]; then echo /bin/bash; \
-          else echo sh; fi ; fi)
-
-build := srctree=$(KDIR) HOSTCXX="$(CXX)" HOSTCC="$(HOSTCC)" CONFIG_SHELL="$(CONFIG_SHELL)" -f $(KDIR)/scripts/Makefile.build obj
-
-xconfig:: links .version
-	-if [ ! -f $(KDIR)/scripts/kconfig/qconf ]; then \
-		$(MAKE) -C $(KDIR) $(build)=scripts/kconfig qconf-target=1 scripts/kconfig/qconf; \
-	fi
-	./scripts/make_kconfig.pl
-	$(KDIR)/scripts/kconfig/qconf Kconfig
-	./scripts/make_noconfig.pl
-
-gconfig:: links .version
-	-if [ ! -f $(KDIR)/scripts/kconfig/gconf ]; then \
-		$(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/gconf; \
-	fi
-	./scripts/make_kconfig.pl
-	$(KDIR)/scripts/kconfig/gconf Kconfig
-	./scripts/make_noconfig.pl
-
-config:: links .version
-	-if [ ! -f $(KDIR)/scripts/kconfig/conf ]; then \
-		$(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/conf; \
-	fi
-	./scripts/make_kconfig.pl
-	$(KDIR)/scripts/kconfig/conf Kconfig
-	./scripts/make_noconfig.pl
-
-menuconfig:: links .version
-	./scripts/make_kconfig.pl
-	-rm scripts/lxdialog scripts/kconfig
-	-if [ -d $(KDIR)/scripts/lxdialog ]; then \
-		if [ ! -f $(KDIR)/scripts/lxdialog/lxdialog ]; then \
-			$(MAKE) -C $(KDIR) $(build)=scripts/lxdialog; \
-		fi; \
-		ln -s $(KDIR)/scripts/lxdialog scripts/lxdialog; \
-	fi
-
-	-if [ -d $(KDIR)/scripts/kconfig ]; then \
-		if [  -d $(KDIR)/scripts/kconfig/lxdialog ]; then \
-			if [ ! -f $(KDIR)/scripts/kconfig/lxdialog ]; then \
-				$(MAKE) -C $(KDIR) $(build)=scripts/kconfig/lxdialog; \
-			fi; \
-		fi; \
-		if [ ! -f $(KDIR)/scripts/kconfig/mconf ]; then \
-			$(MAKE) -C $(KDIR) $(build)=scripts/kconfig scripts/kconfig/mconf; \
-		fi; \
-		ln -s $(KDIR)/scripts/kconfig scripts/kconfig; \
-	fi
-
-	$(KDIR)/scripts/kconfig/mconf Kconfig
+# Kernel config programs
+QCONF := $(KDIR)/scripts/kconfig/qconf
+GCONF := $(KDIR)/scripts/kconfig/gconf
+MCONF := $(KDIR)/scripts/kconfig/mconf
+CONF := $(KDIR)/scripts/kconfig/conf
+
+# lxdialog can be in either scripts/lxdialog or scripts/kconfig/lxdialog
+LXDIALOG_DIR := $(shell if [ -d $(KDIR)/scripts/kconfig/lxdialog ]; then echo kconfig/ ; fi)
+LXDIALOG_LNK := $(if $(LXDIALOG_DIR),scripts/kconfig,scripts/lxdialog)
+LXDIALOG := $(KDIR)/scripts/$(LXDIALOG_DIR)lxdialog/lxdialog
+
+xconfig:: links .version $(QCONF)
+	./scripts/make_kconfig.pl
+	$(QCONF) Kconfig
+	./scripts/make_noconfig.pl
+
+gconfig:: links .version $(GCONF)
+	./scripts/make_kconfig.pl
+	$(QCONF) Kconfig
+	./scripts/make_noconfig.pl
+
+config:: links .version $(CONF)
+	./scripts/make_kconfig.pl
+	$(CONF) Kconfig
+	./scripts/make_noconfig.pl
+
+menuconfig:: links .version $(MCONF) lxdialog
+	./scripts/make_kconfig.pl
+	$(MCONF) Kconfig
 	./scripts/make_noconfig.pl
 
 allyesconfig allmodconfig:: links .version
 	./scripts/make_kconfig.pl 1
 	./scripts/make_noconfig.pl
+
+# rule to build kernel conf programs
+KMAKEVARS := config-targets=1 mixed-targets=0 dot-config=0
+$(QCONF) $(GCONF) $(MCONF) $(CONF):
+	$(MAKE) -C $(KDIR) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(notdir $@)
+
+# lxdialog has two parts, a symlink and the actual binary
+.PHONY: lxdialog
+lxdialog: $(LXDIALOG) $(LXDIALOG_LNK)
+
+$(LXDIALOG_LNK):
+	ln -snf $(KDIR)/$(LXDIALOG_LNK) $(LXDIALOG_LNK)
+
+$(LXDIALOG):
+	$(MAKE) -C $(KDIR) -f $(PWD)/Makefile.kernel $(KMAKEVARS) v4l-$(LXDIALOG)
 
 #################################################
 # IVTV link rules
diff -r e7ff160f2e38 -r f13ca4ca086e v4l/Makefile.kernel
--- /dev/null	Thu Jan  1 00:00:00 1970 +0000
+++ b/v4l/Makefile.kernel	Thu Jun  1 17:24:50 2006 -0700
@@ -0,0 +1,46 @@
+# This Makefile is used to build sources that are part of the kernel tree. 
+# What we want are the various programs used by the kconfig system.  We can't
+# just directly call the top-level kernel Makefile, as it doesn't provide
+# targets to only build the kconfig system.  It provides targets to build
+# the kconfig system *and then configure the kernel*.  
+
+# What we do is include the top-level kernel Makefile here, to get all the
+# variables and rules it defines, and then add our own targets to just build
+# the kconfig system.  You can think of this file as a modified version of the
+# top-level kernel Makefile that has "kconfig build only" targets added to it.
+# Each of these new targets has the prefix v4l- so it doesn't conflict with
+# any targets in the kernel Makefile.
+
+# Like the kernel Makefile, this Makefile should have the cwd be the root
+# of the kernel source.
+
+# These should be defined on the command line, to override the kernel Makefile
+# config-targets := 1
+# mixed-targets := 0
+# dot-config := 0
+
+include Makefile
+
+# Used by the config target
+v4l-conf: scripts_basic
+	$(MAKE) $(build)=scripts/kconfig scripts/kconfig/conf
+
+# Used by the xconfig target
+v4l-qconf: scripts_basic
+	$(MAKE) $(build)=scripts/kconfig qconf-target=1 scripts/kconfig/qconf
+
+# Used by the qconfig target
+v4l-gconf: scripts_basic
+	$(MAKE) $(build)=scripts/kconfig gconf-target=1 scripts/kconfig/gconf
+	
+# Used by the menuconfig target, also needs lxdialog
+v4l-mconf: scripts_basic
+	$(MAKE) $(build)=scripts/kconfig scripts/kconfig/mconf
+
+# Rule used for kernel where lxdialog is in directory scripts/lxdialog
+v4l-%/scripts/lxdialog/lxdialog: scripts_basic
+	$(MAKE) $(build)=scripts/lxdialog
+
+# Rule used for kernel where lxdialog is in directory scripts/kconfig/lxdialog
+v4l-%/scripts/kconfig/lxdialog/lxdialog: scripts_basic
+	$(MAKE) $(build)=scripts/kconfig/lxdialog
_______________________________________________

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