diff options
-rw-r--r-- | meta/conf/distro/include/tcmode-external-csl.inc | 59 | ||||
-rw-r--r-- | meta/recipes-core/meta/external-csl-toolchain.bb | 5 |
2 files changed, 63 insertions, 1 deletions
diff --git a/meta/conf/distro/include/tcmode-external-csl.inc b/meta/conf/distro/include/tcmode-external-csl.inc index 1d82ca1900..0135590060 100644 --- a/meta/conf/distro/include/tcmode-external-csl.inc +++ b/meta/conf/distro/include/tcmode-external-csl.inc | |||
@@ -4,7 +4,8 @@ | |||
4 | 4 | ||
5 | EXTERNAL_TOOLCHAIN ?= "/usr/local/csl/${TARGET_ARCH}" | 5 | EXTERNAL_TOOLCHAIN ?= "/usr/local/csl/${TARGET_ARCH}" |
6 | 6 | ||
7 | PATH =. "${EXTERNAL_TOOLCHAIN}/bin:" | 7 | TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:" |
8 | PATH =. "${TOOLCHAIN_PATH_ADD}" | ||
8 | 9 | ||
9 | CSL_TARGET_SYS_powerpc = "powerpc-linux-gnu" | 10 | CSL_TARGET_SYS_powerpc = "powerpc-linux-gnu" |
10 | CSL_TARGET_SYS_powerpc64 = "powerpc-linux-gnu" | 11 | CSL_TARGET_SYS_powerpc64 = "powerpc-linux-gnu" |
@@ -12,6 +13,8 @@ CSL_TARGET_SYS_arm = "arm-none-linux-gnueabi" | |||
12 | CSL_TARGET_SYS_mips = "mips-linux-gnu" | 13 | CSL_TARGET_SYS_mips = "mips-linux-gnu" |
13 | CSL_TARGET_SYS_mipsel = "mips-linux-gnu" | 14 | CSL_TARGET_SYS_mipsel = "mips-linux-gnu" |
14 | CSL_TARGET_SYS_mips64 = "mips-linux-gnu" | 15 | CSL_TARGET_SYS_mips64 = "mips-linux-gnu" |
16 | CSL_TARGET_SYS_i686 = "i686-pc-linux-gnu" | ||
17 | CSL_TARGET_SYS_i586 = "i686-pc-linux-gnu" | ||
15 | CSL_TARGET_SYS = "${TARGET_SYS}" | 18 | CSL_TARGET_SYS = "${TARGET_SYS}" |
16 | 19 | ||
17 | TARGET_PREFIX = "${CSL_TARGET_SYS}-" | 20 | TARGET_PREFIX = "${CSL_TARGET_SYS}-" |
@@ -41,6 +44,8 @@ TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}" | |||
41 | def csl_target_core(d): | 44 | def csl_target_core(d): |
42 | coredata = { | 45 | coredata = { |
43 | 'armv7a-vfp-neon': 'armv7-a-neon', | 46 | 'armv7a-vfp-neon': 'armv7-a-neon', |
47 | 'i586': 'sgxx-glibc', | ||
48 | 'i686': 'sgxx-glibc', | ||
44 | 'mips': 'mips32', | 49 | 'mips': 'mips32', |
45 | 'mipsel': 'el', | 50 | 'mipsel': 'el', |
46 | 'ppce500': 'te500v1', | 51 | 'ppce500': 'te500v1', |
@@ -51,3 +56,55 @@ def csl_target_core(d): | |||
51 | return coredata.get(d.getVar('TUNE_PKGARCH', True), '') | 56 | return coredata.get(d.getVar('TUNE_PKGARCH', True), '') |
52 | 57 | ||
53 | CSL_TARGET_CORE = "${@csl_target_core(d)}" | 58 | CSL_TARGET_CORE = "${@csl_target_core(d)}" |
59 | |||
60 | # Unfortunately, the CSL ia32 toolchain has non-prefixed binaries in its | ||
61 | # bindir (e.g. gcc, ld). To avoid this messing up our build, we avoid adding | ||
62 | # this bindir to our PATH, and instead add symlinks to the prefixed binaries | ||
63 | # to our staging toolchain bindir. | ||
64 | |||
65 | python toolchain_metadata_setup () { | ||
66 | if not isinstance(e, bb.event.ConfigParsed): | ||
67 | return | ||
68 | |||
69 | d = e.data | ||
70 | |||
71 | if d.getVar('TUNE_PKGARCH', True) in ('i586', 'i686'): | ||
72 | d.setVar('TOOLCHAIN_PATH_ADD', '') | ||
73 | } | ||
74 | addhandler toolchain_metadata_setup | ||
75 | |||
76 | python toolchain_setup () { | ||
77 | if not isinstance(e, bb.event.BuildStarted): | ||
78 | return | ||
79 | |||
80 | d = e.data | ||
81 | |||
82 | if d.getVar('TUNE_PKGARCH', True) in ('i586', 'i686'): | ||
83 | populate_toolchain_links(d) | ||
84 | } | ||
85 | addhandler toolchain_setup | ||
86 | |||
87 | def populate_toolchain_links(d): | ||
88 | import errno | ||
89 | import os | ||
90 | from glob import glob | ||
91 | |||
92 | d = d.createCopy() | ||
93 | d.finalize() | ||
94 | |||
95 | pattern = bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*', d) | ||
96 | files = glob(pattern) | ||
97 | if not files: | ||
98 | bb.fatal("Unable to populate toolchain binary symlinks") | ||
99 | |||
100 | bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True) | ||
101 | bb.mkdirhier(bindir) | ||
102 | for f in files: | ||
103 | base = os.path.basename(f) | ||
104 | newpath = os.path.join(bindir, base) | ||
105 | try: | ||
106 | os.symlink(f, newpath) | ||
107 | except OSError as exc: | ||
108 | if exc.errno == errno.EEXIST: | ||
109 | break | ||
110 | bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc)) | ||
diff --git a/meta/recipes-core/meta/external-csl-toolchain.bb b/meta/recipes-core/meta/external-csl-toolchain.bb index 37ea271eb1..a866e3e3dd 100644 --- a/meta/recipes-core/meta/external-csl-toolchain.bb +++ b/meta/recipes-core/meta/external-csl-toolchain.bb | |||
@@ -60,6 +60,11 @@ external_toolchain_sysroot_adjust() { | |||
60 | rm -f ${SYSROOT_DESTDIR}/${CSL_TARGET_CORE} | 60 | rm -f ${SYSROOT_DESTDIR}/${CSL_TARGET_CORE} |
61 | ln -s . ${SYSROOT_DESTDIR}/${CSL_TARGET_CORE} | 61 | ln -s . ${SYSROOT_DESTDIR}/${CSL_TARGET_CORE} |
62 | fi | 62 | fi |
63 | |||
64 | if [ "${TUNE_PKGARCH}" = "i586" ]; then | ||
65 | rm -f ${SYSROOT_DESTDIR}/system32 | ||
66 | ln -s . ${SYSROOT_DESTDIR}/system32 | ||
67 | fi | ||
63 | } | 68 | } |
64 | 69 | ||
65 | GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "compile" | 70 | GLIBC_INTERNAL_USE_BINARY_LOCALE ?= "compile" |