Bug 12395 - kernel set up with devtool modify builds with wrong config after cleaning
Summary: kernel set up with devtool modify builds with wrong config after cleaning
Status: NEW
Alias: None
Product: OE-Core
Classification: Build System, Metadata & Runtime
Component: Scripts and Tools (show other bugs)
Version: 2.4
Hardware: x86 Multiple
: Medium+ normal
Target Milestone: 5.99
Assignee: Eilís Ní Fhlannagáin
QA Contact:
URL:
Whiteboard:
Depends on:
Blocks:
 
Reported: 2017-12-05 02:15 UTC by Paul Eggleton
Modified: 2025-07-29 00:36 UTC (History)
5 users (show)

See Also:
OS type for building Yocto: ---
Type of Regression: ---
Verified:
Documentation change: No (bug/feature does not impact docs)


Attachments
Fix for kernel config loss in devtool modify workflow (1.80 KB, patch)
2025-07-27 01:19 UTC, Jacob Panov
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Paul Eggleton 2017-12-05 02:15:42 UTC
If you run devtool modify on the kernel, run bitbake -c clean, then try to build the kernel again the configuration will be different:

devtool modify virtual/kernel
bitbake virtual/kernel
cp tmp/work-shared/qemux86-64/kernel-build-artifacts/.config kconfig-good
bitbake -c clean virtual/kernel
bitbake virtual/kernel
diff -udN kconfig-good tmp/work/qemux86_64-poky-linux/linux-yocto/4.12.14+git999-r0/linux-yocto-4.12.14+git999/.config

(The second build of the kernel will almost certainly fail because it will try to generate X.509 certificates and openssl-native isn't in DEPENDS, so the openssl command won't be available to run.)

There is some logic set up in the workspace bbappend for the kernel that sets up the configuration, and I suspect this is where the problem lies - it moves the configuration into place from ${S} to ${B} the first time but the second time around it's not there to move, and you get the default kernel configuration instead.
Comment 1 Randy MacLeod 2022-05-12 15:30:01 UTC
May also need a test.
Comment 2 Randy MacLeod 2023-10-24 14:24:33 UTC
Bulk move from 4.99 or 0.00 to 5.99
Comment 3 Jacob Panov 2025-07-27 01:15:04 UTC
I found that the do_kernel_configme:prepend function standard.py unconditionally moved existing .config files, causing legitimate user configurations to be lost after clean/rebuild cycles.

I changed the logic to preserve legitimate user configurations by checking for .config.baseline presence:

# Before (problematic):
if [ -e ${S}/.config ]; then
    mv ${S}/.config ${S}/.config.old
fi

# After:
if [ -e ${S}/.config ] && [ ! -e ${S}/.config.baseline ]; then
    mv ${S}/.config ${S}/.config.old
fi

User configs with.config.baseline are preserved and stale configs without .config.baseline are moved appropriately.

Patch available for integration.
Comment 4 Jacob Panov 2025-07-27 01:19:16 UTC
Created attachment 5128 [details]
Fix for kernel config loss in devtool modify workflow

The do_kernel_configme:prepend function in scripts/lib/devtool/standard.py unconditionally moved existing .config files, causing legitimate user configurations to be lost after clean/rebuild cycles.

Enhanced the logic to preserve legitimate user configurations by checking for .config.baseline presence:

# Before:
if [ -e ${S}/.config ]; then
    mv ${S}/.config ${S}/.config.old
fi

# After:
if [ -e ${S}/.config ] && [ ! -e ${S}/.config.baseline ]; then
    mv ${S}/.config ${S}/.config.old
fi