mirror of
https://git.yoctoproject.org/poky
synced 2026-02-10 18:53:13 +01:00
Currently this code installs into the standard sysroot, however this causes some conflicts when linking since the linker can look specifically for versioned .so files (e.g. like libpthreads.so.0). This breaks builds of util-linux-native for example. The easiest solution is to install uninative into its own separate sysroot. (From OE-Core rev: e2403bc637e2967a028718058f987cc8841a6edc) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
83 lines
3.5 KiB
Plaintext
83 lines
3.5 KiB
Plaintext
NATIVELSBSTRING = "universal"
|
|
|
|
UNINATIVE_LOADER ?= "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux/lib/${@bb.utils.contains('BUILD_ARCH', 'x86_64', 'ld-linux-x86-64.so.2', 'ld-linux.so.2', d)}"
|
|
|
|
UNINATIVE_URL ?= "unset"
|
|
UNINATIVE_TARBALL ?= "${BUILD_ARCH}-nativesdk-libc.tar.bz2"
|
|
# Example checksums
|
|
#UNINATIVE_CHECKSUM[i586] = "dead"
|
|
#UNINATIVE_CHECKSUM[x86_64] = "dead"
|
|
UNINATIVE_DLDIR ?= "${COREBASE}"
|
|
|
|
addhandler uninative_eventhandler
|
|
uninative_eventhandler[eventmask] = "bb.event.BuildStarted"
|
|
|
|
python uninative_eventhandler() {
|
|
loader = e.data.getVar("UNINATIVE_LOADER", True)
|
|
tarball = d.getVar("UNINATIVE_TARBALL", True)
|
|
tarballdir = d.getVar("UNINATIVE_DLDIR", True)
|
|
if not os.path.exists(loader):
|
|
import subprocess
|
|
|
|
olddir = os.getcwd()
|
|
if not os.path.exists(os.path.join(tarballdir, tarball)):
|
|
# Copy the data object and override DL_DIR and SRC_URI
|
|
localdata = bb.data.createCopy(d)
|
|
|
|
if d.getVar("UNINATIVE_URL", True) == "unset":
|
|
bb.fatal("Uninative selected but not configured, please set UNINATIVE_URL")
|
|
|
|
chksum = d.getVarFlag("UNINATIVE_CHECKSUM", d.getVar("BUILD_ARCH", True), True)
|
|
if not chksum:
|
|
bb.fatal("Uninative selected but not configured correctly, please set UNINATIVE_CHECKSUM[%s]" % d.getVar("BUILD_ARCH", True))
|
|
|
|
srcuri = d.expand("${UNINATIVE_URL}${UNINATIVE_TARBALL};md5sum=%s" % chksum)
|
|
dldir = localdata.expand(tarballdir)
|
|
localdata.setVar('FILESPATH', dldir)
|
|
localdata.setVar('DL_DIR', dldir)
|
|
bb.note("Fetching uninative binary shim from %s" % srcuri)
|
|
fetcher = bb.fetch2.Fetch([srcuri], localdata, cache=False)
|
|
try:
|
|
fetcher.download()
|
|
except Exception as exc:
|
|
bb.fatal("Unable to download uninative tarball: %s" % str(exc))
|
|
|
|
cmd = e.data.expand("mkdir -p ${STAGING_DIR}-uninative; cd ${STAGING_DIR}-uninative; tar -xjf ${UNINATIVE_DLDIR}/${UNINATIVE_TARBALL}; ${STAGING_DIR}-uninative/relocate_sdk.py ${STAGING_DIR}-uninative/${BUILD_ARCH}-linux ${UNINATIVE_LOADER} ${UNINATIVE_LOADER} ${STAGING_DIR}-uninative/${BUILD_ARCH}-linux/patchelf-uninative")
|
|
try:
|
|
subprocess.check_call(cmd, shell=True)
|
|
except subprocess.CalledProcessError as exc:
|
|
bb.fatal("Unable to install uninative tarball: %s" % str(exc))
|
|
os.chdir(olddir)
|
|
}
|
|
|
|
SSTATEPOSTUNPACKFUNCS_append = " uninative_changeinterp"
|
|
|
|
PATH_prepend = "${STAGING_DIR}-uninative/${BUILD_ARCH}-linux${bindir_native}:"
|
|
|
|
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)
|
|
}
|