Linux kbuild/kconfig development
 help / color / mirror / Atom feed
From: Nathan Chancellor <nathan@kernel.org>
To: Song Liu <song@kernel.org>
Cc: linux-kbuild@vger.kernel.org, Nicolas Schier <nsc@kernel.org>
Subject: Re: make olddefconfig surprises
Date: Fri, 23 Jan 2026 13:53:59 -0700	[thread overview]
Message-ID: <20260123205359.GA95167@ax162> (raw)
In-Reply-To: <CAPhsuW48m9pPbKsiiNDnagrtF2vLYwHSZWUASirhFKgUSVrzQQ@mail.gmail.com>

Hi Song,

On Fri, Jan 23, 2026 at 10:21:34AM -0800, Song Liu wrote:
> I was surprised by "make olddefconfig". Reporting here in case this is
> something worth fixing/changing.

Thanks for the write up!

> Here is what I see:
> 
> With make defconfig, CONFIG_DEVTMPFS is enabled:
> 
> $ make defconfig
> *** Default configuration is based on 'x86_64_defconfig'
> #
> # configuration written to .config
> #
> $ grep CONFIG_DEVTMPFS .config
> CONFIG_DEVTMPFS=y
> CONFIG_DEVTMPFS_MOUNT=y
> # CONFIG_DEVTMPFS_SAFE is not set

Right, as CONFIG_DEVTMPFS is explicitly enabled in x86_64_defconfig:

  $ scripts/config --file arch/x86/configs/x86_64_defconfig -s DEVTMPFS
  y

> But with make olddefconfig and an empty .config file,
> CONFIG_DEVTMPFS is disabled:
> 
> $ echo > .config
> $ make olddefconfig
> #
> # configuration written to .config
> #
> $ grep CONFIG_DEVTMPFS .config
> # CONFIG_DEVTMPFS is not set

The key here is "an empty .config file". olddefconfig is documented in
'make help':

  Same as oldconfig but sets new symbols to their default value without
  prompting

and oldconfig is documented as:

  Update current config utilising a provided .config as base

So if .config is present but empty, all symbols will be new and they
will be set to their default value from its Kconfig definition
(basically just alldefconfig at that point).

> In the meanwhile, CONFIG_DEVTMPFS is enabled in my /proc/config.gz
> and /boot/config*

I think /boot/config-$(uname -r) is only used as a potential
configuration base when no configuration is provided initially but it is
not examined at all for the sake of olddefconfig.

> I checked with a few folks. They were also surprised by this.
> 
> I think the logic of "make olddefconfig" is: With a .config, olddefconfig will
> not look at other defaults (x86_64_defconfig, /proc/config.gz, /boot/config*,
> etc.). Instead, olddefconfig only follows Kconfig files. If a config doesn't
> have "default=y" in Kconfig files, it will be disabled.

Correct, per the "sets new symbols to their default value" from the help
text above.

> This is confusing to users. For example, selftests users often have
> a config file in "tools/testing/selftests/*/config" showing which configs are
> needed for the tests to pass. The expectation is: default config with these
> changes will work. However, this is actually not the case. Many of these
> config files actually have "CONFIG_DEVTMPFS=y" to make it work.

I am a little confused by this and how it relates to olddefconfig? Is
this not just a problem with the config file in the selftests not having
every configuration that is needed if it expects CONFIG_DEVTMPFS=y but
does not have it listed? Or am I missing something else here? How are
those config files in selftests expected to be used? Are they merged
into existing configuration files with scripts/kconfig/merge_config.sh
or are they used as a .config then have olddefconfig run on them?

> So, the question is, shall we change the behavior of olddefconfig so
> that it still honors defaults in x86_64_defconfig?

Perhaps this could be clarified somehow in 'make help' or elsewhere in
the Kconfig documentation but this could be a misunderstanding of the
point of olddefconfig. It is just meant to transition an old/existing
configuration file to the current tree noninteractively. It won't
manipulate a configuration beyond that and I am not sure that it should,
especially since it gets a little confusing around what other
configuration files should be taken into account when changing values.

Cheers,
Nathan

  reply	other threads:[~2026-01-23 20:54 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-23 18:21 make olddefconfig surprises Song Liu
2026-01-23 20:53 ` Nathan Chancellor [this message]
2026-01-23 22:54   ` Song Liu
2026-01-23 23:44     ` Nathan Chancellor
2026-01-23 23:57       ` Song Liu
2026-01-24 19:36         ` Nicolas Schier
2026-01-26 17:17           ` Song Liu
2026-01-26 17:52             ` Randy Dunlap
2026-01-26 19:15               ` Song Liu

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260123205359.GA95167@ax162 \
    --to=nathan@kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=nsc@kernel.org \
    --cc=song@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox