1 ################################################################################
5 ################################################################################
8 # This package implements the support for external toolchains, i.e
9 # toolchains that have not been produced by Buildroot itself and that
10 # Buildroot can download from the Web or that are already available on
11 # the system on which Buildroot runs. So far, we have tested this
14 # * Toolchains generated by Crosstool-NG
15 # * Toolchains generated by Buildroot
16 # * Toolchains provided by Linaro for the ARM and AArch64
18 # * Sourcery CodeBench toolchains (from Mentor Graphics) for the ARM,
19 # MIPS, PowerPC, x86, x86_64 and NIOS 2 architectures. For the MIPS
20 # toolchain, the -muclibc variant isn't supported yet, only the
21 # default glibc-based variant is.
22 # * Analog Devices toolchains for the Blackfin architecture
23 # * Xilinx toolchains for the Microblaze architecture
25 # The basic principle is the following
27 # 1. If the toolchain is not pre-installed, download and extract it
28 # in $(TOOLCHAIN_EXTERNAL_INSTALL_DIR). Otherwise,
29 # $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) points to were the toolchain has
30 # already been installed by the user.
32 # 2. For all external toolchains, perform some checks on the
33 # conformity between the toolchain configuration described in the
34 # Buildroot menuconfig system, and the real configuration of the
35 # external toolchain. This is for example important to make sure that
36 # the Buildroot configuration system knows whether the toolchain
37 # supports RPC, IPv6, locales, large files, etc. Unfortunately, these
38 # things cannot be detected automatically, since the value of these
39 # options (such as BR2_TOOLCHAIN_HAS_NATIVE_RPC) are needed at
40 # configuration time because these options are used as dependencies
41 # for other options. And at configuration time, we are not able to
42 # retrieve the external toolchain configuration.
44 # 3. Copy the libraries needed at runtime to the target directory,
45 # $(TARGET_DIR). Obviously, things such as the C library, the dynamic
46 # loader and a few other utility libraries are needed if dynamic
47 # applications are to be executed on the target system.
49 # 4. Copy the libraries and headers to the staging directory. This
50 # will allow all further calls to gcc to be made using --sysroot
51 # $(STAGING_DIR), which greatly simplifies the compilation of the
52 # packages when using external toolchains. So in the end, only the
53 # cross-compiler binaries remains external, all libraries and headers
54 # are imported into the Buildroot tree.
56 # 5. Build a toolchain wrapper which executes the external toolchain
57 # with a number of arguments (sysroot/march/mtune/..) hardcoded,
58 # so we're sure the correct configuration is always used and the
59 # toolchain behaves similar to an internal toolchain.
60 # This toolchain wrapper and symlinks are installed into
61 # $(HOST_DIR)/usr/bin like for the internal toolchains, and the rest
62 # of Buildroot is handled identical for the 2 toolchain types.
64 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC
)$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC
),y
)
65 LIB_EXTERNAL_LIBS
+= libc.so.
* libcrypt.so.
* libdl.so.
* libgcc_s.so.
* libm.so.
* libnsl.so.
* libresolv.so.
* librt.so.
* libutil.so.
*
66 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC
)$(BR2_ARM_EABIHF
),yy
)
67 LIB_EXTERNAL_LIBS
+= ld-linux-armhf.so.
*
69 LIB_EXTERNAL_LIBS
+= ld*.so.
*
71 ifeq ($(BR2_TOOLCHAIN_HAS_THREADS
),y
)
72 LIB_EXTERNAL_LIBS
+= libpthread.so.
*
73 ifneq ($(BR2_PACKAGE_GDB
)$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY
),)
74 LIB_EXTERNAL_LIBS
+= libthread_db.so.
*
79 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_GLIBC
),y
)
80 LIB_EXTERNAL_LIBS
+= libnss_files.so.
* libnss_dns.so.
*
83 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL
),y
)
84 LIB_EXTERNAL_LIBS
+= libc.so libgcc_s.so.
*
87 ifeq ($(BR2_INSTALL_LIBSTDCPP
),y
)
88 USR_LIB_EXTERNAL_LIBS
+= libstdc
++.so.
*
91 LIB_EXTERNAL_LIBS
+= $(call qstrip
,$(BR2_TOOLCHAIN_EXTRA_EXTERNAL_LIBS
))
93 # Details about sysroot directory selection.
95 # To find the sysroot directory, we use the trick of looking for the
96 # 'libc.a' file with the -print-file-name gcc option, and then
97 # mangling the path to find the base directory of the sysroot.
99 # Note that we do not use the -print-sysroot option, because it is
100 # only available since gcc 4.4.x, and we still support 4.2.x (for
103 # When doing this, we don't pass any option to gcc that could select a
104 # multilib variant (such as -march) as we want the "main" sysroot,
105 # which contains all variants of the C library in the case of multilib
106 # toolchains. We use the TARGET_CC_NO_SYSROOT variable, which is the
107 # path of the cross-compiler, without the --sysroot=$(STAGING_DIR),
108 # since what we want to find is the location of the original toolchain
109 # sysroot. This "main" sysroot directory is stored in SYSROOT_DIR.
111 # Then, multilib toolchains are a little bit more complicated, since
112 # they in fact have multiple sysroots, one for each variant supported
113 # by the toolchain. So we need to find the particular sysroot we're
116 # To do so, we ask the compiler where its sysroot is by passing all
117 # flags (including -march and al.), except the --sysroot flag since we
118 # want to the compiler to tell us where its original sysroot
119 # is. ARCH_SUBDIR will contain the subdirectory, in the main
120 # SYSROOT_DIR, that corresponds to the selected architecture
121 # variant. ARCH_SYSROOT_DIR will contain the full path to this
124 # One might wonder why we don't just bother with ARCH_SYSROOT_DIR. The
125 # fact is that in multilib toolchains, the header files are often only
126 # present in the main sysroot, and only the libraries are available in
127 # each variant-specific sysroot directory.
130 TOOLCHAIN_EXTERNAL_PREFIX
= $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_PREFIX
))
131 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD
),y
)
132 TOOLCHAIN_EXTERNAL_INSTALL_DIR
= $(HOST_DIR
)/opt
/ext-toolchain
134 TOOLCHAIN_EXTERNAL_INSTALL_DIR
= $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_PATH
))
137 ifeq ($(TOOLCHAIN_EXTERNAL_INSTALL_DIR
),)
138 ifneq ($(TOOLCHAIN_EXTERNAL_PREFIX
),)
139 # if no path set, figure it out from path
140 TOOLCHAIN_EXTERNAL_BIN
:= $(shell dirname
$(shell which
$(TOOLCHAIN_EXTERNAL_PREFIX
)-gcc
))
144 TOOLCHAIN_EXTERNAL_BIN
:= $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/$(TOOLCHAIN_EXTERNAL_PREFIX
)/bin
146 TOOLCHAIN_EXTERNAL_BIN
:= $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/bin
150 TOOLCHAIN_EXTERNAL_CROSS
= $(TOOLCHAIN_EXTERNAL_BIN
)/$(TOOLCHAIN_EXTERNAL_PREFIX
)-
151 TOOLCHAIN_EXTERNAL_CC
= $(TOOLCHAIN_EXTERNAL_CROSS
)gcc
152 TOOLCHAIN_EXTERNAL_CXX
= $(TOOLCHAIN_EXTERNAL_CROSS
)g
++
153 TOOLCHAIN_EXTERNAL_READELF
= $(TOOLCHAIN_EXTERNAL_CROSS
)readelf
154 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
= -DBR_SYSROOT
='"$(STAGING_SUBDIR)"'
156 ifeq ($(filter $(HOST_DIR
)/%,$(TOOLCHAIN_EXTERNAL_BIN
)),)
157 # TOOLCHAIN_EXTERNAL_BIN points outside HOST_DIR => absolute path
158 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= \
159 -DBR_CROSS_PATH_ABS
='"$(TOOLCHAIN_EXTERNAL_BIN)"'
161 # TOOLCHAIN_EXTERNAL_BIN points inside HOST_DIR => relative path
162 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= \
163 -DBR_CROSS_PATH_REL
='"$(TOOLCHAIN_EXTERNAL_BIN:$(HOST_DIR)/%=%)"'
166 CC_TARGET_TUNE_
:= $(call qstrip
,$(BR2_GCC_TARGET_TUNE
))
167 ifeq ($(call qstrip
,$(BR2_GCC_TARGET_CPU_REVISION
)),)
168 CC_TARGET_CPU_
:= $(call qstrip
,$(BR2_GCC_TARGET_CPU
))
170 CC_TARGET_CPU_
:= $(call qstrip
,$(BR2_GCC_TARGET_CPU
)-$(BR2_GCC_TARGET_CPU_REVISION
))
172 CC_TARGET_ARCH_
:= $(call qstrip
,$(BR2_GCC_TARGET_ARCH
))
173 CC_TARGET_ABI_
:= $(call qstrip
,$(BR2_GCC_TARGET_ABI
))
174 CC_TARGET_FPU_
:= $(call qstrip
,$(BR2_GCC_TARGET_FPU
))
175 CC_TARGET_FLOAT_ABI_
:= $(call qstrip
,$(BR2_GCC_TARGET_FLOAT_ABI
))
176 CC_TARGET_MODE_
:= $(call qstrip
,$(BR2_GCC_TARGET_MODE
))
178 # march/mtune/floating point mode needs to be passed to the external toolchain
179 # to select the right multilib variant
180 ifeq ($(BR2_x86_64
),y
)
181 TOOLCHAIN_EXTERNAL_CFLAGS
+= -m64
182 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_64
184 ifneq ($(CC_TARGET_TUNE_
),)
185 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mtune
=$(CC_TARGET_TUNE_
)
186 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_TUNE
='"$(CC_TARGET_TUNE_)"'
188 ifneq ($(CC_TARGET_ARCH_
),)
189 TOOLCHAIN_EXTERNAL_CFLAGS
+= -march
=$(CC_TARGET_ARCH_
)
190 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_ARCH
='"$(CC_TARGET_ARCH_)"'
192 ifneq ($(CC_TARGET_CPU_
),)
193 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mcpu
=$(CC_TARGET_CPU_
)
194 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_CPU
='"$(CC_TARGET_CPU_)"'
196 ifneq ($(CC_TARGET_ABI_
),)
197 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mabi
=$(CC_TARGET_ABI_
)
198 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_ABI
='"$(CC_TARGET_ABI_)"'
200 ifneq ($(CC_TARGET_FPU_
),)
201 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mfpu
=$(CC_TARGET_FPU_
)
202 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_FPU
='"$(CC_TARGET_FPU_)"'
204 ifneq ($(CC_TARGET_FLOAT_ABI_
),)
205 TOOLCHAIN_EXTERNAL_CFLAGS
+= -mfloat-abi
=$(CC_TARGET_FLOAT_ABI_
)
206 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_FLOAT_ABI
='"$(CC_TARGET_FLOAT_ABI_)"'
208 ifneq ($(CC_TARGET_MODE_
),)
209 TOOLCHAIN_EXTERNAL_CFLAGS
+= -m
$(CC_TARGET_MODE_
)
210 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_MODE
='"$(CC_TARGET_MODE_)"'
212 ifeq ($(BR2_BINFMT_FLAT
),y
)
213 TOOLCHAIN_EXTERNAL_CFLAGS
+= -Wl
,-elf2flt
214 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_BINFMT_FLAT
216 ifeq ($(BR2_mipsel
)$(BR2_mips64el
),y
)
217 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_MIPS_TARGET_LITTLE_ENDIAN
218 TOOLCHAIN_EXTERNAL_CFLAGS
+= -EL
220 ifeq ($(BR2_mips
)$(BR2_mips64
),y
)
221 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_MIPS_TARGET_BIG_ENDIAN
222 TOOLCHAIN_EXTERNAL_CFLAGS
+= -EB
224 ifneq ($(BR2_TARGET_OPTIMIZATION
),)
225 TOOLCHAIN_EXTERNAL_CFLAGS
+= $(call qstrip
,$(BR2_TARGET_OPTIMIZATION
))
226 # We create a list like '"-mfoo", "-mbar", "-mbarfoo"' so that each
227 # flag is a separate argument when used in execv() by the external
229 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_ADDITIONAL_CFLAGS
='$(foreach f,$(call qstrip,$(BR2_TARGET_OPTIMIZATION)),"$(f)",)'
232 ifeq ($(BR2_SOFT_FLOAT
),y
)
233 TOOLCHAIN_EXTERNAL_CFLAGS
+= -msoft-float
234 TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
+= -DBR_SOFTFLOAT
=1
237 # The Linaro ARMhf toolchain expects the libraries in
238 # {/usr,}/lib/arm-linux-gnueabihf, but Buildroot copies them to
239 # {/usr,}/lib, so we need to create a symbolic link.
240 define TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
241 ln
-sf .
$(TARGET_DIR
)/lib
/arm-linux-gnueabihf
242 ln
-sf .
$(TARGET_DIR
)/usr
/lib
/arm-linux-gnueabihf
245 define TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
246 ln
-sf .
$(TARGET_DIR
)/lib
/armeb-linux-gnueabihf
247 ln
-sf .
$(TARGET_DIR
)/usr
/lib
/armeb-linux-gnueabihf
250 define TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
251 ln
-sf .
$(TARGET_DIR
)/lib
/aarch64-linux-gnu
252 ln
-sf .
$(TARGET_DIR
)/usr
/lib
/aarch64-linux-gnu
255 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201305
),y
)
256 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/arm-none-linux-gnueabi
/
257 TOOLCHAIN_EXTERNAL_SOURCE
= arm-2013.05
-24-arm-none-linux-gnueabi-i686-pc-linux-gnu.
tar.bz2
258 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201311
),y
)
259 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/arm-none-linux-gnueabi
/
260 TOOLCHAIN_EXTERNAL_SOURCE
= arm-2013.11
-33-arm-none-linux-gnueabi-i686-pc-linux-gnu.
tar.bz2
261 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201405
),y
)
262 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/arm-none-linux-gnueabi
/
263 TOOLCHAIN_EXTERNAL_SOURCE
= arm-2014.05
-29-arm-none-linux-gnueabi-i686-pc-linux-gnu.
tar.bz2
264 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A_201109
),y
)
265 TOOLCHAIN_EXTERNAL_SITE
= http
://software-dl.ti.com
/sdoemb
/sdoemb_public_sw
/arago_toolchain
/2011_09
/exports
/
266 TOOLCHAIN_EXTERNAL_SOURCE
= arago-2011.09
-armv7a-linux-gnueabi-sdk.
tar.bz2
267 define TOOLCHAIN_EXTERNAL_FIXUP_CMDS
268 mv
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/arago-2011.09
/armv7a
/* $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/
269 rm -rf
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/arago-2011.09
/
271 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE_201109
),y
)
272 TOOLCHAIN_EXTERNAL_SITE
= http
://software-dl.ti.com
/sdoemb
/sdoemb_public_sw
/arago_toolchain
/2011_09
/exports
/
273 TOOLCHAIN_EXTERNAL_SOURCE
= arago-2011.09
-armv5te-linux-gnueabi-sdk.
tar.bz2
274 define TOOLCHAIN_EXTERNAL_FIXUP_CMDS
275 mv
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/arago-2011.09
/armv5te
/* $(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/
276 rm -rf
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)/arago-2011.09
/
278 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM
),y
)
279 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/14.08/components
/toolchain
/binaries
/
280 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-arm-linux-gnueabihf-4.9
-2014.08_linux.
tar.xz
281 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_LINARO_ARMHF_SYMLINK
282 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB
),y
)
283 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/14.08/components
/toolchain
/binaries
/
284 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-armeb-linux-gnueabihf-4.9
-2014.08_linux.
tar.xz
285 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_LINARO_ARMEBHF_SYMLINK
286 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201305
),y
)
287 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/mips-linux-gnu
/
288 TOOLCHAIN_EXTERNAL_SOURCE
= mips-2013.05
-66-mips-linux-gnu-i686-pc-linux-gnu.
tar.bz2
289 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201311
),y
)
290 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/mips-linux-gnu
/
291 TOOLCHAIN_EXTERNAL_SOURCE
= mips-2013.11
-36-mips-linux-gnu-i686-pc-linux-gnu.
tar.bz2
292 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201405
),y
)
293 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/mips-linux-gnu
/
294 TOOLCHAIN_EXTERNAL_SOURCE
= mips-2014.05
-27-mips-linux-gnu-i686-pc-linux-gnu.
tar.bz2
295 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201305
),y
)
296 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/nios2-linux-gnu
/
297 TOOLCHAIN_EXTERNAL_SOURCE
= sourceryg
++-2013.05-43-nios2-linux-gnu-i686-pc-linux-gnu.
tar.bz2
298 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_SANITIZE_KERNEL_HEADERS
299 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201405
),y
)
300 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/nios2-linux-gnu
/
301 TOOLCHAIN_EXTERNAL_SOURCE
= sourceryg
++-2014.05-47-nios2-linux-gnu-i686-pc-linux-gnu.
tar.bz2
302 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201009
),y
)
303 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/powerpc-linux-gnu
/
304 TOOLCHAIN_EXTERNAL_SOURCE
= freescale-2010.09
-55-powerpc-linux-gnu-i686-pc-linux-gnu.
tar.bz2
305 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201103
),y
)
306 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/powerpc-linux-gnu
/
307 TOOLCHAIN_EXTERNAL_SOURCE
= freescale-2011.03
-38-powerpc-linux-gnu-i686-pc-linux-gnu.
tar.bz2
308 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201203
),y
)
309 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/powerpc-mentor-linux-gnu
/
310 TOOLCHAIN_EXTERNAL_SOURCE
= mentor-2012.03
-71-powerpc-mentor-linux-gnu-i686-pc-linux-gnu.
tar.bz2
311 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201103
),y
)
312 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/sh-linux-gnu
/
313 TOOLCHAIN_EXTERNAL_SOURCE
= renesas-2011.03
-37-sh-linux-gnu-i686-pc-linux-gnu.
tar.bz2
314 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201203
),y
)
315 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/sh-linux-gnu
/
316 TOOLCHAIN_EXTERNAL_SOURCE
= renesas-2012.03
-35-sh-linux-gnu-i686-pc-linux-gnu.
tar.bz2
317 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201209
),y
)
318 TOOLCHAIN_EXTERNAL_SITE
= https
://sourcery.mentor.com
/public
/gnu_toolchain
/sh-linux-gnu
/
319 TOOLCHAIN_EXTERNAL_SOURCE
= renesas-2012.09
-61-sh-linux-gnu-i686-pc-linux-gnu.
tar.bz2
320 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH2A_201009
),y
)
321 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/sh-uclinux
/
322 TOOLCHAIN_EXTERNAL_SOURCE
= renesas-2010.09
-60-sh-uclinux-i686-pc-linux-gnu.
tar.bz2
323 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH2A_201103
),y
)
324 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/sh-uclinux
/
325 TOOLCHAIN_EXTERNAL_SOURCE
= renesas-2011.03
-36-sh-uclinux-i686-pc-linux-gnu.
tar.bz2
326 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109
),y
)
327 TOOLCHAIN_EXTERNAL_SITE
= https
://sourcery.mentor.com
/public
/gnu_toolchain
/i686-pc-linux-gnu
/
328 TOOLCHAIN_EXTERNAL_SOURCE
= ia32-2011.09
-24-i686-pc-linux-gnu-i386-linux.
tar.bz2
329 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201203
),y
)
330 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/i686-pc-linux-gnu
/
331 TOOLCHAIN_EXTERNAL_SOURCE
= ia32-2012.03
-27-i686-pc-linux-gnu-i386-linux.
tar.bz2
332 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201209
),y
)
333 TOOLCHAIN_EXTERNAL_SITE
= https
://sourcery.mentor.com
/public
/gnu_toolchain
/i686-pc-linux-gnu
/
334 TOOLCHAIN_EXTERNAL_SOURCE
= ia32-2012.09
-62-i686-pc-linux-gnu-i386-linux.
tar.bz2
335 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2
),y
)
336 TOOLCHAIN_EXTERNAL_SITE
= http
://downloads.sourceforge.net
/project
/adi-toolchain
/2012R2
/2012R2-RC2
/i386
/
337 TOOLCHAIN_EXTERNAL_SOURCE
= blackfin-toolchain-2012R2-RC2.i386.
tar.bz2
338 TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
= blackfin-toolchain-uclibc-full-2012R2-RC2.i386.
tar.bz2
339 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2013R1
),y
)
340 TOOLCHAIN_EXTERNAL_SITE
= http
://downloads.sourceforge.net
/project
/adi-toolchain
/2013R1
/2013R1-RC1
/i386
/
341 TOOLCHAIN_EXTERNAL_SOURCE
= blackfin-toolchain-2013R1-RC1.i386.
tar.bz2
342 TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
= blackfin-toolchain-uclibc-full-2013R1-RC1.i386.
tar.bz2
343 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2014R1
),y
)
344 TOOLCHAIN_EXTERNAL_SITE
= http
://downloads.sourceforge.net
/project
/adi-toolchain
/2014R1
/2014R1-RC2
/i386
/
345 TOOLCHAIN_EXTERNAL_SOURCE
= blackfin-toolchain-2014R1-RC2.i386.
tar.bz2
346 TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
= blackfin-toolchain-uclibc-full-2014R1-RC2.i386.
tar.bz2
347 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_14_3
),y
)
348 TOOLCHAIN_EXTERNAL_SITE
= http
://sources.buildroot.net
/
349 TOOLCHAIN_EXTERNAL_SOURCE
= lin32-microblazeel-unknown-linux-gnu_14.3_early.
tar.xz
350 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_V2
),y
)
351 TOOLCHAIN_EXTERNAL_SITE
= http
://sources.buildroot.net
/
352 TOOLCHAIN_EXTERNAL_SOURCE
= microblazeel-unknown-linux-gnu.tgz
353 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEBE_14_3
),y
)
354 TOOLCHAIN_EXTERNAL_SITE
= http
://sources.buildroot.net
/
355 TOOLCHAIN_EXTERNAL_SOURCE
= lin32-microblaze-unknown-linux-gnu_14.3_early.
tar.xz
356 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEBE_V2
),y
)
357 TOOLCHAIN_EXTERNAL_SITE
= http
://sources.buildroot.net
/
358 TOOLCHAIN_EXTERNAL_SOURCE
= microblaze-unknown-linux-gnu.tgz
359 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64
),y
)
360 TOOLCHAIN_EXTERNAL_SITE
= http
://releases.linaro.org
/14.08/components
/toolchain
/binaries
/
361 TOOLCHAIN_EXTERNAL_SOURCE
= gcc-linaro-aarch64-linux-gnu-4.9
-2014.08_linux.
tar.xz
362 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_LINARO_AARCH64_SYMLINK
363 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64
),y
)
364 TOOLCHAIN_EXTERNAL_SITE
= http
://sourcery.mentor.com
/public
/gnu_toolchain
/aarch64-linux-gnu
/
365 TOOLCHAIN_EXTERNAL_SOURCE
= aarch64-2014.05
-30-aarch64-linux-gnu-i686-pc-linux-gnu.
tar.bz2
366 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS
),y
)
367 TOOLCHAIN_EXTERNAL_VERSION
= 1.1.1
368 TOOLCHAIN_EXTERNAL_SITE
= https
://googledrive.com
/host
/0BwnS5DMB0YQ6bDhPZkpOYVFhbk0
/musl-
$(TOOLCHAIN_EXTERNAL_VERSION
)/
370 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-arm-linux-musleabi-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
371 else ifeq ($(BR2_armeb
),y
)
372 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-armeb-linux-musleabi-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
373 else ifeq ($(BR2_i386
),y
)
374 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-i486-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
375 else ifeq ($(BR2_microblazebe
),y
)
376 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-microblaze-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
377 else ifeq ($(BR2_mips
),y
)
378 ifeq ($(BR2_SOFT_FLOAT
),y
)
379 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-mips-sf-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
381 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-mips-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
382 endif # BR2_SOFT_FLOAT
383 else ifeq ($(BR2_mipsel
),y
)
384 ifeq ($(BR2_SOFT_FLOAT
),y
)
385 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-mipsel-sf-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
387 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-mipsel-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
388 endif # BR2_SOFT_FLOAT
389 else ifeq ($(BR2_powerpc
),y
)
390 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-powerpc-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
391 else ifeq ($(BR2_x86_64
),y
)
392 TOOLCHAIN_EXTERNAL_SOURCE
= crossx86-x86_64-linux-musl-
$(TOOLCHAIN_EXTERNAL_VERSION
).
tar.xz
396 TOOLCHAIN_EXTERNAL_SITE
= $(dir $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_URL
)))
397 TOOLCHAIN_EXTERNAL_SOURCE
= $(notdir $(call qstrip
,$(BR2_TOOLCHAIN_EXTERNAL_URL
)))
400 # In fact, we don't need to download the toolchain, since it is already
401 # available on the system, so force the site and source to be empty so
402 # that nothing will be downloaded/extracted.
403 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_PREINSTALLED
),y
)
404 TOOLCHAIN_EXTERNAL_SITE
=
405 TOOLCHAIN_EXTERNAL_SOURCE
=
408 TOOLCHAIN_EXTERNAL_ADD_TOOLCHAIN_DEPENDENCY
= NO
410 TOOLCHAIN_EXTERNAL_INSTALL_STAGING
= YES
412 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2
)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2013R1
)$(BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2014R1
),y
)
413 # Special handling for Blackfin toolchain, because of the split in two
414 # tarballs, and the organization of tarball contents. The tarballs
415 # contain ./opt/uClinux/{bfin-uclinux,bfin-linux-uclibc} directories,
416 # which themselves contain the toolchain. This is why we strip more
417 # components than usual.
418 define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
419 mkdir
-p
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)
420 $(call suitable-extractor
,$(TOOLCHAIN_EXTERNAL_SOURCE
)) $(DL_DIR
)/$(TOOLCHAIN_EXTERNAL_SOURCE
) | \
421 $(TAR
) $(TAR_STRIP_COMPONENTS
)=3 --hard-dereference
-C
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
) $(TAR_OPTIONS
) -
422 $(call suitable-extractor
,$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
)) $(DL_DIR
)/$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS
) | \
423 $(TAR
) $(TAR_STRIP_COMPONENTS
)=3 --hard-dereference
-C
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
) $(TAR_OPTIONS
) -
425 else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE
),)
426 # Normal handling of toolchain tarball extraction.
427 define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
428 mkdir
-p
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
)
429 $(call suitable-extractor
,$(TOOLCHAIN_EXTERNAL_SOURCE
)) $(DL_DIR
)/$(TOOLCHAIN_EXTERNAL_SOURCE
) | \
430 $(TAR
) $(TAR_STRIP_COMPONENTS
)=1 --exclude
='usr/lib/locale/*' -C
$(TOOLCHAIN_EXTERNAL_INSTALL_DIR
) $(TAR_OPTIONS
) -
431 $(TOOLCHAIN_EXTERNAL_FIXUP_CMDS
)
435 # Returns the location of the libc.a file for the given compiler + flags
436 define toolchain_find_libc_a
437 $$(readlink
-f
$$(LANG
=C
$(1) -print-file-name
=libc.a
))
440 # Returns the sysroot location for the given compiler + flags
441 define toolchain_find_sysroot
442 $$(echo
-n
$(call toolchain_find_libc_a
,$(1)) | sed
-r
-e
's:(usr/)?lib(32|64)?/([^/]*/)?libc\.a::')
445 # Returns the lib subdirectory for the given compiler + flags (i.e
446 # typically lib32 or lib64 for some toolchains)
447 define toolchain_find_libdir
448 $$(echo
-n
$(call toolchain_find_libc_a
,$(1)) | sed
-r
-e
's:.*/(usr/)?(lib(32|64)?)/([^/]*/)?libc.a:\2:')
451 # Checks for an already installed toolchain: check the toolchain
452 # location, check that it supports sysroot, and then verify that it
453 # matches the configuration provided in Buildroot: ABI, C++ support,
454 # kernel headers version, type of C library and all C library features.
455 define TOOLCHAIN_EXTERNAL_CONFIGURE_CMDS
456 $(Q
)$(call check_cross_compiler_exists
,$(TOOLCHAIN_EXTERNAL_CC
))
457 $(Q
)$(call check_unusable_toolchain
,$(TOOLCHAIN_EXTERNAL_CC
))
458 $(Q
)SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
459 if
test -z
"$${SYSROOT_DIR}" ; then \
460 @echo
"External toolchain doesn't support --sysroot. Cannot use." ; \
463 $(call check_kernel_headers_version
,\
464 $(call toolchain_find_sysroot
,$(TOOLCHAIN_EXTERNAL_CC
)),\
465 $(call qstrip
,$(BR2_TOOLCHAIN_HEADERS_AT_LEAST
))); \
466 if
test "$(BR2_arm)" = "y" ; then \
467 $(call check_arm_abi
,\
468 "$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS)",\
469 $(TOOLCHAIN_EXTERNAL_READELF
)) ; \
471 if
test "$(BR2_INSTALL_LIBSTDCPP)" = "y" ; then \
472 $(call check_cplusplus
,$(TOOLCHAIN_EXTERNAL_CXX
)) ; \
474 if
test "$(BR2_TOOLCHAIN_EXTERNAL_UCLIBC)" = "y" ; then \
475 $(call check_uclibc
,$${SYSROOT_DIR}) ; \
476 elif
test "$(BR2_TOOLCHAIN_EXTERNAL_MUSL)" = "y" ; then \
477 $(call check_musl
,$${SYSROOT_DIR}) ; \
479 $(call check_glibc
,$${SYSROOT_DIR}) ; \
483 # With the musl C library, the libc.so library directly plays the role
484 # of the dynamic library loader. We just need to create a symbolic
485 # link to libc.so with the appropriate name.
486 ifeq ($(BR2_TOOLCHAIN_EXTERNAL_MUSL
),y
)
492 define TOOLCHAIN_EXTERNAL_MUSL_LD_LINK
493 ln
-sf libc.so
$(TARGET_DIR
)/lib
/ld-musl-
$(MUSL_ARCH
).so
.1
495 TOOLCHAIN_EXTERNAL_POST_INSTALL_STAGING_HOOKS
+= TOOLCHAIN_EXTERNAL_MUSL_LD_LINK
498 # Integration of the toolchain into Buildroot: find the main sysroot
499 # and the variant-specific sysroot, then copy the needed libraries to
500 # the $(TARGET_DIR) and copy the whole sysroot (libraries and headers)
503 # Variables are defined as follows:
505 # LIBC_A_LOCATION: location of the libc.a file in the default
506 # multilib variant (allows to find the main
508 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/usr/lib/libc.a
510 # SYSROOT_DIR: the main sysroot directory, deduced from
511 # LIBC_A_LOCATION by removing the
512 # usr/lib[32|64]/libc.a part of the path.
513 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/
515 # ARCH_LIBC_A_LOCATION: location of the libc.a file in the selected
516 # multilib variant (taking into account the
517 # CFLAGS). Allows to find the sysroot of the
518 # selected multilib variant.
519 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/usr/lib/libc.a
521 # ARCH_SYSROOT_DIR: the sysroot of the selected multilib variant,
522 # deduced from ARCH_LIBC_A_LOCATION by removing
523 # usr/lib[32|64]/libc.a at the end of the path.
524 # Ex: /x-tools/mips-2011.03/mips-linux-gnu/libc/mips16/soft-float/el/
526 # ARCH_LIB_DIR: 'lib', 'lib32' or 'lib64' depending on where libraries
527 # are stored. Deduced from ARCH_LIBC_A_LOCATION by
528 # looking at usr/lib??/libc.a.
531 # ARCH_SUBDIR: the relative location of the sysroot of the selected
532 # multilib variant compared to the main sysroot.
533 # Ex: mips16/soft-float/el
535 # SUPPORT_LIB_DIR: some toolchains, such as recent Linaro toolchains,
536 # store GCC support libraries (libstdc++,
537 # libgcc_s, etc.) outside of the sysroot. In
538 # this case, SUPPORT_LIB_DIR is set to a
539 # non-empty value, and points to the directory
540 # where these support libraries are
541 # available. Those libraries will be copied to
542 # our sysroot, and the directory will also be
543 # considered when searching libraries for copy
544 # to the target filesystem.
546 define TOOLCHAIN_EXTERNAL_INSTALL_CORE
547 $(Q
)SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC))" ; \
548 if
test -z
"$${SYSROOT_DIR}" ; then \
549 @echo
"External toolchain doesn't support --sysroot. Cannot use." ; \
552 ARCH_SYSROOT_DIR
="$(call toolchain_find_sysroot,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
553 ARCH_LIB_DIR
="$(call toolchain_find_libdir,$(TOOLCHAIN_EXTERNAL_CC) $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
554 SUPPORT_LIB_DIR
="" ; \
555 if
test `find $${ARCH_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq
0 ; then \
556 LIBSTDCPP_A_LOCATION
=$$(LANG
=C
$(TOOLCHAIN_EXTERNAL_CC
) $(TOOLCHAIN_EXTERNAL_CFLAGS
) -print-file-name
=libstdc
++.a
) ; \
557 if
[ -e
"$${LIBSTDCPP_A_LOCATION}" ]; then \
558 SUPPORT_LIB_DIR
=`readlink -f $${LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
561 ARCH_SUBDIR
=`echo $${ARCH_SYSROOT_DIR} | sed -r -e "s:^$${SYSROOT_DIR}(.*)/$$:\1:"` ; \
562 if
test -z
"$(BR2_PREFER_STATIC_LIB)" ; then \
563 $(call MESSAGE
,"Copying external toolchain libraries to target...") ; \
564 for libs in
$(LIB_EXTERNAL_LIBS
); do \
565 $(call copy_toolchain_lib_root
,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/lib
); \
567 for libs in
$(USR_LIB_EXTERNAL_LIBS
); do \
568 $(call copy_toolchain_lib_root
,$${ARCH_SYSROOT_DIR},$${SUPPORT_LIB_DIR},$${ARCH_LIB_DIR},$$libs,/usr
/lib
); \
571 $(call MESSAGE
,"Copying external toolchain sysroot to staging...") ; \
572 $(call copy_toolchain_sysroot
,$${SYSROOT_DIR},$${ARCH_SYSROOT_DIR},$${ARCH_SUBDIR},$${ARCH_LIB_DIR},$${SUPPORT_LIB_DIR}) ; \
573 if
test "$(BR2_TOOLCHAIN_EXTERNAL_GDB_SERVER_COPY)" = "y"; then \
574 $(call MESSAGE
,"Copying gdbserver") ; \
575 gdbserver_found
=0 ; \
576 for d in
$${ARCH_SYSROOT_DIR}/usr
$${ARCH_SYSROOT_DIR}/..
/debug-root
/usr
$${ARCH_SYSROOT_DIR}/usr
/$${ARCH_LIB_DIR} ; do \
577 if
test -f
$${d}/bin
/gdbserver
; then \
578 install -m
0755 -D
$${d}/bin
/gdbserver
$(TARGET_DIR
)/usr
/bin
/gdbserver
; \
579 gdbserver_found
=1 ; \
583 if
[ $${gdbserver_found} -eq
0 ] ; then \
584 echo
"Could not find gdbserver in external toolchain" ; \
590 # Special installation target used on the Blackfin architecture when
591 # FDPIC is not the primary binary format being used, but the user has
592 # nonetheless requested the installation of the FDPIC libraries to the
594 ifeq ($(BR2_BFIN_INSTALL_FDPIC_SHARED
),y
)
595 define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
596 $(Q
)$(call MESSAGE
,"Install external toolchain FDPIC libraries to target...") ; \
597 FDPIC_EXTERNAL_CC
=$(dir $(TOOLCHAIN_EXTERNAL_CC
))/..
/..
/bfin-linux-uclibc
/bin
/bfin-linux-uclibc-gcc
; \
598 FDPIC_SYSROOT_DIR
="$(call toolchain_find_sysroot,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
599 FDPIC_LIB_DIR
="$(call toolchain_find_libdir,$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS))" ; \
600 FDPIC_SUPPORT_LIB_DIR
="" ; \
601 if
test `find $${FDPIC_SYSROOT_DIR} -name 'libstdc++.a' | wc -l` -eq
0 ; then \
602 FDPIC_LIBSTDCPP_A_LOCATION
=$$(LANG
=C
$${FDPIC_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS
) -print-file-name
=libstdc
++.a
) ; \
603 if
[ -e
"$${FDPIC_LIBSTDCPP_A_LOCATION}" ]; then \
604 FDPIC_SUPPORT_LIB_DIR
=`readlink -f $${FDPIC_LIBSTDCPP_A_LOCATION} | sed -r -e 's:libstdc\+\+\.a::'` ; \
607 for libs in
$(LIB_EXTERNAL_LIBS
); do \
608 $(call copy_toolchain_lib_root
,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/lib
); \
610 for libs in
$(USR_LIB_EXTERNAL_LIBS
); do \
611 $(call copy_toolchain_lib_root
,$${FDPIC_SYSROOT_DIR},$${FDPIC_SUPPORT_LIB_DIR},$${FDPIC_LIB_DIR},$$libs,/usr
/lib
); \
616 # Special installation target used on the Blackfin architecture when
617 # shared FLAT is not the primary format being used, but the user has
618 # nonetheless requested the installation of the shared FLAT libraries
619 # to the target filesystem. The flat libraries are found and linked
620 # according to the index in name "libN.so". Index 1 is reserved for
621 # the standard C library. Customer libraries can use 4 and above.
622 ifeq ($(BR2_BFIN_INSTALL_FLAT_SHARED
),y
)
623 define TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT
624 $(Q
)$(call MESSAGE
,"Install external toolchain FLAT libraries to target...") ; \
625 FLAT_EXTERNAL_CC
=$(dir $(TOOLCHAIN_EXTERNAL_CC
))..
/..
/bfin-uclinux
/bin
/bfin-uclinux-gcc
; \
626 FLAT_LIBC_A_LOCATION
=`$${FLAT_EXTERNAL_CC} $(TOOLCHAIN_EXTERNAL_CFLAGS) -mid-shared-library -print-file-name=libc`; \
627 if
[ -f
$${FLAT_LIBC_A_LOCATION} -a
! -h
$${FLAT_LIBC_A_LOCATION} ] ; then \
628 $(INSTALL
) -D
$${FLAT_LIBC_A_LOCATION} $(TARGET_DIR
)/lib
/lib1.so
; \
633 # Build toolchain wrapper for preprocessor, C and C++ compiler and setup
634 # symlinks for everything else. Skip gdb symlink when we are building our
635 # own gdb to prevent two gdb's in output/host/usr/bin.
636 define TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
637 $(Q
)$(call MESSAGE
,"Building ext-toolchain wrapper")
638 mkdir
-p
$(HOST_DIR
)/usr
/bin
; cd
$(HOST_DIR
)/usr
/bin
; \
639 for i in
$(TOOLCHAIN_EXTERNAL_CROSS
)*; do \
642 *cc|
*cc-
*|
*++|
*++-*|
*cpp) \
643 ln
-sf ext-toolchain-wrapper
$$base; \
646 if
test "$(BR2_PACKAGE_HOST_GDB)" != "y"; then \
647 ln
-sf
$$(echo
$$i | sed
's%^$(HOST_DIR)%../..%') .
; \
651 ln
-sf
$$(echo
$$i | sed
's%^$(HOST_DIR)%../..%') .
; \
655 # We use --hash-style=both to increase the compatibility of
656 # the generated binary with older platforms
657 $(HOSTCC
) $(HOST_CFLAGS
) $(TOOLCHAIN_EXTERNAL_WRAPPER_ARGS
) -s
-Wl
,--hash-style
=both \
658 toolchain
/toolchain-external
/ext-toolchain-wrapper.c \
659 -o
$(HOST_DIR
)/usr
/bin
/ext-toolchain-wrapper
662 # This sed magic is taken from Linux headers_install.sh script.
663 define TOOLCHAIN_EXTERNAL_SANITIZE_KERNEL_HEADERS
664 $(Q
)$(call MESSAGE
,"Sanitizing kernel headers");
665 find
$(STAGING_DIR
)/usr
/include/linux
/ -name
"*.h" | xargs sed
-r
-i \
666 -e
's/([ \t(])(__user|__force|__iomem)[ \t]/\1/g' \
667 -e
's/__attribute_const__([ \t]|$$)/\1/g' \
668 -e
's@^#include <linux/compiler.h>@@' \
669 -e
's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$$)/\1__attribute__((packed))\2/g' \
670 -e
's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$$)/\1__\2__\3/g' \
671 -e
's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @'
674 define TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT
675 if
test -f
$(TARGET_CROSS
)gdb
; then \
676 $(call gen_gdbinit_file
) ; \
680 # Even though we're installing things in both the staging, the host
681 # and the target directory, we do everything within the
682 # install-staging step, arbitrarily.
683 define TOOLCHAIN_EXTERNAL_INSTALL_STAGING_CMDS
684 $(TOOLCHAIN_EXTERNAL_INSTALL_CORE
)
685 $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FDPIC
)
686 $(TOOLCHAIN_EXTERNAL_INSTALL_BFIN_FLAT
)
687 $(TOOLCHAIN_EXTERNAL_INSTALL_WRAPPER
)
688 $(TOOLCHAIN_EXTERNAL_INSTALL_GDBINIT
)
691 $(eval
$(generic-package
))