]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
u-boot: Add support for UBOOT_CONFIG_FRAGMENTS and UBOOT_FRAGMENTS
authorRyan Eatmon <reatmon@ti.com>
Thu, 8 Jan 2026 20:22:38 +0000 (14:22 -0600)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 19 Jan 2026 17:46:18 +0000 (17:46 +0000)
There are config fragments that live in the u-boot source tree.
UBOOT_FRAGMENTS will globally add a set of fragments to the configure.
UBOOT_CONFIG_FRAGMENTS makes use of the overhauled config flow to add
support for specifying alternative fragments for each variation build.

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/uboot-config.bbclass
meta/recipes-bsp/u-boot/u-boot-configure.inc

index 715fb5c1d210d26cfa83569f426a9396ae3c7a8a..823a66157ac52c5e17ee8420c1cb0d2cb4d67086 100644 (file)
@@ -18,6 +18,8 @@
 # UBOOT_CONFIG_MAKE_OPTS[foo] = "FOO=1"
 # UBOOT_CONFIG_MAKE_OPTS[bar] = "BAR=1"
 #
+# UBOOT_CONFIG_FRAGMENTS[foo] = "foo.fragment"
+#
 # For more information about this, please see the official documentation.
 #
 # There is a legacy method that is still supported where some of the above
@@ -57,6 +59,7 @@ UBOOT_IMAGE ?= "${UBOOT_BINARYNAME}-${MACHINE}-${UBOOT_VERSION}.${UBOOT_SUFFIX}"
 UBOOT_SYMLINK ?= "${UBOOT_BINARYNAME}-${MACHINE}.${UBOOT_SUFFIX}"
 UBOOT_MAKE_TARGET ?= "all"
 UBOOT_MAKE_OPTS ?= ""
+UBOOT_FRAGMENTS ?= ""
 
 # Output the ELF generated. Some platforms can use the ELF file and directly
 # load it (JTAG booting, QEMU) additionally the ELF can be used for debugging
@@ -141,6 +144,8 @@ python () {
     ubootconfigbinaryflags = d.getVarFlags('UBOOT_CONFIG_BINARY')
     ubootconfigmakeopts = d.getVar('UBOOT_CONFIG_MAKE_OPTS')
     ubootconfigmakeoptsflags = d.getVarFlags('UBOOT_CONFIG_MAKE_OPTS')
+    ubootconfigfragments = d.getVar('UBOOT_CONFIG_FRAGMENTS')
+    ubootconfigfragmentsflags = d.getVarFlags('UBOOT_CONFIG_FRAGMENTS')
     # The "doc" varflag is special, we don't want to see it here
     ubootconfigflags.pop('doc', None)
     ubootconfig = (d.getVar('UBOOT_CONFIG') or "").split()
@@ -164,6 +169,9 @@ python () {
     if ubootconfigmakeopts:
         raise bb.parse.SkipRecipe("You cannot use UBOOT_CONFIG_MAKE_OPTS as a variable, you can only set flags.")
 
+    if ubootconfigfragments:
+        raise bb.parse.SkipRecipe("You cannot use UBOOT_CONFIG_FRAGMENTS as a variable, you can only set flags.")
+
     if len(ubootconfig) > 0:
         for config in ubootconfig:
             found = False
@@ -220,6 +228,17 @@ python () {
             bb.debug(1, "Appending '%s' to UBOOT_CONFIG_MAKE_OPTS." % make_opts)
             d.appendVar('UBOOT_CONFIG_MAKE_OPTS', make_opts + " ? ")
 
+            # Extract out any settings from UBOOT_CONFIG_FRAGMENTS[config]
+            fragments = ""
+            if ubootconfigfragmentsflags:
+                for f, v in ubootconfigfragmentsflags.items():
+                    if config == f:
+                        bb.debug(1, "Staging '%s' for UBOOT_CONFIG_FRAGMENTS." % v)
+                        fragments = v
+
+            bb.debug(1, "Appending '%s' to UBOOT_CONFIG_FRAGMENTS." % fragments)
+            d.appendVar('UBOOT_CONFIG_FRAGMENTS', fragments + " ? ")
+
             # This recipe might be inherited e.g. by the kernel recipe via kernel-fitimage.bbclass
             # Ensure the uboot specific menuconfig settings do not leak into other recipes
             if 'u-boot' in recipename:
index 337b8ed6c338b3812a484841ffb58e42f68d0c29..379637e73e271da81b6f685d84926fb284859070 100644 (file)
@@ -36,8 +36,9 @@ uboot_configure_config () {
     builddir="${config}-${type}"
 
     config_make_opts=$(uboot_config_get_indexed_value "${UBOOT_CONFIG_MAKE_OPTS}" $i)
+    config_fragments=$(uboot_config_get_indexed_value "${UBOOT_CONFIG_FRAGMENTS}" $i)
 
-    oe_runmake -C ${S} O=${B}/${builddir} ${config_make_opts} ${UBOOT_MAKE_OPTS} ${config}
+    oe_runmake -C ${S} O=${B}/${builddir} ${config_make_opts} ${UBOOT_MAKE_OPTS} ${config} ${config_fragments} ${UBOOT_FRAGMENTS}
     if [ -n "${@' '.join(find_cfgs(d))}" ]; then
         merge_config.sh -m -O ${B}/${builddir} ${B}/${builddir}/.config ${@" ".join(find_cfgs(d))}
         oe_runmake -C ${S} O=${B}/${builddir} oldconfig
@@ -46,7 +47,7 @@ uboot_configure_config () {
 
 uboot_configure () {
     if [ -n "${UBOOT_MACHINE}" ]; then
-        oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_OPTS} ${UBOOT_MACHINE}
+        oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_OPTS} ${UBOOT_MACHINE} ${UBOOT_FRAGMENTS}
     else
         oe_runmake -C ${S} O=${B} ${UBOOT_MAKE_OPTS} oldconfig
     fi