<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>12395</bug_id>
          
          <creation_ts>2017-12-05 02:15:42 +0000</creation_ts>
          <short_desc>kernel set up with devtool modify builds with wrong config after cleaning</short_desc>
          <delta_ts>2025-07-29 00:36:43 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>Scripts and Tools</component>
          <version>2.4</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard> </status_whiteboard>
          <keywords></keywords>
          <priority>Medium+</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>5.99</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Paul Eggleton">bluelightning</reporter>
          <assigned_to name="Eilís Ní Fhlannagáin">pidge</assigned_to>
          <cc>ccasciato</cc>
    
    <cc>jacobpanov</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
    
    <cc>tim.orling</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>78508</commentid>
    <comment_count>0</comment_count>
    <who name="Paul Eggleton">bluelightning</who>
    <bug_when>2017-12-05 02:15:42 +0000</bug_when>
    <thetext>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&apos;t in DEPENDS, so the openssl command won&apos;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&apos;s not there to move, and you get the default kernel configuration instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>93263</commentid>
    <comment_count>1</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2022-05-12 15:30:01 +0000</bug_when>
    <thetext>May also need a test.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>96865</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2023-10-24 14:24:33 +0000</bug_when>
    <thetext>Bulk move from 4.99 or 0.00 to 5.99</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102516</commentid>
    <comment_count>3</comment_count>
    <who name="Jacob Panov">jacobpanov</who>
    <bug_when>2025-07-27 01:15:04 +0000</bug_when>
    <thetext>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 ] &amp;&amp; [ ! -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.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>102517</commentid>
    <comment_count>4</comment_count>
      <attachid>5128</attachid>
    <who name="Jacob Panov">jacobpanov</who>
    <bug_when>2025-07-27 01:19:16 +0000</bug_when>
    <thetext>Created attachment 5128
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 ] &amp;&amp; [ ! -e ${S}/.config.baseline ]; then
    mv ${S}/.config ${S}/.config.old
fi</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>5128</attachid>
            <date>2025-07-27 01:19:16 +0000</date>
            <delta_ts>2025-07-27 01:19:16 +0000</delta_ts>
            <desc>Fix for kernel config loss in devtool modify workflow</desc>
            <filename>0001-devtool-Fix-kernel-config-loss-after-clean-rebuild-i.patch</filename>
            <type>text/plain</type>
            <size>1845</size>
            <attacher name="Jacob Panov">jacobpanov</attacher>
            
              <data encoding="base64">RnJvbSBhZTFmZjQ3YjY4Nzk0NzExMDU1NWM4MWQ4ZmYxY2MyYmRkNzFjM2U2IE1vbiBTZXAgMTcg
MDA6MDA6MDAgMjAwMQpGcm9tOiBqYWNvYnBhbm92IDxqYWNvYnBhbm92QGdtYWlsLmNvbT4KRGF0
ZTogU2F0LCAyNiBKdWwgMjAyNSAyMTowNToxNyAtMDQwMApTdWJqZWN0OiBbUEFUQ0hdIGRldnRv
b2w6IEZpeCBrZXJuZWwgY29uZmlnIGxvc3MgYWZ0ZXIgY2xlYW4vcmVidWlsZCBpbiBtb2RpZnkK
IHdvcmtmbG93CgpUaGUgZG9fa2VybmVsX2NvbmZpZ21lOnByZXBlbmQgZnVuY3Rpb24gd2FzIHVu
Y29uZGl0aW9uYWxseSBtb3ZpbmcgYW55CmV4aXN0aW5nIC5jb25maWcgZmlsZSB0byAuY29uZmln
Lm9sZCwgY2F1c2luZyBsZWdpdGltYX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G9vbC9zdGFuZGFyZC5weQpAQCAtOTQ4LDcgKzk0OCw5IEBAIGRlZiBtb2RpZnkoYXJn
cywgY29uZmlnLCBiYXNlcGF0aCwgd29ya3NwYWNlKToKIAogICAgICAgICAgICAgaWYgYmIuZGF0
YS5pbmhlcml0c19jbGFzcygna2VybmVsJywgcmQpOgogICAgICAgICAgICAgICAgIGYud3JpdGUo
J1xuZG9fa2VybmVsX2NvbmZpZ21lOnByZXBlbmQoKSB7XG4nCi0gICAgICAgICAgICAgICAgICAg
ICAgICAnICAgIGlmIFsgLWUgJHtTfS8uY29uZmlnIF07IHRoZW5cbicKKyAgICAgICAgICAgICAg
ICAgICAgICAgICcgICAgaWYgWyAtZSAke1N9Ly5jb25maWcgXSAmJiBbICEgLWUgJHtTfS8uY29u
ZmlnLmJhc2VsaW5lIF07IHRoZW5cbicKKyAgICAgICAgICAgICAgICAgICAgICAgICcgICAgICAg
ICMgT25seSBtb3ZlIC5jb25maWcgaWYgdGhlcmUgaXMgbm8gLmNvbmZpZy5iYXNlbGluZSxcbicK
KyAgICAgICAgICAgICAgICAgICAgICAgICcgICAgICAgICMgaW5kaWNhdGluZyB0aGlzIG1heSBi
ZSBhIHN0YWxlIGNvbmZpZyBmcm9tIGEgcHJldmlvdXMgYnVpbGRcbicKICAgICAgICAgICAgICAg
ICAgICAgICAgICcgICAgICAgIG12ICR7U30vLmNvbmZpZyAke1N9Ly5jb25maWcub2xkXG4nCiAg
ICAgICAgICAgICAgICAgICAgICAgICAnICAgIGZpXG4nCiAgICAgICAgICAgICAgICAgICAgICAg
ICAnfVxuJykKLS0gCjIuMzQuMQoK
</data>

          </attachment>
      

    </bug>

</bugzilla>