Skip to contentSkip to conversation

Rewriting kernel config after generation

DISCUSSION Alexey Dobriyan 2 participants 3 messages Dec 2, 2011 – Dec 10, 2011 Kbuild

lore
Share & tools
lore
#0 lore raw

I'm trying to add compiling with -march=native to the kernel.
The problem is that then some config options become discoverable at the beginning of the compilation. For example, CONFIG_X86_L1_CACHE_SHIFT=6 can be derived from "--param l1-cache-line-size=64". I suspect this is no-go, because all the dependency logic must be duplicated somewhere else (in the march=native script) for the above to work.

Is there any cleaner way I'm missing?

In theory, such script could even turn off CONFIG_CPU_SUP_AMD if it detects Intel CPU.

Alexey

#1 lore raw
Quoted 8 lines · Alexey Dobriyan

I'm trying to add compiling with -march=native to the kernel.
The problem is that then some config options become discoverable at the beginning of the compilation. For example, CONFIG_X86_L1_CACHE_SHIFT=6 can be derived from "--param l1-cache-line-size=64". I suspect this is no-go, because all the dependency logic must be duplicated somewhere else (in the march=native script) for the above to work.

Quoted 4 lines

Is there any cleaner way I'm missing?

In theory, such script could even turn off CONFIG_CPU_SUP_AMD if it detects Intel CPU.

Hrph, this is harder than it looks because "silentoldconfig" is done at the beginning rewriting whatever changes done to .config by hand. :-(

#2 lore raw
Quoted 9 lines · Alexey Dobriyan
Quoted 8 lines · Alexey Dobriyan

I'm trying to add compiling with -march=native to the kernel.
The problem is that then some config options become discoverable at the beginning of the compilation. For example, CONFIG_X86_L1_CACHE_SHIFT=6 can be derived from "--param l1-cache-line-size=64". I suspect this is no-go, because all the dependency logic must be duplicated somewhere else (in the march=native script) for the above to work.

Quoted 7 lines
Quoted 4 lines

Is there any cleaner way I'm missing?

In theory, such script could even turn off CONFIG_CPU_SUP_AMD if it detects Intel CPU.

Hrph, this is harder than it looks because "silentoldconfig" is done at the beginning rewriting whatever changes done to .config by hand. :-(

X86_L1_CACHE_SHIFT has no prompt, so it cannot be modified by the user. You would need to add a prompt if you want to modify it, e.g.

config X86_L1_CACHE_SHIFT

        int
	prompt "..." if X86_MARCH_NATIVE

But I wonder why is this needed. To build for the native cpu, you only need to detect what cpu you are running and select the matching processor family. The x86 Kconfig/Makefile will then take care of setting the right kconfig options and the right -march= parameter for gcc.

Michal