<?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>8289</bug_id>
          
          <creation_ts>2015-09-11 15:07:25 +0000</creation_ts>
          <short_desc>kernel_configme step should use &quot;oldnoconfig&quot; instead of &quot;allnoconfig&quot; when silently upgrading user defconfig</short_desc>
          <delta_ts>2016-09-09 17:06:44 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>Kernel</product>
          <component>kernel-tooling</component>
          <version>1.8.1</version>
          <rep_platform>All</rep_platform>
          <op_sys>Multiple</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>2.2 M3</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Rob Calhoun">rcalhoun-bugzilla</reporter>
          <assigned_to name="Bruce Ashfield">bruce.ashfield</assigned_to>
          <cc>sgw</cc>
    
    <cc>yp.kernel.watcher</cc>
    
    <cc>yp.watcher</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>53979</commentid>
    <comment_count>0</comment_count>
    <who name="Rob Calhoun">rcalhoun-bugzilla</who>
    <bug_when>2015-09-11 15:07:25 +0000</bug_when>
    <thetext>This bug was found by compiling linux 4.2 (mainline) using yocto fido 1.8.1 starting with a defconfig from linux-yocto-3.19. Automatic upgrade of the defconfig by the build system resulted in (new in 4.1) kernel option CONFIG_MULTIUSER being set to:

# CONFIG_MULTIUSER is not set

This builds fine, but a kernel that has CONFIG_MULTIUSER undefined causes numerous (and an potentially serious) runtime issues for embedded systems, including breaking remote login via dropbear and causing numerous issues with busybox.

The busybox issues are tracked here:
http://lists.busybox.net/pipermail/busybox/2015-May/082910.html

I will file a separate ticket against dropbear. (Dropbear runs fine but fails during user login with &quot;dropbear[3741]: Exit (root): Failed to set euid&quot;)

The sense of CONFIG_MULTIUSER is by design (allnoconfig should generate de minimal kernel.) Since CONFIG_MULTIUSER is an advanced option that defaults to y, silent upgrades should define this kernel option (and others that default to Y) to avoid unexpected behavior.

Yocto has two steps that modify the kernel configuration:

do_kernel_configme (defined in classes/kernel-yocto.bbclass)
do_configure  (defined in classes/kernel.bbclass)

kernel-yocto.bbclass uses allnoconfig; kernel.bbclass uses allnoconfig. Since do_kernel_configme runs before do_configure, user&apos;s defconfig is silently upgraded with to &quot;CONFIG_MULTIUSER is not set&quot; and kernel.bbclass&apos;s allnoconfig does not change it.

kernel-yocto.bbclass should use &quot;oldnoconfig&quot; insted of &quot;allnoconfig&quot; when silently upgrading user&apos;s config to avoid unexpected behavior when upgrading kernel defconfigs.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53984</commentid>
    <comment_count>1</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-09-11 17:09:24 +0000</bug_when>
    <thetext>(In reply to comment #0)
&gt; This bug was found by compiling linux 4.2 (mainline) using yocto fido 1.8.1
&gt; starting with a defconfig from linux-yocto-3.19. Automatic upgrade of the
&gt; defconfig by the build system resulted in (new in 4.1) kernel option
&gt; CONFIG_MULTIUSER being set to:
&gt; 
&gt; # CONFIG_MULTIUSER is not set
&gt; 
&gt; This builds fine, but a kernel that has CONFIG_MULTIUSER undefined causes
&gt; numerous (and an potentially serious) runtime issues for embedded systems,
&gt; including breaking remote login via dropbear and causing numerous issues
&gt; with busybox.
&gt; 
&gt; The busybox issues are tracked here:
&gt; http://lists.busybox.net/pipermail/busybox/2015-May/082910.html
&gt; 
&gt; I will file a separate ticket against dropbear. (Dropbear runs fine but
&gt; fails during user login with &quot;dropbear[3741]: Exit (root): Failed to set
&gt; euid&quot;)
&gt; 
&gt; The sense of CONFIG_MULTIUSER is by design (allnoconfig should generate de
&gt; minimal kernel.) Since CONFIG_MULTIUSER is an advanced option that defaults
&gt; to y, silent upgrades should define this kernel option (and others that
&gt; default to Y) to avoid unexpected behavior.
&gt; 
&gt; Yocto has two steps that modify the kernel configuration:
&gt; 
&gt; do_kernel_configme (defined in classes/kernel-yocto.bbclass)
&gt; do_configure  (defined in classes/kernel.bbclass)
&gt; 
&gt; kernel-yocto.bbclass uses allnoconfig; kernel.bbclass uses allnoconfig.
&gt; Since do_kernel_configme runs before do_configure, user&apos;s defconfig is
&gt; silently upgraded with to &quot;CONFIG_MULTIUSER is not set&quot; and kernel.bbclass&apos;s
&gt; allnoconfig does not change it.
&gt; 
&gt; kernel-yocto.bbclass should use &quot;oldnoconfig&quot; insted of &quot;allnoconfig&quot; when
&gt; silently upgrading user&apos;s config to avoid unexpected behavior when upgrading
&gt; kernel defconfigs.

The use of allnoconfig is on purpose, the processing of defconfigs is
not intented as an upgrade path. The existing semantics of the defconfig
processing in the yocto model (well, technically we&apos;d rather they not
be used at all .. but that is a different story) is that if you supply
a deconfig, those are the settings that the use would explicitly like
to set for the given kernel .. everything else should be turned off, to
wipe the slate clean, and then the deconfig is applied.

I won&apos;t break those existing semantics, but can patch the tools to 
allow a different mode to be passed via KCONFIG_MODE, and that should
meet the need here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53989</commentid>
    <comment_count>2</comment_count>
    <who name="Rob Calhoun">rcalhoun-bugzilla</who>
    <bug_when>2015-09-11 21:04:57 +0000</bug_when>
    <thetext>&gt; The use of allnoconfig is on purpose, the processing of defconfigs is not intented as an upgrade path.

Umm, so what is the correct upgrade path?

It seems to me that there should be a kernel task defined to this, something comparable to the existing do_menuconfig. In the absence of a e.g. do_upgrade_kernel_config (which would call oldconfig?) one needs to upgrade the kernel configuration some other way.

Doing it by hand within the yocto system (via -c devshell, make oldnoconfig) is not too easy, especially now that source directory and the build directory are different. I know how to do it now, but I did not know how to do it the first time I built the 4.2 kernel and got &quot;unexpected results&quot;. Hence the bug report: yocto currently has two .config upgrade scripts defined (one in do_kernel_configme and one in do_configure), they are not the same, and the allnoconfig called in do_kernel_configme can lead one pretty badly into the weeds without any warning. (Yocto throws warnings about lesser matters than this!)

&gt; well, technically we&apos;d rather they not be used at all .. but that is a different story

Ah, configuration fragments! :-)

I am currently doing board bring-up on a new machine using yocto. I am trying to use best practices with layers, patches, kernel recipes and so forth. I suppose I am just doing it all wrong, but it is pretty difficult even without configuration fragments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54000</commentid>
    <comment_count>3</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-09-14 02:04:36 +0000</bug_when>
    <thetext>(In reply to comment #2)
&gt; &gt; The use of allnoconfig is on purpose, the processing of defconfigs is not intented as an upgrade path.
&gt; 
&gt; Umm, so what is the correct upgrade path?
&gt; 
&gt; It seems to me that there should be a kernel task defined to this, something
&gt; comparable to the existing do_menuconfig. In the absence of a e.g.
&gt; do_upgrade_kernel_config (which would call oldconfig?) one needs to upgrade
&gt; the kernel configuration some other way.
&gt; 
&gt; Doing it by hand within the yocto system (via -c devshell, make oldnoconfig)
&gt; is not too easy, especially now that source directory and the build
&gt; directory are different. I know how to do it now, but I did not know how to
&gt; do it the first time I built the 4.2 kernel and got &quot;unexpected results&quot;.
&gt; Hence the bug report: yocto currently has two .config upgrade scripts
&gt; defined (one in do_kernel_configme and one in do_configure), they are not
&gt; the same, and the allnoconfig called in do_kernel_configme can lead one
&gt; pretty badly into the weeds without any warning. (Yocto throws warnings
&gt; about lesser matters than this!)

For the most part, folks maintaining kernels and configuration blocks
for those kernels, only use the build system at the very end of the
cycle. It builds and generates and image, but as for maintenance of the
tree, and the config .. they do that themselves, and when happy, codify
it in the build system.

Hence none of the tasks is really meant for upgrading a config, they are
meant to apply the config and build it.

The devtool work that is happening, is trying to address some of the most
common development tasks, and can somewhat address this use case, but
getting a config that you are happy with, is still in the hands of the
developer.

Note: If you are using fragments there is more auditing available, and
new options are flagged when the base fragments are upgraded between
revisions, so many options and unexpected results are caught when putting
thee baseline in place.

Having a dedicated task for upgrades, and extending configme to take
oldnoconfig as an optional mode are both things that I&apos;m willing to
do. If there&apos;s a preference .. feel free to indicate it here.

Bruce 

&gt; 
&gt; &gt; well, technically we&apos;d rather they not be used at all .. but that is a different story
&gt; 
&gt; Ah, configuration fragments! :-)
&gt; 
&gt; I am currently doing board bring-up on a new machine using yocto. I am
&gt; trying to use best practices with layers, patches, kernel recipes and so
&gt; forth. I suppose I am just doing it all wrong, but it is pretty difficult
&gt; even without configuration fragments.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54301</commentid>
    <comment_count>4</comment_count>
    <who name="Rob Calhoun">rcalhoun-bugzilla</who>
    <bug_when>2015-09-18 20:14:12 +0000</bug_when>
    <thetext>&gt; Having a dedicated task for upgrades, and extending configme to take
oldnoconfig as an optional mode are both things that I&apos;m willing to
do. If there&apos;s a preference .. feel free to indicate it here.

Thanks for taking this on, Bruce.

If it&apos;s not too late, I think adding a dedicated task for upgrades would be cleanest. 

Reasoning as follows:

Josh Triplett (who worked on the CONFIG_MULTIUSER feature) recommended running &quot;oldconfig&quot; (vs &quot;oldnoconfig&quot;) when upgrading a .config to a newer version of linux. This is good advice, but interactive scripts are the bane of build automation and thus &quot;oldconfig&quot; is not a realistic option for do_configure/do_kernel_configme.

Yocto can always throw a warnings, however. I see no downside to throwing a warning whenever the (supplied / constructed) .config does not match the version of linux being built. The warning could recommend the user run the (new) upgrade task (do_oldconfig or do_upgrade_config or whatever) and build again. Like the current do_menuconfig task, the upgrade task can be interactive without breaking build automation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>54482</commentid>
    <comment_count>5</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2015-09-22 18:21:55 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; &gt; Having a dedicated task for upgrades, and extending configme to take
&gt; oldnoconfig as an optional mode are both things that I&apos;m willing to
&gt; do. If there&apos;s a preference .. feel free to indicate it here.
&gt; 
&gt; Thanks for taking this on, Bruce.
&gt; 
&gt; If it&apos;s not too late, I think adding a dedicated task for upgrades would be
&gt; cleanest. 

We&apos;ve missed the gate for the 2.0 release, but I do have some work
in progress now. I can submit it to master and get a backport, since
this is new functionality versus a behaviour change.

&gt; 
&gt; Reasoning as follows:
&gt; 
&gt; Josh Triplett (who worked on the CONFIG_MULTIUSER feature) recommended
&gt; running &quot;oldconfig&quot; (vs &quot;oldnoconfig&quot;) when upgrading a .config to a newer
&gt; version of linux. This is good advice, but interactive scripts are the bane
&gt; of build automation and thus &quot;oldconfig&quot; is not a realistic option for
&gt; do_configure/do_kernel_configme.
&gt; 
&gt; Yocto can always throw a warnings, however. I see no downside to throwing a
&gt; warning whenever the (supplied / constructed) .config does not match the
&gt; version of linux being built. The warning could recommend the user run the
&gt; (new) upgrade task (do_oldconfig or do_upgrade_config or whatever) and build
&gt; again. Like the current do_menuconfig task, the upgrade task can be
&gt; interactive without breaking build automation.

Yes, there&apos;s a balance we can strike between warning (and not alarming)
and not breaking the old behaviour. 

There&apos;s already an audit task, and it is easy enough to enhance it to 
pick up defconfig as well as fragment issues.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>66014</commentid>
    <comment_count>6</comment_count>
    <who name="Bruce Ashfield">bruce.ashfield</who>
    <bug_when>2016-09-09 17:06:44 +0000</bug_when>
    <thetext>It took a long time, but this has now been dealt with in the master branch of oe-core, which is the 2.2 release.

The kernel-yocto configuration has been re-worked, and configme removed from the processing of fragments.

This means that any fragments, defconfigs, etc, are processed by merge_config.sh directly.

The mode that merge_config.sh uses is controlled by the KCONFIG_MODE variable.

There&apos;s still no way to reliably detect if a defconfig is complete, a savedefconfig output, or an old defconfig so the control of what is to be done is left up to the recipe author / user.

If KCONFIG_MODE is set to alldefconfig, merge_config will concatenate the provided configuration values (including a defconfig or only a defconfig) and then issue an alldefconfig configuration step.

The end result is the same as an oldnoconfig/olddefconfig, in which any new symbols are filled in with their defaults.

We would have to hack merge_config.sh, or do some extra detection if we really needed olddefconfig versus alldefconfig (with the delta really just being the &quot;existing&quot; versus &quot;new config&quot;). In that case, again, we could write a task that did an update and saved the new defconfig to a specified location which could be fed back into the build. New tasks/complexity in this area are to be avoided .. so trying the current implementation is the plan.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>