All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: Kconfig olddefconfig nukes 32-bit
       [not found] <af3a3eea-ae34-4f94-b17c-43f154e80ff7@app.fastmail.com>
@ 2026-04-12 16:19 ` Nicolas Schier
  2026-04-12 18:36   ` Andrew Valencia
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Schier @ 2026-04-12 16:19 UTC (permalink / raw)
  To: Andrew Valencia; +Cc: linux-kbuild

Cc: linux-kbuild

On Sat, Apr 11, 2026 at 10:55:15AM -0700, Andrew Valencia wrote:
> Hi,
> 
> I'm working over in the 6.19..12 world, and brought over a working
> .config which I updated with olddefconfig.  Long story short, the
> config was converted to a x86 64-bit config.
> 
> The issue is the new config entry 64BIT, which has a default value of
> ARCH != "i386".

yes, there is a 64BIT Kconfig symbol defined at arch/x86/Kconfig which
is true by default for non-i386 builds.  According to my git tree, the
corresponding lines did not change since v4.18 [1].

[1]: https://git.kernel.org/kbuild/c/104daea149c45

> On my 32-bit x86 build machine with its 32-bit .config, the default Y
> is being selected.  Is it possible i386 is not the correct name for
> ARCH on this target?

I guess, that you want to cross-build a 32bit-Linux on a 64bit-machine,
right?  How did you call olddefconfig (e.g. make ARCH=i386 olddefconfig)?

Kind regards

-- 
Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kconfig olddefconfig nukes 32-bit
  2026-04-12 16:19 ` Kconfig olddefconfig nukes 32-bit Nicolas Schier
@ 2026-04-12 18:36   ` Andrew Valencia
  2026-04-14  9:40     ` Nicolas Schier
  0 siblings, 1 reply; 5+ messages in thread
From: Andrew Valencia @ 2026-04-12 18:36 UTC (permalink / raw)
  To: Nicolas Schier; +Cc: linux-kbuild

(Re-sending for rejection of an HTML part by the list management SW.)

Hi,

This is for x86 32-bit target, built _on_ a x86 32-bit machine.

The issue appears to be:

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

Which appears to say this config item is only enabled if ARCH is x86.  But this then makes the default value calculation invariant for any target with this config item--it is always true, and thus always 64-bit.

So things like CONFIG_X86_32 go away, and CONFIG_OUTPUT_FORMAT switch away from elf32-i386.  Even if you're on a 32-bit build machine with a proper .config brought over from a previous 32-bit x86 build.

When 64BIT is being introduced in olddefconfig, I'd hope it would key off of CONFIG_X86_32 or something like it.

Thank you for giving this a look!
Andy

On Sun, Apr 12, 2026, at 9:19 AM, Nicolas Schier wrote:
> Cc: linux-kbuild
> 
> On Sat, Apr 11, 2026 at 10:55:15AM -0700, Andrew Valencia wrote:
> > Hi,
> > 
> > I'm working over in the 6.19..12 world, and brought over a working
> > .config which I updated with olddefconfig.  Long story short, the
> > config was converted to a x86 64-bit config.
> > 
> > The issue is the new config entry 64BIT, which has a default value of
> > ARCH != "i386".
> 
> yes, there is a 64BIT Kconfig symbol defined at arch/x86/Kconfig which
> is true by default for non-i386 builds.  According to my git tree, the
> corresponding lines did not change since v4.18 [1].
> 
> [1]: https://git.kernel.org/kbuild/c/104daea149c45
> 
> > On my 32-bit x86 build machine with its 32-bit .config, the default Y
> > is being selected.  Is it possible i386 is not the correct name for
> > ARCH on this target?
> 
> I guess, that you want to cross-build a 32bit-Linux on a 64bit-machine,
> right?  How did you call olddefconfig (e.g. make ARCH=i386 olddefconfig)?
> 
> Kind regards
> 
> -- 
> Nicolas
> 

--------------------------------
Andy Valencia
https://vsta.org/andy/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kconfig olddefconfig nukes 32-bit
  2026-04-12 18:36   ` Andrew Valencia
@ 2026-04-14  9:40     ` Nicolas Schier
  2026-04-14 10:04       ` Nicolas Schier
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Schier @ 2026-04-14  9:40 UTC (permalink / raw)
  To: Andrew Valencia; +Cc: x86, linux-kbuild

[ CC: x86 (x86 arch specific olddefconfig behaviour) ]

Hi Andrew,

please reply in-line instead of top-posting.

On Sun, Apr 12, 2026 at 11:36:16AM -0700, Andrew Valencia wrote:
> (Re-sending for rejection of an HTML part by the list management SW.)
> 
> Hi,
> 
> This is for x86 32-bit target, built _on_ a x86 32-bit machine.
> 
> The issue appears to be:
> 
> config 64BIT
>         bool "64-bit kernel" if "$(ARCH)" = "x86"

This makes 64BIT interactively selectable only if ARCH=x86.
When using ARCH=i386 or ARCH=x86_64, the "64-bit kernel" Kconfig option
is not available in 'make oldconfig' or 'make menuconfig' etc.

>         default "$(ARCH)" != "i386"

This sets the default value for CONFIG_64BIT to 'y' if ARCH is not 
explicitly set to 'i386' -- thus for ARCH=x86 and ARCH=x86_64.

>         help
>           Say yes to build a 64-bit kernel - formerly known as x86_64
> 
> Which appears to say this config item is only enabled if ARCH is x86.  
> But this then makes the default value calculation invariant for any 
> target with this config item--it is always true, and thus always 
> 64-bit.
> 
> So things like CONFIG_X86_32 go away, and CONFIG_OUTPUT_FORMAT switch 
> away from elf32-i386.  Even if you're on a 32-bit build machine with a 
> proper .config brought over from a previous 32-bit x86 build.
> 
> When 64BIT is being introduced in olddefconfig, I'd hope it would key 
> off of CONFIG_X86_32 or something like it.

Running 'make olddefconfig' (w/o a specific x86 arch) lets 
arch/x86/Makefile choose a defconfig file for reference (cp. head of 
arch/x86/Makefile).  If ARCH=x86 (or unspecified on any x86 machine), 
the output of `uname -m` is evaluated.  If ARCH=i386 is explicitly 
given, the 32bit defconfig will be chosen, no matter what kind of x86 
the build host is; and the other way around for ARCH=x86_64.

Thus, if you build a 32bit kernel with your 32bit config file on a 
x86_64 host, you have to use

   make ARCH=i386 olddefconfig

if you want to use 'olddefconfig' to let the config keep the 
CONFIG_64BIT=n setting.

Does that help?

Kind regards,
Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kconfig olddefconfig nukes 32-bit
  2026-04-14  9:40     ` Nicolas Schier
@ 2026-04-14 10:04       ` Nicolas Schier
  2026-05-05 23:49         ` Andrew Valencia
  0 siblings, 1 reply; 5+ messages in thread
From: Nicolas Schier @ 2026-04-14 10:04 UTC (permalink / raw)
  To: Andrew Valencia; +Cc: x86, linux-kbuild

On Tue, Apr 14, 2026 at 11:40:56AM +0200, Nicolas Schier wrote:
> [ CC: x86 (x86 arch specific olddefconfig behaviour) ]

typo in x86@kernel.org, resending



> 
> Hi Andrew,
> 
> please reply in-line instead of top-posting.
> 
> On Sun, Apr 12, 2026 at 11:36:16AM -0700, Andrew Valencia wrote:
> > (Re-sending for rejection of an HTML part by the list management SW.)
> > 
> > Hi,
> > 
> > This is for x86 32-bit target, built _on_ a x86 32-bit machine.
> > 
> > The issue appears to be:
> > 
> > config 64BIT
> >         bool "64-bit kernel" if "$(ARCH)" = "x86"
> 
> This makes 64BIT interactively selectable only if ARCH=x86.
> When using ARCH=i386 or ARCH=x86_64, the "64-bit kernel" Kconfig option
> is not available in 'make oldconfig' or 'make menuconfig' etc.
> 
> >         default "$(ARCH)" != "i386"
> 
> This sets the default value for CONFIG_64BIT to 'y' if ARCH is not 
> explicitly set to 'i386' -- thus for ARCH=x86 and ARCH=x86_64.
> 
> >         help
> >           Say yes to build a 64-bit kernel - formerly known as x86_64
> > 
> > Which appears to say this config item is only enabled if ARCH is x86.  
> > But this then makes the default value calculation invariant for any 
> > target with this config item--it is always true, and thus always 
> > 64-bit.
> > 
> > So things like CONFIG_X86_32 go away, and CONFIG_OUTPUT_FORMAT switch 
> > away from elf32-i386.  Even if you're on a 32-bit build machine with a 
> > proper .config brought over from a previous 32-bit x86 build.
> > 
> > When 64BIT is being introduced in olddefconfig, I'd hope it would key 
> > off of CONFIG_X86_32 or something like it.
> 
> Running 'make olddefconfig' (w/o a specific x86 arch) lets 
> arch/x86/Makefile choose a defconfig file for reference (cp. head of 
> arch/x86/Makefile).  If ARCH=x86 (or unspecified on any x86 machine), 
> the output of `uname -m` is evaluated.  If ARCH=i386 is explicitly 
> given, the 32bit defconfig will be chosen, no matter what kind of x86 
> the build host is; and the other way around for ARCH=x86_64.
> 
> Thus, if you build a 32bit kernel with your 32bit config file on a 
> x86_64 host, you have to use
> 
>    make ARCH=i386 olddefconfig
> 
> if you want to use 'olddefconfig' to let the config keep the 
> CONFIG_64BIT=n setting.
> 
> Does that help?
> 
> Kind regards,
> Nicolas

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Kconfig olddefconfig nukes 32-bit
  2026-04-14 10:04       ` Nicolas Schier
@ 2026-05-05 23:49         ` Andrew Valencia
  0 siblings, 0 replies; 5+ messages in thread
From: Andrew Valencia @ 2026-05-05 23:49 UTC (permalink / raw)
  To: Nicolas Schier; +Cc: x86, linux-kbuild

Hi, Nicolas.  Thanks for your helpful comments, I went off and read code and tried many scenarios based on your comments.

On Tue, Apr 14, 2026, at 3:04 AM, Nicolas Schier wrote:
> > Running 'make olddefconfig' (w/o a specific x86 arch) lets 
> > arch/x86/Makefile choose a defconfig file for reference (cp. head of 
> > arch/x86/Makefile).  If ARCH=x86 (or unspecified on any x86 machine), 
> > the output of `uname -m` is evaluated.  If ARCH=i386 is explicitly 
> > given, the 32bit defconfig will be chosen, no matter what kind of x86 
> > the build host is; and the other way around for ARCH=x86_64.

All my comments which follow are for an existing 32-bit config, a new kernel.org source tree, on a 32-bit build machine.  The starting point config is from a Linux-libre project config, config-6.18.18-gnu:

https://linux486.org/pickup/olddefconfig/config-6.18.18-gnu.txt

"make olddefconfig" results in a config with CONFIG_64BIT=y.  "make ARCH=i386 olddefconfig" results in a 32-bit config with no mention of CONFIG_64BIT at all.  "make ARCH=x86_64 olddefconfig" results in the same config as "make olddefconfig", as does "make ARCH=x86 olddefconfig"

I propose to you that 64BIT be a proper config item for all x86en, 32-bit and 64-bit.  For 64-bit, "CONFIG_64BIT-y" and for 32-bit "# CONFIG_64BIT is not set".  This results in config files fully describing what they need to build--and guiding any future olddefconfig to stay with what has previously been selected.

> > Thus, if you build a 32bit kernel with your 32bit config file on a 
> > x86_64 host, you have to use
> > 
> >    make ARCH=i386 olddefconfig
> > 
> > if you want to use 'olddefconfig' to let the config keep the 
> > CONFIG_64BIT=n setting.
> > 
> > Does that help?

Very much so.  The remaining suggestion I make is that the default be selected so that an old 32-bit config, on a 32-bit build machine, by default (i.e., without explicitly setting ARCH) generate a 32-bit new config when olddefconfig is used.  This obviously would depend on the "uname -m" value.

A small patch to (1) preserve the resolution of the 64BIT config item on all x86, plus (2) choose a default value guided by uname -m when ARCH is the general x86 value:

https://linux486.org/pickup/olddefconfig/uarch.diff.txt

Thank you for your help!
Andy

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-05-05 23:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <af3a3eea-ae34-4f94-b17c-43f154e80ff7@app.fastmail.com>
2026-04-12 16:19 ` Kconfig olddefconfig nukes 32-bit Nicolas Schier
2026-04-12 18:36   ` Andrew Valencia
2026-04-14  9:40     ` Nicolas Schier
2026-04-14 10:04       ` Nicolas Schier
2026-05-05 23:49         ` Andrew Valencia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.