Preparatory work on toolchains - v2
cover Preparatory work on toolchains - v2
Hello All!
These are preparatory work on toolchain, laying ground to later add crosstool-NG as a backend. Currently, these are rather an RFC, even if it works OK for me.
Changes since v1:
- rebased against latest tree
- patches formatted to detect renames/copies
Yann E. MORIN (5):
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
Makefile | 17 +-
toolchain/Config.in | 16 +-
toolchain/external-toolchain/ext-tool.mk | 322 ------
toolchain/helpers.mk | 217 ++++
toolchain/toolchain-buildroot.mk | 14 +
toolchain/{Config.in.1 => toolchain-buildroot/Config.in} | 2 +-
toolchain/toolchain-buildroot/Config.in.2 | 37 +
toolchain/{Config.in.2 => toolchain-common.in} | 46 +-
toolchain/toolchain-external.mk | 16 +
toolchain/{external-toolchain => toolchain-external}/Config.in | 0
toolchain/{external-toolchain => toolchain-external}/Config.in.2 | 0
toolchain/toolchain-external/ext-tool.mk | 108 ++
12 files changed, 410 insertions(+), 385 deletions(-)PATCH 1/5 toolchain: move helper functions from external toolchain
The helper functions used for external toolchains may also be useful to alternate toolchain backends (currently, the external toolchain is the sole user).
--- Makefile | 1 + toolchain/external-toolchain/ext-tool.mk | 214 ----------------------------- toolchain/helpers.mk | 217 ++++++++++++++++++++++++++++++ 3 files changed, 218 insertions(+), 214 deletions(-) create mode 100644 toolchain/helpers.mk
Makefile +1 -0
@@ -306,6 +306,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 -214
220 lines not on this page · raw message
toolchain/helpers.mk new file +217 -0
217 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 2/5 toolchain: rename external toolchain dir
In reply to Yann E. MORINRename 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 ++--
.../Config.in | 0
.../Config.in.2 | 0
.../ext-tool.mk | 0
4 files changed, 2 insertions(+), 2 deletions(-)
rename toolchain/{external-toolchain => toolchain-external}/Config.in (100%)
rename toolchain/{external-toolchain => toolchain-external}/Config.in.2 (100%)
rename toolchain/{external-toolchain => toolchain-external}/ext-tool.mk (100%)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/toolchain-external/Config.in renamed from toolchain/external-toolchain/Config.in +0 -0
toolchain/toolchain-external/Config.in.2 renamed from toolchain/external-toolchain/Config.in.2 +0 -0
toolchain/toolchain-external/ext-tool.mk renamed from toolchain/external-toolchain/ext-tool.mk +0 -0
Signature · 1 line
1.7.1
PATCH 3/5 toolchain: move makefile includes
In reply to Yann E. MORINIncluding a bunch of Makefiles with wildcard makes it impossible to add new toolchain backends. Avoid that by namely including needed files.
--- Makefile | 16 ++-------------- toolchain/toolchain-buildroot.mk | 14 ++++++++++++++ toolchain/toolchain-external.mk | 16 ++++++++++++++++ 3 files changed, 32 insertions(+), 14 deletions(-) create mode 100644 toolchain/toolchain-buildroot.mk create mode 100644 toolchain/toolchain-external.mk
Makefile +2 -14
@@ -293,21 +293,9 @@ all: world # 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-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 include package/*/*.mk
toolchain/toolchain-buildroot.mk new file +14 -0
@@ -0,0 +1,14 @@ +# 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-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
Signature · 1 line
1.7.1
PATCH 3/5 toolchain: move makefile includes
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Yann> Including a bunch of Makefiles with wildcard makes it impossible Yann> to add new toolchain backends. Avoid that by namely including Yann> needed files.
Yann> --- /dev/null
Yann> +++ b/toolchain/toolchain-buildroot.mk
Yann> @@ -0,0 +1,14 @@
Yann> +# Include files required for the internal toolchain backend
Yann> +
Yann> +# avoid pulling in external toolchain which is broken for toplvl parallel builds Yann> +# Explicit ordering:
Yann> +include toolchain/dependencies/dependencies.mk
Yann> +include toolchain/binutils/binutils.mk
Yann> +include toolchain/ccache/ccache.mk
Yann> +include toolchain/elf2flt/elf2flt.mk
Yann> +include toolchain/gcc/gcc-uclibc-4.x.mk
Yann> +include toolchain/gdb/gdb.mk
Yann> +include toolchain/kernel-headers/kernel-headers.mk
Yann> +include toolchain/mklibs/mklibs.mk
Yann> +include toolchain/sstrip/sstrip.mk
Yann> +include toolchain/uClibc/uclibc.mk
Yann> diff --git a/toolchain/toolchain-external.mk b/toolchain/toolchain-external.mk Yann> new file mode 100644
Yann> index 0000000..6c00330
Yann> --- /dev/null
Yann> +++ b/toolchain/toolchain-external.mk
Yann> @@ -0,0 +1,16 @@
Yann> +# Required includes for the external toolchain backend
Yann> +
Yann> +# Explicit ordering:
Yann> +include toolchain/helpers.mk
Yann> +include toolchain/binutils/binutils.mk
Yann> +include toolchain/ccache/ccache.mk
Yann> +include toolchain/dependencies/dependencies.mk
Yann> +include toolchain/elf2flt/elf2flt.mk
Yann> +include toolchain/gcc/gcc-uclibc-3.x.mk
Yann> +include toolchain/gcc/gcc-uclibc-4.x.mk
Yann> +include toolchain/gdb/gdb.mk
Yann> +include toolchain/toolchain-external/ext-tool.mk
Yann> +include toolchain/mklibs/mklibs.mk
Yann> +include toolchain/sstrip/sstrip.mk
Yann> +include toolchain/toolchain-external/ext-tool.mk
Yann> +include toolchain/uClibc/uclibc.mk
Why are the order of those includes not the same? gcc-uclibc-3.x.mk is gone.
2x toolchain-external/ext-tool.mk?
Why do we need to include all these when using an external toolchain? Most of them doesn't seem to make sense to me.
Signature · 1 line
Bye, Peter Korsgaard
PATCH 3/5 toolchain: move makefile includes
Peter, All,
Quoted 4 lines · On Sunday 27 June 2010 23:06:56 Peter Korsgaard wrote:
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Yann> Including a bunch of Makefiles with wildcard makes it impossible Yann> to add new toolchain backends. Avoid that by namely including Yann> needed files.
[--SNIP--]
Quoted 1 line
Why are the order of those includes not the same?
For external toolchains, the original Makefile was doing:
include toolchain/*/*.mk
So I just did:
ls -1 toolchain/*/*.mk
and replaced the single include with the output of ls, so as to keep the inclusion in the same order the original Makefile was doing it.
Quoted 2 lines
gcc-uclibc-3.x.mk is gone.
2xtoolchain-external/ext-tool.mk?
Hmmm... I seem to have missed something here. Wrong tree, I guess... :-(
Quoted 2 lines
Why do we need to include all these when using an external toolchain? Most of them doesn't seem to make sense to me.
I just did what the original Makefile did, just moved the stuff to toolchain-specific Makefiles.
I guess it is needed when the user wants to have a native toolchain in his/her rootfs, as the rules to build it are in those files. The cross-stuff is not built due to the BASE_TARGETS variable that does include them only for internal toolchain.
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. | '------------------------------^-------^------------------^--------------------'
PATCH 4/5 toolchain: move buildroot config files
In reply to Yann E. MORINHandle the internal toolchain backend mechanism the same way we handle other backends.
---
toolchain/Config.in | 12 +----
.../{Config.in.1 => toolchain-buildroot/Config.in} | 2 +-
toolchain/toolchain-buildroot/Config.in.2 | 37 ++++++++++++++++
toolchain/{Config.in.2 => toolchain-common.in} | 46 ++++----------------
4 files changed, 50 insertions(+), 47 deletions(-)
rename toolchain/{Config.in.1 => toolchain-buildroot/Config.in} (82%)
create mode 100644 toolchain/toolchain-buildroot/Config.in.2
rename toolchain/{Config.in.2 => toolchain-common.in} (84%)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/toolchain-buildroot/Config.in renamed from toolchain/Config.in.1 +1 -1
@@ -1,4 +1,4 @@ -# +# Config entries for internal toolchain backend if BR2_TOOLCHAIN_BUILDROOT source "toolchain/kernel-headers/Config.in"
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 renamed from toolchain/Config.in.2 +9 -37
52 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 5/5 toolchain: rename base target for external toolchains
In reply to Yann E. MORINIt 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
@@ -230,7 +230,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 libresolv.so librt.so libutil.so ifeq ($(BR2_TOOLCHAIN_EXTERNAL_UCLIBC),y)
Signature · 1 line
1.7.1
PATCH 5/5 toolchain: rename base target for external toolchains
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"Yann" == Yann E MORIN <[email protected]> writes:
Yann> It is misleeading to name the external toolchain make target 'uclibc', as Yann> external toochains can be based on other C libraries (eg. glibc or eglibc).
Typo - s/toochains/toolchains/
Otherwise looks good.
Signature · 1 line
Bye, Peter Korsgaard