From 6bd4ec919aec8e2007d06dab699c7a8b4deb4136 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Thu, 10 Apr 2014 08:15:22 -0700 Subject: [PATCH 1/3] tcmode: disable pseudo when running the toolchain The sourcery toolchain writes temporary files to /tmp, and includes the username. If multiple users are doing builds with pseudo enabled, it'll try to write to the other user's file, since both will use 'root', and the build will fail as a result. Initially, I attempted to alter CC, KERNEL_CC, LD, etc to prepend with 'env PSEUDO_UNLOAD=1 ', but this isn't ideal, as it seems there are cases where our vars aren't obeyed. For example, the kernel build runs gcc -E, but it seems it gets that from the cross-compiler prefix, not from CC, and we aren't passing anything in for CPP. So, for now, use wrappers to deal with it, to ensure that absolutely any call to any of the toolchain binaries will unload pseudo. JIRA: MEIP-393, SB-1905 Signed-off-by: Christopher Larson --- conf/distro/include/tcmode-external-sourcery.inc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/conf/distro/include/tcmode-external-sourcery.inc b/conf/distro/include/tcmode-external-sourcery.inc index 5989612..97b24e4 100644 --- a/conf/distro/include/tcmode-external-sourcery.inc +++ b/conf/distro/include/tcmode-external-sourcery.inc @@ -151,12 +151,12 @@ def populate_toolchain_links(d): 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)) + if not os.path.exists(newpath): + with open(newpath, 'w') as new: + new.write('#!/bin/sh\n') + new.write('export PSEUDO_UNLOAD=1\n') + new.write('exec {0} "$@"\n'.format(f)) + os.chmod(newpath, 0755) # Ensure that we have a ld.bfd available, now that KERNEL_LD uses it ld = d.expand('${TARGET_PREFIX}ld') From 5f48a48ec7cd330e82816623b1c1f15f00761037 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Thu, 10 Apr 2014 12:39:09 -0700 Subject: [PATCH 2/3] tcmode: use eventmask for the handler Signed-off-by: Christopher Larson --- conf/distro/include/tcmode-external-sourcery.inc | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/conf/distro/include/tcmode-external-sourcery.inc b/conf/distro/include/tcmode-external-sourcery.inc index 97b24e4..f4a1f68 100644 --- a/conf/distro/include/tcmode-external-sourcery.inc +++ b/conf/distro/include/tcmode-external-sourcery.inc @@ -98,9 +98,6 @@ TUNE_LDARGS += "${@'-m ${LDEMULATION}' if LDEMULATION else ''}" ERROR_QA[type] ?= "list" python toolchain_metadata_setup () { - if not isinstance(e, bb.event.ConfigParsed): - return - import subprocess d = e.data @@ -134,6 +131,7 @@ python toolchain_metadata_setup () { d.setVar('ERROR_QA', ' '.join(error_qa)) d.appendVar('WARN_QA', ' ldflags') } +toolchain_metadata_setup[eventmask] = "bb.event.ConfigParsed" addhandler toolchain_metadata_setup def populate_toolchain_links(d): From 075e1b76a419abd51401c4bd80b6df718b7305a6 Mon Sep 17 00:00:00 2001 From: Christopher Larson Date: Thu, 10 Apr 2014 12:56:01 -0700 Subject: [PATCH 3/3] csl-versions: use eventmask for the handler Signed-off-by: Christopher Larson --- conf/distro/include/csl-versions.inc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/conf/distro/include/csl-versions.inc b/conf/distro/include/csl-versions.inc index 7e45ed8..ea6109a 100644 --- a/conf/distro/include/csl-versions.inc +++ b/conf/distro/include/csl-versions.inc @@ -85,8 +85,6 @@ def csl_get_gdb_version(d): return first_line.split()[-1] python csl_version_handler () { - if not isinstance(e, bb.event.ConfigParsed): - return d = e.data ld = d.createCopy() ld.finalize() @@ -97,6 +95,7 @@ python csl_version_handler () { d.setVar('CSL_VER_KERNEL', csl_get_kernel_version(ld)) d.setVar('CSL_VER_GDB', csl_get_gdb_version(ld)) } +csl_version_handler[eventmask] = "bb.event.ConfigParsed" addhandler csl_version_handler # Ensure that any variable which includes the --sysroot (CC, CXX, etc) also