2010-02-09 21:34:49 +01:00
|
|
|
|
2009-07-17 00:20:33 +02:00
|
|
|
#
|
|
|
|
# This file implements the support for external toolchains, i.e
|
|
|
|
# toolchains that have not been produced by Buildroot itself and that
|
2010-12-13 17:27:39 +01:00
|
|
|
# Buildroot can download from the Web or that are already available on
|
|
|
|
# the system on which Buildroot runs. So far, we have tested this
|
|
|
|
# with:
|
external-toolchain: Support for multilib toolchains
Multilib toolchains provide different versions of the base libraries
for different architecture variants. For example, the ARM Codesourcery
toolchain provides base libraries for ARMv5 (default), ARMv4t and
Thumb2.
Depending on the -march= argument passed to gcc, the sysroot used by
the compiler is therefore different. This means that the sysroot
location in CROSS-gcc -v cannot be used. Instead, we must use
CROSS-gcc -print-sysroot when available and fall back to the old way
if unavailable.
Moreover, we cannot simply copy the full sysroot as we used to do,
because the sysroot organization of multilib toolchain is more
complicated. In Codesourcery toolchains, we have :
/
etc -- for ARMv5
lib -- for ARMv5
sbin -- for ARMv5
usr -- for ARMv5 (includes headers)
armv4t
etc -- for ARMv4t
lib -- for ARMv4t
sbin -- for ARMv4t
usr -- for ARMv4t (no headers!)
thumb2
etc -- for Thumb2
lib -- for Thumb2
sbin -- for Thumb2
usr -- for Thumb2 (no headers!)
So we have the default ARMv5 architecture variant that is installed in
the main directory, and we have subdirectories for the ARMv4t and
Thumb2 architecture variants.
Copying the full sysroot to the staging directory doesn't work. All
our packages are based on the fact that they should install libraries
in staging/usr/lib. But if ARMv4t is used, the compiler would only
look in staging/armv4t/usr/lib for libraries (even when overriding the
sysroot with the --sysroot option, the multilib compiler suffixes the
sysroot directory with the architecture variant if it matches a
recognized one).
Therefore, we have to copy only the sysroot that we are interested
in. This is rendered a little bit complicated by the fact that the
armv4t and thumb2 sysroot do not contain the headers since they are
shared with the armv5 sysroot.
So, this patch :
* Modifies how we compute SYSROOT_DIR in order to use -print-sysroot
if it exists. SYSROOT_DIR contains the location of the main sysroot
directory, i.e the sysroot for the default architecture variant.
* Defines ARCH_SUBDIR as the subdirectory in the main sysroot for the
currently selected architecture variant (in our case, it can be
".", "armv4t" or "thumb2"). ARCH_SYSROOT_DIR is defined as the full
path to the sysroot of the currently selected architecture variant.
* Modifies copy_toolchain_lib_root (which copies a library to the
target/ directory) so that libraries are taken from
ARCH_SYSROOT_DIR instead of SYSROOT_DIR. This ensures that
libraries for the correct architecture variant are properly copied
to the target.
* Modifies copy_toolchain_sysroot (which copies the sysroot to the
staging/ directory), so that it copies the contents of
ARCH_SYSROOT_DIR, and if needed, adds the headers from the main
sysroot directory and a symbolic link (armv4t -> . or thumb2 -> .)
to make the compiler believe that its sysroot is really in armv4t/
or thumb2/.
Tested with Codesourcery 2009q1 ARM toolchain, Crosstool-NG ARM glibc
and ARM uClibc toolchains.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2009-08-22 01:13:22 +02:00
|
|
|
#
|
|
|
|
# * Toolchains generated by Crosstool-NG
|
|
|
|
# * Toolchains generated by Buildroot
|
2010-07-05 18:58:59 +02:00
|
|
|
# * ARM, MIPS and PowerPC toolchains made available by
|
|
|
|
# Codesourcery. For the MIPS toolchain, the -muclibc variant isn't
|
|
|
|
# supported yet, only the default glibc-based variant is.
|
2009-07-17 00:20:33 +02:00
|
|
|
#
|
|
|
|
# The basic principle is the following
|
|
|
|
#
|
2012-06-22 07:42:39 +02:00
|
|
|
# 1. If the toolchain is not pre-installed, download and extract it
|
|
|
|
# in $(TOOLCHAIN_EXTERNAL_DIR).
|
2010-12-13 17:27:39 +01:00
|
|
|
#
|
2012-06-22 07:42:39 +02:00
|
|
|
# 2. For all external toolchains, perform some checks on the
|
2010-12-13 17:27:39 +01:00
|
|
|
# conformity between the toolchain configuration described in the
|
|
|
|
# Buildroot menuconfig system, and the real configuration of the
|
|
|
|
# external toolchain. This is for example important to make sure that
|
|
|
|
# the Buildroot configuration system knows whether the toolchain
|
|
|
|
# supports RPC, IPv6, locales, large files, etc. Unfortunately, these
|
|
|
|
# things cannot be detected automatically, since the value of these
|
2012-11-03 18:47:49 +01:00
|
|
|
# options (such as BR2_TOOLCHAIN_HAS_NATIVE_RPC) are needed at
|
|
|
|
# configuration time because these options are used as dependencies
|
|
|
|
# for other options. And at configuration time, we are not able to
|
|
|
|
# retrieve the external toolchain configuration.
|
2009-07-17 00:20:33 +02:00
|
|
|
#
|
2012-06-22 07:42:39 +02:00
|
|
|
# 3. Copy the libraries needed at runtime to the target directory,
|
2009-07-17 00:20:33 +02:00
|
|
|
# $(TARGET_DIR). Obviously, things such as the C library, the dynamic
|
|
|
|
# loader and a few other utility libraries are needed if dynamic
|
|
|
|
# applications are to be executed on the target system.
|
|
|
|
#
|
2012-06-22 07:42:39 +02:00
|
|
|
# 4. Copy the libraries and headers to the staging directory. This
|
2009-07-17 00:20:33 +02:00
|
|
|
# will allow all further calls to gcc to be made using --sysroot
|
|
|
|
# $(STAGING_DIR), which greatly simplifies the compilation of the
|
|
|
|
# packages when using external toolchains. So in the end, only the
|
|
|
|
# cross-compiler binaries remains external, all libraries and headers
|
|
|
|
# are imported into the Buildroot tree.
|
2011-04-29 13:09:26 +02:00
|
|
|
#
|
2012-06-22 07:42:39 +02:00
|
|
|
# 5. Build a toolchain wrapper which executes the external toolchain
|
2011-04-29 13:09:26 +02:00
|
|
|
# with a number of arguments (sysroot/march/mtune/..) hardcoded,
|
|
|
|
# so we're sure the correct configuration is always used and the
|
|
|
|
# toolchain behaves similar to an internal toolchain.
|
|
|
|
# This toolchain wrapper and symlinks are installed into
|
|
|
|
# $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest
|
|
|
|
# of Buildroot is handled identical for the 2 toolchain types.
|
2009-07-17 00:20:33 +02:00
|
|
|
|
2010-07-05 18:59:03 +02:00
|
|
|
LIB_EXTERNAL_LIBS=ld*.so libc.so libcrypt.so libdl.so libgcc_s.so libm.so libnsl.so libresolv.so librt.so libutil.so
|
2011-10-02 21:20:10 +02:00
|
|
|
LIB_EXTERNAL_LIBS+=$(call qstrip,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS))
|
2010-07-08 22:08:46 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC),y)
|
2010-07-05 18:59:03 +02:00
|
|
|
LIB_EXTERNAL_LIBS+=libnss_files.so libnss_dns.so
|
2009-07-16 23:56:10 +02:00
|
|
|
endif
|
|
|
|
|
2009-07-17 00:26:23 +02:00
|
|
|
ifeq ($(BR2_INSTALL_LIBSTDCPP),y)
|
2010-07-05 18:59:03 +02:00
|
|
|
USR_LIB_EXTERNAL_LIBS+=libstdc++.so
|
2009-07-17 00:26:23 +02:00
|
|
|
endif
|
|
|
|
|
2010-12-13 17:27:44 +01:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_HAS_THREADS),y)
|
2010-07-05 18:59:03 +02:00
|
|
|
LIB_EXTERNAL_LIBS+=libpthread.so
|
2012-11-20 07:17:23 +01:00
|
|
|
ifneq ($(BR2_PACKAGE_GDB_SERVER)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY),)
|
2010-07-05 18:59:03 +02:00
|
|
|
LIB_EXTERNAL_LIBS+=libthread_db.so
|
2010-05-28 23:23:20 +02:00
|
|
|
endif # gdbserver
|
2010-05-28 23:23:14 +02:00
|
|
|
endif # ! no threads
|
|
|
|
|
2010-12-13 17:27:39 +01:00
|
|
|
# Details about sysroot directory selection.
|
|
|
|
#
|
|
|
|
# To find the sysroot directory:
|
|
|
|
#
|
|
|
|
# * We first try the -print-sysroot option, available in gcc 4.4.x
|
|
|
|
# and in some Codesourcery toolchains.
|
|
|
|
#
|
|
|
|
# * If this option is not available, we fallback to the value of
|
|
|
|
# --with-sysroot as visible in CROSS-gcc -v.
|
|
|
|
#
|
|
|
|
# When doing those tests, we don't pass any option to gcc that could
|
|
|
|
# select a multilib variant (such as -march) as we want the "main"
|
|
|
|
# sysroot, which contains all variants of the C library in the case of
|
|
|
|
# multilib toolchains. We use the TARGET_CC_NO_SYSROOT variable, which
|
|
|
|
# is the path of the cross-compiler, without the
|
|
|
|
# --sysroot=$(STAGING_DIR), since what we want to find is the location
|
|
|
|
# of the original toolchain sysroot. This "main" sysroot directory is
|
|
|
|
# stored in SYSROOT_DIR.
|
|
|
|
#
|
|
|
|
# Then, multilib toolchains are a little bit more complicated, since
|
|
|
|
# they in fact have multiple sysroots, one for each variant supported
|
|
|
|
# by the toolchain. So we need to find the particular sysroot we're
|
|
|
|
# interested in.
|
|
|
|
#
|
|
|
|
# To do so, we ask the compiler where its sysroot is by passing all
|
|
|
|
# flags (including -march and al.), except the --sysroot flag since we
|
|
|
|
# want to the compiler to tell us where its original sysroot
|
|
|
|
# is. ARCH_SUBDIR will contain the subdirectory, in the main
|
|
|
|
# SYSROOT_DIR, that corresponds to the selected architecture
|
|
|
|
# variant. ARCH_SYSROOT_DIR will contain the full path to this
|
|
|
|
# location.
|
|
|
|
#
|
|
|
|
# One might wonder why we don't just bother with ARCH_SYSROOT_DIR. The
|
|
|
|
# fact is that in multilib toolchains, the header files are often only
|
|
|
|
# present in the main sysroot, and only the libraries are available in
|
|
|
|
# each variant-specific sysroot directory.
|
|
|
|
|
2011-04-29 13:09:26 +02:00
|
|
|
|
|
|
|
TOOLCHAIN_EXTERNAL_PREFIX=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX))
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_DIR=$(HOST_DIR)/opt/ext-toolchain
|
|
|
|
else
|
|
|
|
TOOLCHAIN_EXTERNAL_DIR=$(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_PATH))
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(TOOLCHAIN_EXTERNAL_DIR),)
|
|
|
|
# if no path set, figure it out from path
|
|
|
|
TOOLCHAIN_EXTERNAL_BIN:=$(shell dirname $(shell which $(TOOLCHAIN_EXTERNAL_PREFIX)-gcc))
|
|
|
|
else
|
|
|
|
TOOLCHAIN_EXTERNAL_BIN:=$(TOOLCHAIN_EXTERNAL_DIR)/bin
|
|
|
|
endif
|
|
|
|
|
|
|
|
TOOLCHAIN_EXTERNAL_CROSS=$(TOOLCHAIN_EXTERNAL_BIN)/$(TOOLCHAIN_EXTERNAL_PREFIX)-
|
|
|
|
TOOLCHAIN_EXTERNAL_CC=$(TOOLCHAIN_EXTERNAL_CROSS)gcc
|
2011-05-08 18:52:27 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_CXX=$(TOOLCHAIN_EXTERNAL_CROSS)g++
|
2012-07-15 03:12:05 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS = -DBR_SYSROOT='"$(STAGING_SUBDIR)"'
|
|
|
|
|
|
|
|
ifeq ($(filter $(HOST_DIR)/%,$(TOOLCHAIN_EXTERNAL_BIN)),)
|
|
|
|
# TOOLCHAIN_EXTERNAL_BIN points outside HOST_DIR => absolute path
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += \
|
|
|
|
-DBR_CROSS_PATH_ABS='"$(TOOLCHAIN_EXTERNAL_BIN)"'
|
|
|
|
else
|
|
|
|
# TOOLCHAIN_EXTERNAL_BIN points inside HOST_DIR => relative path
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += \
|
|
|
|
-DBR_CROSS_PATH_REL='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"'
|
|
|
|
endif
|
2011-04-29 13:09:26 +02:00
|
|
|
|
2011-05-02 23:58:20 +02:00
|
|
|
CC_TARGET_TUNE_:=$(call qstrip,$(BR2_GCC_TARGET_TUNE))
|
2013-05-03 02:39:36 +02:00
|
|
|
ifeq ($(call qstrip,$(BR2_GCC_TARGET_CPU_REVISION)),)
|
2011-11-01 13:19:16 +01:00
|
|
|
CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU))
|
2013-05-03 02:39:36 +02:00
|
|
|
else
|
|
|
|
CC_TARGET_CPU_:=$(call qstrip,$(BR2_GCC_TARGET_CPU)-$(BR2_GCC_TARGET_CPU_REVISION))
|
|
|
|
endif
|
2011-05-02 23:58:20 +02:00
|
|
|
CC_TARGET_ARCH_:=$(call qstrip,$(BR2_GCC_TARGET_ARCH))
|
|
|
|
CC_TARGET_ABI_:=$(call qstrip,$(BR2_GCC_TARGET_ABI))
|
|
|
|
|
2011-04-29 13:09:26 +02:00
|
|
|
# march/mtune/floating point mode needs to be passed to the external toolchain
|
|
|
|
# to select the right multilib variant
|
2012-03-13 23:30:00 +01:00
|
|
|
ifeq ($(BR2_x86_64),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -m64
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_64
|
|
|
|
endif
|
2011-04-29 13:09:26 +02:00
|
|
|
ifneq ($(CC_TARGET_TUNE_),)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mtune=$(CC_TARGET_TUNE_)
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_TUNE='"$(CC_TARGET_TUNE_)"'
|
|
|
|
endif
|
|
|
|
ifneq ($(CC_TARGET_ARCH_),)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -march=$(CC_TARGET_ARCH_)
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ARCH='"$(CC_TARGET_ARCH_)"'
|
|
|
|
endif
|
2011-11-01 13:19:16 +01:00
|
|
|
ifneq ($(CC_TARGET_CPU_),)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mcpu=$(CC_TARGET_CPU_)
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_CPU='"$(CC_TARGET_CPU_)"'
|
|
|
|
endif
|
2011-04-29 13:09:26 +02:00
|
|
|
ifneq ($(CC_TARGET_ABI_),)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mabi=$(CC_TARGET_ABI_)
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ABI='"$(CC_TARGET_ABI_)"'
|
|
|
|
endif
|
2013-05-03 02:39:34 +02:00
|
|
|
ifeq ($(BR2_BINFMT_FLAT),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -Wl,-elf2flt
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_BINFMT_FLAT
|
|
|
|
endif
|
2011-04-29 13:09:26 +02:00
|
|
|
|
2011-12-31 12:09:33 +01:00
|
|
|
ifneq ($(BR2_TARGET_OPTIMIZATION),)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += $(call qstrip,$(BR2_TARGET_OPTIMIZATION))
|
|
|
|
# We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each
|
|
|
|
# flag is a separate argument when used in execv() by the external
|
|
|
|
# toolchain wrapper.
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_ADDITIONAL_CFLAGS='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)'
|
|
|
|
endif
|
|
|
|
|
2011-04-29 13:09:26 +02:00
|
|
|
ifeq ($(BR2_SOFT_FLOAT),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -msoft-float
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_SOFTFLOAT=1
|
|
|
|
endif
|
|
|
|
|
|
|
|
ifeq ($(BR2_VFP_FLOAT),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_CFLAGS += -mfpu=vfp
|
|
|
|
TOOLCHAIN_EXTERNAL_WRAPPER_ARGS += -DBR_VFPFLOAT=1
|
|
|
|
endif
|
2010-12-13 17:27:39 +01:00
|
|
|
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_DEPENDENCIES = $(TOOLCHAIN_EXTERNAL_DIR)/.extracted
|
|
|
|
endif
|
|
|
|
|
2013-05-26 14:08:20 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201109),y)
|
2011-12-31 12:18:23 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=arm-2011.09-70-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
|
2012-09-10 02:02:57 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201203),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=arm-2012.03-57-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
|
2013-05-26 14:08:19 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201305),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/arm-none-linux-gnueabi/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=arm-2013.05-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.tar.bz2
|
2013-02-02 13:42:03 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_2013_01),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://launchpad.net/linaro-toolchain-binaries/trunk/2013.01/+download/
|
2013-04-13 08:37:07 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=gcc-linaro-arm-linux-gnueabihf-4.7-2013.01-20130125_linux.tar.bz2
|
2013-04-07 10:00:59 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_2013_02),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://releases.linaro.org/13.02/components/toolchain/binaries/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=gcc-linaro-arm-linux-gnueabihf-4.7-2013.02-01-20130221_linux.tar.xz
|
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_2013_03),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://releases.linaro.org/13.03/components/toolchain/binaries/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=gcc-linaro-arm-linux-gnueabihf-4.7-2013.03-20130313_linux.tar.bz2
|
2012-12-20 14:23:20 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201203),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/mips-linux-gnu/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=mips-2012.03-63-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2012-12-20 14:23:21 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201209),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/mips-linux-gnu/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=mips-2012.09-99-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2013-06-08 11:14:14 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201305),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/mips-linux-gnu/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=mips-2013.05-36-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2010-12-13 17:27:39 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201009),y)
|
2012-12-20 14:23:24 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/powerpc-linux-gnu/
|
2010-12-13 17:27:39 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=freescale-2010.09-55-powerpc-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2011-12-31 12:28:34 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201103),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/powerpc-linux-gnu/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=freescale-2011.03-38-powerpc-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2011-10-02 21:20:13 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201103),y)
|
2012-12-20 14:23:24 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/
|
2011-10-02 21:20:13 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=renesas-2011.03-37-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2012-11-04 08:34:19 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201203),y)
|
2012-12-20 14:23:24 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/
|
2012-11-04 08:34:19 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=renesas-2012.03-35-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2012-11-04 08:34:21 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201209),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://sourcery.mentor.com/public/gnu_toolchain/sh-linux-gnu/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=renesas-2012.09-61-sh-linux-gnu-i686-pc-linux-gnu.tar.bz2
|
2011-05-06 16:23:04 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH2A_201009),y)
|
2012-12-20 14:23:24 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/sh-uclinux/
|
2011-05-06 16:23:04 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=renesas-2010.09-60-sh-uclinux-i686-pc-linux-gnu.tar.bz2
|
2011-10-02 21:20:11 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH2A_201103),y)
|
2012-12-20 14:23:24 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/sh-uclinux/
|
2011-10-02 21:20:11 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=renesas-2011.03-36-sh-uclinux-i686-pc-linux-gnu.tar.bz2
|
2011-12-31 12:34:33 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://sourcery.mentor.com/public/gnu_toolchain/i686-pc-linux-gnu/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=ia32-2011.09-24-i686-pc-linux-gnu-i386-linux.tar.bz2
|
2012-11-04 08:34:20 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201203),y)
|
2012-12-20 14:23:24 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sourcery.mentor.com/public/gnu_toolchain/i686-pc-linux-gnu/
|
2012-11-04 08:34:20 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=ia32-2012.03-27-i686-pc-linux-gnu-i386-linux.tar.bz2
|
2012-11-04 08:34:22 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201209),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://sourcery.mentor.com/public/gnu_toolchain/i686-pc-linux-gnu/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=ia32-2012.09-62-i686-pc-linux-gnu-i386-linux.tar.bz2
|
2012-06-03 16:04:39 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1),y)
|
2012-12-06 19:18:55 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE_1 = http://blackfin.uclinux.org/gf/download/frsrelease/559/9858/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE_1 = blackfin-toolchain-2012R1-RC2.i386.tar.bz2
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE_2 = http://blackfin.uclinux.org/gf/download/frsrelease/559/9866/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE_2 = blackfin-toolchain-uclibc-full-2012R1-RC2.i386.tar.bz2
|
2012-06-03 16:04:39 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE = $(TOOLCHAIN_EXTERNAL_SOURCE_1) $(TOOLCHAIN_EXTERNAL_SOURCE_2)
|
2013-02-01 04:04:50 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE_1 = http://blackfin.uclinux.org/gf/download/frsrelease/588/10139/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE_1 = blackfin-toolchain-2012R2-RC2.i386.tar.bz2
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE_2 = http://blackfin.uclinux.org/gf/download/frsrelease/588/10147/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE_2 = blackfin-toolchain-uclibc-full-2012R2-RC2.i386.tar.bz2
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE = $(TOOLCHAIN_EXTERNAL_SOURCE_1) $(TOOLCHAIN_EXTERNAL_SOURCE_2)
|
toolchain-external: add new Microblaze toolchains
The existing Microblaze toolchains that we have have the annoying
property of being based on a very old glibc version: 2.3.6. Xilinx
provides newer toolchains with glibc 2.14, generated by Crosstool-NG,
but they are only available as part of a huge Git repository that
contains the gcc, Linux, binutils, glibc sources unpacked (4.4 GB
total), which makes is very unpractical.
I contacted the Xilinx person who did those toolchains, but they
apparently didn't intend to change that anytime soon.
So, we have created a tarball for those toolchains, adding a
README.txt file in the tarball that points back to the original
location that contains the source code for them. Those tarballs are
hosted on sources.buildroot.net.
This commit then adds support for those two new external toolchains,
one for little endian Microblaze, another one for big endian
Microblaze.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-02-04 23:37:29 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_14_3),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sources.buildroot.net/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=lin32-microblazeel-unknown-linux-gnu_14.3_early.tar.xz
|
2012-03-16 14:42:55 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_V2),y)
|
2013-04-11 07:48:18 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sources.buildroot.net/
|
2012-03-16 14:42:55 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=microblazeel-unknown-linux-gnu.tgz
|
toolchain-external: add new Microblaze toolchains
The existing Microblaze toolchains that we have have the annoying
property of being based on a very old glibc version: 2.3.6. Xilinx
provides newer toolchains with glibc 2.14, generated by Crosstool-NG,
but they are only available as part of a huge Git repository that
contains the gcc, Linux, binutils, glibc sources unpacked (4.4 GB
total), which makes is very unpractical.
I contacted the Xilinx person who did those toolchains, but they
apparently didn't intend to change that anytime soon.
So, we have created a tarball for those toolchains, adding a
README.txt file in the tarball that points back to the original
location that contains the source code for them. Those tarballs are
hosted on sources.buildroot.net.
This commit then adds support for those two new external toolchains,
one for little endian Microblaze, another one for big endian
Microblaze.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
2013-02-04 23:37:29 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEBE_14_3),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sources.buildroot.net/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=lin32-microblaze-unknown-linux-gnu_14.3_early.tar.xz
|
2012-03-16 14:42:55 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEBE_V2),y)
|
2013-04-11 07:48:18 +02:00
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://sources.buildroot.net/
|
2012-03-16 14:42:55 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=microblaze-unknown-linux-gnu.tgz
|
2013-02-02 04:46:22 +01:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64_13_01),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=http://releases.linaro.org/13.01/components/toolchain/binaries/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=gcc-linaro-aarch64-linux-gnu-4.7-2013.01-20130125_linux.tar.xz
|
2013-04-07 10:01:00 +02:00
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64_13_02),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://releases.linaro.org/13.02/components/toolchain/binaries/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=gcc-linaro-aarch64-linux-gnu-4.7-2013.02-01-20130221_linux.tar.xz
|
|
|
|
else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64_13_03),y)
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=https://releases.linaro.org/13.03/components/toolchain/binaries/
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=gcc-linaro-aarch64-linux-gnu-4.7-2013.03-20130313_linux.tar.xz
|
2010-12-13 17:27:39 +01:00
|
|
|
else
|
2012-06-22 07:42:38 +02:00
|
|
|
# Custom toolchain
|
|
|
|
TOOLCHAIN_EXTERNAL_SITE=$(dir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))
|
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=$(notdir $(call qstrip,$(BR2_TOOLCHAIN_EXTERNAL_URL)))
|
|
|
|
|
2010-12-13 17:27:39 +01:00
|
|
|
# A value must be set (even if unused), otherwise the
|
|
|
|
# $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) rule would override the main
|
|
|
|
# $(DL_DIR) rule
|
2012-06-22 07:42:38 +02:00
|
|
|
ifeq (,$(TOOLCHAIN_EXTERNAL_SOURCE))
|
2010-12-13 17:27:39 +01:00
|
|
|
TOOLCHAIN_EXTERNAL_SOURCE=none
|
external-toolchain: Support for multilib toolchains
Multilib toolchains provide different versions of the base libraries
for different architecture variants. For example, the ARM Codesourcery
toolchain provides base libraries for ARMv5 (default), ARMv4t and
Thumb2.
Depending on the -march= argument passed to gcc, the sysroot used by
the compiler is therefore different. This means that the sysroot
location in CROSS-gcc -v cannot be used. Instead, we must use
CROSS-gcc -print-sysroot when available and fall back to the old way
if unavailable.
Moreover, we cannot simply copy the full sysroot as we used to do,
because the sysroot organization of multilib toolchain is more
complicated. In Codesourcery toolchains, we have :
/
etc -- for ARMv5
lib -- for ARMv5
sbin -- for ARMv5
usr -- for ARMv5 (includes headers)
armv4t
etc -- for ARMv4t
lib -- for ARMv4t
sbin -- for ARMv4t
usr -- for ARMv4t (no headers!)
thumb2
etc -- for Thumb2
lib -- for Thumb2
sbin -- for Thumb2
usr -- for Thumb2 (no headers!)
So we have the default ARMv5 architecture variant that is installed in
the main directory, and we have subdirectories for the ARMv4t and
Thumb2 architecture variants.
Copying the full sysroot to the staging directory doesn't work. All
our packages are based on the fact that they should install libraries
in staging/usr/lib. But if ARMv4t is used, the compiler would only
look in staging/armv4t/usr/lib for libraries (even when overriding the
sysroot with the --sysroot option, the multilib compiler suffixes the
sysroot directory with the architecture variant if it matches a
recognized one).
Therefore, we have to copy only the sysroot that we are interested
in. This is rendered a little bit complicated by the fact that the
armv4t and thumb2 sysroot do not contain the headers since they are
shared with the armv5 sysroot.
So, this patch :
* Modifies how we compute SYSROOT_DIR in order to use -print-sysroot
if it exists. SYSROOT_DIR contains the location of the main sysroot
directory, i.e the sysroot for the default architecture variant.
* Defines ARCH_SUBDIR as the subdirectory in the main sysroot for the
currently selected architecture variant (in our case, it can be
".", "armv4t" or "thumb2"). ARCH_SYSROOT_DIR is defined as the full
path to the sysroot of the currently selected architecture variant.
* Modifies copy_toolchain_lib_root (which copies a library to the
target/ directory) so that libraries are taken from
ARCH_SYSROOT_DIR instead of SYSROOT_DIR. This ensures that
libraries for the correct architecture variant are properly copied
to the target.
* Modifies copy_toolchain_sysroot (which copies the sysroot to the
staging/ directory), so that it copies the contents of
ARCH_SYSROOT_DIR, and if needed, adds the headers from the main
sysroot directory and a symbolic link (armv4t -> . or thumb2 -> .)
to make the compiler believe that its sysroot is really in armv4t/
or thumb2/.
Tested with Codesourcery 2009q1 ARM toolchain, Crosstool-NG ARM glibc
and ARM uClibc toolchains.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2009-08-22 01:13:22 +02:00
|
|
|
endif
|
2012-06-22 07:42:38 +02:00
|
|
|
endif
|
external-toolchain: Support for multilib toolchains
Multilib toolchains provide different versions of the base libraries
for different architecture variants. For example, the ARM Codesourcery
toolchain provides base libraries for ARMv5 (default), ARMv4t and
Thumb2.
Depending on the -march= argument passed to gcc, the sysroot used by
the compiler is therefore different. This means that the sysroot
location in CROSS-gcc -v cannot be used. Instead, we must use
CROSS-gcc -print-sysroot when available and fall back to the old way
if unavailable.
Moreover, we cannot simply copy the full sysroot as we used to do,
because the sysroot organization of multilib toolchain is more
complicated. In Codesourcery toolchains, we have :
/
etc -- for ARMv5
lib -- for ARMv5
sbin -- for ARMv5
usr -- for ARMv5 (includes headers)
armv4t
etc -- for ARMv4t
lib -- for ARMv4t
sbin -- for ARMv4t
usr -- for ARMv4t (no headers!)
thumb2
etc -- for Thumb2
lib -- for Thumb2
sbin -- for Thumb2
usr -- for Thumb2 (no headers!)
So we have the default ARMv5 architecture variant that is installed in
the main directory, and we have subdirectories for the ARMv4t and
Thumb2 architecture variants.
Copying the full sysroot to the staging directory doesn't work. All
our packages are based on the fact that they should install libraries
in staging/usr/lib. But if ARMv4t is used, the compiler would only
look in staging/armv4t/usr/lib for libraries (even when overriding the
sysroot with the --sysroot option, the multilib compiler suffixes the
sysroot directory with the architecture variant if it matches a
recognized one).
Therefore, we have to copy only the sysroot that we are interested
in. This is rendered a little bit complicated by the fact that the
armv4t and thumb2 sysroot do not contain the headers since they are
shared with the armv5 sysroot.
So, this patch :
* Modifies how we compute SYSROOT_DIR in order to use -print-sysroot
if it exists. SYSROOT_DIR contains the location of the main sysroot
directory, i.e the sysroot for the default architecture variant.
* Defines ARCH_SUBDIR as the subdirectory in the main sysroot for the
currently selected architecture variant (in our case, it can be
".", "armv4t" or "thumb2"). ARCH_SYSROOT_DIR is defined as the full
path to the sysroot of the currently selected architecture variant.
* Modifies copy_toolchain_lib_root (which copies a library to the
target/ directory) so that libraries are taken from
ARCH_SYSROOT_DIR instead of SYSROOT_DIR. This ensures that
libraries for the correct architecture variant are properly copied
to the target.
* Modifies copy_toolchain_sysroot (which copies the sysroot to the
staging/ directory), so that it copies the contents of
ARCH_SYSROOT_DIR, and if needed, adds the headers from the main
sysroot directory and a symbolic link (armv4t -> . or thumb2 -> .)
to make the compiler believe that its sysroot is really in armv4t/
or thumb2/.
Tested with Codesourcery 2009q1 ARM toolchain, Crosstool-NG ARM glibc
and ARM uClibc toolchains.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2009-08-22 01:13:22 +02:00
|
|
|
|
2011-05-30 23:56:56 +02:00
|
|
|
# Special handling for Blackfin toolchain, because of the split in two
|
|
|
|
# tarballs, and the organization of tarball contents. The tarballs
|
|
|
|
# contain ./opt/uClinux/{bfin-uclinux,bfin-linux-uclibc} directories,
|
|
|
|
# which themselves contain the toolchain. This is why we strip more
|
|
|
|
# components than usual.
|
2013-05-26 14:08:15 +02:00
|
|
|
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R1)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2),y)
|
2011-05-30 23:56:56 +02:00
|
|
|
$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1):
|
2013-04-12 11:40:30 +02:00
|
|
|
$(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_1:/=:/=)/$(TOOLCHAIN_EXTERNAL_SOURCE_1))
|
2011-05-30 23:56:56 +02:00
|
|
|
|
|
|
|
$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2):
|
2013-04-12 11:40:30 +02:00
|
|
|
$(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE_2:/=:/=)/$(TOOLCHAIN_EXTERNAL_SOURCE_2))
|
2011-05-30 23:56:56 +02:00
|
|
|
|
|
|
|
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2)
|
|
|
|
mkdir -p $(@D)
|
|
|
|
$(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_1))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_1) | \
|
|
|
|
$(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
|
|
|
|
$(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE_2))) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE_2) | \
|
|
|
|
$(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(@D) $(TAR_OPTIONS) -
|
|
|
|
ifeq ($(TOOLCHAIN_EXTERNAL_PREFIX),bfin-uclinux)
|
|
|
|
rm -rf $(TOOLCHAIN_EXTERNAL_DIR)/bfin-linux-uclibc
|
|
|
|
mv $(TOOLCHAIN_EXTERNAL_DIR)/bfin-uclinux $(TOOLCHAIN_EXTERNAL_DIR)/tmp
|
|
|
|
mv $(TOOLCHAIN_EXTERNAL_DIR)/tmp/* $(TOOLCHAIN_EXTERNAL_DIR)/
|
|
|
|
rmdir $(TOOLCHAIN_EXTERNAL_DIR)/tmp
|
|
|
|
else
|
|
|
|
rm -rf $(TOOLCHAIN_EXTERNAL_DIR)/bfin-uclinux
|
|
|
|
mv $(TOOLCHAIN_EXTERNAL_DIR)/bfin-linux-uclibc $(TOOLCHAIN_EXTERNAL_DIR)/tmp
|
|
|
|
mv $(TOOLCHAIN_EXTERNAL_DIR)/tmp/* $(TOOLCHAIN_EXTERNAL_DIR)/
|
|
|
|
rmdir $(TOOLCHAIN_EXTERNAL_DIR)/tmp
|
|
|
|
endif
|
|
|
|
$(Q)touch $@
|
|
|
|
else
|
2010-12-13 17:27:39 +01:00
|
|
|
# Download and extraction of a toolchain
|
|
|
|
$(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE):
|
2012-03-16 14:42:53 +01:00
|
|
|
$(call DOWNLOAD,$(TOOLCHAIN_EXTERNAL_SITE)$(TOOLCHAIN_EXTERNAL_SOURCE),$(TOOLCHAIN_EXTERNAL_SOURCE))
|
2010-12-13 17:27:39 +01:00
|
|
|
|
|
|
|
$(TOOLCHAIN_EXTERNAL_DIR)/.extracted: $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE)
|
|
|
|
mkdir -p $(@D)
|
2011-10-09 19:44:31 +02:00
|
|
|
$(INFLATE$(suffix $(TOOLCHAIN_EXTERNAL_SOURCE))) $^ | \
|
|
|
|
$(TAR) $(TAR_STRIP_COMPONENTS)=1 --exclude='usr/lib/locale/*' -C $(@D) $(TAR_OPTIONS) -
|
2010-12-23 10:31:08 +01:00
|
|
|
$(Q)touch $@
|
2011-05-30 23:56:56 +02:00
|
|
|
endif
|
2009-07-16 23:56:10 +02:00
|
|
|
|
2010-12-13 17:27:39 +01:00
|
|
|
# Checks for an already installed toolchain: check the toolchain
|
|
|
|
# location, check that it supports sysroot, and then verify that it
|
|
|
|
# matches the configuration provided in Buildroot: ABI, C++ support,
|
|
|
|
# type of C library and all C library features.
|
2011-12-31 16:13:58 +01:00
|
|
|
$(STAMP_DIR)/ext-toolchain-checked: $(TOOLCHAIN_EXTERNAL_DEPENDENCIES)
|
2013-01-20 07:03:45 +01:00
|
|
|
@$(call MESSAGE,"Checking external toolchain settings")
|
2011-05-08 18:52:27 +02:00
|
|
|
$(Q)$(call check_cross_compiler_exists,$(TOOLCHAIN_EXTERNAL_CC))
|
Improve external toolchain logic to support IA32 Sourcery CodeBench toolchain
The IA32 Sourcery CodeBench toolchain has a relatively special
structure, with the following multilib variants:
* Intel Pentium 4, 32 bits, the multilib variant is in ./ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Xeon Nocona, 64 bits, the multilib variant is in ./ relative
to the main sysroot, with the libraries in the lib64/ directory.
* Intel Atom 32 bits, the multilib variant is in atom/ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Core 2 64 bits, the multilib variant is in core2/ relative to
the main sysroot, with the libraries in lib64/ directory.
So the first two variants are in the same sysroot, only the name of
the directory for the libraries is different.
Therefore, we introduce a new ARCH_LIB_DIR variable, which contains
either 'lib' or 'lib64'. This variable is defined according to the
location of the libc.a file for the selected multilib variant, and is
then used when copying the libraries to the target and to the staging
directory.
In addition to this, we no longer use the -print-multi-directory to
get the ARCH_SUBDIR, since in the case of the 64 bits variants of this
toolchain, it returns just '64' and not a real path. Instead, we
simply compute the difference between the arch-specific sysroot and
the main sysroot.
We also take that opportunity to expand the documentation on the
meaning of the different variables.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2011-12-31 11:57:15 +01:00
|
|
|
$(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
|
2012-01-28 17:12:02 +01:00
|
|
|
SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:usr/lib(64)?/(.*/)?libc\.a::'` ; \
|
2010-12-13 17:27:39 +01:00
|
|
|
if test -z "$${SYSROOT_DIR}" ; then \
|
|
|
|
@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
|
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
|
|
|
if test x$(BR2_arm) == x"y" ; then \
|
2011-05-08 18:52:27 +02:00
|
|
|
$(call check_arm_abi,$(TOOLCHAIN_EXTERNAL_CC)) ; \
|
2010-12-13 17:27:39 +01:00
|
|
|
fi ; \
|
|
|
|
if test x$(BR2_INSTALL_LIBSTDCPP) == x"y" ; then \
|
2011-05-08 18:52:27 +02:00
|
|
|
$(call check_cplusplus,$(TOOLCHAIN_EXTERNAL_CXX)) ; \
|
2010-12-13 17:27:39 +01:00
|
|
|
fi ; \
|
|
|
|
if test x$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC) == x"y" ; then \
|
|
|
|
$(call check_uclibc,$${SYSROOT_DIR}) ; \
|
|
|
|
else \
|
|
|
|
$(call check_glibc,$${SYSROOT_DIR}) ; \
|
2010-07-05 18:58:58 +02:00
|
|
|
fi
|
2010-12-23 10:31:08 +01:00
|
|
|
$(Q)touch $@
|
2010-12-13 17:27:39 +01:00
|
|
|
|
|
|
|
# Integration of the toolchain into Buildroot: find the main sysroot
|
|
|
|
# and the variant-specific sysroot, then copy the needed libraries to
|
|
|
|
# the $(TARGET_DIR) and copy the whole sysroot (libraries and headers)
|
|
|
|
# to $(STAGING_DIR).
|
Improve external toolchain logic to support IA32 Sourcery CodeBench toolchain
The IA32 Sourcery CodeBench toolchain has a relatively special
structure, with the following multilib variants:
* Intel Pentium 4, 32 bits, the multilib variant is in ./ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Xeon Nocona, 64 bits, the multilib variant is in ./ relative
to the main sysroot, with the libraries in the lib64/ directory.
* Intel Atom 32 bits, the multilib variant is in atom/ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Core 2 64 bits, the multilib variant is in core2/ relative to
the main sysroot, with the libraries in lib64/ directory.
So the first two variants are in the same sysroot, only the name of
the directory for the libraries is different.
Therefore, we introduce a new ARCH_LIB_DIR variable, which contains
either 'lib' or 'lib64'. This variable is defined according to the
location of the libc.a file for the selected multilib variant, and is
then used when copying the libraries to the target and to the staging
directory.
In addition to this, we no longer use the -print-multi-directory to
get the ARCH_SUBDIR, since in the case of the 64 bits variants of this
toolchain, it returns just '64' and not a real path. Instead, we
simply compute the difference between the arch-specific sysroot and
the main sysroot.
We also take that opportunity to expand the documentation on the
meaning of the different variables.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2011-12-31 11:57:15 +01:00
|
|
|
#
|
|
|
|
# Variables are defined as follows:
|
|
|
|
#
|
|
|
|
# LIBC_A_LOCATION: location of the libc.a file in the default
|
|
|
|
# multilib variant (allows to find the main
|
|
|
|
# sysroot directory)
|
|
|
|
# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/usr/lib/libc.a
|
|
|
|
#
|
|
|
|
# SYSROOT_DIR: the main sysroot directory, deduced from
|
|
|
|
# LIBC_A_LOCATION by removing the
|
|
|
|
# usr/lib[64]/libc.a part of the path.
|
|
|
|
# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/
|
|
|
|
#
|
|
|
|
# ARCH_LIBC_A_LOCATION: location of the libc.a file in the selected
|
|
|
|
# multilib variant (taking into account the
|
|
|
|
# CFLAGS). Allows to find the sysroot of the
|
|
|
|
# selected multilib variant.
|
|
|
|
# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/usr/lib/libc.a
|
|
|
|
#
|
|
|
|
# ARCH_SYSROOT_DIR: the sysroot of the selected multilib variant,
|
|
|
|
# deduced from ARCH_LIBC_A_LOCATION by removing
|
|
|
|
# usr/lib[64]/libc.a at the end of the path.
|
|
|
|
# Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/
|
|
|
|
#
|
|
|
|
# ARCH_LIB_DIR: 'lib' or 'lib64' depending on where libraries are
|
|
|
|
# stored. Deduced from ARCH_LIBC_A_LOCATION by
|
|
|
|
# looking at usr/lib??/libc.a.
|
|
|
|
# Ex: lib
|
|
|
|
#
|
|
|
|
# ARCH_SUBDIR: the relative location of the sysroot of the selected
|
|
|
|
# multilib variant compared to the main sysroot.
|
|
|
|
# Ex: mips16/soft-float/el
|
2012-05-07 15:02:19 +02:00
|
|
|
#
|
|
|
|
# SUPPORT_LIB_DIR: some toolchains, such as recent Linaro toolchains,
|
|
|
|
# store GCC support libraries (libstdc++,
|
|
|
|
# libgcc_s, etc.) outside of the sysroot. In
|
|
|
|
# this case, SUPPORT_LIB_DIR is set to a
|
|
|
|
# non-empty value, and points to the directory
|
|
|
|
# where these support libraries are
|
|
|
|
# available. Those libraries will be copied to
|
|
|
|
# our sysroot, and the directory will also be
|
|
|
|
# considered when searching libraries for copy
|
|
|
|
# to the target filesystem.
|
Improve external toolchain logic to support IA32 Sourcery CodeBench toolchain
The IA32 Sourcery CodeBench toolchain has a relatively special
structure, with the following multilib variants:
* Intel Pentium 4, 32 bits, the multilib variant is in ./ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Xeon Nocona, 64 bits, the multilib variant is in ./ relative
to the main sysroot, with the libraries in the lib64/ directory.
* Intel Atom 32 bits, the multilib variant is in atom/ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Core 2 64 bits, the multilib variant is in core2/ relative to
the main sysroot, with the libraries in lib64/ directory.
So the first two variants are in the same sysroot, only the name of
the directory for the libraries is different.
Therefore, we introduce a new ARCH_LIB_DIR variable, which contains
either 'lib' or 'lib64'. This variable is defined according to the
location of the libc.a file for the selected multilib variant, and is
then used when copying the libraries to the target and to the staging
directory.
In addition to this, we no longer use the -print-multi-directory to
get the ARCH_SUBDIR, since in the case of the 64 bits variants of this
toolchain, it returns just '64' and not a real path. Instead, we
simply compute the difference between the arch-specific sysroot and
the main sysroot.
We also take that opportunity to expand the documentation on the
meaning of the different variables.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2011-12-31 11:57:15 +01:00
|
|
|
|
2011-12-31 16:13:58 +01:00
|
|
|
$(STAMP_DIR)/ext-toolchain-installed: $(STAMP_DIR)/ext-toolchain-checked
|
Improve external toolchain logic to support IA32 Sourcery CodeBench toolchain
The IA32 Sourcery CodeBench toolchain has a relatively special
structure, with the following multilib variants:
* Intel Pentium 4, 32 bits, the multilib variant is in ./ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Xeon Nocona, 64 bits, the multilib variant is in ./ relative
to the main sysroot, with the libraries in the lib64/ directory.
* Intel Atom 32 bits, the multilib variant is in atom/ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Core 2 64 bits, the multilib variant is in core2/ relative to
the main sysroot, with the libraries in lib64/ directory.
So the first two variants are in the same sysroot, only the name of
the directory for the libraries is different.
Therefore, we introduce a new ARCH_LIB_DIR variable, which contains
either 'lib' or 'lib64'. This variable is defined according to the
location of the libc.a file for the selected multilib variant, and is
then used when copying the libraries to the target and to the staging
directory.
In addition to this, we no longer use the -print-multi-directory to
get the ARCH_SUBDIR, since in the case of the 64 bits variants of this
toolchain, it returns just '64' and not a real path. Instead, we
simply compute the difference between the arch-specific sysroot and
the main sysroot.
We also take that opportunity to expand the documentation on the
meaning of the different variables.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2011-12-31 11:57:15 +01:00
|
|
|
$(Q)LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) -print-file-name=libc.a)` ; \
|
2012-01-28 17:12:02 +01:00
|
|
|
SYSROOT_DIR=`echo $${LIBC_A_LOCATION} | sed -r -e 's:usr/lib(64)?/(.*/)?libc\.a::'` ; \
|
2010-12-13 17:27:39 +01:00
|
|
|
if test -z "$${SYSROOT_DIR}" ; then \
|
|
|
|
@echo "External toolchain doesn't support --sysroot. Cannot use." ; \
|
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
Improve external toolchain logic to support IA32 Sourcery CodeBench toolchain
The IA32 Sourcery CodeBench toolchain has a relatively special
structure, with the following multilib variants:
* Intel Pentium 4, 32 bits, the multilib variant is in ./ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Xeon Nocona, 64 bits, the multilib variant is in ./ relative
to the main sysroot, with the libraries in the lib64/ directory.
* Intel Atom 32 bits, the multilib variant is in atom/ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Core 2 64 bits, the multilib variant is in core2/ relative to
the main sysroot, with the libraries in lib64/ directory.
So the first two variants are in the same sysroot, only the name of
the directory for the libraries is different.
Therefore, we introduce a new ARCH_LIB_DIR variable, which contains
either 'lib' or 'lib64'. This variable is defined according to the
location of the libc.a file for the selected multilib variant, and is
then used when copying the libraries to the target and to the staging
directory.
In addition to this, we no longer use the -print-multi-directory to
get the ARCH_SUBDIR, since in the case of the 64 bits variants of this
toolchain, it returns just '64' and not a real path. Instead, we
simply compute the difference between the arch-specific sysroot and
the main sysroot.
We also take that opportunity to expand the documentation on the
meaning of the different variables.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2011-12-31 11:57:15 +01:00
|
|
|
ARCH_LIBC_A_LOCATION=`readlink -f $$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libc.a)` ; \
|
2012-01-28 17:12:02 +01:00
|
|
|
ARCH_SYSROOT_DIR=`echo $${ARCH_LIBC_A_LOCATION} | sed -r -e 's:usr/lib(64)?/(.*/)?libc\.a::'` ; \
|
|
|
|
ARCH_LIB_DIR=`echo $${ARCH_LIBC_A_LOCATION} | sed -r -e 's:.*/usr/(lib(64)?)/(.*/)?libc.a:\1:'` ; \
|
2012-05-15 22:44:17 +02:00
|
|
|
SUPPORT_LIB_DIR="" ; \
|
2012-05-07 15:02:19 +02:00
|
|
|
if test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq 0 ; then \
|
2012-05-15 22:44:17 +02:00
|
|
|
LIBSTDCPP_A_LOCATION=$$(LANG=C $(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS) -print-file-name=libstdc++.a) ; \
|
|
|
|
if [ -e "$${LIBSTDCPP_A_LOCATION}" ]; then \
|
|
|
|
SUPPORT_LIB_DIR=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
|
|
|
|
fi ; \
|
2012-05-07 15:02:19 +02:00
|
|
|
fi ; \
|
Improve external toolchain logic to support IA32 Sourcery CodeBench toolchain
The IA32 Sourcery CodeBench toolchain has a relatively special
structure, with the following multilib variants:
* Intel Pentium 4, 32 bits, the multilib variant is in ./ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Xeon Nocona, 64 bits, the multilib variant is in ./ relative
to the main sysroot, with the libraries in the lib64/ directory.
* Intel Atom 32 bits, the multilib variant is in atom/ relative to
the main sysroot, with the libraries in the lib/ directory.
* Intel Core 2 64 bits, the multilib variant is in core2/ relative to
the main sysroot, with the libraries in lib64/ directory.
So the first two variants are in the same sysroot, only the name of
the directory for the libraries is different.
Therefore, we introduce a new ARCH_LIB_DIR variable, which contains
either 'lib' or 'lib64'. This variable is defined according to the
location of the libc.a file for the selected multilib variant, and is
then used when copying the libraries to the target and to the staging
directory.
In addition to this, we no longer use the -print-multi-directory to
get the ARCH_SUBDIR, since in the case of the 64 bits variants of this
toolchain, it returns just '64' and not a real path. Instead, we
simply compute the difference between the arch-specific sysroot and
the main sysroot.
We also take that opportunity to expand the documentation on the
meaning of the different variables.
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2011-12-31 11:57:15 +01:00
|
|
|
ARCH_SUBDIR=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
|
2010-12-13 17:27:39 +01:00
|
|
|
mkdir -p $(TARGET_DIR)/lib ; \
|
2012-04-23 13:45:08 +02:00
|
|
|
if test -z "$(BR2_PREFER_STATIC_LIB)" ; then \
|
2013-01-20 07:03:45 +01:00
|
|
|
$(call MESSAGE,"Copying external toolchain libraries to target...") ; \
|
2012-04-23 13:45:08 +02:00
|
|
|
for libs in $(LIB_EXTERNAL_LIBS); do \
|
2012-05-07 15:02:19 +02:00
|
|
|
$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/lib); \
|
2012-04-23 13:45:08 +02:00
|
|
|
done ; \
|
|
|
|
for libs in $(USR_LIB_EXTERNAL_LIBS); do \
|
2012-05-07 15:02:19 +02:00
|
|
|
$(call copy_toolchain_lib_root,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr/lib); \
|
2012-04-23 13:45:08 +02:00
|
|
|
done ; \
|
|
|
|
fi ; \
|
2013-01-20 07:03:45 +01:00
|
|
|
$(call MESSAGE,"Copying external toolchain sysroot to staging...") ; \
|
2012-05-07 15:02:19 +02:00
|
|
|
$(call copy_toolchain_sysroot,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) ; \
|
2013-05-11 06:49:34 +02:00
|
|
|
if [ -L $${ARCH_SYSROOT_DIR}/lib64 -o -d $${ARCH_SYSROOT_DIR}/lib64 ] ; then \
|
2010-12-13 17:27:39 +01:00
|
|
|
$(call create_lib64_symlinks) ; \
|
|
|
|
fi ; \
|
2012-03-14 23:49:57 +01:00
|
|
|
if test x"$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" == x"y"; then \
|
2013-01-20 07:03:45 +01:00
|
|
|
$(call MESSAGE,"Copying gdbserver") ; \
|
2012-03-14 23:49:57 +01:00
|
|
|
gdbserver_found=0 ; \
|
2013-04-07 02:04:36 +02:00
|
|
|
for d in $${ARCH_SYSROOT_DIR}/usr $${ARCH_SYSROOT_DIR}/../debug-root/usr $${ARCH_SYSROOT_DIR}/usr/$${ARCH_LIB_DIR} ; do \
|
|
|
|
if test -f $${d}/bin/gdbserver ; then \
|
|
|
|
install -m 0755 -D $${d}/bin/gdbserver $(TARGET_DIR)/usr/bin/gdbserver ; \
|
2012-03-14 23:49:57 +01:00
|
|
|
gdbserver_found=1 ; \
|
|
|
|
break ; \
|
|
|
|
fi ; \
|
|
|
|
done ; \
|
|
|
|
if [ $${gdbserver_found} -eq 0 ] ; then \
|
|
|
|
echo "Could not find gdbserver in external toolchain" ; \
|
|
|
|
exit 1 ; \
|
|
|
|
fi ; \
|
|
|
|
fi ; \
|
2010-12-23 11:42:49 +01:00
|
|
|
touch $@
|
2011-04-29 13:09:26 +02:00
|
|
|
|
|
|
|
# Build toolchain wrapper for preprocessor, C and C++ compiler, and setup
|
|
|
|
# symlinks for everything else
|
|
|
|
$(HOST_DIR)/usr/bin/ext-toolchain-wrapper: $(STAMP_DIR)/ext-toolchain-installed
|
2013-01-20 07:03:45 +01:00
|
|
|
$(Q)$(call MESSAGE,"Building ext-toolchain wrapper")
|
2011-04-29 13:09:26 +02:00
|
|
|
mkdir -p $(HOST_DIR)/usr/bin; cd $(HOST_DIR)/usr/bin; \
|
|
|
|
for i in $(TOOLCHAIN_EXTERNAL_CROSS)*; do \
|
2011-11-01 01:53:38 +01:00
|
|
|
base=$${i##*/}; \
|
|
|
|
case "$$base" in \
|
2011-04-29 13:09:26 +02:00
|
|
|
*cc|*cc-*|*++|*++-*|*cpp) \
|
|
|
|
ln -sf $(@F) $$base; \
|
|
|
|
;; \
|
|
|
|
*) \
|
2012-07-15 03:12:05 +02:00
|
|
|
ln -sf $$(echo $$i | sed 's%^$(HOST_DIR)%../..%') .; \
|
2011-04-29 13:09:26 +02:00
|
|
|
;; \
|
|
|
|
esac; \
|
|
|
|
done ;
|
|
|
|
$(HOSTCC) $(HOST_CFLAGS) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS) -s \
|
|
|
|
toolchain/toolchain-external/ext-toolchain-wrapper.c -o $@
|
2011-07-13 08:49:52 +02:00
|
|
|
|
|
|
|
# 'uclibc' is the target to provide toolchain / staging dir
|
|
|
|
uclibc: dependencies $(HOST_DIR)/usr/bin/ext-toolchain-wrapper
|
|
|
|
|
|
|
|
ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD),y)
|
|
|
|
# download ext toolchain if so configured
|
|
|
|
uclibc-source: $(addprefix $(DL_DIR)/,$(TOOLCHAIN_EXTERNAL_SOURCE))
|
|
|
|
endif
|