From: Ryan Eatmon Date: Thu, 8 Jan 2026 20:22:38 +0000 (-0600) Subject: u-boot: Add support for UBOOT_CONFIG_FRAGMENTS and UBOOT_FRAGMENTS X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9e96d3dedee47657657686310508e0aaee7f4e02;p=thirdparty%2Fopenembedded%2Fopenembedded-core.git u-boot: Add support for UBOOT_CONFIG_FRAGMENTS and UBOOT_FRAGMENTS 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 Signed-off-by: Mathieu Dubois-Briand Signed-off-by: Richard Purdie --- diff --git a/meta/classes-recipe/uboot-config.bbclass b/meta/classes-recipe/uboot-config.bbclass index 715fb5c1d2..823a66157a 100644 --- a/meta/classes-recipe/uboot-config.bbclass +++ b/meta/classes-recipe/uboot-config.bbclass @@ -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: diff --git a/meta/recipes-bsp/u-boot/u-boot-configure.inc b/meta/recipes-bsp/u-boot/u-boot-configure.inc index 337b8ed6c3..379637e73e 100644 --- a/meta/recipes-bsp/u-boot/u-boot-configure.inc +++ b/meta/recipes-bsp/u-boot/u-boot-configure.inc @@ -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