Add crostool-NG as backend to generate toolchain
cover Add crostool-NG as backend to generate toolchain
This series is a snapshot of my attempt at using crosstool-NG as a backend to generate the toolchain.
The series is two-fold:
- patch 1..5 are cleanups to lay down a proper base to add a new backend
- patch 6 is the actual addition of crosstool-NG as a new backend
This series is not final! It is *not* intended to be included as is. It is posted for preliminary review, so as to make it ready for early inclusion in the next release cycle.
Of particular interest:
- patch 1..4 appear to be complete, but have been lightly tested, as my primary goal is to first add crosstool-NG as a backend, and then fix the broken stuff in a generic way.
- patch 5:
I have not thoroughly checked that the renaming was complete. There might be some packages that still depend on the old target, especially gdb, which has a dependency on 'uClibc', and I haven't checked that one (yet).
- patch 6:
The toolchain is only built, not installed, and a lot of options from BR are not yet pushed into crosstool-NG's .config.
---
Yann E. MORIN (6):
toolchain: move helper functions from external toolchain
toolchain: rename external toolchain dir
toolchain: move makefile includes
toolchain: move buildroot config files
toolchain: rename base target for external toolchains
toolchain: add new toolchain backend: crosstool-NG
Makefile | 22 - toolchain/Config.in | 20 + toolchain/Config.in.1 | 9 - toolchain/Config.in.2 | 185 ---------- toolchain/external-toolchain/Config.in | 22 - toolchain/external-toolchain/Config.in.2 | 17 - toolchain/external-toolchain/ext-tool.mk | 303 ----------------- toolchain/helpers.mk | 208 ++++++++++++ toolchain/toolchain-buildroot.mk | 15 + toolchain/toolchain-buildroot/Config.in | 9 + toolchain/toolchain-buildroot/Config.in.2 | 37 ++ toolchain/toolchain-common.in | 157 +++++++++ toolchain/toolchain-crosstool-NG.mk | 16 + toolchain/toolchain-crosstool-NG/Config.in | 53 +++ .../toolchain-crosstool-NG/crosstool-NG.config | 360 ++++++++++++++++++++ toolchain/toolchain-crosstool-NG/crosstool-NG.mk | 118 +++++++ toolchain/toolchain-external.mk | 16 + toolchain/toolchain-external/Config.in | 22 + toolchain/toolchain-external/Config.in.2 | 17 + toolchain/toolchain-external/ext-tool.mk | 98 +++++ 20 files changed, 1141 insertions(+), 563 deletions(-) delete mode 100644 toolchain/Config.in.1 delete mode 100644 toolchain/Config.in.2 delete mode 100644 toolchain/external-toolchain/Config.in delete mode 100644 toolchain/external-toolchain/Config.in.2 delete mode 100644 toolchain/external-toolchain/ext-tool.mk create mode 100644 toolchain/helpers.mk create mode 100644 toolchain/toolchain-buildroot.mk create mode 100644 toolchain/toolchain-buildroot/Config.in create mode 100644 toolchain/toolchain-buildroot/Config.in.2 create mode 100644 toolchain/toolchain-common.in create mode 100644 toolchain/toolchain-crosstool-NG.mk create mode 100644 toolchain/toolchain-crosstool-NG/Config.in create mode 100644 toolchain/toolchain-crosstool-NG/crosstool-NG.config create mode 100644 toolchain/toolchain-crosstool-NG/crosstool-NG.mk create mode 100644 toolchain/toolchain-external.mk create mode 100644 toolchain/toolchain-external/Config.in create mode 100644 toolchain/toolchain-external/Config.in.2 create mode 100644 toolchain/toolchain-external/ext-tool.mk
Signature · 1 line
Signature
PATCH 1/6 toolchain: move helper functions from external toolchain
From: Yann E. MORIN <[email protected]>
The helper functions used for external toolchains may also be useful to alternate toolchain backends (currently, only external toolchain is the sole user).
--- Makefile | 1 toolchain/external-toolchain/ext-tool.mk | 205 ------------------------------ toolchain/helpers.mk | 208 ++++++++++++++++++++++++++++++ 3 files changed, 209 insertions(+), 205 deletions(-) create mode 100644 toolchain/helpers.mk
Makefile +1 -0
@@ -305,6 +305,7 @@ include toolchain/mklibs/mklibs.mk include toolchain/sstrip/sstrip.mk include toolchain/uClibc/uclibc.mk else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) +include toolchain/helpers.mk include toolchain/*/*.mk endif
toolchain/external-toolchain/ext-tool.mk +0 -205
211 lines not on this page · raw message
toolchain/helpers.mk new file +208 -0
208 lines not on this page · raw message
PATCH 2/6 toolchain: rename external toolchain dir
In reply to Yann E. MORINFrom: Yann E. MORIN <[email protected]>
Rename the external toolchain directory.
When new backends are here, it will be easier to sort them out if they are all prefixed the same way.
--- toolchain/Config.in | 4 + toolchain/external-toolchain/Config.in | 22 ------- toolchain/external-toolchain/Config.in.2 | 17 ----- toolchain/external-toolchain/ext-tool.mk | 98 ------------------------------ toolchain/toolchain-external/Config.in | 22 +++++++ toolchain/toolchain-external/Config.in.2 | 17 +++++ toolchain/toolchain-external/ext-tool.mk | 98 ++++++++++++++++++++++++++++++ 7 files changed, 139 insertions(+), 139 deletions(-) delete mode 100644 toolchain/external-toolchain/Config.in delete mode 100644 toolchain/external-toolchain/Config.in.2 delete mode 100644 toolchain/external-toolchain/ext-tool.mk create mode 100644 toolchain/toolchain-external/Config.in create mode 100644 toolchain/toolchain-external/Config.in.2 create mode 100644 toolchain/toolchain-external/ext-tool.mk
toolchain/Config.in +2 -2
@@ -17,7 +17,7 @@ config BR2_TOOLCHAIN_EXTERNAL endchoice source "toolchain/Config.in.1" -source "toolchain/external-toolchain/Config.in" +source "toolchain/toolchain-external/Config.in" # we want gdb config in the middle of both source and external # toolchains, but mconf won't let us source the same file twice,
@@ -26,6 +26,6 @@ source "toolchain/gdb/Config.in" comment "Common Toolchain Options" source "toolchain/Config.in.2" -source "toolchain/external-toolchain/Config.in.2" +source "toolchain/toolchain-external/Config.in.2" endmenu
toolchain/external-toolchain/Config.in deleted +0 -22
@@ -1,22 +0,0 @@ -# - -if BR2_TOOLCHAIN_EXTERNAL -choice - prompt "External toolchain C library" - default BR2_TOOLCHAIN_EXTERNAL_UCLIBC - -config BR2_TOOLCHAIN_EXTERNAL_UCLIBC - bool "uClibc" - -config BR2_TOOLCHAIN_EXTERNAL_GLIBC - bool "glibc" - -endchoice - -config BR2_TOOLCHAIN_EXTERNAL_STRIP - bool - default y - prompt "Strip shared libraries" - help - Strip shared libraries copied from the external toolchain. -endif
toolchain/external-toolchain/Config.in.2 deleted +0 -17
@@ -1,17 +0,0 @@ -# - -if BR2_TOOLCHAIN_EXTERNAL -config BR2_TOOLCHAIN_EXTERNAL_PATH - string "External toolchain path" - default "/path/to/staging_dir/usr" - help - Path to where the external toolchain is installed. - -config BR2_TOOLCHAIN_EXTERNAL_PREFIX - string "External toolchain prefix" - default "$(ARCH)-linux" - help - This the the external toolchain prefix. For example: - armeb-unknown-linux-gnu, mipsel-unknown-linux-gnu, etc. - -endif
toolchain/external-toolchain/ext-tool.mk deleted +0 -98
98 lines not on this page · raw message
toolchain/toolchain-external/Config.in new file +22 -0
@@ -0,0 +1,22 @@ +# + +if BR2_TOOLCHAIN_EXTERNAL +choice + prompt "External toolchain C library" + default BR2_TOOLCHAIN_EXTERNAL_UCLIBC + +config BR2_TOOLCHAIN_EXTERNAL_UCLIBC + bool "uClibc" + +config BR2_TOOLCHAIN_EXTERNAL_GLIBC + bool "glibc" + +endchoice + +config BR2_TOOLCHAIN_EXTERNAL_STRIP + bool + default y + prompt "Strip shared libraries" + help + Strip shared libraries copied from the external toolchain. +endif
toolchain/toolchain-external/Config.in.2 new file +17 -0
@@ -0,0 +1,17 @@ +# + +if BR2_TOOLCHAIN_EXTERNAL +config BR2_TOOLCHAIN_EXTERNAL_PATH + string "External toolchain path" + default "/path/to/staging_dir/usr" + help + Path to where the external toolchain is installed. + +config BR2_TOOLCHAIN_EXTERNAL_PREFIX + string "External toolchain prefix" + default "$(ARCH)-linux" + help + This the the external toolchain prefix. For example: + armeb-unknown-linux-gnu, mipsel-unknown-linux-gnu, etc. + +endif
toolchain/toolchain-external/ext-tool.mk new file +98 -0
98 lines not on this page · raw message
PATCH 3/6 toolchain: move makefile includes
In reply to Yann E. MORINFrom: Yann E. MORIN <[email protected]>
Including a bunch of Makefiles with wildcard makes it impossible to add new toolchain backends. Avoid that by namely including needed files.
--- Makefile | 17 ++--------------- toolchain/toolchain-buildroot.mk | 15 +++++++++++++++ toolchain/toolchain-external.mk | 16 ++++++++++++++++ 3 files changed, 33 insertions(+), 15 deletions(-) create mode 100644 toolchain/toolchain-buildroot.mk create mode 100644 toolchain/toolchain-external.mk
Makefile +2 -15
@@ -291,22 +291,9 @@ include .config.cmd # each selected package to TARGETS if that package was selected # in the .config file. ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) -# avoid pulling in external toolchain which is broken for toplvl parallel builds -# Explicit ordering: -include toolchain/dependencies/dependencies.mk -include toolchain/binutils/binutils.mk -include toolchain/ccache/ccache.mk -include toolchain/elf2flt/elf2flt.mk -include toolchain/gcc/gcc-uclibc-3.x.mk -include toolchain/gcc/gcc-uclibc-4.x.mk -include toolchain/gdb/gdb.mk -include toolchain/kernel-headers/kernel-headers.mk -include toolchain/mklibs/mklibs.mk -include toolchain/sstrip/sstrip.mk -include toolchain/uClibc/uclibc.mk +include toolchain/toolchain-buildroot.mk else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) -include toolchain/helpers.mk -include toolchain/*/*.mk +include toolchain/toolchain-external.mk endif ifeq ($(BR2_PACKAGE_LINUX),y)
toolchain/toolchain-buildroot.mk new file +15 -0
@@ -0,0 +1,15 @@ +# Include files required for the internal toolchain backend + +# avoid pulling in external toolchain which is broken for toplvl parallel builds +# Explicit ordering: +include toolchain/dependencies/dependencies.mk +include toolchain/binutils/binutils.mk +include toolchain/ccache/ccache.mk +include toolchain/elf2flt/elf2flt.mk +include toolchain/gcc/gcc-uclibc-3.x.mk +include toolchain/gcc/gcc-uclibc-4.x.mk +include toolchain/gdb/gdb.mk +include toolchain/kernel-headers/kernel-headers.mk +include toolchain/mklibs/mklibs.mk +include toolchain/sstrip/sstrip.mk +include toolchain/uClibc/uclibc.mk
toolchain/toolchain-external.mk new file +16 -0
@@ -0,0 +1,16 @@ +# Required includes for the external toolchain backend + +# Explicit ordering: +include toolchain/helpers.mk +include toolchain/binutils/binutils.mk +include toolchain/ccache/ccache.mk +include toolchain/dependencies/dependencies.mk +include toolchain/elf2flt/elf2flt.mk +include toolchain/gcc/gcc-uclibc-3.x.mk +include toolchain/gcc/gcc-uclibc-4.x.mk +include toolchain/gdb/gdb.mk +include toolchain/toolchain-external/ext-tool.mk +include toolchain/mklibs/mklibs.mk +include toolchain/sstrip/sstrip.mk +include toolchain/toolchain-external/ext-tool.mk +include toolchain/uClibc/uclibc.mk
PATCH 4/6 toolchain: move buildroot config files
In reply to Yann E. MORINFrom: Yann E. MORIN <[email protected]>
Handle the internal toolchain backend mechanism the same way we handle other backends.
--- toolchain/Config.in | 12 -- toolchain/Config.in.1 | 9 - toolchain/Config.in.2 | 185 ----------------------------- toolchain/toolchain-buildroot/Config.in | 9 + toolchain/toolchain-buildroot/Config.in.2 | 37 ++++++ toolchain/toolchain-common.in | 157 +++++++++++++++++++++++++ 6 files changed, 206 insertions(+), 203 deletions(-) delete mode 100644 toolchain/Config.in.1 delete mode 100644 toolchain/Config.in.2 create mode 100644 toolchain/toolchain-buildroot/Config.in create mode 100644 toolchain/toolchain-buildroot/Config.in.2 create mode 100644 toolchain/toolchain-common.in
toolchain/Config.in +3 -9
@@ -16,16 +16,10 @@ config BR2_TOOLCHAIN_EXTERNAL endchoice -source "toolchain/Config.in.1" +source "toolchain/toolchain-buildroot/Config.in" source "toolchain/toolchain-external/Config.in" - -# we want gdb config in the middle of both source and external -# toolchains, but mconf won't let us source the same file twice, -# so put it here instead -source "toolchain/gdb/Config.in" -comment "Common Toolchain Options" - -source "toolchain/Config.in.2" +source "toolchain/toolchain-common.in" +source "toolchain/toolchain-buildroot/Config.in.2" source "toolchain/toolchain-external/Config.in.2" endmenu
toolchain/Config.in.1 deleted +0 -9
@@ -1,9 +0,0 @@ -# - -if BR2_TOOLCHAIN_BUILDROOT -source "toolchain/kernel-headers/Config.in" -source "toolchain/uClibc/Config.in" -source "toolchain/binutils/Config.in" -source "toolchain/gcc/Config.in" -source "toolchain/ccache/Config.in" -endif
toolchain/Config.in.2 deleted +0 -185
185 lines not on this page · raw message
toolchain/toolchain-buildroot/Config.in new file +9 -0
@@ -0,0 +1,9 @@ +# + +if BR2_TOOLCHAIN_BUILDROOT +source "toolchain/kernel-headers/Config.in" +source "toolchain/uClibc/Config.in" +source "toolchain/binutils/Config.in" +source "toolchain/gcc/Config.in" +source "toolchain/ccache/Config.in" +endif
toolchain/toolchain-buildroot/Config.in.2 new file +37 -0
@@ -0,0 +1,37 @@ +# Buildroot backend specific options + +if BR2_TOOLCHAIN_BUILDROOT +source "toolchain/elf2flt/Config.in" +source "toolchain/mklibs/Config.in" +source "toolchain/sstrip/Config.in" + +config BR2_ENABLE_MULTILIB + bool "Enable multilib support?" + help + Build libraries to support different ABIs. + +config BR2_VFP_FLOAT + bool "Use ARM Vector Floating Point unit" + depends on !BR2_SOFT_FLOAT + depends on BR2_arm || BR2_armeb + help + Setting this option will enable the "-mfpu=vfp" option. + If your ARM CPU has a Vector Floating Point Unit (VFP) + and the toolchain supports the option, then the + code can be optimized. + + Most people will answer N. + +config BR2_CROSS_TOOLCHAIN_TARGET_UTILS + bool "Include target utils in cross toolchain" + default y + help + When using buildroot to build a deployable cross toolchain, + it is handy to include certain target apps with that toolchain + as a convenience. + Examples include ldd, gdbserver, and strace. + + Answer Y if you want these apps (if built) copied into the + cross toolchain dir under <arch>-linux-uclibc/target_utils/. + +endif
toolchain/toolchain-common.in new file +157 -0
157 lines not on this page · raw message
PATCH 5/6 toolchain: rename base target for external toolchains
In reply to Yann E. MORINFrom: Yann E. MORIN <[email protected]>
It is misleeading to name the external toolchain make target 'uclibc', as external toochains can be based on other C libraries (eg. glibc or eglibc).
--- Makefile | 2 +- toolchain/toolchain-external/ext-tool.mk | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
Makefile +1 -1
@@ -202,7 +202,7 @@ PREFERRED_LIB_FLAGS:=--enable-static --enable-shared ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) -BASE_TARGETS:=uclibc +BASE_TARGETS:=toolchain-prepare endif TARGETS:=
toolchain/toolchain-external/ext-tool.mk +1 -1
@@ -35,7 +35,7 @@ # cross-compiler binaries remains external, all libraries and headers # are imported into the Buildroot tree. -uclibc: dependencies $(STAMP_DIR)/ext-toolchain-installed +toolchain-prepare: dependencies $(STAMP_DIR)/ext-toolchain-installed EXTERNAL_LIBS=libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libpthread.so libresolv.so librt.so libutil.so ifeq ($(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
PATCH 6/6 toolchain: add new toolchain backend: crosstool-NG
In reply to Yann E. MORINFrom: Yann E. MORIN <[email protected]>
--- Makefile | 4 toolchain/Config.in | 4 toolchain/toolchain-crosstool-NG.mk | 16 + toolchain/toolchain-crosstool-NG/Config.in | 53 +++ .../toolchain-crosstool-NG/crosstool-NG.config | 360 ++++++++++++++++++++ toolchain/toolchain-crosstool-NG/crosstool-NG.mk | 118 +++++++ 6 files changed, 554 insertions(+), 1 deletions(-) create mode 100644 toolchain/toolchain-crosstool-NG.mk create mode 100644 toolchain/toolchain-crosstool-NG/Config.in create mode 100644 toolchain/toolchain-crosstool-NG/crosstool-NG.config create mode 100644 toolchain/toolchain-crosstool-NG/crosstool-NG.mk
Makefile +3 -1
@@ -201,7 +201,7 @@ PREFERRED_LIB_FLAGS:=--enable-static --enable-shared ############################################################## ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) BASE_TARGETS:=uclibc-configured binutils cross_compiler uclibc-target-utils kernel-headers -else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) +else BASE_TARGETS:=toolchain-prepare endif TARGETS:=
@@ -294,6 +294,8 @@ ifeq ($(BR2_TOOLCHAIN_BUILDROOT),y) include toolchain/toolchain-buildroot.mk else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y) include toolchain/toolchain-external.mk +else ifeq ($(BR2_TOOLCHAIN_CTNG),y) +include toolchain/toolchain-crosstool-NG.mk endif ifeq ($(BR2_PACKAGE_LINUX),y)
toolchain/Config.in +4 -0
@@ -14,10 +14,14 @@ config BR2_TOOLCHAIN_BUILDROOT config BR2_TOOLCHAIN_EXTERNAL bool "External toolchain" +config BR2_TOOLCHAIN_CTNG + bool "Crosstool-NG toolchain" + endchoice source "toolchain/toolchain-buildroot/Config.in" source "toolchain/toolchain-external/Config.in" +source "toolchain/toolchain-crosstool-NG/Config.in source "toolchain/toolchain-common.in" source "toolchain/toolchain-buildroot/Config.in.2" source "toolchain/toolchain-external/Config.in.2"
toolchain/toolchain-crosstool-NG.mk new file +16 -0
@@ -0,0 +1,16 @@ +# Required includes for the external toolchain backend + +# Explicit ordering: +include toolchain/helpers.mk +include toolchain/binutils/binutils.mk +include toolchain/ccache/ccache.mk +include toolchain/dependencies/dependencies.mk +include toolchain/elf2flt/elf2flt.mk +include toolchain/gcc/gcc-uclibc-3.x.mk +include toolchain/gcc/gcc-uclibc-4.x.mk +include toolchain/gdb/gdb.mk +include toolchain/toolchain-crosstool-NG/crosstool-NG.mk +include toolchain/mklibs/mklibs.mk +include toolchain/sstrip/sstrip.mk +include toolchain/toolchain-external/ext-tool.mk +include toolchain/uClibc/uclibc.mk
toolchain/toolchain-crosstool-NG/Config.in new file +53 -0
53 lines not on this page · raw message
toolchain/toolchain-crosstool-NG/crosstool-NG.config new file +360 -0
360 lines not on this page · raw message
toolchain/toolchain-crosstool-NG/crosstool-NG.mk new file +118 -0
118 lines not on this page · raw message
cover Add crostool-NG as backend to generate toolchain
In reply to Yann E. MORINHello Yann,
I did a quick review of your patches, and found nothing specific to say, it looks good to me.
I would at least like patches 1 -> 5 to be merged early in the release cycle of 2010.08, because I have other changes to make on external toolchain support that will depend on these. So don't wait for the CT-NG support to be fully ready to send preliminary patches cleaning up things that you need for CT-NG integration.
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
cover Add crostool-NG as backend to generate toolchain
In reply to Yann E. MORINHello Yann,
I'd like to make some changes in the configuration options related to toolchains. As I don't want to break your work on Crosstool-NG, could you please send an official pull request for patches 1 to 5 to the list, so that Peter can merge this early cleanup/preparation work, and I can base my changes on top of it ?
Thanks!
Thomas
Signature · 4 lines
Thomas Petazzoni, Free Electrons Kernel, drivers, real-time and embedded Linux development, consulting, training and support. http://free-electrons.com
cover Add crostool-NG as backend to generate toolchain
Thomas, All,
Quoted 5 lines · On Tuesday 01 June 2010 09:15:55 Thomas Petazzoni wrote:
I'd like to make some changes in the configuration options related to toolchains. As I don't want to break your work on Crosstool-NG, could you please send an official pull request for patches 1 to 5 to the list, so that Peter can merge this early cleanup/preparation work, and I can base my changes on top of it ?
I'll push tonight, then!
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: | | +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ | | +33 223 225 172 `------------.-------: X AGAINST | \e/ There is no | | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. | '------------------------------^-------^------------------^--------------------'