From 0c785e1100862ed6280fa96a39b021bea08f7cd0 Mon Sep 17 00:00:00 2001 From: Bruce Ashfield Date: Tue, 7 Nov 2023 14:14:54 +0000 Subject: image-oci: map architectures using local function commit 115f636 [classes/image-oci: Map image architecture correctly] fixes architecture mapping, but uses a library function that isn't available in nanbield. We make a local copy of that go_arch mapping function and maintain it locally, so we fix the architecture mapping exactly the same way. Signed-off-by: Bruce Ashfield --- classes/image-oci.bbclass | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) (limited to 'classes/image-oci.bbclass') diff --git a/classes/image-oci.bbclass b/classes/image-oci.bbclass index 0ec5c487..4453b709 100644 --- a/classes/image-oci.bbclass +++ b/classes/image-oci.bbclass @@ -52,7 +52,7 @@ OCI_IMAGE_AUTHOR_EMAIL ?= "${PATCH_GIT_USER_EMAIL}" OCI_IMAGE_TAG ?= "latest" OCI_IMAGE_RUNTIME_UID ?= "" -OCI_IMAGE_ARCH ?= "${@oe.go.map_arch(d.getVar('TARGET_ARCH'))}" +OCI_IMAGE_ARCH ?= "${@oci_map_arch(d.getVar('TARGET_ARCH'), d)}" OCI_IMAGE_SUBARCH ?= "${@oci_map_subarch(d.getVar('TARGET_ARCH'), d.getVar('TUNE_FEATURES'), d)}" OCI_IMAGE_ENTRYPOINT ?= "sh" @@ -74,6 +74,39 @@ OCI_IMAGE_ENV_VARS ?= "" # bundled into a tarball. OCI_IMAGE_TAR_OUTPUT ?= "true" +# this is from goarch.bbclass. We currently can't inherit +# the entire goarch bbclass, so we duplicate the function +# here. This moves to a library function in newer releases +# so we no longer need this. +def oci_map_arch(a, d): + import re + if re.match('i.86', a): + return '386' + elif a == 'x86_64': + return 'amd64' + elif re.match('arm.*', a): + return 'arm' + elif re.match('aarch64.*', a): + return 'arm64' + elif re.match('mips64el.*', a): + return 'mips64le' + elif re.match('mips64.*', a): + return 'mips64' + elif a == 'mips': + return 'mips' + elif a == 'mipsel': + return 'mipsle' + elif re.match('p(pc|owerpc)(64le)', a): + return 'ppc64le' + elif re.match('p(pc|owerpc)(64)', a): + return 'ppc64' + elif a == 'riscv64': + return 'riscv64' + elif a == 'loongarch64': + return 'loong64' + else: + raise bb.parse.SkipRecipe("Unsupported CPU architecture: %s" % a) + # Generate a subarch that is appropriate to OCI image # types. This is typically only ARM architectures at the # moment. -- cgit v1.2.3-54-g00ecf