summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--meta/conf/distro/include/csl-versions.inc105
-rw-r--r--meta/conf/distro/include/tcmode-external-csl.inc2
-rw-r--r--meta/recipes-core/meta/external-csl-toolchain.bb24
3 files changed, 131 insertions, 0 deletions
diff --git a/meta/conf/distro/include/csl-versions.inc b/meta/conf/distro/include/csl-versions.inc
new file mode 100644
index 0000000000..22e83946a1
--- /dev/null
+++ b/meta/conf/distro/include/csl-versions.inc
@@ -0,0 +1,105 @@
1def 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
16def 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 return 'UNKNOWN'
22 else:
23 last_line = stderr.splitlines()[-1]
24 return last_line
25
26def csl_get_main_version(d):
27 version = csl_get_version(d)
28 if version != 'UNKNOWN':
29 return version.split()[-1].rstrip(')')
30 else:
31 return version
32
33def csl_get_gcc_version(d):
34 version = csl_get_version(d)
35 if version != 'UNKNOWN':
36 return version.split()[2]
37 else:
38 return version
39
40def csl_get_libc_version(d):
41 import os,bb
42 syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${CSL_TARGET_SYS}', d)
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
56def csl_get_kernel_version(d):
57 import os,bb
58 syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${CSL_TARGET_SYS}', d)
59 if not syspath:
60 return 'UNKNOWN'
61
62 vf = syspath + '/libc/usr/include/linux/version.h'
63 if not os.path.exists(vf):
64 vf = syspath + '/libc/sgxx-glibc/usr/include/linux/version.h'
65
66 try:
67 f = open(vf, 'r')
68 except (OSError, IOError):
69 return 'UNKNOWN'
70
71 l = f.readlines();
72 f.close();
73 for s in l:
74 if s.find('LINUX_VERSION_CODE') > 0:
75 ver = int(s.split()[2])
76 maj = ver / 65536
77 ver = ver % 65536
78 min = ver / 256
79 ver = ver % 256
80 return str(maj)+'.'+str(min)+'.'+str(ver)
81 return 'UNKNOWN'
82
83def csl_get_gdb_version(d):
84 try:
85 stdout, stderr = csl_run(d, 'gdb', '-v')
86 except CmdError:
87 return 'UNKNOWN'
88 else:
89 first_line = stdout.splitlines()[0]
90 return first_line.split()[-1]
91
92python csl_version_handler () {
93 if not isinstance(e, bb.event.ConfigParsed):
94 return
95 d = e.data
96 ld = d.createCopy()
97 ld.finalize()
98
99 d.setVar('CSL_VER_MAIN', csl_get_main_version(ld))
100 d.setVar('CSL_VER_GCC', csl_get_gcc_version(ld))
101 d.setVar('CSL_VER_LIBC', csl_get_libc_version(ld))
102 d.setVar('CSL_VER_KERNEL', csl_get_kernel_version(ld))
103 d.setVar('CSL_VER_GDB', csl_get_gdb_version(ld))
104}
105addhandler csl_version_handler
diff --git a/meta/conf/distro/include/tcmode-external-csl.inc b/meta/conf/distro/include/tcmode-external-csl.inc
index 0135590060..1ff808d9e7 100644
--- a/meta/conf/distro/include/tcmode-external-csl.inc
+++ b/meta/conf/distro/include/tcmode-external-csl.inc
@@ -108,3 +108,5 @@ def populate_toolchain_links(d):
108 if exc.errno == errno.EEXIST: 108 if exc.errno == errno.EEXIST:
109 break 109 break
110 bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc)) 110 bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc))
111
112require conf/distro/include/csl-versions.inc
diff --git a/meta/recipes-core/meta/external-csl-toolchain.bb b/meta/recipes-core/meta/external-csl-toolchain.bb
index 8cf73dad99..c9f35c408d 100644
--- a/meta/recipes-core/meta/external-csl-toolchain.bb
+++ b/meta/recipes-core/meta/external-csl-toolchain.bb
@@ -23,6 +23,7 @@ PROVIDES += "\
23 libgcc \ 23 libgcc \
24 virtual/linux-libc-headers \ 24 virtual/linux-libc-headers \
25" 25"
26PV = "${CSL_VER_MAIN}"
26PR = "r3" 27PR = "r3"
27 28
28#SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/${CSL_TARGET_SYS}/arm-${PV}-${TARGET_PREFIX}i686-pc-linux-gnu.tar.bz2" 29#SRC_URI = "http://www.codesourcery.com/public/gnu_toolchain/${CSL_TARGET_SYS}/arm-${PV}-${TARGET_PREFIX}i686-pc-linux-gnu.tar.bz2"
@@ -97,6 +98,29 @@ PKG_${PN}-extra-nss = "eglibc-extra-nss"
97PKG_${PN}-thread-db = "eglibc-thread-db" 98PKG_${PN}-thread-db = "eglibc-thread-db"
98PKG_${PN}-pcprofile = "eglibc-pcprofile" 99PKG_${PN}-pcprofile = "eglibc-pcprofile"
99 100
101PKGV_${PN} = "${CSL_VER_LIBC}"
102PKGV_${PN}-dev = "${CSL_VER_LIBC}"
103PKGV_${PN}-doc = "${CSL_VER_LIBC}"
104PKGV_${PN}-dbg = "${CSL_VER_LIBC}"
105PKGV_${PN}-pic = "${CSL_VER_LIBC}"
106PKGV_${PN}-utils = "${CSL_VER_LIBC}"
107PKGV_${PN}-gconv = "${CSL_VER_LIBC}"
108PKGV_${PN}-extra-nss = "${CSL_VER_LIBC}"
109PKGV_${PN}-thread-db = "${CSL_VER_LIBC}"
110PKGV_${PN}-pcprofile = "${CSL_VER_LIBC}"
111PKGV_catchsegv = "${CSL_VER_LIBC}"
112PKGV_libsegfault = "${CSL_VER_LIBC}"
113PKGV_sln = "${CSL_VER_LIBC}"
114PKGV_nscd = "${CSL_VER_LIBC}"
115PKGV_ldd = "${CSL_VER_LIBC}"
116PKGV_libgcc = "${CSL_VER_GCC}"
117PKGV_libgcc-dev = "${CSL_VER_GCC}"
118PKGV_libstdc++ = "${CSL_VER_GCC}"
119PKGV_libstdc++-dev = "${CSL_VER_GCC}"
120PKGV_linux-libc-headers = "${CSL_VER_KERNEL}"
121PKGV_linux-libc-headers-dev = "${CSL_VER_KERNEL}"
122PKGV_gdbserver = "${CSL_VER_GDBSERVER}"
123
100FILES_libgcc = "${base_libdir}/libgcc_s.so.1" 124FILES_libgcc = "${base_libdir}/libgcc_s.so.1"
101FILES_libgcc-dev = "${base_libdir}/libgcc_s.so" 125FILES_libgcc-dev = "${base_libdir}/libgcc_s.so"
102FILES_libstdc++ = "${libdir}/libstdc++.so.*" 126FILES_libstdc++ = "${libdir}/libstdc++.so.*"