diff options
Diffstat (limited to 'meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc')
-rw-r--r-- | meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc | 101 |
1 files changed, 101 insertions, 0 deletions
diff --git a/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc b/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc new file mode 100644 index 0000000..19be8af --- /dev/null +++ b/meta-linaro-toolchain/conf/distro/include/tcmode-external-linaro.inc | |||
@@ -0,0 +1,101 @@ | |||
1 | # | ||
2 | # Configuration to use an external Linaro binary toolchain | ||
3 | # | ||
4 | |||
5 | EXTERNAL_TOOLCHAIN ?= "/usr/local/linaro-binary-toolchain/${TARGET_ARCH}" | ||
6 | |||
7 | TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:" | ||
8 | PATH =. "${TOOLCHAIN_PATH_ADD}" | ||
9 | |||
10 | ELT_TARGET_SYS_arm ?= "arm-linux-gnueabihf" | ||
11 | ELT_TARGET_SYS_aarch64 ?= "aarch64-linux-gnu" | ||
12 | ELT_TARGET_SYS = "${TARGET_SYS}" | ||
13 | TARGET_PREFIX = "${ELT_TARGET_SYS}-" | ||
14 | |||
15 | GCCMULTILIB_forcevariable = "--disable-multilib" | ||
16 | IMAGE_LINGUAS_forcevariable = "" | ||
17 | |||
18 | PREFERRED_PROVIDER_linux-libc-headers = "external-linaro-toolchain" | ||
19 | PREFERRED_PROVIDER_linux-libc-headers-dev = "external-linaro-toolchain" | ||
20 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-linaro-toolchain" | ||
21 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-linaro-toolchain" | ||
22 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-linaro-toolchain" | ||
23 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-linaro-toolchain" | ||
24 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "external-linaro-toolchain" | ||
25 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-linaro-toolchain" | ||
26 | PREFERRED_PROVIDER_glibc = "external-linaro-toolchain" | ||
27 | PREFERRED_PROVIDER_libgcc = "external-linaro-toolchain" | ||
28 | PREFERRED_PROVIDER_virtual/libc = "external-linaro-toolchain" | ||
29 | PREFERRED_PROVIDER_virtual/libintl = "external-linaro-toolchain" | ||
30 | PREFERRED_PROVIDER_virtual/libiconv = "external-linaro-toolchain" | ||
31 | PREFERRED_PROVIDER_glibc-thread-db = "external-linaro-toolchain" | ||
32 | PREFERRED_PROVIDER_virtual/linux-libc-headers = "external-linaro-toolchain" | ||
33 | |||
34 | TARGET_CPPFLAGS_prepend = " -isystem${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/include " | ||
35 | TARGET_LDFLAGS_prepend = " -L${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/lib -Wl,-rpath-link,${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/lib " | ||
36 | |||
37 | TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}" | ||
38 | |||
39 | DISTRO_FEATURES_LIBC = "ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-crypt \ | ||
40 | libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse \ | ||
41 | libc-getlogin libc-idn libc-inet-anl libc-libm libc-libm-big \ | ||
42 | libc-memusage libc-nis libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams libc-sunrpc \ | ||
43 | libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc \ | ||
44 | libc-posix-wchar-io" | ||
45 | |||
46 | ENABLE_BINARY_LOCALE_GENERATION = "0" | ||
47 | GLIBC_INTERNAL_USE_BINARY_LOCALE = "precompiled" | ||
48 | |||
49 | ERROR_QA[type] ?= "list" | ||
50 | python toolchain_metadata_setup () { | ||
51 | import subprocess | ||
52 | if not isinstance(e, bb.event.ConfigParsed): | ||
53 | return | ||
54 | |||
55 | d = e.data | ||
56 | l = d.createCopy() | ||
57 | l.finalize() | ||
58 | oe_import(l) | ||
59 | |||
60 | external_toolchain = l.getVar('EXTERNAL_TOOLCHAIN', True) | ||
61 | if not external_toolchain or external_toolchain == 'UNDEFINED': | ||
62 | bb.fatal("Error: EXTERNAL_TOOLCHAIN must be set to the path to your linaro toolchain") | ||
63 | |||
64 | if not os.path.exists(external_toolchain): | ||
65 | bb.fatal("Error: EXTERNAL_TOOLCHAIN path '%s' does not exist" % external_toolchain) | ||
66 | |||
67 | # The external toolchain may not have been built with the oe-core preferred | ||
68 | # gnu hash setting, so ensure that the corresponding sanity check is not an error. | ||
69 | error_qa = oe.data.typed_value('ERROR_QA', l) | ||
70 | if 'ldflags' in error_qa: | ||
71 | error_qa.remove('ldflags') | ||
72 | d.setVar('ERROR_QA', ' '.join(error_qa)) | ||
73 | } | ||
74 | addhandler toolchain_metadata_setup | ||
75 | |||
76 | def populate_toolchain_links(d): | ||
77 | import errno | ||
78 | import os | ||
79 | from glob import glob | ||
80 | |||
81 | d = d.createCopy() | ||
82 | d.finalize() | ||
83 | |||
84 | pattern = bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*', d) | ||
85 | files = glob(pattern) | ||
86 | if not files: | ||
87 | bb.fatal("Unable to populate toolchain binary symlinks") | ||
88 | |||
89 | bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True) | ||
90 | bb.mkdirhier(bindir) | ||
91 | for f in files: | ||
92 | base = os.path.basename(f) | ||
93 | newpath = os.path.join(bindir, base) | ||
94 | try: | ||
95 | os.symlink(f, newpath) | ||
96 | except OSError as exc: | ||
97 | if exc.errno == errno.EEXIST: | ||
98 | break | ||
99 | bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc)) | ||
100 | |||
101 | require conf/distro/include/external-linaro-toolchain-versions.inc | ||