diff options
author | Patrick Williams <patrick@stwcx.xyz> | 2015-09-15 22:41:29 +0300 |
---|---|---|
committer | Patrick Williams <patrick@stwcx.xyz> | 2015-09-15 22:41:29 +0300 |
commit | 21f9b84b4b729fbd7acbd465e7a3f726e4d20f91 (patch) | |
tree | eb2d091d427ca0813b445509d59cc8e27e8ad25f /yocto-poky/meta/classes/uninative.bbclass | |
parent | 101cef31e2bf54c678501155cd2106251acbd076 (diff) | |
parent | c124f4f2e04dca16a428a76c89677328bc7bf908 (diff) | |
download | openbmc-21f9b84b4b729fbd7acbd465e7a3f726e4d20f91.tar.xz |
Merge commit 'c124f4f2e04dca16a428a76c89677328bc7bf908' as 'yocto-poky'
Diffstat (limited to 'yocto-poky/meta/classes/uninative.bbclass')
-rw-r--r-- | yocto-poky/meta/classes/uninative.bbclass | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/yocto-poky/meta/classes/uninative.bbclass b/yocto-poky/meta/classes/uninative.bbclass new file mode 100644 index 000000000..51391dbc4 --- /dev/null +++ b/yocto-poky/meta/classes/uninative.bbclass @@ -0,0 +1,44 @@ +NATIVELSBSTRING = "universal" + +UNINATIVE_LOADER = "${STAGING_DIR_NATIVE}/lib/ld-linux-x86-64.so.2" + +addhandler uninative_eventhandler +uninative_eventhandler[eventmask] = "bb.event.BuildStarted" + +python uninative_eventhandler() { + loader = e.data.getVar("UNINATIVE_LOADER", True) + if not os.path.exists(loader): + import subprocess + cmd = e.data.expand("mkdir -p ${STAGING_DIR}; cd ${STAGING_DIR}; tar -xjf ${COREBASE}/${BUILD_ARCH}-nativesdk-libc.tar.bz2; ${STAGING_DIR}/relocate_sdk.py ${STAGING_DIR_NATIVE} ${UNINATIVE_LOADER} ${UNINATIVE_LOADER} ${STAGING_BINDIR_NATIVE}/patchelf-uninative") + #bb.warn("nativesdk lib extraction: " + cmd) + subprocess.check_call(cmd, shell=True) +} + +SSTATEPOSTUNPACKFUNCS_append = " uninative_changeinterp" + +python uninative_changeinterp () { + import subprocess + import stat + import oe.qa + + if not (bb.data.inherits_class('native', d) or bb.data.inherits_class('crosssdk', d) or bb.data.inherits_class('cross', d)): + return + + sstateinst = d.getVar('SSTATE_INSTDIR', True) + for walkroot, dirs, files in os.walk(sstateinst): + for file in files: + f = os.path.join(walkroot, file) + if os.path.islink(f): + continue + s = os.stat(f) + if not ((s[stat.ST_MODE] & stat.S_IXUSR) or (s[stat.ST_MODE] & stat.S_IXGRP) or (s[stat.ST_MODE] & stat.S_IXOTH)): + continue + elf = oe.qa.ELFFile(f) + try: + elf.open() + except: + continue + + #bb.warn("patchelf-uninative --set-interpreter %s %s" % (d.getVar("UNINATIVE_LOADER", True), f)) + subprocess.call("patchelf-uninative --set-interpreter %s %s" % (d.getVar("UNINATIVE_LOADER", True), f), shell=True) +} |