Fixes to enable cross-canadian toolchains
cover Fixes to enable cross-canadian toolchains
I've been working to enable putting a cross-compiler on a regular Yocto target (as opposed to SDKs), and these are the changes needed in oe-core to enable that.
Two of them swap TARGET for HOST (the terminology is set by the GNU project, it is confusing, but it still needs to be followed), one allows populating the native sysroot of a target recipe with the output of two different cross recipes building for different TARGETs.
The actual cross-compiler is available from here, please refer to the README:
https://github.com/kanavin/meta-cross-toolchain
The plan is to further investigate what happens inside gcc's build system so that the way that layer works can be better aligned with oe-core.
Alexander Kanavin (3):
base/staging: use HOST_PREFIX, not TARGET_PREFIX
sstate: do not add TARGET_ARCH to pkgarch for cross recipes.
insane: use HOST_ variables, not TARGET_ to determine the cross system
meta/classes/base.bbclass | 2 +- meta/classes/insane.bbclass | 8 ++++---- meta/classes/sstate.bbclass | 3 +-- meta/classes/staging.bbclass | 4 ++-- meta/lib/oe/sstatesig.py | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-)
Signature · 1 line
2.20.1
PATCH 1/3 base/staging: use HOST_PREFIX, not TARGET_PREFIX
This matters when cross-compiling a cross-toolchain:
we need to specify the system where the toolchain will run, not the system it will produce output for.
For everything else, HOST and TARGET are the same.
--- meta/classes/base.bbclass | 2 +- meta/classes/staging.bbclass | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-)
meta/classes/base.bbclass +1 -1
@@ -71,7 +71,7 @@ def get_base_dep(d): return "" return "${BASE_DEFAULT_DEPS}" -BASE_DEFAULT_DEPS = "virtual/${TARGET_PREFIX}gcc virtual/${TARGET_PREFIX}compilerlibs virtual/libc" +BASE_DEFAULT_DEPS = "virtual/${HOST_PREFIX}gcc virtual/${HOST_PREFIX}compilerlibs virtual/libc" BASEDEPENDS = "" BASEDEPENDS:class-target = "${@get_base_dep(d)}"
meta/classes/staging.bbclass +2 -2
@@ -119,8 +119,8 @@ do_populate_sysroot[vardeps] += "${SYSROOT_PREPROCESS_FUNCS}" do_populate_sysroot[vardepsexclude] += "BB_MULTI_PROVIDER_ALLOWED" POPULATESYSROOTDEPS = "" -POPULATESYSROOTDEPS:class-target = "virtual/${MLPREFIX}${TARGET_PREFIX}binutils:do_populate_sysroot" -POPULATESYSROOTDEPS:class-nativesdk = "virtual/${TARGET_PREFIX}binutils-crosssdk:do_populate_sysroot" +POPULATESYSROOTDEPS:class-target = "virtual/${MLPREFIX}${HOST_PREFIX}binutils:do_populate_sysroot" +POPULATESYSROOTDEPS:class-nativesdk = "virtual/${HOST_PREFIX}binutils-crosssdk:do_populate_sysroot" do_populate_sysroot[depends] += "${POPULATESYSROOTDEPS}" SSTATETASKS += "do_populate_sysroot"
Signature · 1 line
2.20.1
PATCH 2/3 sstate: do not add TARGET_ARCH to pkgarch for cross recipes.
In reply to Alexander KanavinThis is redundant (target arch is already in PN), and breaks compiling a cross-canadian toolchain, as that needs populating the sysroot with two different native-hosted toolchains built from cross recipes. Inserting TARGET_ARCH allows only one or the other.
--- meta/classes/sstate.bbclass | 3 +-- meta/lib/oe/sstatesig.py | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-)
meta/classes/sstate.bbclass +1 -2
@@ -83,7 +83,6 @@ SSTATE_ARCHS = " \ ${BUILD_ARCH} \ ${BUILD_ARCH}_${ORIGNATIVELSBSTRING} \ ${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS} \ - ${BUILD_ARCH}_${TARGET_ARCH} \ ${SDK_ARCH}_${SDK_OS} \ ${SDK_ARCH}_${PACKAGE_ARCH} \ allarch \
@@ -138,7 +137,7 @@ python () { elif bb.data.inherits_class('crosssdk', d): d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}")) elif bb.data.inherits_class('cross', d): - d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}_${TARGET_ARCH}")) + d.setVar('SSTATE_PKGARCH', d.expand("${BUILD_ARCH}")) elif bb.data.inherits_class('nativesdk', d): d.setVar('SSTATE_PKGARCH', d.expand("${SDK_ARCH}_${SDK_OS}")) elif bb.data.inherits_class('cross-canadian', d):
meta/lib/oe/sstatesig.py +1 -1
@@ -443,7 +443,7 @@ def find_sstate_manifest(taskdata, taskdata2, taskname, d, multilibcache): elif "-cross-canadian" in taskdata: pkgarchs = ["${SDK_ARCH}_${SDK_ARCH}-${SDKPKGSUFFIX}"] elif "-cross-" in taskdata: - pkgarchs = ["${BUILD_ARCH}_${TARGET_ARCH}"] + pkgarchs = ["${BUILD_ARCH}"] elif "-crosssdk" in taskdata: pkgarchs = ["${BUILD_ARCH}_${SDK_ARCH}_${SDK_OS}"] else:
Signature · 1 line
2.20.1
PATCH 3/3 insane: use HOST_ variables, not TARGET_ to determine the cross system
In reply to Alexander KanavinAlmost everywhere those are the same, except when making a cross toolchain where HOST_ is where it's going to run, and TARGET_ is what it's going to produce.
--- meta/classes/insane.bbclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
meta/classes/insane.bbclass +4 -4
@@ -325,8 +325,8 @@ def package_qa_check_arch(path,name,d, elf, messages): if not elf: return - target_os = d.getVar('TARGET_OS') - target_arch = d.getVar('TARGET_ARCH') + target_os = d.getVar('HOST_OS') + target_arch = d.getVar('HOST_ARCH') provides = d.getVar('PROVIDES') bpn = d.getVar('BPN')
@@ -691,8 +691,8 @@ def prepopulate_objdump_p(elf, d): # Walk over all files in a directory and call func def package_qa_walk(warnfuncs, errorfuncs, package, d): #if this will throw an exception, then fix the dict above - target_os = d.getVar('TARGET_OS') - target_arch = d.getVar('TARGET_ARCH') + target_os = d.getVar('HOST_OS') + target_arch = d.getVar('HOST_ARCH') warnings = {} errors = {}
Signature · 1 line
2.20.1
Re: [OE-core] [PATCH 3/3] insane: use HOST_ variables, not TARGET_ to determine the cross system
Quoted 14 lines · Alexander Kanavin
Almost everywhere those are the same, except when making a cross toolchain where
HOST_is where it's going to run, andTARGET_is what it's going to produce.Signed-off-by Alexander Kanavin <[email protected]>--- meta/classes/insane.bbclass | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)meta/classes/insane.bbclass +0
-0
meta/classes/insane.bbclass def package_qa_check_arch(path,name,d, elf, messages): · line 331
Quoted 9 lines
meta/classes/insane.bbclass +2
-2@@ -325,8 +325,8 @@ def package_qa_check_arch(path,name,d, elf, messages): if not elf: return - target_os = d.getVar('TARGET_OS') - target_arch = d.getVar('TARGET_ARCH') + target_os = d.getVar('HOST_OS') + target_arch = d.getVar('HOST_ARCH') provides = d.getVar('PROVIDES') bpn = d.getVar('BPN')
Interestingly I was just looking at this code. Does this change mean we can remove the skipping of nativesdk recipes in the arch check?
Ross
Re: [OE-core] [PATCH 3/3] insane: use HOST_ variables, not TARGET_ to determine the cross system
Quoted 9 lines · Ross Burton
meta/classes/insane.bbclass def package_qa_check_arch(path,name,d, elf, messages): · line 331
Quoted 6 lines
meta/classes/insane.bbclass +2
-2- target_os = d.getVar('TARGET_OS') - target_arch = d.getVar('TARGET_ARCH') + target_os = d.getVar('HOST_OS') + target_arch = d.getVar('HOST_ARCH') provides = d.getVar('PROVIDES') bpn = d.getVar('BPN')Interestingly I was just looking at this code. Does this change mean we can remove the skipping of nativesdk recipes in the arch check?
I don't know, the only answer I have is 'patches welcome' :)
Alex