Bug 15603

Summary: u-boot recipe cannot be used with devtool due to a bug in poky/meta/classes-recipe/uboot-config.bbclass
Product: [Build System, Metadata & Runtime] OE-Core Reporter: Iuliu Vasilescu <iuliuv>
Component: coreAssignee: Yoann Congal <yoann.congal>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: Medium CC: ccasciato, meta.mr.watcher, meta.watcher, poky.bs.watcher, poky.watcher, tim.orling, yoann.congal
Version: 5.0.16   
Target Milestone: 5.0.17   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: ---
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
patch for scarthgap
none
patch for master none

Description Iuliu Vasilescu 2024-10-01 13:49:10 UTC
This bug affects scarthgap and master at least. Steps to reproduce. For any machine/configuration. I have tested for NXP imx, using the NXP i.MX Yocto BSP:

devtool modify u-boot
devtool build -c u-boot
devtool build u-boot

the last command results in an error to due to do_configure trying to copy the .config from 
...u-boot/2024.04/build/.. which is not the correct build directory if devtool is active. The correct directory is ...u-boot/2024.4/u-boot-2024.04...

This is due to the fact that in poky/meta/classes-recipe/uboot-config.bbclass:
d.setVar('KCONFIG_CONFIG_ROOTDIR', os.path.join(d.getVar("B"), d.getVar("UBOOT_MACHINE").strip()))

the "B" var is expanded too early, before the new value set by devtool had a chance to be set. Proposed change which works but might not be the correct way to solve the issue is to change the line to:

d.setVar('KCONFIG_CONFIG_ROOTDIR', os.path.join("${B}/", d.getVar("UBOOT_MACHINE").strip()))


the exact error is here (notice it is u-boot-imx - which is the name of the recipe in this distro):
| cp: cannot stat '/imx/95/tmp/work/imx8mn_lpddr4_evk-poky-linux/u-boot-imx/2024.04/build/imx8mn_evk_defconfig/.config': No such file or directory
| WARNING: /imx/95/tmp/work/imx8mn_lpddr4_evk-poky-linux/u-boot-imx/2024.04/temp/run.do_configure.73156:175 exit 1 from 'cp /imx/95/tmp/work/imx8mn_lpddr4_evk-poky-linux/u-boot-imx/2024.04/build/imx8mn_evk_defconfig/.config /imx/95/workspace/sources/u-boot-imx/.config.baseline'
| WARNING: Backtrace (BB generated script):
|       #1: do_configure, /imx/95/tmp/work/imx8mn_lpddr4_evk-poky-linux/u-boot-imx/2024.04/temp/run.do_configure.73156, line 175
|       #2: main, /imx/95/tmp/work/imx8mn_lpddr4_evk-poky-linux/u-boot-imx/2024.04/temp/run.do_configure.73156, line 223
Comment 1 Tim Orling 2024-10-03 14:38:59 UTC
Would you be able to send a patch to not expand the variables?
Comment 2 Iuliu Vasilescu 2024-10-05 18:01:00 UTC
Created attachment 5070 [details]
patch for scarthgap
Comment 3 Iuliu Vasilescu 2024-10-05 18:01:33 UTC
Created attachment 5071 [details]
patch for master
Comment 4 Iuliu Vasilescu 2024-10-05 18:03:28 UTC
I've attached the proposed patch formatted for master and for scarthgap. Again, should be checked by someone with a good understanding of the whole devtool interaction.
Comment 5 Tim Orling 2024-10-10 15:24:36 UTC
Could you please send to the mailing list? we do not take patches from Bugzilla.

https://docs.yoctoproject.org/dev/contributor-guide/submit-changes.html

https://lists.openembedded.org/g/openembedded-core
Comment 6 Yoann Congal 2025-02-05 23:01:10 UTC
A patch was sent: "[PATCH v2] uboot-config: Fix devtool modify" By Tom Hochstein
https://lists.openembedded.org/g/openembedded-core/message/210880
Comment 7 Yoann Congal 2026-03-06 15:47:21 UTC
This has merged (~a year ago) in master (and is present on whinlatter):
commit 57b21065a25100c31515b32fd7c77bde3355d684
Author: Tom Hochstein <tom.hochstein@oss.nxp.com>
Date:   Wed Feb 5 16:18:55 2025 -0600

    uboot-config: Fix devtool modify
https://git.openembedded.org/openembedded-core/commit/?id=57b21065a25100c31515b32fd7c77bde3355d684

I'll take it for scarthgap since I had a request for a backport:
[scarthgap][PATCH] uboot-config: Fix devtool modify #scarthgap - nicolas.heemeryck
https://lore.kernel.org/openembedded-core/NOkm.1772551368148819834.HwYd@lists.openembedded.org/