]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
u-boot: Separate out from kernel-arch.bbclass
authorRichard Purdie <richard.purdie@linuxfoundation.org>
Fri, 31 Jul 2026 10:34:58 +0000 (11:34 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 3 Aug 2026 17:04:08 +0000 (18:04 +0100)
Move the UBOOT_ARCH usage into u-boot.inc and stop using kernel-arch.bbclass
since there are things in there which u-boot might not want.

This does mean the ARCH and UBOOT_ARCH variables are no longer in the environment
but I hopefully covered the main uboot usages of the variables.

Also document where these values are from and what they're supposed to mean
explictly, including the difference between UBOOT_ARCH and UBOOT_ARCH_DIR.
UBOOT_ARCH_DIR has issues which will need discussion with newer platforms
which use dts/upstream.

You might think we need to set ARCH in EXTRA_OEMAKE for u-boot but it turns
out it was ignoring the value and setting it breaks builds. This patch
therefore doesn't do that after confirmation from the u-boot devs:

https://lists.u-boot-project.org/pipermail/u-boot/2026-July/627045.html

This is confirmed by the UBOOT_DTB patch which added the kernel-arch inherit
which is much later than when u-boot was established.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/kernel.py
meta/recipes-bsp/u-boot/u-boot.inc

index bab375c37aea1041d36bc50a0e477317b2bc806e..6c57ef402e82878bf7c0a3dc59eccc7408bdcd3e 100644 (file)
@@ -38,6 +38,8 @@ def map_kernel_arch(d):
             return a
         bb.error("cannot map '%s' to a linux kernel architecture" % a)
 
+# Return a value for the -A parameter to u-boot's mkimage
+# This would be the value from the table in boot/image.c:uimage_arch
 def map_uboot_arch(d):
     a = map_kernel_arch(d)
 
index a75948dfc3431600bf6996f0c4b92805ec7978be..3e2f5aa1a5fa28f59abc27ebf7d466b96a17298b 100644 (file)
@@ -6,7 +6,7 @@ PACKAGE_ARCH = "${MACHINE_ARCH}"
 DEPENDS += "${@bb.utils.contains('UBOOT_ENV_SUFFIX', 'scr', 'u-boot-mkimage-native', '', d)}"
 DEPENDS += "${@ 'u-boot-mkenvimage-native' if bb.utils.to_boolean(d.getVar('UBOOT_INITIAL_ENV_BINARY')) else ''}"
 
-inherit uboot-config uboot-extlinux-config uboot-sign deploy python3native kernel-arch
+inherit uboot-config uboot-extlinux-config uboot-sign deploy python3native
 
 DEPENDS += "swig-native"
 
@@ -34,6 +34,11 @@ UBOOT_INITIAL_ENV ?= "${PN}-initial-env"
 
 require u-boot-configure.inc
 
+UBOOT_ARCH = "${@oe.kernel.map_uboot_arch(d)}"
+# UBOOT_ARCH_DIR is the directory which contains the UBOOT_ARCH, i.e. the options are
+# the directories listed by "ls arch/" in the u-boot source. It is broken for platforms which
+# use dts/upstream.
+# arm contains arm and arm64.
 UBOOT_ARCH_DIR = "${@'arm' if d.getVar('UBOOT_ARCH').startswith('arm') else d.getVar('UBOOT_ARCH')}"
 do_compile () {
     unset LDFLAGS