diff options
Diffstat (limited to 'meta/conf')
-rw-r--r-- | meta/conf/distro/include/csl-versions.inc | 107 | ||||
-rw-r--r-- | meta/conf/distro/include/tcmode-external-csl.inc | 2 | ||||
-rw-r--r-- | meta/conf/distro/include/tcmode-external-sourcery.inc | 128 | ||||
-rw-r--r-- | meta/conf/documentation.conf | 2 |
4 files changed, 1 insertions, 238 deletions
diff --git a/meta/conf/distro/include/csl-versions.inc b/meta/conf/distro/include/csl-versions.inc deleted file mode 100644 index 3938bf7ed2..0000000000 --- a/meta/conf/distro/include/csl-versions.inc +++ /dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | def csl_run(d, cmd, *args): | ||
2 | import bb.process | ||
3 | import subprocess | ||
4 | |||
5 | topdir = d.getVar('TOPDIR', True) | ||
6 | toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True) | ||
7 | if not toolchain_path: | ||
8 | return 'UNKNOWN', 'UNKNOWN' | ||
9 | |||
10 | target_prefix = d.getVar('TARGET_PREFIX', True) | ||
11 | path = os.path.join(toolchain_path, 'bin', target_prefix + cmd) | ||
12 | args = [path] + list(args) | ||
13 | |||
14 | return bb.process.run(args, cwd=topdir, stderr=subprocess.PIPE) | ||
15 | |||
16 | def csl_get_version(d): | ||
17 | try: | ||
18 | stdout, stderr = csl_run(d, 'gcc', '-v') | ||
19 | except bb.process.CmdError as exc: | ||
20 | bb.error('Failed to obtain CodeSourcery toolchain version: %s' % exc) | ||
21 | bb.error('Make sure that MACHINE is set correctly in your local.conf and the toolchain supports %s.' % d.getVar("TARGET_ARCH", True)) | ||
22 | return 'UNKNOWN' | ||
23 | else: | ||
24 | last_line = stderr.splitlines()[-1] | ||
25 | return last_line | ||
26 | |||
27 | def csl_get_main_version(d): | ||
28 | version = csl_get_version(d) | ||
29 | if version != 'UNKNOWN': | ||
30 | return version.split()[-1].rstrip(')') | ||
31 | else: | ||
32 | return version | ||
33 | |||
34 | def csl_get_gcc_version(d): | ||
35 | version = csl_get_version(d) | ||
36 | if version != 'UNKNOWN': | ||
37 | return version.split()[2] | ||
38 | else: | ||
39 | return version | ||
40 | |||
41 | def csl_get_libc_version(d): | ||
42 | syspath = d.expand('${EXTERNAL_TOOLCHAIN}/${CSL_TARGET_SYS}') | ||
43 | if not syspath: | ||
44 | return 'UNKNOWN' | ||
45 | |||
46 | libpath = syspath + '/libc/lib/' | ||
47 | if not os.path.exists(libpath): | ||
48 | libpath = syspath + '/libc/sgxx-glibc/lib/' | ||
49 | |||
50 | if os.path.exists(libpath): | ||
51 | for file in os.listdir(libpath): | ||
52 | if file.find('libc-') == 0: | ||
53 | return file[5:-3] | ||
54 | return 'UNKNOWN' | ||
55 | |||
56 | def csl_get_kernel_version(d): | ||
57 | syspath = d.expand('${EXTERNAL_TOOLCHAIN}/${CSL_TARGET_SYS}') | ||
58 | if not syspath: | ||
59 | return 'UNKNOWN' | ||
60 | |||
61 | vf = syspath + '/libc/usr/include/linux/version.h' | ||
62 | if not os.path.exists(vf): | ||
63 | vf = syspath + '/libc/sgxx-glibc/usr/include/linux/version.h' | ||
64 | |||
65 | try: | ||
66 | f = open(vf, 'r') | ||
67 | except (OSError, IOError): | ||
68 | return 'UNKNOWN' | ||
69 | |||
70 | l = f.readlines(); | ||
71 | f.close(); | ||
72 | for s in l: | ||
73 | if s.find('LINUX_VERSION_CODE') > 0: | ||
74 | ver = int(s.split()[2]) | ||
75 | maj = ver / 65536 | ||
76 | ver = ver % 65536 | ||
77 | min = ver / 256 | ||
78 | ver = ver % 256 | ||
79 | return str(maj)+'.'+str(min)+'.'+str(ver) | ||
80 | return 'UNKNOWN' | ||
81 | |||
82 | def csl_get_gdb_version(d): | ||
83 | try: | ||
84 | stdout, stderr = csl_run(d, 'gdb', '-v') | ||
85 | except bb.process.CmdError: | ||
86 | return 'UNKNOWN' | ||
87 | else: | ||
88 | first_line = stdout.splitlines()[0] | ||
89 | return first_line.split()[-1] | ||
90 | |||
91 | python csl_version_handler () { | ||
92 | d = e.data | ||
93 | ld = d.createCopy() | ||
94 | ld.finalize() | ||
95 | |||
96 | d.setVar('CSL_VER_MAIN', csl_get_main_version(ld)) | ||
97 | d.setVar('CSL_VER_GCC', csl_get_gcc_version(ld)) | ||
98 | d.setVar('CSL_VER_LIBC', csl_get_libc_version(ld)) | ||
99 | d.setVar('CSL_VER_KERNEL', csl_get_kernel_version(ld)) | ||
100 | d.setVar('CSL_VER_GDB', csl_get_gdb_version(ld)) | ||
101 | } | ||
102 | addhandler csl_version_handler | ||
103 | csl_version_handler[eventmask] = "bb.event.ConfigParsed" | ||
104 | |||
105 | # Ensure that any variable which includes the --sysroot (CC, CXX, etc) also | ||
106 | # depends on the toolchain version | ||
107 | TOOLCHAIN_OPTIONS[vardeps] += "CSL_VER_MAIN CSL_VER_GCC" | ||
diff --git a/meta/conf/distro/include/tcmode-external-csl.inc b/meta/conf/distro/include/tcmode-external-csl.inc deleted file mode 100644 index 9e530ab1e7..0000000000 --- a/meta/conf/distro/include/tcmode-external-csl.inc +++ /dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | TCMODE = "external-sourcery" | ||
2 | require conf/distro/include/tcmode-${TCMODE}.inc | ||
diff --git a/meta/conf/distro/include/tcmode-external-sourcery.inc b/meta/conf/distro/include/tcmode-external-sourcery.inc deleted file mode 100644 index 5590f7a1e9..0000000000 --- a/meta/conf/distro/include/tcmode-external-sourcery.inc +++ /dev/null | |||
@@ -1,128 +0,0 @@ | |||
1 | # | ||
2 | # Configuration to use external Sourcery G++ toolchain | ||
3 | # | ||
4 | |||
5 | EXTERNAL_TOOLCHAIN ?= "/usr/local/csl/${TARGET_ARCH}" | ||
6 | |||
7 | TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:" | ||
8 | PATH =. "${TOOLCHAIN_PATH_ADD}" | ||
9 | |||
10 | CSL_TARGET_SYS_powerpc ?= "powerpc-linux-gnu" | ||
11 | CSL_TARGET_SYS_powerpc64 ?= "powerpc-linux-gnu" | ||
12 | CSL_TARGET_SYS_arm ?= "arm-none-linux-gnueabi" | ||
13 | CSL_TARGET_SYS_mips ?= "mips-linux-gnu" | ||
14 | CSL_TARGET_SYS_mipsel ?= "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" | ||
18 | CSL_TARGET_SYS = "${TARGET_SYS}" | ||
19 | |||
20 | TARGET_PREFIX = "${CSL_TARGET_SYS}-" | ||
21 | |||
22 | PREFERRED_PROVIDER_linux-libc-headers = "external-sourcery-toolchain" | ||
23 | PREFERRED_PROVIDER_linux-libc-headers-dev = "external-sourcery-toolchain" | ||
24 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-sourcery-toolchain" | ||
25 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-sourcery-toolchain" | ||
26 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "external-sourcery-toolchain" | ||
27 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-sourcery-toolchain" | ||
28 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-sourcery-toolchain" | ||
29 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "external-sourcery-toolchain" | ||
30 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-initial = "external-sourcery-toolchain" | ||
31 | PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-sourcery-toolchain" | ||
32 | PREFERRED_PROVIDER_libgcc = "external-sourcery-toolchain" | ||
33 | PREFERRED_PROVIDER_eglibc = "external-sourcery-toolchain" | ||
34 | PREFERRED_PROVIDER_virtual/libc = "external-sourcery-toolchain" | ||
35 | PREFERRED_PROVIDER_virtual/libintl = "external-sourcery-toolchain" | ||
36 | PREFERRED_PROVIDER_virtual/libiconv = "external-sourcery-toolchain" | ||
37 | PREFERRED_PROVIDER_glibc-thread-db = "external-sourcery-toolchain" | ||
38 | PREFERRED_PROVIDER_virtual/linux-libc-headers = "external-sourcery-toolchain" | ||
39 | PREFERRED_PROVIDER_virtual/linux-libc-headers-dev = "external-sourcery-toolchain" | ||
40 | PREFERRED_PROVIDER_gdbserver ??= "external-sourcery-toolchain" | ||
41 | |||
42 | # No need to re-compile the locale files | ||
43 | GLIBC_INTERNAL_USE_BINARY_LOCALE = "precompiled" | ||
44 | ENABLE_BINARY_LOCALE_GENERATION = "" | ||
45 | |||
46 | TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}" | ||
47 | |||
48 | # Point to the appropriate multilib sysroot from the external toolchain, whose | ||
49 | # files will be extracted into the OE sysroot | ||
50 | def exttc_run(d, cmd): | ||
51 | try: | ||
52 | return bb.process.run(cmd, shell=True, env={'PATH': d.getVar('PATH', True)})[0].rstrip() | ||
53 | except (OSError, bb.process.CmdError): | ||
54 | return '' | ||
55 | |||
56 | EXTERNAL_TOOLCHAIN_SYSROOT_CMD = "${TARGET_PREFIX}gcc ${TARGET_CC_ARCH} -print-sysroot" | ||
57 | EXTERNAL_TOOLCHAIN_SYSROOT ??= "${@exttc_run(d, EXTERNAL_TOOLCHAIN_SYSROOT_CMD)}" | ||
58 | |||
59 | # These bits are here temporarily to sidestep the need to use a separate set | ||
60 | # of tune files to pass the appropriate multilib selection arguments to the | ||
61 | # sourcery toolchain, as is needed to extract the sysroot content. | ||
62 | TUNE_CCARGS_append_x86 = " -msgxx-glibc" | ||
63 | |||
64 | CSL_MULTILIB_ARGS[ppce500] ?= "-te500v1" | ||
65 | CSL_MULTILIB_ARGS[ppce500mc] ?= "-te500mc" | ||
66 | CSL_MULTILIB_ARGS[ppce500v2] ?= "-te500v2" | ||
67 | CSL_MULTILIB_ARGS[ppce600] ?= "-te600" | ||
68 | |||
69 | def csl_multilib_arg(d): | ||
70 | argument = d.getVarFlag('CSL_MULTILIB_ARGS', d.getVar('DEFAULTTUNE', True) or '') | ||
71 | if argument: | ||
72 | return argument | ||
73 | else: | ||
74 | return '' | ||
75 | |||
76 | EXTERNAL_TOOLCHAIN_SYSROOT_CMD += "${@csl_multilib_arg(d)}" | ||
77 | |||
78 | |||
79 | # Unfortunately, the CSL ia32 toolchain has non-prefixed binaries in its | ||
80 | # bindir (e.g. gcc, ld). To avoid this messing up our build, we avoid adding | ||
81 | # this bindir to our PATH, and instead add symlinks to the prefixed binaries | ||
82 | # to our staging toolchain bindir. | ||
83 | |||
84 | python toolchain_metadata_setup () { | ||
85 | d = e.data | ||
86 | |||
87 | l = d.createCopy() | ||
88 | l.finalize() | ||
89 | if os.path.exists(bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/gcc', l)): | ||
90 | d.setVar('TOOLCHAIN_PATH_ADD', '') | ||
91 | } | ||
92 | addhandler toolchain_metadata_setup | ||
93 | toolchain_metadata_setup[eventmask] = "bb.event.ConfigParsed" | ||
94 | |||
95 | python toolchain_setup () { | ||
96 | d = e.data | ||
97 | |||
98 | if not d.getVar('TOOLCHAIN_PATH_ADD', True): | ||
99 | populate_toolchain_links(d) | ||
100 | } | ||
101 | addhandler toolchain_setup | ||
102 | toolchain_setup[eventmask] = "bb.event.BuildStarted" | ||
103 | |||
104 | def populate_toolchain_links(d): | ||
105 | import errno | ||
106 | from glob import glob | ||
107 | |||
108 | d = d.createCopy() | ||
109 | d.finalize() | ||
110 | |||
111 | pattern = d.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*') | ||
112 | files = glob(pattern) | ||
113 | if not files: | ||
114 | bb.fatal("Unable to populate toolchain binary symlinks in %s" % pattern) | ||
115 | |||
116 | bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True) | ||
117 | bb.utils.mkdirhier(bindir) | ||
118 | for f in files: | ||
119 | base = os.path.basename(f) | ||
120 | newpath = os.path.join(bindir, base) | ||
121 | try: | ||
122 | os.symlink(f, newpath) | ||
123 | except OSError as exc: | ||
124 | if exc.errno == errno.EEXIST: | ||
125 | break | ||
126 | bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc)) | ||
127 | |||
128 | require conf/distro/include/csl-versions.inc | ||
diff --git a/meta/conf/documentation.conf b/meta/conf/documentation.conf index a40b0b87da..c96ddd31bf 100644 --- a/meta/conf/documentation.conf +++ b/meta/conf/documentation.conf | |||
@@ -260,7 +260,7 @@ TARGET_OS[doc] = "Specifies the target's operating system." | |||
260 | TARGET_PREFIX[doc] = "The prefix for the cross compile toolchain. E.g arm-linux- ." | 260 | TARGET_PREFIX[doc] = "The prefix for the cross compile toolchain. E.g arm-linux- ." |
261 | TARGET_SYS[doc] = "The target system is composed out of TARGET_ARCH,TARGET_VENDOR and TARGET_OS." | 261 | TARGET_SYS[doc] = "The target system is composed out of TARGET_ARCH,TARGET_VENDOR and TARGET_OS." |
262 | TCLIBC[doc] = "Specifies which variant of the GNU standard C library (libc) to use during the build process. You can select eglibc or uclibc." | 262 | TCLIBC[doc] = "Specifies which variant of the GNU standard C library (libc) to use during the build process. You can select eglibc or uclibc." |
263 | TCMODE[doc] = "The toolchain selector. It selects the external toolchain built using the OpenEmbedded build system or a few supported combinations of the upstream GCC or CodeSourcery Labs toolchain." | 263 | TCMODE[doc] = "Enables an external toolchain (where provided by an additional layer) if set to a value other than 'default'." |
264 | TEST_IMAGE[doc] = "Enable test booting of virtual machine images under the qemu emulator after any root filesystems are created and run tests against those images." | 264 | TEST_IMAGE[doc] = "Enable test booting of virtual machine images under the qemu emulator after any root filesystems are created and run tests against those images." |
265 | TIME[doc] = "The time the build was started HMS" | 265 | TIME[doc] = "The time the build was started HMS" |
266 | TMPDIR[doc] = "This variable is the temporary directory the OpenEmbedded build system uses when it does its work building images. By default, the TMPDIR variable is named tmp within the Build Directory." | 266 | TMPDIR[doc] = "This variable is the temporary directory the OpenEmbedded build system uses when it does its work building images. By default, the TMPDIR variable is named tmp within the Build Directory." |