Re: due to kconfig changes kernel config file is no longer sufficient for configuring the kernel

From: Michal SuchÃnek
Date: Thu Jul 26 2018 - 04:34:04 EST


On Thu, 28 Jun 2018 11:16:23 +0200
Michal SuchÃnek <msuchanek@xxxxxxx> wrote:

> On Wed, 27 Jun 2018 23:07:21 +0900
> Masahiro Yamada <yamada.masahiro@xxxxxxxxxxxxx> wrote:
>
> > Hi.
> >
> >
> > 2018-06-27 21:37 GMT+09:00 Michal SuchÃnek <msuchanek@xxxxxxx>:
> > > Hello,
> > >
> > > in the x86 Kconfig we have this:
> > >
> > > # Select 32 or 64 bit
> > > config 64BIT
> > > bool "64-bit kernel" if "$(ARCH)" = "x86"
> > > default "$(ARCH)" != "i386"
> > > ---help---
> > > Say yes to build a 64-bit kernel - formerly known as
> > > x86_64 Say no to build a 32-bit kernel - formerly known as i386
> > >
> > > Since commit 104daea149c4 ("kconfig: reference environment
> > > variables directly and remove 'option env='") the value of ARCH
> > > is not saved in the kernel config.
> >
> > I think this commit is unrelated. It was just a syntax change.
>
> This does not look like syntax only change to me:
>
> diff --git a/init/Kconfig b/init/Kconfig
> index 15aae32e0719..1217fc62ca61 100644
> --- a/init/Kconfig
> +++ b/init/Kconfig
> @@ -1,20 +1,12 @@
> -config ARCH
> - string
> - option env="ARCH"
> -
> -config KERNELVERSION
> - string
> - option env="KERNELVERSION"
> -
>
> >
> > Unless I am missing something,
> > we have never saved ARCH in the .config in the past.
>
> There was a config symbol defined for it before the commit removed it.

nonetheless its value was not saved anyway.
>
> >
> >
> > > Since commit f467c5640c29 ("kconfig: only write '#
> > > CONFIG_FOO is not set' for visible symbols") the value of 64BIT is
> > > not saved if the ARCH is set i386 or x86_64 because the symbol is
> > > not visible.
> >
> > This is correct.
> >
> > It was discussed a few weeks ago.
> >
> > https://lkml.org/lkml/2018/6/5/847

And it went nowhere.

Anyway, the observed issue with CONFIG_64BIT on x86 is the tip of a
larger problem which was unnoticed for ages. The .config simply does
not contain the whole kernel configuration. ie. make oldconfig (and
make syncconfig) is *not* expected to just work. It used to work just by
luck until f467c5640c29 ("kconfig: only write '# CONFIG_FOO is not set'
for visible symbols") finally exposed the problem.

So is .config supposed to contain the kernel configuration or is it
just some byproduct of the kernel build which is meaningless outside of
your build environment (the object tree, shell environment, etc).

Thanks

Michal