[uClibc] [andersen at codepoet.org: Re: [BusyBox] busybox: linux and kernel-headers target]

Jan Lana jan.lana at Sun.COM
Wed Nov 10 08:37:01 UTC 2004


Hi Eric,

I suppose one package is better that two - it's easier to create a new kernel
configuration. And we can have more prepared kernel configs (like gcc or
binutils). And - your wife's kernel config already included in the patch. :)

Yes, you need a toolchain recompile after kernel config change but it's correct
because the toolchain doesn't match the kernel.

- Jenda

> On Mon Oct 18, 2004 at 09:39:47AM +0200, Jan Lana wrote:
> > Hi,
> > 
> > The current CVS version has two independent kernel packages:
> >  - toolchain/kernel-headers
> >  - packages/linux
> 
> These are separate for a reason.  The main reason it is allows
> you to nuke and rebuild the kernel without needed to rebuild the
> toolchain, which used to be a problem before they were seperated.
> I'd rather keep these entirely separate as they are currently.
> 
> As for the package/linux/ stuff, that is basically setup to build
> a linux kernel that works on the wireless access point that lives
> in my wife's office.  Obviously for any other use it would be
> necessary for people to customize the thing to suit whatever they
> are planning on building.
> 
>  -Erik
> 
> --
> Erik B. Andersen             http://codepoet-consulting.com/
> --This message was written using 73% post-consumer electrons--
> 
> _______________________________________________
> busybox mailing list
> busybox at mail.busybox.net
> http://uclibc.org/mailman/listinfo/busybox
> 
> 
> ----- End forwarded message -----
-------------- next part --------------
diff -Naurx CVS buildroot.orig/Makefile buildroot/Makefile
--- buildroot.orig/Makefile	2004-10-17 19:12:50.000000000 +0200
+++ buildroot/Makefile	2004-10-17 21:18:29.000000000 +0200
@@ -49,7 +49,7 @@
 # along with the packages to build for the target.
 #
 ##############################################################
-TARGETS:=host-sed kernel-headers uclibc-configured binutils gcc uclibc-target-utils
+TARGETS:=host-sed linux-headers uclibc-configured binutils gcc uclibc-target-utils
 include toolchain/Makefile.in
 include toolchain/*/Makefile.in
 include package/Makefile.in
diff -Naurx CVS buildroot.orig/package/Config.in buildroot/package/Config.in
--- buildroot.orig/package/Config.in	2004-10-14 22:13:23.000000000 +0200
+++ buildroot/package/Config.in	2004-10-17 20:47:38.000000000 +0200
@@ -60,7 +60,7 @@
 source "package/libmad/Config.in"
 source "package/libtool/Config.in"
 source "package/links/Config.in"
-source "package/linux/Config.in"
+source "toolchain/linux/Config.in.2"
 source "package/lrzsz/Config.in"
 source "package/ltp-testsuite/Config.in"
 source "package/ltrace/Config.in"
diff -Naurx CVS buildroot.orig/package/linux/Config.in buildroot/package/linux/Config.in
--- buildroot.orig/package/linux/Config.in	2004-10-09 08:13:08.000000000 +0200
+++ buildroot/package/linux/Config.in	2004-10-17 19:19:35.000000000 +0200
@@ -1,8 +1,20 @@
 #
 
-config BR2_PACKAGE_LINUX
-	bool"linux"
-	default n
+choice
+	prompt "Kernel Linux Version"
+	default BR2_LINUX_VERSION_2_4_26_eric
 	help
-	  Add help text here.
+	  Select the version of linux kernel you wish to use
+
+	config BR2_LINUX_VERSION_2_4_26_eric
+		bool "kernel 2.4.26-eric"
+
+	config BR2_LINUX_VERSION_2_6_7
+		bool "kernel 2.6.7"
+endchoice
+
+config BR2_LINUX_VERSION
+	string
+	default "2.4.26-eric"	if BR2_LINUX_VERSION_2_4_26_eric
+	default "2.6.7"		if BR2_LINUX_VERSION_2_6_7
 
diff -Naurx CVS buildroot.orig/package/linux/Config.in.2 buildroot/package/linux/Config.in.2
--- buildroot.orig/package/linux/Config.in.2	1970-01-01 01:00:00.000000000 +0100
+++ buildroot/package/linux/Config.in.2	2004-10-17 19:19:26.000000000 +0200
@@ -0,0 +1,8 @@
+#
+
+config BR2_PACKAGE_LINUX
+	bool "linux kernel"
+	default n
+	help
+	  Compile linux kernel for target arch
+
diff -Naurx CVS buildroot.orig/package/linux/linux.mk buildroot/package/linux/linux.mk
--- buildroot.orig/package/linux/linux.mk	2004-10-09 23:19:10.000000000 +0200
+++ buildroot/package/linux/linux.mk	2004-10-18 00:27:03.000000000 +0200
@@ -19,49 +19,52 @@
 #  -Erik
 #
 #############################################################
-ifneq ($(filter $(TARGETS),linux),)
 
 # Version of Linux to download and then apply patches to
-DOWNLOAD_LINUX_VERSION=2.4.26
+LINUX_DOWNLOAD_VERSION=$(shell echo $(LINUX_VERSION) | sed -e 's/\(2\.[456]\.[0-9]*\).*/\1/')
+LINUX_DOWNLOAD_CLASS=$(shell echo $(LINUX_VERSION) | sed -e 's/\(2\.[456]\).*/\1/')
 # Version of Linux AFTER patches
-LINUX_VERSION=2.4.26-erik
 
-LINUX_FORMAT=bzImage
+LINUX_FORMAT:=bzImage
 #LINUX_FORMAT=images/zImage.prep
 LINUX_KARCH:=$(shell echo $(ARCH) | sed -e 's/i[3-9]86/i386/' \
 	-e 's/mipsel/mips/' \
 	-e 's/powerpc/ppc/' \
 	-e 's/sh[234]/sh/' \
 	)
-LINUX_BINLOC=arch/$(LINUX_KARCH)/boot/$(LINUX_FORMAT)
+LINUX_BINLOC:=arch/$(LINUX_KARCH)/boot/$(LINUX_FORMAT)
 
-LINUX_DIR=$(BUILD_DIR)/linux-$(LINUX_VERSION)
-LINUX_SOURCE=linux-$(DOWNLOAD_LINUX_VERSION).tar.bz2
-LINUX_SITE=http://www.kernel.org/pub/linux/kernel/v2.4
-LINUX_KCONFIG=package/linux/linux.config
-LINUX_KERNEL=$(BUILD_DIR)/buildroot-kernel
+LINUX_DIR:=$(TOOL_BUILD_DIR)/linux-$(LINUX_VERSION)
+LINUX_SOURCE:=linux-$(LINUX_DOWNLOAD_VERSION).tar.bz2
+LINUX_SITE:=http://www.kernel.org/pub/linux/kernel/v$(LINUX_DOWNLOAD_CLASS)
+LINUX_KCONFIG:=toolchain/linux/$(LINUX_VERSION).config
+LINUX_KERNEL:=$(BUILD_DIR)/buildroot-kernel
 # Used by pcmcia-cs and others
 LINUX_SOURCE_DIR=$(LINUX_DIR)
 
 
 $(DL_DIR)/$(LINUX_SOURCE):
-	-mkdir  $(DL_DIR)
+	mkdir -p $(DL_DIR)
 	$(WGET) -P $(DL_DIR) $(LINUX_SITE)/$(LINUX_SOURCE)
 
 $(LINUX_DIR)/.unpacked: $(DL_DIR)/$(LINUX_SOURCE)
-	-mkdir  $(TOOL_BUILD_DIR)
+	mkdir  -p $(TOOL_BUILD_DIR)
 	#mkdir -p $(LINUX_DIR)
 	#rm -rf $(LINUX_DIR)
-	bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(BUILD_DIR) $(TAR_OPTIONS) -
-ifneq ($(DOWNLOAD_LINUX_VERSION),$(LINUX_VERSION))
+	bzcat $(DL_DIR)/$(LINUX_SOURCE) | tar -C $(TOOL_BUILD_DIR) $(TAR_OPTIONS) -
+ifneq ($(LINUX_DOWNLOAD_VERSION),$(LINUX_VERSION))
 	# Rename the dir from the downloaded version to the AFTER patch version	
-	mv -f $(BUILD_DIR)/linux-$(DOWNLOAD_LINUX_VERSION) $(BUILD_DIR)/linux-$(LINUX_VERSION)
+	rm -Rf $(TOOL_BUILD_DIR)/linux-$(LINUX_VERSION)
+	mv -f $(TOOL_BUILD_DIR)/linux-$(LINUX_DOWNLOAD_VERSION) $(TOOL_BUILD_DIR)/linux-$(LINUX_VERSION)
 endif
-	mkdir -p package/linux/kernel-patches
-	toolchain/patch-kernel.sh $(LINUX_DIR) package/linux/kernel-patches
-	-(cd $(TOOL_BUILD_DIR); ln -sf $(LINUX_DIR) linux)
 	touch $(LINUX_DIR)/.unpacked
 
+$(LINUX_DIR)/.patched: $(LINUX_DIR)/.unpacked
+	#mkdir -p toolchain/linux/$(LINUX_VERSION)
+	toolchain/patch-kernel.sh $(LINUX_DIR) toolchain/linux/$(LINUX_VERSION) \*.patch
+	-(cd $(TOOL_BUILD_DIR); ln -sf $(LINUX_DIR) linux)
+	touch $(LINUX_DIR)/.patched
+
 $(LINUX_KCONFIG):
 	@if [ ! -f "$(LINUX_KCONFIG)" ] ; then \
 		echo ""; \
@@ -71,7 +74,7 @@
 		sleep 5; \
 	fi;
 
-$(LINUX_DIR)/.configured $(BUILD_DIR)/linux/.configured:  $(LINUX_DIR)/.unpacked  $(LINUX_KCONFIG)
+$(LINUX_DIR)/.configured:  $(LINUX_DIR)/.patched  $(LINUX_KCONFIG)
 	$(SED) "s,^CROSS_COMPILE.*,CROSS_COMPILE=$(KERNEL_CROSS),g;" $(LINUX_DIR)/Makefile
 	-cp $(LINUX_KCONFIG) $(LINUX_DIR)/.config
 	$(MAKE) -C $(LINUX_DIR) oldconfig include/linux/version.h
@@ -105,11 +108,26 @@
 linux-source: $(DL_DIR)/$(LINUX_SOURCE)
 
 # This has been renamed so we do _NOT_ by default run this on 'make clean'
-linuxclean: clean
+linux-clean: clean
 	rm -f $(LINUX_KERNEL)
 	-$(MAKE) -C $(LINUX_DIR) clean
 
 linux-dirclean:
 	rm -rf $(LINUX_DIR)
 
-endif
+
+##################################
+# toolchain kernel headers 
+##################################
+
+LINUX_HEADERS_DIR:=$(TOOL_BUILD_DIR)/linux
+
+$(LINUX_HEADERS_DIR): $(LINUX_DIR)/.configured
+	ln -s $(LINUX_DIR) $(LINUX_HEADERS_DIR)
+
+linux-headers: $(LINUX_HEADERS_DIR)
+
+linux-headers-clean: linux-clean
+
+linux-headers-dirclean:
+	rm -rf $(LINUX_HEADERS_DIR)
diff -Naurx CVS buildroot.orig/package/linux/Makefile.in buildroot/package/linux/Makefile.in
--- buildroot.orig/package/linux/Makefile.in	2004-10-09 08:13:08.000000000 +0200
+++ buildroot/package/linux/Makefile.in	2004-10-17 17:26:17.000000000 +0200
@@ -1,3 +1,5 @@
+LINUX_VERSION:=$(strip $(subst ",, $(BR2_LINUX_VERSION)))
+#"
 ifeq ($(strip $(BR2_PACKAGE_LINUX)),y)
 TARGETS+=linux
 endif
diff -Naurx CVS buildroot.orig/toolchain/Config.in buildroot/toolchain/Config.in
--- buildroot.orig/toolchain/Config.in	2004-10-09 23:28:56.000000000 +0200
+++ buildroot/toolchain/Config.in	2004-10-17 20:44:50.000000000 +0200
@@ -3,7 +3,7 @@
 menu "Toolchain Options"
 
 
-source "toolchain/kernel-headers/Config.in"
+source "toolchain/linux/Config.in"
 source "toolchain/uClibc/Config.in"
 source "toolchain/binutils/Config.in"
 source "toolchain/gcc/Config.in"


More information about the uClibc mailing list