Skip to contentSkip to conversation

use same kernel in buildroot and in crosstool-ng

PATCH New sinseman44 2 participants 3 messages Sep 22, 2011 Kbuild

lore
Share & tools
lore

sinseman44

author
#0 lore raw

PATCH 1/1 use same kernel in buildroot and in crosstool-ng

---
 Makefile                                           |    4 +-
 ...-ng-001-makefile-buildroot-kernel-version.patch |   41 ++++++++++++++++++++
 ...ol-ng-002-config-buildroot-kernel-version.patch |   24 +++++++++++
 package/crosstool-ng/crosstool-ng.mk               |    6 ++-
 toolchain/toolchain-crosstool-ng/Config.in         |    5 ++
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk   |    5 ++
 6 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644 package/crosstool-ng/crosstool-ng-001-makefile-buildroot-kernel-version.patch
 create mode 100644 package/crosstool-ng/crosstool-ng-002-config-buildroot-kernel-version.patch
Makefile +3 -1
index a20d3e2..59eb941 100644
@@ -301,6 +301,8 @@ all: world
 # We also need the various per-package makefiles, which also add
 # each selected package to TARGETS if that package was selected
 # in the .config file.
+include linux/linux.mk
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
 include toolchain/toolchain-buildroot.mk
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
@@ -313,7 +315,7 @@ include package/*/*.mk
 
 include boot/common.mk
 include target/Makefile.in
-include linux/linux.mk
+
 
 TARGETS+=target-finalize
 
package/crosstool-ng/crosstool-ng-001-makefile-buildroot-kernel-version.patch new file +41 -0

41 lines not on this page · raw message

package/crosstool-ng/crosstool-ng-002-config-buildroot-kernel-version.patch new file +24 -0
new file mode 100644
index 0000000..0d98ced
@@ -0,0 +1,24 @@
+--- crosstool-ng-1.12.1/config/kernel/linux.in	2011-09-21 11:00:49.759188996 +0200
++++ host-crosstool-ng-1.12.1/config/kernel/linux.in	2011-09-21 11:02:45.390254678 +0200
+@@ -144,16 +144,18 @@
+ 
+ config KERNEL_LINUX_CUSTOM
+     bool
+-    prompt "custom tarball"
++    prompt "custom tarball or directory"
+     help
+-      Use a local tarball of a complete kernel source tree.
++      Use a local tarball of a complete kernel source tree or
++      a local kernel tree (not pre-installed)
+ 
+ config KERNEL_LINUX_CUSTOM_TARBALL
+     string
+     prompt "Path to custom tarball"
+     depends on KERNEL_LINUX_CUSTOM
+     help
+-      Enter here the path to the tarball of your full kernel tree.
++      Enter here the path to the tarball of your full kernel tree or
++      the path or the local kernel tree
+ 
+ endchoice
+ 
package/crosstool-ng/crosstool-ng.mk +5 -1
index 076be28..99bbde7 100644
@@ -4,6 +4,10 @@ CROSSTOOL_NG_SITE              = http://crosstool-ng.org/download/crosstool-ng/
 CROSSTOOL_NG_INSTALL_STAGING   = NO
 CROSSTOOL_NG_INSTALL_TARGET    = NO
 CROSSTOOL_NG_MAKE              = $(MAKE1)
-HOST_CROSSTOOL_NG_DEPENDENCIES = host-gawk host-automake $(if $(BR2_CCACHE),host-ccache)
+HOST_CROSSTOOL_NG_DEPENDENCIES = $(if $(BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL), \
+								   $(LINUX_TARGET_SOURCE) $(LINUX_TARGET_EXTRACT) $(LINUX_TARGET_PATCH) $(LINUX_TARGET_CONFIGURE)) \
+								 host-gawk \
+								 host-automake \
+								 $(if $(BR2_CCACHE),host-ccache) 
 
 $(eval $(call AUTOTARGETS,package,crosstool-ng,host))
toolchain/toolchain-crosstool-ng/Config.in +5 -0
index 2d1e801..9ac9f4c 100644
@@ -46,6 +46,11 @@ config BR2_TOOLCHAIN_CTNG_CONFIG
 
 	  If unsure, keep the default value.
 
+config BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL
+	bool "Buildroot kernel version"
+	help
+		Use buildroot kernel version in crosstool-Ng
+
 if BR2_TOOLCHAIN_CTNG_uClibc
 
 comment "Toolchain Options"
toolchain/toolchain-crosstool-ng/crosstool-ng.mk +5 -0
index 3a205dd..29fb022 100644
@@ -218,6 +218,11 @@ else
 CTNG_FIX_DOT_CONFIG_SED += s:^(CT_CC_LANG_CXX)=.*:\# \1 is not set:;
 endif
 
+ifeq ($(BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL),y)
+CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_KERNEL_LINUX_CUSTOM) is not set:\1=y:;
+CTNG_FIX_DOT_CONFIG_SED += s:^(CT_KERNEL_LINUX_CUSTOM_TARBALL)=.*:\1="$(BUILD_DIR)/linux-$(call qstrip,$(BR2_LINUX_KERNEL_VERSION))":;
+endif
+
 # Shoe-horn CPU variant now
 ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
 CTNG_FIX_DOT_CONFIG_SED += s:^(CT_ARCH_ARCH)=.*:\1=$(BR2_GCC_TARGET_ARCH):;
Signature · 1 line
1.7.0.4
#1 lore raw

PATCH 1/1 use same kernel in buildroot and in crosstool-ng

Hi all,

I create patch to use the current kernel version chosen in buildroot in crosstool-ng
with a new parameter (boolean) in buildroot (BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL), the user can choose if he wants to use the same kernel version in crosstool-ng
the makefile of package crosstool-ng is changed to download the kernel and apply patches before compile crosstool-ng.

2 patches for crosstool-ng (add them in directory package/crosstool-ng/) :
create a sym link (linux-custom) and install kernel headers

crosstool-ng-001-makefile-buildroot-kernel-version.patch crosstool-ng-002-config-buildroot-kernel-version.patch

sincerely

2011/9/22 sinseman44 <[email protected]>

Quoted 201 lines
---
 Makefile                                           |    4 +-
 ...-ng-001-makefile-buildroot-kernel-version.patch |   41
++++++++++++++++++++
 ...ol-ng-002-config-buildroot-kernel-version.patch |   24 +++++++++++
 package/crosstool-ng/crosstool-ng.mk               |    6 ++-
 toolchain/toolchain-crosstool-ng/Config.in         |    5 ++
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk   |    5 ++
 6 files changed, 83 insertions(+), 2 deletions(-)
 create mode 100644
package/crosstool-ng/crosstool-ng-001-makefile-buildroot-kernel-version.patch
 create mode 100644

package/crosstool-ng/crosstool-ng-002-config-buildroot-kernel-version.patch

Makefile +3 -1
index a20d3e2..59eb941 100644
@@ -301,6 +301,8 @@ all: world
 # We also need the various per-package makefiles, which also add
 # each selected package to TARGETS if that package was selected
 # in the .config file.
+include linux/linux.mk
+
 ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y)
 include toolchain/toolchain-buildroot.mk
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
@@ -313,7 +315,7 @@ include package/*/*.mk
 
 include boot/common.mk
 include target/Makefile.in
-include linux/linux.mk
+
 
 TARGETS+=target-finalize
 

diff --git a/package/crosstool-ng/crosstool-ng-001-makefile-buildroot-kernel-version.patch b/package/crosstool-ng/crosstool-ng-001-makefile-buildroot-kernel-version.patch new file mode 100644
index 0000000..2a2c8ac
--- /dev/null
+++
b/package/crosstool-ng/crosstool-ng-001-makefile-buildroot-kernel-version.patch

Makefile +1 -0
@@ -0,0 +1,41 @@
+--- crosstool-ng-1.12.1/scripts/build/kernel/linux.sh  2011-09-21

10:50:31.403186872 +0200
++++ host-crosstool-ng-1.12.1/scripts/build/kernel/linux.sh 2011-09-21
10:50:56.932014313 +0200
+@@ -61,21 +61,24 @@

Makefile +4 -0
+                 return 0
+             fi
+
+-            CT_TestAndAbort "Custom kernel tree partially extracted.

Remove before resuming" -f "${CT_SRC_DIR}/.linux-custom.extracting"
+- CT_DoExecLog DEBUG touch
"${CT_SRC_DIR}/.linux-custom.extracting"

+-            CT_DoExecLog DEBUG mkdir "${CT_SRC_DIR}/linux-custom"
+-
+-            case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in
+-                *.tar.bz2)      tar_opt=-j;;
+-                *.tar.gz|*.tgz) tar_opt=-z;;
+-                *.tar)          ;;
+-                *)              CT_Abort "Don't know how to handle
'${CT_KERNEL_LINUX_CUSTOM_TARBALL}': unknown extension";;
+-            esac
+-            CT_DoLog EXTRA "Extracting custom linux kernel"
+-            CT_DoExecLog ALL tar x -C "${CT_SRC_DIR}/linux-custom"      \
+-                                 --strip-components 1 -v ${tar_opt}     \
+-                                 -f "${CT_KERNEL_LINUX_CUSTOM_TARBALL}"
++                      CT_TestAndAbort "Custom kernel tree partially

extracted. Remove before resuming" -f
"${CT_SRC_DIR}/.linux-custom.extracting"
++ CT_DoExecLog DEBUG touch
"${CT_SRC_DIR}/.linux-custom.extracting"
+
++ if [ ! -d "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" ];
then
++ CT_DoExecLog DEBUG mkdir
"${CT_SRC_DIR}/linux-custom"
++ case "${CT_KERNEL_LINUX_CUSTOM_TARBALL}" in

++                                      *.tar.bz2)      tar_opt=-j;;
++                                      *.tar.gz|*.tgz) tar_opt=-z;;
++                                      *.tar)          ;;
++                                      *)              CT_Abort "Don't

know how to handle '${CT_KERNEL_LINUX_CUSTOM_TARBALL}': unknown extension";;
++ esac
++ CT_DoLog EXTRA "Extracting custom linux
kernel"
++ CT_DoExecLog ALL tar x -C
"${CT_SRC_DIR}/linux-custom" \
++
--strip-components 1 -v ${tar_opt} \
++ -f
"${CT_KERNEL_LINUX_CUSTOM_TARBALL}"
++ else
++ CT_DoExecLog ALL ln -s
"${CT_KERNEL_LINUX_CUSTOM_TARBALL}" "${CT_SRC_DIR}/linux-custom"
++ fi
+ CT_DoExecLog ALL mv -v
"${CT_SRC_DIR}/.linux-custom.extracting" "${CT_SRC_DIR}/.linux-custom.extracted"

Makefile +2 -0
+         else
+             CT_Extract "linux-${CT_KERNEL_VERSION}"

diff --git a/package/crosstool-ng/crosstool-ng-002-config-buildroot-kernel-version.patch b/package/crosstool-ng/crosstool-ng-002-config-buildroot-kernel-version.patch new file mode 100644
index 0000000..0d98ced
--- /dev/null
+++
b/package/crosstool-ng/crosstool-ng-002-config-buildroot-kernel-version.patch

Makefile +1 -0
@@ -0,0 +1,24 @@
+--- crosstool-ng-1.12.1/config/kernel/linux.in 2011-09-21

11:00:49.759188996 +0200
++++ host-crosstool-ng-1.12.1/config/kernel/linux.in 2011-09-21
11:02:45.390254678 +0200
+@@ -144,16 +144,18 @@

Makefile +21 -0
+
+ config KERNEL_LINUX_CUSTOM
+     bool
+-    prompt "custom tarball"
++    prompt "custom tarball or directory"
+     help
+-      Use a local tarball of a complete kernel source tree.
++      Use a local tarball of a complete kernel source tree or
++      a local kernel tree (not pre-installed)
+
+ config KERNEL_LINUX_CUSTOM_TARBALL
+     string
+     prompt "Path to custom tarball"
+     depends on KERNEL_LINUX_CUSTOM
+     help
+-      Enter here the path to the tarball of your full kernel tree.
++      Enter here the path to the tarball of your full kernel tree or
++      the path or the local kernel tree
+
+ endchoice
+
package/crosstool-ng/ renamed from package/crosstool-ng/crosstool-ng.mk +0 -0

crosstool-ng.mk
index 076be28..99bbde7 100644

package/crosstool-ng/crosstool-ng.mk +0 -0
@@ -4,6 +4,10 @@ CROSSTOOL_NG_SITE              =

http://crosstool-ng.org/download/crosstool-ng/

 CROSSTOOL_NG_INSTALL_STAGING   = NO
 CROSSTOOL_NG_INSTALL_TARGET    = NO
 CROSSTOOL_NG_MAKE              = $(MAKE1)

-HOST_CROSSTOOL_NG_DEPENDENCIES = host-gawk host-automake $(if $(BR2_CCACHE),host-ccache)
+HOST_CROSSTOOL_NG_DEPENDENCIES = $(if $(BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL), \
+
$(LINUX_TARGET_SOURCE) $(LINUX_TARGET_EXTRACT) $(LINUX_TARGET_PATCH)
$(LINUX_TARGET_CONFIGURE)) \
+ host-gawk
\

package/crosstool-ng/crosstool-ng.mk +2 -0
+
 host-automake \
+                                                                $(if

$(BR2_CCACHE),host-ccache)

$(eval $(call AUTOTARGETS,package,crosstool-ng,host))

toolchain/toolchain-crosstool-ng/Config.in +5 -0
index 2d1e801..9ac9f4c 100644
@@ -46,6 +46,11 @@ config BR2_TOOLCHAIN_CTNG_CONFIG
 
         If unsure, keep the default value.
 
+config BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL
+       bool "Buildroot kernel version"
+       help
+               Use buildroot kernel version in crosstool-Ng
+
 if BR2_TOOLCHAIN_CTNG_uClibc
 
 comment "Toolchain Options"
(quoted diff) +0 -0

crosstool-ng.mk
index 3a205dd..29fb022 100644

toolchain/toolchain-crosstool-ng/crosstool-ng.mk +3 -0
@@ -218,6 +218,11 @@ else
 CTNG_FIX_DOT_CONFIG_SED += s:^(CT_CC_LANG_CXX)=.*:\# \1 is not set:;
 endif
 
+ifeq ($(BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL),y)
+CTNG_FIX_DOT_CONFIG_SED += s:^\# (CT_KERNEL_LINUX_CUSTOM) is not
 set:\1=y:;
+CTNG_FIX_DOT_CONFIG_SED +=

s:^(CT_KERNEL_LINUX_CUSTOM_TARBALL)=.*:\1="$(BUILD_DIR)/linux-$(call qstrip,$(BR2_LINUX_KERNEL_VERSION))":;

toolchain/toolchain-crosstool-ng/crosstool-ng.mk +2 -0
+endif
+
 # Shoe-horn CPU variant now
 ifneq ($(call qstrip,$(BR2_GCC_TARGET_ARCH)),)
 CTNG_FIX_DOT_CONFIG_SED +=
Quoted 5 lines

s:^(CT_ARCH_ARCH)=.*:\1=$(BR2_GCC_TARGET_ARCH):;
--
1.7.0.4

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20110922/96da2926/attachment-0001.html>

#2 lore raw

PATCH 1/1 use same kernel in buildroot and in crosstool-ng

In reply to sinseman44

Le Thu, 22 Sep 2011 11:36:11 +0200,
sinseman44 <[email protected]> a ?crit :

Quoted 1 line

+ config KERNEL_LINUX_CUSTOM_TARBALL

Presumably the name of this option needs to be changed. KERNEL_LINUX_CUSTOM_LOCATION or something like that.

package/crosstool-ng/crosstool-ng.mk CROSSTOOL_NG_SITE = http://crosstool-ng.org/download/crosstool-ng/ · line 11

Quoted 6 lines
package/crosstool-ng/crosstool-ng.mk +5 -1
-HOST_CROSSTOOL_NG_DEPENDENCIES = host-gawk host-automake $(if $(BR2_CCACHE),host-ccache)
+HOST_CROSSTOOL_NG_DEPENDENCIES = $(if $(BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL), \
+								   $(LINUX_TARGET_SOURCE) $(LINUX_TARGET_EXTRACT) $(LINUX_TARGET_PATCH) $(LINUX_TARGET_CONFIGURE)) \
+								 host-gawk \
+								 host-automake \
+								 $(if $(BR2_CCACHE),host-ccache) 

Something like:

HOST_CROSSTOOL_NG_DEPENDENCIES = host-gawk host-automake $(if $(BR2_CCACHE),host-ccache)

ifeq ($(BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL),y) HOST_CROSSTOOL_NG_DEPENDENCIES += linux-configure endif

Would be a lot better.

toolchain/toolchain-crosstool-ng/Config.in config BR2_TOOLCHAIN_CTNG_CONFIG · line 50

Quoted 2 lines
toolchain/toolchain-crosstool-ng/Config.in +2 -0
+config BR2_TOOLCHAIN_CTNG_BUILDROOT_KERNEL
+	bool "Buildroot kernel version"

Missing:

depends on BR2_LINUX_KERNEL

toolchain/toolchain-crosstool-ng/Config.in config BR2_TOOLCHAIN_CTNG_CONFIG

Quoted 4 lines
toolchain/toolchain-crosstool-ng/Config.in +4 -0
+	help
+		Use buildroot kernel version in crosstool-Ng
+
+CTNG_FIX_DOT_CONFIG_SED += s:^(CT_KERNEL_LINUX_CUSTOM_TARBALL)=.*:\1="$(BUILD_DIR)/linux-$(call qstrip,$(BR2_LINUX_KERNEL_VERSION))":;

$(LINUX_DIR) ?

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com