BuildRoot with a prebuilt toolchain

Allan Clark allanc at chickenandporn.com
Tue Sep 27 15:55:01 UTC 2005


Hi Dan;

It might be better if you describe how your change differs from the one 
currently overlooked in the bug-tracking tool:

http://bugs.uclibc.org/view.php?id=237

> buildroot builds uclibc-based toolchain and uses it to build userland 
> programs.
> here is a patch to enable buildroot to use crosstool build glibc-based 
> toolchain.
>
> you have to set correct crosstool toolchain location and prefix to use 
> this feature.
I'm currently using it successfully, and can make an updated patch 
available that applies to the latest (well, yesterday's) SVN version.

I see some changes in your work that might add some functionality to 
sjhill's latest version of this, or my blind update of that version.  
... or if you just want to grab my stuff, which has a bunch of other 
patches in it, grab 
http://www.chickenandporn.com/~allanc/busybox-new.tar.bz2

I've tested with the pxa270 kit from Intel, and an old Sharp/Zaurus 
toolchain used for Qtopia-1.6 (even downloads that one for you).

Allan


Daniel Laird wrote:
> I am working on a project that has a number of developers.
> We have been looking at using buildroot.
> One of the biggest drawbacks was that the toolchain had to be built 
> for each developer which is a config management nightmare.
>
> We have made a patch file that allows buildroot to have a prebuilt 
> toolchain.  It uses this to build all of the packages.  This is 
> controlled in the usual manner using make menuconfig.
>
> I would be interested in seeing what people think of this idea and 
> would appreciate feedback as it would obviously help us if this patch 
> gets accepted into main line.
>
> Cheers
> Dan
>
> diff -ru buildroot-20050922/Config.in buildroot/Config.in
> --- buildroot-20050922/Config.in    2005-09-22 08:15:55.000000000 +0100
> +++ buildroot/Config.in    2005-09-23 13:55:20.000000000 +0100
> @@ -135,6 +135,15 @@
>         The list of mirrors is available here:
>         http://prdownloads.sourceforge.net/index-sf.html?download
>
> +config BR2_USE_BUILT_TOOLS
> +    bool "Use pre-built toolchain"
> +    default n
> +
> +config BR2_TOOLS_DIR
> +    string "Toolchain location"
> +    default "/opt/nxlinux/gcc/gcc-3.4.2-uClibc-0.9.28"
> +    depends BR2_USE_BUILT_TOOLS
> +
> config BR2_STAGING_DIR
>     string "Toolchain and header file location?"
>     default "$(BUILD_DIR)/staging_dir"
> @@ -164,7 +173,7 @@
>         Add a custom string to the end of the build directories.
>
>         build_ARCH -> build_ARCH_[SUFFIX]
> -        toolchain_build_ARCH -> toolchain_build_ARCH_[SUFFIX]
> +        toolchain_build_ARCH -> toolchain_build_ARCH_[SUFFIX]
>
> config BR2_JLEVEL
>     int "Number of jobs to run simultaneously"
> diff -ru buildroot-20050922/Makefile buildroot/Makefile
> --- buildroot-20050922/Makefile    2005-09-22 08:15:55.000000000 +0100
> +++ buildroot/Makefile    2005-09-26 14:30:59.000000000 +0100
> @@ -49,7 +49,11 @@
> # along with the packages to build for the target.
> #
> ##############################################################
> +ifneq ($(BR2_USE_BUILT_TOOLS),y)
> TARGETS:=host-sed kernel-headers uclibc-configured binutils gcc 
> uclibc-target-utils
> +else
> +TARGETS:=host-sed
> +endif
> include toolchain/Makefile.in
> include package/Makefile.in
>
> diff -ru buildroot-20050922/package/directfb/Config.in 
> buildroot/package/directfb/Config.in
> --- buildroot-20050922/package/directfb/Config.in    2005-09-22 
> 08:15:37.000000000 +0100
> +++ buildroot/package/directfb/Config.in    2005-09-26 
> 10:33:07.000000000 +0100
> @@ -6,6 +6,7 @@
>     select BR2_PACKAGE_LIBPNG
>     select BR2_PACKAGE_LIBSYSFS
>     select BR2_PACKAGE_FREETYPE
> +    select BR2_PACKAGE_SDL
>     help
>
>     http://www.directfb.org/
> diff -ru buildroot-20050922/package/directfb/directfb.mk 
> buildroot/package/directfb/directfb.mk
> --- buildroot-20050922/package/directfb/directfb.mk    2005-09-22 
> 08:15:37.000000000 +0100
> +++ buildroot/package/directfb/directfb.mk    2005-09-26 
> 10:44:30.000000000 +0100
> @@ -22,8 +22,8 @@
> $(DIRECTFB_DIR)/.configured: $(DIRECTFB_DIR)/.unpacked
>     (cd $(DIRECTFB_DIR); \
>     $(TARGET_CONFIGURE_OPTS) \
> -    CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include" \
> -    LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib" \
> +    CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/usr/include 
> -I$(STAGING_DIR)/include" \
> +    LDFLAGS="-L$(STAGING_DIR)/lib -L$(STAGING_DIR)/usr/lib 
> -Wl,--rpath-link -Wl,$(STAGING_DIR)/lib" \
>     ac_cv_header_linux_wm97xx_h=no \
>     ac_cv_header_linux_sisfb_h=no \
>     ./configure \
> @@ -56,7 +56,7 @@
>     cp -rdpf $(STAGING_DIR)/usr/lib/directfb-$(DIRECTFB_VERSION) 
> $(TARGET_DIR)/usr/lib/
>     -$(STRIP) --strip-unneeded $(TARGET_DIR)/usr/lib/libdirectfb.so
>
> -directfb: uclibc jpeg libpng freetype libsysfs 
> $(TARGET_DIR)/usr/lib/libdirectfb.so
> +directfb: uclibc jpeg libpng freetype libsysfs sdl 
> $(TARGET_DIR)/usr/lib/libdirectfb.so
>
> directfb-clean:
>     $(MAKE) DESTDIR=$(TARGET_DIR) CC=$(TARGET_CC) -C $(DIRECTFB_DIR) 
> uninstall
> diff -ru buildroot-20050922/package/dropbear_sshd/dropbear_sshd.mk 
> buildroot/package/dropbear_sshd/dropbear_sshd.mk
> --- buildroot-20050922/package/dropbear_sshd/dropbear_sshd.mk    
> 2005-09-22 08:15:36.000000000 +0100
> +++ buildroot/package/dropbear_sshd/dropbear_sshd.mk    2005-09-26 
> 11:26:04.000000000 +0100
> @@ -27,7 +27,8 @@
>     (cd $(DROPBEAR_SSHD_DIR); rm -rf config.cache; \
>         autoconf; \
>         $(TARGET_CONFIGURE_OPTS) \
> -        CFLAGS="$(TARGET_CFLAGS)" \
> +        CFLAGS="$(TARGET_CFLAGS) -I$(STAGING_DIR)/include" \
> +        LDFLAGS="-L$(STAGING_DIR)/lib" \
>         ./configure \
>         --target=$(GNU_TARGET_NAME) \
>         --host=$(GNU_TARGET_NAME) \
> diff -ru buildroot-20050922/package/hotplug/hotplug.mk 
> buildroot/package/hotplug/hotplug.mk
> --- buildroot-20050922/package/hotplug/hotplug.mk    2005-09-22 
> 08:15:30.000000000 +0100
> +++ buildroot/package/hotplug/hotplug.mk    2005-09-26 
> 11:55:16.000000000 +0100
> @@ -16,7 +16,7 @@
>
> $(HOTPLUG_DIR)/hotplug: $(HOTPLUG_DIR)
>     $(MAKE) CROSS=$(TARGET_CROSS) DEBUG=false KLIBC=false \
> -        KERNEL_INCLUDE_DIR=$(STAGING_DIR)/include \
> +        KERNEL_INCLUDE_DIR=$(TOOLS_DIR)/include \
>         TARGET_DIR=$(TARGET_DIR) -C $(HOTPLUG_DIR);
>     $(STRIP) $(HOTPLUG_DIR)/hotplug;
>     touch -c $(HOTPLUG_DIR)/hotplug
> diff -ru buildroot-20050922/package/libpng/libpng.mk 
> buildroot/package/libpng/libpng.mk
> --- buildroot-20050922/package/libpng/libpng.mk    2005-09-22 
> 08:15:53.000000000 +0100
> +++ buildroot/package/libpng/libpng.mk    2005-09-26 
> 10:17:33.000000000 +0100
> @@ -40,6 +40,7 @@
>     ( \
>         cd $(LIBPNG_DIR) ; \
>         cp scripts/makefile.linux Makefile ; \
> +        $(SED) 's~../zlib~$(ZLIB_DIR)~' Makefile ; \
>         $(SED) 's~prefix=/usr/local/~$(STAGING_DIR)~' Makefile ; \
>         $(SED) 's~gcc~${TARGET_CC}~' Makefile ; \
>         $(SED) "s~-O3 -funroll-loops~${TARGET_CFLAGS}~" Makefile ; \
> diff -ru buildroot-20050922/package/Makefile.in 
> buildroot/package/Makefile.in
> --- buildroot-20050922/package/Makefile.in    2005-09-22 
> 08:15:55.000000000 +0100
> +++ buildroot/package/Makefile.in    2005-09-23 13:55:20.000000000 +0100
> @@ -8,6 +8,8 @@
> #"
> SVN:=$(strip $(subst ",, $(BR2_SVN)))
> #"
> +TOOLS_DIR:=$(strip $(subst ",, $(BR2_TOOLS_DIR)))
> +#"
>
>
>
> @@ -36,12 +38,15 @@
> # Strip off the annoying quoting
> STAGING_DIR:=$(strip $(subst ",, $(BR2_STAGING_DIR)))
> #"
> -TARGET_PATH=$(STAGING_DIR)/bin:$(TOOL_BUILD_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin 
>
> +ifeq ($(TOOLS_DIR),)
> +TOOLS_DIR:=$(STAGING_DIR)
> +endif
> +TARGET_PATH=$(TOOLS_DIR)/bin:$(STAGING_DIR)/bin:$(TOOL_BUILD_DIR)/bin:/bin:/sbin:/usr/bin:/usr/sbin 
>
> IMAGE:=$(BASE_DIR)/rootfs.$(ARCH)$(ARCH_FPU_SUFFIX)
> REAL_GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux-uclibc
> GNU_TARGET_NAME=$(OPTIMIZE_FOR_CPU)-linux
> -KERNEL_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
> -TARGET_CROSS=$(STAGING_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
> +KERNEL_CROSS=$(TOOLS_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
> +TARGET_CROSS=$(TOOLS_DIR)/bin/$(OPTIMIZE_FOR_CPU)-linux-uclibc-
> TARGET_CC=$(TARGET_CROSS)gcc
> TARGET_RANLIB=$(TARGET_CROSS)ranlib
> STRIP=$(TARGET_CROSS)strip --remove-section=.comment 
> --remove-section=.note
> diff -ru buildroot-20050922/package/mtd/mtd.mk 
> buildroot/package/mtd/mtd.mk
> --- buildroot-20050922/package/mtd/mtd.mk    2005-09-22 
> 08:15:30.000000000 +0100
> +++ buildroot/package/mtd/mtd.mk    2005-09-26 12:53:13.000000000 +0100
> @@ -78,8 +78,10 @@
> MTD_BUILD_TARGETS := $(addprefix $(MTD_DIR)/util/, $(MTD_TARGETS_y))
>
> $(MTD_BUILD_TARGETS): $(MTD_DIR)/.unpacked
> -    CFLAGS="-I$(LINUX_HEADERS_DIR)/include $(TARGET_CFLAGS)" \
> -    $(MAKE)    CC=$(TARGET_CC) LINUXDIR=$(LINUX_DIR) -C $(MTD_DIR)/util
> +    CFLAGS="-I$(LINUX_HEADERS_DIR)/include -I$(STAGING_DIR)/include 
> $(TARGET_CFLAGS)" \
> +    $(MAKE)    CFLAGS="-I$(MTD_DIR)/include -I$(STAGING_DIR)/include 
> $(TARGET_CFLAGS)" \
> +            LDFLAGS="-L$(STAGING_DIR)/lib" \
> +            CC=$(TARGET_CC) LINUXDIR=$(LINUX_DIR) -C $(MTD_DIR)/util
>
> MTD_TARGETS := $(addprefix $(TARGET_DIR)/usr/sbin/, $(MTD_TARGETS_y))
>
> diff -ru buildroot-20050922/toolchain/binutils/Config.in 
> buildroot/toolchain/binutils/Config.in
> --- buildroot-20050922/toolchain/binutils/Config.in    2005-09-22 
> 08:15:09.000000000 +0100
> +++ buildroot/toolchain/binutils/Config.in    2005-09-23 
> 13:55:20.000000000 +0100
> @@ -1,5 +1,5 @@
> # Choose binutils version.
> -
> +if !BR2_USE_BUILT_TOOLS
> comment "Binutils Options"
>
> choice
> @@ -48,3 +48,4 @@
>     default "2.16.90.0.3"     if BR2_BINUTILS_VERSION_2_16_90_0_3
>     default "2.16.91.0.2"     if BR2_BINUTILS_VERSION_2_16_91_0_2
>     default "2.16.91.0.3"     if BR2_BINUTILS_VERSION_2_16_91_0_3
> +endif
> diff -ru buildroot-20050922/toolchain/ccache/Config.in 
> buildroot/toolchain/ccache/Config.in
> --- buildroot-20050922/toolchain/ccache/Config.in    2005-09-22 
> 08:15:08.000000000 +0100
> +++ buildroot/toolchain/ccache/Config.in    2005-09-23 
> 13:55:20.000000000 +0100
> @@ -1,5 +1,5 @@
> #
> -
> +if !BR2_USE_BUILT_TOOLS
> comment "Ccache Options"
>
> config BR2_CCACHE
> @@ -7,4 +7,4 @@
>     default y
>     help
>         Enable ccache support?
> -
> +endif
> diff -ru buildroot-20050922/toolchain/Config.in 
> buildroot/toolchain/Config.in
> --- buildroot-20050922/toolchain/Config.in    2005-09-22 
> 08:15:16.000000000 +0100
> +++ buildroot/toolchain/Config.in    2005-09-23 13:55:20.000000000 +0100
> @@ -1,5 +1,4 @@
> #
> -
> menu "Toolchain Options"
>
>
> @@ -48,6 +47,7 @@
> config BR2_CROSS_TOOLCHAIN_TARGET_UTILS
>     bool "Include target utils in cross toolchain"
>     default y
> +    depends on !BR2_USE_BUILT_TOOLS
>     help
>       When using buildroot to build a deployable cross toolchain, it 
> is handy
>       to include certain target apps with that toolchain as a 
> convenience.
> diff -ru buildroot-20050922/toolchain/gcc/Config.in 
> buildroot/toolchain/gcc/Config.in
> --- buildroot-20050922/toolchain/gcc/Config.in    2005-09-22 
> 08:15:15.000000000 +0100
> +++ buildroot/toolchain/gcc/Config.in    2005-09-23 13:55:20.000000000 
> +0100
> @@ -1,5 +1,5 @@
> # Choose gcc version.
> -
> +if !BR2_USE_BUILT_TOOLS
> comment "Gcc Options"
>
> choice
> @@ -79,3 +79,4 @@
>     default n
>     help
>         Build/install Objective-C compiler and runtime?
> +endif
> diff -ru buildroot-20050922/toolchain/gdb/Config.in 
> buildroot/toolchain/gdb/Config.in
> --- buildroot-20050922/toolchain/gdb/Config.in    2005-09-22 
> 08:15:16.000000000 +0100
> +++ buildroot/toolchain/gdb/Config.in    2005-09-23 13:55:20.000000000 
> +0100
> @@ -17,6 +17,7 @@
> config BR2_PACKAGE_GDB_CLIENT
>     bool "Build gdb client for the Host"
>     default n
> +    depends !BR2_USE_BUILT_TOOLS
>     help
>         Build gdb to run on the host to debug programs running on the 
> target.
>
> diff -ru buildroot-20050922/toolchain/kernel-headers/Config.in 
> buildroot/toolchain/kernel-headers/Config.in
> --- buildroot-20050922/toolchain/kernel-headers/Config.in    
> 2005-09-22 08:15:10.000000000 +0100
> +++ buildroot/toolchain/kernel-headers/Config.in    2005-09-23 
> 13:55:20.000000000 +0100
> @@ -1,7 +1,7 @@
> # Choose the kernel headers to use for kernel-headers target. This is
> # ignored if you are building your own kernel or using the system kernel.
> #
> -
> +if !BR2_USE_BUILT_TOOLS
> comment "Kernel Header Options"
>
> choice
> @@ -40,4 +40,4 @@
>     default "2.4.31"    if BR2_KERNEL_HEADERS_2_4_31
>     default "2.6.11"    if BR2_KERNEL_HEADERS_2_6_11
>     default "2.6.12"    if BR2_KERNEL_HEADERS_2_6_12
> -
> +endif
> diff -ru buildroot-20050922/toolchain/sstrip/Config.in 
> buildroot/toolchain/sstrip/Config.in
> --- buildroot-20050922/toolchain/sstrip/Config.in    2005-09-22 
> 08:15:08.000000000 +0100
> +++ buildroot/toolchain/sstrip/Config.in    2005-09-23 
> 13:55:20.000000000 +0100
> @@ -7,5 +7,6 @@
> config BR2_PACKAGE_SSTRIP_HOST
>     bool "Install sstrip for the host/build system"
>     default n
> +    depends !BR2_USE_BUILT_TOOLS
>     help
>       Maximal 'strip'ing utility.
> diff -ru buildroot-20050922/toolchain/uClibc/Config.in 
> buildroot/toolchain/uClibc/Config.in
> --- buildroot-20050922/toolchain/uClibc/Config.in    2005-09-22 
> 08:15:08.000000000 +0100
> +++ buildroot/toolchain/uClibc/Config.in    2005-09-23 
> 13:55:20.000000000 +0100
> @@ -1,6 +1,6 @@
> # Choose uClibc options
> #
> -
> +if !BR2_USE_BUILT_TOOLS
> comment "uClibc Options"
>
> config BR2_UCLIBC_VERSION_SNAPSHOT
> @@ -27,4 +27,4 @@
>     default n
>     help
>         Enable Native POSIX Threading (NPTL) support?
> -
> +endif
> diff -ru buildroot-20050922/toolchain/uClibc/uclibc.mk 
> buildroot/toolchain/uClibc/uclibc.mk
> --- buildroot-20050922/toolchain/uClibc/uclibc.mk    2005-09-22 
> 08:15:08.000000000 +0100
> +++ buildroot/toolchain/uClibc/uclibc.mk    2005-09-26 
> 14:31:14.000000000 +0100
> @@ -115,15 +115,24 @@
>     touch -c $(STAGING_DIR)/lib/libc.a
>
> ifneq ($(TARGET_DIR),)
> -$(TARGET_DIR)/lib/libc.so.0: $(STAGING_DIR)/lib/libc.a
> +$(TARGET_DIR)/lib/libc.so.0: $(TOOLS_DIR)/lib/libc.a
> +ifeq ($(BR2_USE_BUILT_TOOLS),y)
> +    mkdir -p $(TARGET_DIR)/lib
> +    cp -d $(TOOLS_DIR)/lib/*.so* $(TARGET_DIR)/lib
> +else
>     $(MAKE1) -C $(UCLIBC_DIR) \
>         PREFIX=$(TARGET_DIR) \
>         DEVEL_PREFIX=/usr/ \
>         RUNTIME_PREFIX=/ \
>         install_runtime
> +endif
>     touch -c $(TARGET_DIR)/lib/libc.so.0
>
> $(TARGET_DIR)/usr/bin/ldd:
> +ifeq ($(BR2_USE_BUILT_TOOLS),y)
> +    install -c $(TOOLS_DIR)/$(REAL_GNU_TARGET_NAME)/target_utils/ldd \
> +        $(TARGET_DIR)/usr/bin/ldd
> +else
>     $(MAKE1) -C $(UCLIBC_DIR) $(TARGET_CONFIGURE_OPTS) \
>         PREFIX=$(TARGET_DIR) utils install_utils
> ifeq ($(strip $(BR2_CROSS_TOOLCHAIN_TARGET_UTILS)),y)
> @@ -133,12 +142,13 @@
> endif
>     touch -c $(TARGET_DIR)/usr/bin/ldd
>
> +endif
> UCLIBC_TARGETS=$(TARGET_DIR)/lib/libc.so.0
> endif
>
> uclibc-configured: $(UCLIBC_DIR)/.configured
>
> -uclibc: $(STAGING_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc 
> $(STAGING_DIR)/lib/libc.a \
> +uclibc: $(TOOLS_DIR)/bin/$(REAL_GNU_TARGET_NAME)-gcc 
> $(TOOLS_DIR)/lib/libc.a \
>     $(UCLIBC_TARGETS)
>
> uclibc-source: $(DL_DIR)/$(UCLIBC_SOURCE)
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> uClibc mailing list
> uClibc at uclibc.org
> http://busybox.net/cgi-bin/mailman/listinfo/uclibc




More information about the uClibc mailing list