aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Werner <ken.werner@linaro.org>2012-02-10 16:15:26 +0100
committerKen Werner <ken.werner@linaro.org>2012-03-07 14:22:27 +0100
commit781c7caa535281f85f7a0c1b839293cfe05e7857 (patch)
tree667ec6fdf9f9d0cc9223f8017ea10cf0b3311ca3
downloadmeta-linaro-781c7caa535281f85f7a0c1b839293cfe05e7857.tar.gz
Initial version
Adds the infrastructure for building OpenEmbedded-Core using the external Linaro toolchain. Signed-off-by: Ken Werner <ken.werner@linaro.org>
-rw-r--r--conf/distro/include/external-linaro-toolchain-versions.inc101
-rw-r--r--conf/distro/include/tcmode-external-linaro.inc59
-rw-r--r--conf/layer.conf3
-rw-r--r--recipes-devtools/external-linaro-toolchain.bb191
-rw-r--r--recipes-devtools/external-linaro-toolchain/SUPPORTED1
5 files changed, 355 insertions, 0 deletions
diff --git a/conf/distro/include/external-linaro-toolchain-versions.inc b/conf/distro/include/external-linaro-toolchain-versions.inc
new file mode 100644
index 00000000..d064f398
--- /dev/null
+++ b/conf/distro/include/external-linaro-toolchain-versions.inc
@@ -0,0 +1,101 @@
+def elt_run(d, cmd, *args):
+ import bb.process
+ import subprocess
+
+ topdir = d.getVar('TOPDIR', True)
+ toolchain_path = d.getVar('EXTERNAL_TOOLCHAIN', True)
+ if not toolchain_path:
+ return 'UNKNOWN', 'UNKNOWN'
+
+ target_prefix = d.getVar('TARGET_PREFIX', True)
+ path = os.path.join(toolchain_path, 'bin', target_prefix + cmd)
+ args = [path] + list(args)
+
+ return bb.process.run(args, cwd=topdir, stderr=subprocess.PIPE)
+
+def elt_get_version(d):
+ try:
+ stdout, stderr = elt_run(d, 'gcc', '-v')
+ except bb.process.CmdError as exc:
+ bb.error('Failed to obtain external Linaro toolchain version: %s' % exc)
+ return 'UNKNOWN'
+ else:
+ last_line = stderr.splitlines()[-1]
+ return last_line
+
+def elt_get_main_version(d):
+ version = elt_get_version(d)
+ if version != 'UNKNOWN':
+ return version.split()[-1].rstrip(')')
+ else:
+ return version
+
+def elt_get_gcc_version(d):
+ version = elt_get_version(d)
+ if version != 'UNKNOWN':
+ return version.split()[2]
+ else:
+ return version
+
+def elt_get_libc_version(d):
+ import os,bb
+ syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}', d)
+ if not syspath:
+ return 'UNKNOWN'
+
+ libpath = syspath + '/libc/lib/${ELT_TARGET_SYS}/'
+
+ if os.path.exists(libpath):
+ for file in os.listdir(libpath):
+ if file.find('libc-') == 0:
+ return file[5:-3]
+ return 'UNKNOWN'
+
+def elt_get_kernel_version(d):
+ import os,bb
+ syspath = bb.data.expand('${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}', d)
+ if not syspath:
+ return 'UNKNOWN'
+
+ vf = syspath + '/libc/usr/include/linux/version.h'
+
+ try:
+ f = open(vf, 'r')
+ except (OSError, IOError):
+ return 'UNKNOWN'
+
+ l = f.readlines();
+ f.close();
+ for s in l:
+ if s.find('LINUX_VERSION_CODE') > 0:
+ ver = int(s.split()[2])
+ maj = ver / 65536
+ ver = ver % 65536
+ min = ver / 256
+ ver = ver % 256
+ return str(maj)+'.'+str(min)+'.'+str(ver)
+ return 'UNKNOWN'
+
+def elt_get_gdb_version(d):
+ try:
+ stdout, stderr = elt_run(d, 'gdb', '-v')
+ except CmdError:
+ return 'UNKNOWN'
+ else:
+ first_line = stdout.splitlines()[0]
+ return first_line.split()[-1]
+
+python external_linaro_toolchain_version_handler () {
+ if not isinstance(e, bb.event.ConfigParsed):
+ return
+ d = e.data
+ ld = d.createCopy()
+ ld.finalize()
+
+ d.setVar('ELT_VER_MAIN', elt_get_main_version(ld))
+ d.setVar('ELT_VER_GCC', elt_get_gcc_version(ld))
+ d.setVar('ELT_VER_LIBC', elt_get_libc_version(ld))
+ d.setVar('ELT_VER_KERNEL', elt_get_kernel_version(ld))
+ d.setVar('ELT_VER_GDB', elt_get_gdb_version(ld))
+}
+addhandler external_linaro_toolchain_version_handler
diff --git a/conf/distro/include/tcmode-external-linaro.inc b/conf/distro/include/tcmode-external-linaro.inc
new file mode 100644
index 00000000..bf36c65d
--- /dev/null
+++ b/conf/distro/include/tcmode-external-linaro.inc
@@ -0,0 +1,59 @@
+#
+# Configuration to use an external Linaro binary toolchain
+#
+
+EXTERNAL_TOOLCHAIN ?= "/usr/local/linaro-binary-toolchain/${TARGET_ARCH}"
+
+TOOLCHAIN_PATH_ADD = "${EXTERNAL_TOOLCHAIN}/bin:"
+PATH =. "${TOOLCHAIN_PATH_ADD}"
+
+ELT_TARGET_SYS = "arm-linux-gnueabi"
+TARGET_PREFIX = "${ELT_TARGET_SYS}-"
+
+PREFERRED_PROVIDER_linux-libc-headers = "external-linaro-toolchain"
+PREFERRED_PROVIDER_linux-libc-headers-dev = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-initial = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}gcc-intermediate = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}g++ = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}binutils = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}libc-for-gcc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/${TARGET_PREFIX}compilerlibs = "external-linaro-toolchain"
+PREFERRED_PROVIDER_libgcc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/libc = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/libintl = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/libiconv = "external-linaro-toolchain"
+PREFERRED_PROVIDER_glibc-thread-db = "external-linaro-toolchain"
+PREFERRED_PROVIDER_virtual/linux-libc-headers = "external-linaro-toolchain"
+
+TARGET_CPPFLAGS_prepend = " -isystem${EXTERNAL_TOOLCHAIN}/${TARGET_SYS}/include "
+TARGET_LDFLAGS_prepend = " -L${EXTERNAL_TOOLCHAIN}/${TARGET_SYS}/lib -Wl,-rpath-link,${EXTERNAL_TOOLCHAIN}/${TARGET_SYS}/lib "
+
+TOOLCHAIN_OPTIONS = " --sysroot=${STAGING_DIR_HOST}"
+
+def populate_toolchain_links(d):
+ import errno
+ import os
+ from glob import glob
+
+ d = d.createCopy()
+ d.finalize()
+
+ pattern = bb.data.expand('${EXTERNAL_TOOLCHAIN}/bin/${TARGET_PREFIX}*', d)
+ files = glob(pattern)
+ if not files:
+ bb.fatal("Unable to populate toolchain binary symlinks")
+
+ bindir = d.getVar('STAGING_BINDIR_TOOLCHAIN', True)
+ bb.mkdirhier(bindir)
+ for f in files:
+ base = os.path.basename(f)
+ newpath = os.path.join(bindir, base)
+ try:
+ os.symlink(f, newpath)
+ except OSError as exc:
+ if exc.errno == errno.EEXIST:
+ break
+ bb.fatal("Unable to populate toolchain binary symlink for %s: %s" % (newpath, exc))
+
+require conf/distro/include/external-linaro-toolchain-versions.inc
diff --git a/conf/layer.conf b/conf/layer.conf
new file mode 100644
index 00000000..060e2b02
--- /dev/null
+++ b/conf/layer.conf
@@ -0,0 +1,3 @@
+BBPATH .= ":${LAYERDIR}"
+BBFILES .= "${LAYERDIR}/recipes-*/*.bb \
+ ${LAYERDIR}/recipes-*/*.bbappend"
diff --git a/recipes-devtools/external-linaro-toolchain.bb b/recipes-devtools/external-linaro-toolchain.bb
new file mode 100644
index 00000000..5c210481
--- /dev/null
+++ b/recipes-devtools/external-linaro-toolchain.bb
@@ -0,0 +1,191 @@
+require recipes-core/eglibc/eglibc-package.inc
+
+INHIBIT_DEFAULT_DEPS = "1"
+
+# License applies to this recipe code, not the toolchain itself
+LICENSE = "MIT"
+LIC_FILES_CHKSUM = "\
+ file://${COREBASE}/LICENSE;md5=3f40d7994397109285ec7b81fdeb3b58 \
+ file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420 \
+"
+
+PROVIDES += "\
+ linux-libc-headers \
+ virtual/${TARGET_PREFIX}gcc \
+ virtual/${TARGET_PREFIX}g++ \
+ virtual/${TARGET_PREFIX}gcc-initial \
+ virtual/${TARGET_PREFIX}gcc-intermediate \
+ virtual/${TARGET_PREFIX}binutils \
+ virtual/${TARGET_PREFIX}libc-for-gcc \
+ virtual/${TARGET_PREFIX}compilerlibs \
+ virtual/libc \
+ virtual/libintl \
+ virtual/libiconv \
+ glibc-thread-db \
+ libgcc \
+ virtual/linux-libc-headers \
+"
+PV = "${ELT_VER_MAIN}"
+PR = "r0"
+
+# https://launchpad.net/linaro-toolchain-binaries
+# http://launchpad.net/linaro-toolchain-binaries/trunk/2012.01/+download/gcc-linaro-arm-linux-gnueabi-2012.01-20120125_linux.tar.bz2
+SRC_URI = "file://SUPPORTED"
+
+do_install() {
+ install -d ${D}${base_libdir}
+ install -d ${D}${bindir}
+ install -d ${D}${sbindir}
+ install -d ${D}${libdir}
+ install -d ${D}${libexecdir}
+ install -d ${D}${datadir}
+ install -d ${D}${includedir}
+
+ cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/lib/${ELT_TARGET_SYS}/* ${D}${base_libdir}
+ cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/lib/* ${D}${base_libdir}
+ cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/lib/${ELT_TARGET_SYS}/* ${D}${libdir}
+ cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/lib/* ${D}${libdir}
+ cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/share/* ${D}${datadir}
+ cp -a ${EXTERNAL_TOOLCHAIN}/${ELT_TARGET_SYS}/libc/usr/include/* ${D}${includedir}
+
+ rm -r ${D}${libdir}/${ELT_TARGET_SYS}
+ rm -r ${D}${base_libdir}/${ELT_TARGET_SYS}
+
+ # fix up the copied symlinks (they are still pointing to the multiarch directory)
+ ln -sf ld-2.13.so ${D}${base_libdir}/ld-linux.so.3
+ ln -sf ../../lib/libnsl.so.1 ${D}${libdir}/libnsl.so
+ ln -sf ../../lib/librt.so.1 ${D}${libdir}/librt.so
+ ln -sf ../../lib/libcrypt.so.1 ${D}${libdir}/libcrypt.so
+ ln -sf ../../lib/libnss_nis.so.2 ${D}${libdir}/libnss_nis.so
+ ln -sf ../../lib/libresolv.so.2 ${D}${libdir}/libresolv.so
+ ln -sf ../../lib/libnss_dns.so.2 ${D}${libdir}/libnss_dns.so
+ ln -sf ../../lib/libnss_hesiod.so.2 ${D}${libdir}/libnss_hesiod.so
+ ln -sf ../../lib/libutil.so.1 ${D}${libdir}/libutil.so
+ ln -sf ../../lib/libnss_files.so.2 ${D}${libdir}/libnss_files.so
+ ln -sf ../../lib/libnss_compat.so.2 ${D}${libdir}/libnss_compat.so
+ ln -sf ../../lib/libcidn.so.1 ${D}${libdir}/libcidn.so
+ ln -sf ../../lib/libBrokenLocale.so.1 ${D}${libdir}/libBrokenLocale.so
+ ln -sf ../../lib/libthread_db.so.1 ${D}${libdir}/libthread_db.so
+ ln -sf ../../lib/libanl.so.1 ${D}${libdir}/libanl.so
+ ln -sf ../../lib/libdl.so.2 ${D}${libdir}/libdl.so
+ ln -sf ../../lib/libnss_nisplus.so.2 ${D}${libdir}/libnss_nisplus.so
+ ln -sf ../../lib/libm.so.6 ${D}${libdir}/libm.so
+
+ sed -i -e "s# /lib/${ELT_TARGET_SYS}# ../../lib#g" -e "s# /usr/lib/${ELT_TARGET_SYS}# .#g" ${D}${libdir}/libc.so
+ sed -i -e "s# /lib/${ELT_TARGET_SYS}# ../../lib#g" -e "s# /usr/lib/${ELT_TARGET_SYS}# .#g" ${D}${libdir}/libpthread.so
+}
+
+PACKAGES =+ "\
+ libgcc \
+ libgcc-dev \
+ libstdc++ \
+ libstdc++-dev \
+ linux-libc-headers \
+ linux-libc-headers-dev \
+"
+
+INSANE_SKIP_libgcc = "1"
+INSANE_SKIP_libstdc++ = "1"
+INSANE_SKIP_gdbserver = "1"
+
+PKG_${PN} = "eglibc"
+PKG_${PN}-dev = "eglibc-dev"
+PKG_${PN}-doc = "eglibc-doc"
+PKG_${PN}-dbg = "eglibc-dbg"
+PKG_${PN}-pic = "eglibc-pic"
+PKG_${PN}-utils = "eglibc-utils"
+PKG_${PN}-gconv = "eglibc-gconv"
+PKG_${PN}-extra-nss = "eglibc-extra-nss"
+PKG_${PN}-thread-db = "eglibc-thread-db"
+PKG_${PN}-pcprofile = "eglibc-pcprofile"
+
+PKGV_${PN} = "${ELT_VER_LIBC}"
+PKGV_${PN}-dev = "${ELT_VER_LIBC}"
+PKGV_${PN}-doc = "${ELT_VER_LIBC}"
+PKGV_${PN}-dbg = "${ELT_VER_LIBC}"
+PKGV_${PN}-pic = "${ELT_VER_LIBC}"
+PKGV_${PN}-utils = "${ELT_VER_LIBC}"
+PKGV_${PN}-gconv = "${ELT_VER_LIBC}"
+PKGV_${PN}-extra-nss = "${ELT_VER_LIBC}"
+PKGV_${PN}-thread-db = "${ELT_VER_LIBC}"
+PKGV_${PN}-pcprofile = "${ELT_VER_LIBC}"
+PKGV_catchsegv = "${ELT_VER_LIBC}"
+PKGV_libsegfault = "${ELT_VER_LIBC}"
+PKGV_sln = "${ELT_VER_LIBC}"
+PKGV_nscd = "${ELT_VER_LIBC}"
+PKGV_ldd = "${ELT_VER_LIBC}"
+PKGV_libgcc = "${ELT_VER_GCC}"
+PKGV_libgcc-dev = "${ELT_VER_GCC}"
+PKGV_libstdc++ = "${ELT_VER_GCC}"
+PKGV_libstdc++-dev = "${ELT_VER_GCC}"
+PKGV_linux-libc-headers = "${ELT_VER_KERNEL}"
+PKGV_linux-libc-headers-dev = "${ELT_VER_KERNEL}"
+PKGV_gdbserver = "${ELT_VER_GDBSERVER}"
+
+FILES_libgcc = "${base_libdir}/libgcc_s.so.1"
+FILES_libgcc-dev = "${base_libdir}/libgcc_s.so"
+FILES_libstdc++ = "${base_libdir}/libstdc++.so.*"
+FILES_libstdc++-dev = "\
+ ${includedir}/c++/${PV} \
+ ${base_libdir}/libstdc++.so \
+ ${base_libdir}/libstdc++.a \
+ ${base_libdir}/libsupc++.a \
+"
+FILES_linux-libc-headers = "\
+ ${includedir}/asm* \
+ ${includedir}/linux \
+ ${includedir}/mtd \
+ ${includedir}/rdma \
+ ${includedir}/scsi \
+ ${includedir}/sound \
+ ${includedir}/video \
+"
+FILES_${PN} += "\
+ ${libdir}/bin \
+ ${libdir}/locale \
+ ${libdir}/gconv/gconv-modules \
+ ${datadir}/zoneinfo \
+ ${base_libdir}/libcrypt*.so.* \
+ ${base_libdir}/libcrypt-*.so \
+ ${base_libdir}/libc.so.* \
+ ${base_libdir}/libc-*.so \
+ ${base_libdir}/libm*.so.* \
+ ${base_libdir}/libm-*.so \
+ ${base_libdir}/ld*.so.* \
+ ${base_libdir}/ld-*.so \
+ ${base_libdir}/libpthread*.so.* \
+ ${base_libdir}/libpthread-*.so \
+ ${base_libdir}/libresolv*.so.* \
+ ${base_libdir}/libresolv-*.so \
+ ${base_libdir}/librt*.so.* \
+ ${base_libdir}/librt-*.so \
+ ${base_libdir}/libutil*.so.* \
+ ${base_libdir}/libutil-*.so \
+ ${base_libdir}/libnsl*.so.* \
+ ${base_libdir}/libnsl-*.so \
+ ${base_libdir}/libnss_files*.so.* \
+ ${base_libdir}/libnss_files-*.so \
+ ${base_libdir}/libnss_compat*.so.* \
+ ${base_libdir}/libnss_compat-*.so \
+ ${base_libdir}/libnss_dns*.so.* \
+ ${base_libdir}/libnss_dns-*.so \
+ ${base_libdir}/libnss_nis*.so.* \
+ ${base_libdir}/libnss_nisplus-*.so \
+ ${base_libdir}/libnss_nisplus*.so.* \
+ ${base_libdir}/libnss_nis-*.so \
+ ${base_libdir}/libnss_hesiod*.so.* \
+ ${base_libdir}/libnss_hesiod-*.so \
+ ${base_libdir}/libdl*.so.* \
+ ${base_libdir}/libdl-*.so \
+ ${base_libdir}/libanl*.so.* \
+ ${base_libdir}/libanl-*.so \
+ ${base_libdir}/libBrokenLocale*.so.* \
+ ${base_libdir}/libBrokenLocale-*.so \
+ ${base_libdir}/libcidn*.so.* \
+ ${base_libdir}/libcidn-*.so \
+ ${base_libdir}/libthread_db*.so.* \
+ ${base_libdir}/libthread_db-*.so \
+ ${base_libdir}/libmemusage.so \
+ ${base_libdir}/libSegFault.so \
+ ${base_libdir}/libpcprofile.so \
+"
diff --git a/recipes-devtools/external-linaro-toolchain/SUPPORTED b/recipes-devtools/external-linaro-toolchain/SUPPORTED
new file mode 100644
index 00000000..9615075e
--- /dev/null
+++ b/recipes-devtools/external-linaro-toolchain/SUPPORTED
@@ -0,0 +1 @@
+POSIX