blob: 178fb71e4383a64b435e818274c2b966a639fadf [file] [log] [blame]
Brad Bishopbec4ebc2022-08-03 09:55:16 -04001#
2# Configuration to use an external Arm binary toolchain
3#
4
5EXTERNAL_TOOLCHAIN ?= "/usr/local/arm-binary-toolchain/${TARGET_ARCH}"
6
7TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:"
8PATH =. "${TOOLCHAIN_PATH_ADD}"
9
10EAT_TARGET_SYS:arm ?= "${@ 'arm-none-linux-gnueabihf' if os.path.exists('${EXTERNAL_TOOLCHAIN}/bin/arm-none-linux-gnueabihf-gcc') else 'arm-linux-gnueabihf'}"
11EAT_TARGET_SYS:aarch64 ?= "${@ 'aarch64-none-linux-gnu' if os.path.exists('${EXTERNAL_TOOLCHAIN}/bin/aarch64-none-linux-gnu-gcc') else 'aarch64-linux-gnu'}"
12EAT_TARGET_SYS = "${TARGET_SYS}"
13TARGET_PREFIX = "${EAT_TARGET_SYS}-"
14
15EAT_LIBDIR:arm = "lib"
16EAT_LIBDIR:aarch64 = "lib64"
17
18GCCMULTILIB:forcevariable = "--disable-multilib"
19IMAGE_LINGUAS:forcevariable = ""
20
21# Blacklist toolchain recipes as a belt-and-suspenders way to use the external toolchain
22SKIP_RECIPE[glibc] = "Using external toolchain"
23SKIP_RECIPE[libgcc] = "Using external toolchain"
24SKIP_RECIPE[gcc-cross] = "Using external toolchain"
25SKIP_RECIPE[gcc-cross-aarch64] = "Using external toolchain"
26SKIP_RECIPE[gcc-cross-arm] = "Using external toolchain"
27SKIP_RECIPE[gcc-runtime] = "Using external toolchain"
28SKIP_RECIPE[gcc-sanitizers] = "Using external toolchain"
29
30PREFERRED_PROVIDER_linux-libc-headers = "external-arm-toolchain"
31PREFERRED_PROVIDER_linux-libc-headers-dev = "external-arm-toolchain"
32PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-arm-toolchain"
33PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-arm-toolchain"
34PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-arm-toolchain"
35PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-arm-toolchain"
36PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "external-arm-toolchain"
37PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-arm-toolchain"
38PREFERRED_PROVIDER_glibc = "external-arm-toolchain"
39PREFERRED_PROVIDER_libgcc = "external-arm-toolchain"
40PREFERRED_PROVIDER_virtual/libc = "external-arm-toolchain"
41PREFERRED_PROVIDER_virtual/libc-locale = "external-arm-toolchain"
42PREFERRED_PROVIDER_virtual/libintl = "external-arm-toolchain"
43PREFERRED_PROVIDER_virtual/libiconv = "external-arm-toolchain"
44PREFERRED_PROVIDER_virtual/crypt = "external-arm-toolchain"
45PREFERRED_PROVIDER_glibc-thread-db = "external-arm-toolchain"
46PREFERRED_PROVIDER_glibc-mtrace = "external-arm-toolchain"
47PREFERRED_PROVIDER_libc-mtrace = "external-arm-toolchain"
48PREFERRED_PROVIDER_virtual/linux-libc-headers = "external-arm-toolchain"
49
50PREFERRED_PROVIDER_gcc-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "external-arm-sdk-toolchain-${TRANSLATED_TARGET_ARCH}"
51PREFERRED_PROVIDER_binutils-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "external-arm-sdk-toolchain-${TRANSLATED_TARGET_ARCH}"
52PREFERRED_PROVIDER_gdb-cross-canadian-${TRANSLATED_TARGET_ARCH} ?= "external-arm-sdk-toolchain-${TRANSLATED_TARGET_ARCH}"
53
54TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}"
55
56DISTRO_FEATURES_LIBC = "ipv4 ipv6 libc-backtrace libc-big-macros libc-bsd libc-cxx-tests libc-catgets libc-crypt \
57 libc-crypt-ufc libc-db-aliases libc-envz libc-fcvt libc-fmtmsg libc-fstab libc-ftraverse \
58 libc-getlogin libc-idn libc-inet-anl libc-libm libc-libm-big \
59 libc-locales libc-locale-code libc-charsets \
60 libc-memusage libc-nis libc-nsswitch libc-rcmd libc-rtld-debug libc-spawn libc-streams libc-sunrpc \
61 libc-utmp libc-utmpx libc-wordexp libc-posix-clang-wchar libc-posix-regexp libc-posix-regexp-glibc \
62 libc-posix-wchar-io"
63
64ENABLE_BINARY_LOCALE_GENERATION = "0"
65GLIBC_INTERNAL_USE_BINARY_LOCALE = "precompiled"
66LIBCOVERRIDE = ":libc-glibc"
67LIBC_DEPENDENCIES:remove = "glibc-gconv-cp1252 glibc-gconv-ibm850 glibc-gconv-iso8859-1 glibc-gconv-iso8859-15 glibc-localedata-i18n"
68
69ERROR_QA[type] ?= "list"
70python toolchain_metadata_setup () {
71 import subprocess
72 if not isinstance(e, bb.event.ConfigParsed):
73 return
74
75 d = e.data
76 l = d.createCopy()
77 l.finalize()
78 oe_import(l)
79
80 external_toolchain = l.getVar('EXTERNAL_TOOLCHAIN', True)
81 if not external_toolchain or external_toolchain == 'UNDEFINED':
82 bb.fatal("Error: EXTERNAL_TOOLCHAIN must be set to the path to your arm toolchain")
83
84 if not os.path.exists(external_toolchain):
85 bb.fatal("Error: EXTERNAL_TOOLCHAIN path '%s' does not exist" % external_toolchain)
86
87 # The external toolchain may not have been built with the oe-core preferred
88 # gnu hash setting, so ensure that the corresponding sanity check is not an error.
89 error_qa = oe.data.typed_value('ERROR_QA', l)
90 if 'ldflags' in error_qa:
91 error_qa.remove('ldflags')
92 d.setVar('ERROR_QA', ' '.join(error_qa))
93}
94addhandler toolchain_metadata_setup
95
96def populate_toolchain_links(d):
97 import errno
98 import os
99 from glob import glob
100
101 d = d.createCopy()
102 d.finalize()
103
104 pattern = bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*', d)
105 files = glob(pattern)
106 if not files:
107 bb.fatal("Unable to populate toolchain binary symlinks")
108
109 bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True)
110 bb.mkdirhier(bindir)
111 for f in files:
112 base = os.path.basename(f)
113 newpath = os.path.join(bindir, base)
114 try:
115 os.symlink(f, newpath)
116 except OSError as exc:
117 if exc.errno == errno.EEXIST:
118 break
119 bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc))
120
121require conf/distro/include/external-arm-toolchain-versions.inc