Bug 15478

Summary: do_menuconfig for linux-yocto fails with kernel-fitimage and UBOOT_CONFIG
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Tim <tim.vanderstaaij>
Component: kernelAssignee: Bruce Ashfield <bruce.ashfield>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium+ CC: adrian.freihofer, randy.macleod, richard.purdie, Rouven.Rastetter
Version: 5.0   
Target Milestone: 6.1 M1   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)

Description Tim 2024-05-06 14:19:41 UTC
When KERNEL_CLASSES contains kernel-fitimage, and UBOOT_CONFIG is used instead of UBOOT_MACHINE, then `bitbake -c menuconfig linux-yocto` fails with:

ERROR: linux-yocto-6.6.23+git-r0 do_menuconfig: do_menuconfig is disabled, please check KCONFIG_CONFIG_ENABLE_MENUCONFIG variable.
ERROR: Logfile of failure stored in: <projectroot>/build/tmp/work/qemuarm-poky-linux-gnueabi/linux-yocto/6.6.23+git/temp/log.do_menuconfig.1050647
ERROR: Task (<projectroot>/sources/poky/meta/recipes-kernel/linux/linux-yocto_6.6.bb:do_menuconfig) failed with exit code '1'

Minimal reproducible example:

build/conf/bblayers.conf
---
POKY_BBLAYERS_CONF_VERSION = "2"
BBPATH = "${TOPDIR}"
BBFILES ?= ""
YOCTOROOT = "${@os.path.abspath(os.path.join("${TOPDIR}", os.pardir))}"
BBLAYERS ?= " \
  ${YOCTOROOT}/sources/poky/meta \
  ${YOCTOROOT}/sources/poky/meta-poky \
  "
---

build/conf/local.conf as generated by `oe-init-build-env`, with the addition of:
---
MACHINE = "qemuarm"
KERNEL_CLASSES += "kernel-fitimage"
UBOOT_MACHINE = ""
UBOOT_CONFIG = "confa confb"
UBOOT_CONFIG[confa] = "qemu_arm_defconfig"
UBOOT_CONFIG[confb] = "qemu_arm_defconfig"
---

The error message suggests that this was introduced by 0241bdb, and reverting that commit does indeed solve the issue.

The error message suggests that setting KCONFIG_CONFIG_ENABLE_MENUCONFIG = "true" in local.conf or a linux-yocto bbappend could be a workaround, but this doesn't help.
Comment 1 Rouven Rastetter 2024-10-18 15:30:58 UTC
I can confirm this bug. I imagine the correct fix is probably to split uboot-config.bbclass so that fitimage.bbclass can only include relevant parts?

We currently fixed it by only executing the offending logic, when the current recipe PROVIDES u-boot:

diff --git a/meta/classes-recipe/uboot-config.bbclass b/meta/classes-recipe/uboot-config.bbclass
index 28d5545b27..fd05924415 100644
--- a/meta/classes-recipe/uboot-config.bbclass
+++ b/meta/classes-recipe/uboot-config.bbclass
@@ -94,6 +94,10 @@ UBOOT_DTB_BINARY ??= ""
 UBOOT_FIT_CHECK_SIGN ?= "uboot-fit_check_sign"
 
 python () {
+    # we may not be building a u-boot recipe, e.g. fitimage.bbclass also includes uboot-config.bbclass
+    if not bb.utils.contains('PROVIDES', 'u-boot', True, False, d):
+        return
+
     ubootmachine = d.getVar("UBOOT_MACHINE")
     ubootconfigflags = d.getVarFlags('UBOOT_CONFIG')
     ubootbinary = d.getVar('UBOOT_BINARY')
-- 
2.47.0
Comment 2 Rouven Rastetter 2024-11-15 10:52:26 UTC
Update: This is already fixed in styhead by

19931344ade6044cd6e3a01af452315910d36ec2 uboot-config: fix devtool modify with kernel-fitimage

At least I can't reproduce the problem in styhead.
Comment 3 Adrian 2024-12-11 22:23:41 UTC
Probably there are two issues here: With commit 19931344ade6044cd6e3a01af452315910d36ec2 it works for one u-boot configuration set via UBOOT_MACHINE. But it still fails if UBOOT_CONFIG with more than one build configuration is used.

This is also interesting: https://lists.yoctoproject.org/g/yocto/message/64152, but to be honest I don't understand it. Is there an issue with parsing d.getVar("B") versus "${B}"?
Comment 4 Randy MacLeod 2025-04-24 18:54:44 UTC
Bulk move as requesting during YP BB meeting.
Comment 5 Adrian 2026-05-28 15:10:44 UTC
The kernel-fitimage.bbclass does no longer exist. I think we can then also close this issue.