Skip to contentSkip to conversation

Add crosstool-NG toolchain backend

PATCH New Yann E. MORIN 2 participants 7 messages Sep 19, 2010 – Oct 1, 2010 Kbuild

lore
Share & tools
lore
#0 lore raw

cover Add crosstool-NG toolchain backend

Hello All!

This series adds support to use crosstool-NG as a backend to generate the toolchain used by buildroot.

[PATCH 1/2] host tools: create the host sed in $(O)/host/ [PATCH 2/2] toolchain: add new toolchain backend: crosstool-NG

Changes since v0 (last status report):
- use lower-case in new file names (Thomas on IRC)
- do not rebuild the toolchain if related options did not changed

The first patch fixes the location of the host sed, so it does not get removed by crosstool-NG when building the toolchain. This is needed because crostool-NG wipes-out the toolchain installation directory before building the toolchain. In the end, the host-sed will probably entirely go away, but this is not the subject of the series, and can come later.

The second patch adds the crosstool-NG backend proper. The idea idea to treat the toolchain as if it was an external toolchain, except that it is not pre-built.

I've tried to split the second patch into smaller chunks, but I was not sure it would make sense to do so, as it is a self-contained change. It is a huge hunk, but the core of it is located in a single hunk, that adds the toolchain build.

Although the implementation is fully functional, some work remains that is not really essential to building the toolchain. Most notably, sanity checks are not yet performed on the configuration, and some target-related options are not yet passed down from the buildroot configuration to the corresponding crosstool-NG options.

As has been looked over in the previous status report, here is the left-over work that remains to be done:

- use latest stable release of crostool-NG: 1.8.1
- switch to generic package infrastructure, if possible
- push more options down to crosstool-NG
- sanity-check the toolchain configuration
- warn the user when he/she made changes in crosstool-NG's config that confilct with options from buildroot
- stress-test...

Thanks for your attention! I am open for any comment on this series. :-)

Regards,
Yann E. MORIN.

#1 lore raw

PATCH 1/2 host tools: create the host sed in $(O)/host/

The host sed does not belong to $(O)toolchain/ but really belongs to $(O)/host/

---
 package/sed/sed.mk |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)
package/sed/sed.mk +3 -5
index c393dd9..deae71d 100644
@@ -7,7 +7,7 @@ SED_VERSION:=4.2.1
 SED_SOURCE:=sed-$(SED_VERSION).tar.gz
 SED_SITE:=$(BR2_GNU_MIRROR)/sed
 SED_CAT:=$(ZCAT)
-SED_DIR1:=$(TOOLCHAIN_DIR)/sed-$(SED_VERSION)
+SED_DIR1:=$(HOST_DIR)/sed-$(SED_VERSION)
 SED_DIR2:=$(BUILD_DIR)/sed-$(SED_VERSION)
 SED_BINARY:=sed/sed
 SED_TARGET_BINARY:=bin/sed
@@ -15,7 +15,7 @@ ifeq ($(BR2_LARGEFILE),y)
 SED_CPPFLAGS=-D_FILE_OFFSET_BITS=64
 endif
 #HOST_SED_DIR:=$(STAGING_DIR)
-HOST_SED_DIR:=$(TOOLCHAIN_DIR)
+HOST_SED_DIR:=$(HOST_DIR)
 SED:=$(HOST_SED_DIR)/bin/sed -i -e
 HOST_SED_BINARY:=$(shell package/sed/sedcheck.sh)
 HOST_SED_IF_ANY=$(shell toolchain/dependencies/check-host-sed.sh)
@@ -33,9 +33,7 @@ sed-source: $(DL_DIR)/$(SED_SOURCE)
 #
 #############################################################
 $(SED_DIR1)/.unpacked: $(DL_DIR)/$(SED_SOURCE)
-	mkdir -p $(TOOLCHAIN_DIR)
-	mkdir -p $(HOST_SED_DIR)/bin
-	$(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(TOOLCHAIN_DIR) $(TAR_OPTIONS) -
+	$(SED_CAT) $(DL_DIR)/$(SED_SOURCE) | tar -C $(HOST_DIR) $(TAR_OPTIONS) -
 	toolchain/patch-kernel.sh $(SED_DIR1) package/sed/ configure.patch
 	$(CONFIG_UPDATE) $(SED_DIR1)/config
 	touch $@
Signature · 1 line
1.7.1
#2 lore raw

PATCH 1/2 host tools: create the host sed in $(O)/host/

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> The host sed does not belong to $(O)toolchain/ but Yann> really belongs to $(O)/host/

Thanks, but this is broken (and so was what we had), so I prefer to just get rid of it - It's not difficult to install a working sed on your build machine.

Signature · 1 line
Bye, Peter Korsgaard
#3 lore raw

PATCH 1/2 host tools: create the host sed in $(O)/host/

Peter, All,

Quoted 6 lines · On Thursday 30 September 2010 23:12:59 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> The host sed does not belong to $(O)toolchain/ but Yann> really belongs to $(O)/host/
Thanks, but this is broken (and so was what we had), so I prefer to just get rid of it - It's not difficult to install a working sed on your build machine.

I was expecting we would have to get rid of the host sed stuff, but I did not have time to properly do it before I submit the CT-NG backend, so this little workaround in the meantime. Thanks for taking care of that!

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.  |
'------------------------------^-------^------------------^--------------------'
#4 lore raw

PATCH 2/2 toolchain: add new toolchain backend: crosstool-NG

In reply to Yann E. MORIN
---
 Makefile                                           |    4 +-
 package/Makefile.in                                |    2 +
 toolchain/Config.in                                |    9 +
 ...chain-external.mk => toolchain-crosstool-ng.mk} |    4 +-
 toolchain/toolchain-crosstool-ng/Config.in         |   60 +++
 .../toolchain-crosstool-ng/crosstool-ng.config     |  360 +++++++++++++++
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk   |  275 +++++++++++
 .../uClibc.config}                                 |  126 +++---
 8 files changed, 773 insertions(+), 67 deletions(-)
Makefile +3 -1
index faa802b..12a7526 100644
@@ -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)
+else
 BASE_TARGETS:=uclibc
 endif
 TARGETS:=
@@ -287,6 +287,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
 
 include package/*/*.mk
package/Makefile.in +2 -0
index bb2aafa..3ee9f99 100644
@@ -117,6 +117,8 @@ else ifeq ($(BR2_TOOLCHAIN_EXTERNAL),y)
 TOOLCHAIN_EXTERNAL_PREFIX:=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))
 TOOLCHAIN_EXTERNAL_PATH:=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
 TARGET_CROSS=$(TOOLCHAIN_EXTERNAL_PATH)/bin/$(TOOLCHAIN_EXTERNAL_PREFIX)-
+else ifeq ($(BR2_TOOLCHAIN_CTNG),y)
+TARGET_CROSS=$(TOOLCHAIN_DIR)/bin/$(REAL_GNU_TARGET_NAME)-
 endif
 
 # Quotes are needed for spaces et al in path components.
toolchain/Config.in +9 -0
index fc9a048..d476cbf 100644
@@ -14,10 +14,19 @@ config BR2_TOOLCHAIN_BUILDROOT
 config BR2_TOOLCHAIN_EXTERNAL
 	bool "External toolchain"
 
+config BR2_TOOLCHAIN_CTNG
+	bool "Crosstool-NG toolchain"
+	help
+	  Say 'y' if you want to generate the toolchain with crosstool-NG
+	  ( http://ymorin.is-a-geek.org/projects/crosstool )
+
+	  This is considered experimental, and you can expect some breakage.
+
 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 renamed from toolchain/toolchain-external.mk +2 -2
similarity index 80%
copy from toolchain/toolchain-external.mk
copy to toolchain/toolchain-crosstool-ng.mk
index 6f1f641..81fce18 100644
@@ -1,5 +1,6 @@
 # Required includes for the external toolchain backend
 
+# Explicit ordering:
 include toolchain/helpers.mk
 include toolchain/binutils/binutils.mk
 include toolchain/ccache/ccache.mk
@@ -7,8 +8,7 @@ include toolchain/dependencies/dependencies.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/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 +60 -0

60 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 +275 -0

275 lines not on this page · raw message

toolchain/toolchain-crosstool-ng/uClibc.config renamed from toolchain/uClibc/uClibc-0.9.30.config +62 -64

250 lines not on this page · raw message

Signature · 1 line
1.7.1
#5 lore raw

PATCH 2/2 toolchain: add new toolchain backend: crosstool-NG

All,

Quoted 11 lines · On Sunday 19 September 2010 21:54:09 Yann E. MORIN wrote:
---
 Makefile                                           |    4 +-
 package/Makefile.in                                |    2 +
 toolchain/Config.in                                |    9 +
 ...chain-external.mk => toolchain-crosstool-ng.mk} |    4 +-
 toolchain/toolchain-crosstool-ng/Config.in         |   60 +++
 .../toolchain-crosstool-ng/crosstool-ng.config     |  360 +++++++++++++++
 toolchain/toolchain-crosstool-ng/crosstool-ng.mk   |  275 +++++++++++
 .../uClibc.config}                                 |  126 +++---
 8 files changed, 773 insertions(+), 67 deletions(-)

Ping? ;-)

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.  |
'------------------------------^-------^------------------^--------------------'
#6 lore raw

PATCH 2/2 toolchain: add new toolchain backend: crosstool-NG

In reply to Yann E. MORIN
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Yann" == Yann E MORIN <[email protected]> writes:

Yann> Signed-off-by: Yann E. MORIN <[email protected]>

Committed, thanks a lot!

I fixed a few minor things (Config.in should be indented with tabs, we normally don't use a seperate prompt ".." line, and shuffled the make targets around slightly so they follow the logic flow (download/extract/patch/configure/build/.. rather than the other way around).

I've noticed that you're not propagating some of the toolchain options (like wchar) to ct-ng, but we can add that later.

Signature · 1 line
Bye, Peter Korsgaard