OCI requires that the architecture [1] be a valid GOARCH [2]. "x86_64"
is not a valid GOARCH so map it to the correct "amd64" value.

Signed-off-by: Joshua Watt <[email protected]>

[1]: https://github.com/opencontainers/image-spec/blob/main/config.md#properties
[2]: https://go.dev/doc/install/source#environment

Signed-off-by: Joshua Watt <[email protected]>
---
 classes/image-oci.bbclass | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/classes/image-oci.bbclass b/classes/image-oci.bbclass
index 9ddb88b..3370f86 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 ?= "${TARGET_ARCH}"
+OCI_IMAGE_ARCH ?= "${@oci_map_arch(d.getVar('TARGET_ARCH'))}"
 OCI_IMAGE_SUBARCH ?= "${@oci_map_subarch(d.getVar('TARGET_ARCH'), 
d.getVar('TUNE_FEATURES'), d)}"
 
 OCI_IMAGE_ENTRYPOINT ?= "sh"
@@ -74,6 +74,13 @@ OCI_IMAGE_ENV_VARS ?= ""
 # bundled into a tarball.
 OCI_IMAGE_TAR_OUTPUT ?= "true"
 
+# Map architectures to a valid container arch. Note that the container archs
+# should be a valid GOARCH
+def oci_map_arch(a):
+    if a == "x86_64":
+        return "amd64"
+    return a
+
 # Generate a subarch that is appropriate to OCI image
 # types. This is typically only ARM architectures at the
 # moment.
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#8376): 
https://lists.yoctoproject.org/g/meta-virtualization/message/8376
Mute This Topic: https://lists.yoctoproject.org/mt/102006091/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/meta-virtualization/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to