You are not logged in.

#1 2013-04-10 11:31:33

whoops
Member
Registered: 2009-03-19
Posts: 891

override single kernel config option globally?

Hi!

I need some custom kernel config options (wireless debugging) for all the kernels I (re)compile. Is there a way to make those permanent globally, so I don't have to do it every time I upgrade my kernel, while letting the whole rest of the configuration update normally? Not sure if/how/where I could set those so they stay...

At the moment, I'm using linux-ck - there's a handy "use current kernel's config" option in the PKGBUILD there which I guess I could set as environment  variable so I don't have to edit the PKGBUILD every time... but that option seems to take ALL settings from the current config, not just the ones I changed manually - so making this a default might not be a good idea...

Any alternatives?

Last edited by whoops (2013-04-10 11:32:21)

Offline

#2 2013-04-10 12:13:17

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: override single kernel config option globally?

You only need to edit the kernel config the first time you compile - just use the same config for subsequent rebuilds.

Offline

#3 2013-04-11 08:05:05

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: override single kernel config option globally?

Hmmm... so...
Does that mean I should just keep using the same old config I have now forever for all future kernel versions, no matter how much the stock config changes?

Offline

#4 2013-04-11 09:19:11

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,885
Website

Re: override single kernel config option globally?

Include the config as a source file in the PKGBUILD, write a line to copy the config to $srcdir/linux-*/.config, and put something like 'make olddefconfig' before the 'make' statement. Look at how linux-mainline does it (though it uses 'yes ""|make oldconfig' instead of what I suggested)


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#5 2013-04-11 09:35:01

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: override single kernel config option globally?

Yes, that's about how I'm doing it at the moment.

But is there a way to override a single kernel config option globally?

Only one option, not the whole config?
For EVERY kernel I build and every version of it, not just one PKGBUILD?

I only tried gentoo very briefly and barely remember it, but the very first thing I did there during installation (which subsequently broke EVERYTHING because I did it wrong big_smile)... with all the flags for all the packages... that looked sort of like what I'm trying to do now with that kernel setting.

Offline

#6 2013-04-11 09:53:04

chord
Member
Registered: 2012-11-07
Posts: 121

Re: override single kernel config option globally?

whoops wrote:

Hmmm... so...
Does that mean I should just keep using the same old config I have now forever for all future kernel versions, no matter how much the stock config changes?

If some new kernel options will be missing in your old .config, you will be asked for these options when you run 'make'.

Offline

#7 2013-04-11 10:49:43

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: override single kernel config option globally?

That is one of the reasons why I'm trying to override only a single option, without touching the rest - so new ones can be added normally, without me holding "enter" during make while text that I don't know the meaning of flies by.

Also I'd prefer not to have existing options "stuck" at old defaults...

Offline

#8 2013-04-11 11:21:23

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: override single kernel config option globally?

whoops wrote:

so new ones can be added normally

What's "normally" here? You're compiling you're own kernels, so you will have to say yes or no to new options that become available.

Offline

#9 2013-04-11 12:00:20

chord
Member
Registered: 2012-11-07
Posts: 121

Re: override single kernel config option globally?

whoops wrote:

That is one of the reasons why I'm trying to override only a single option, without touching the rest - so new ones can be added normally, without me holding "enter" during make while text that I don't know the meaning of flies by.

Also I'd prefer not to have existing options "stuck" at old defaults...

New options can't be added 'normally' since you build custom kernel. You should say 'Yes' or 'No'. If you looking for 'normal' way - you should use default config that contains 'normal' values for new options.

You should set values for new options at least once. Your answers will be saved in config and you can save it for future use. Next time you will not be asked about these options

Offline

#10 2013-04-11 12:11:49

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: override single kernel config option globally?

If you looking for 'normal' way - you should use default config that contains 'normal' values for new options.

Yes, that's what I'm doing! I am using the default config. I only need ONE option changed. I'd like that option overridden automatically / globally somehow instead of changing the same single option in every single config every time I upgrade / rebuild a kernel ( = new default config).

chord wrote:

You should set values for new options at least once. Your answers will be saved in config and you can save it for future use.

That won't happen ever again for already existing options though, even if the default value in the stock config changes. I'd like those "updates" to happen and not to be stuck with older default values. I am only changing one option.

I feel like we're going in circles. Am I asking the wrong question(s)?

Last edited by whoops (2013-04-11 12:15:03)

Offline

#11 2013-04-11 12:17:20

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: override single kernel config option globally?

why not write a small bash script to use sed to change the option in the config, and then simply run the script before building?


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#12 2013-04-11 12:52:20

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: override single kernel config option globally?

Because I was hoping, there would be a better / more specific solution for this sort of thing that automatically applied to all kernels I build (or at least the ones I build with makepkg) without requiring changes to each individual PKGBUILD (or manual intervention every time I build a kernel).

Like p.e. setting some build flags in makepkg.conf or in some generic compiler settings file... or with environment variables to override this setting in the individual config files... like a "global kernel.config.local" or something with only the option I want changed in it.

Last edited by whoops (2013-04-11 12:53:04)

Offline

#13 2013-04-11 14:40:10

chord
Member
Registered: 2012-11-07
Posts: 121

Re: override single kernel config option globally?

whoops wrote:

I'd like that option overridden automatically / globally somehow instead of changing the same single option in every single config every time I upgrade / rebuild a kernel ( = new default config).

I think you want to apply your answers for all future builds. If it is then 'make oldconfig' does it. Takes existing config (saved from previous build) and
asks only for new options that becames since your last build. If there is no kernel options changes since your last build, you have nothing to be asked.

http://stackoverflow.com/questions/4178 … l-makefile

I do this everytime I rebuild kernel or reinstall system. I replace the default config (that included in kernel package) with my custom config and run make oldconfig. This works in Gentoo. In Arch it works also if you build kernel in traditional way, without PKGBUILD.

If override single kernel config option globally means something else may be it makes sense to explain this in more detail

Offline

#14 2013-04-11 15:21:07

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: override single kernel config option globally?

OK... it seems you're using Arch's kernel config, with just one option changed, is that correct? You didn't mention this before - that's why you've been getting the answers above. Your original query concerned "all the kernels I (re)compile", without any mention of Arch's config.

In that context, there is no such global option available. Roken's sed suggestion is the best option, and this can be incorporated into your PKGBUILD if you wish.

Offline

#15 2013-04-11 15:53:45

whoops
Member
Registered: 2009-03-19
Posts: 891

Re: override single kernel config option globally?

Thanks!

I'm not only using arch's kernel config but several (arch, vanilla, aur-linux-ck) - sadly that answer still applies though I guess.

So - just to be safe - that means not a single one of all those custom hooks & other methods that are sometimes used to recompile "foreign" modules for all kernels and stuff like that (I think there are multiple implementations for different situations) get executed pre-build (but instead mostly on installation when mkinitcpio is called), right? So I can't use one of those solutions to have the sed script executed every time before a kernel is compiled in the build directory?

Guess I'll just stick with my current chaotic "keep old config for a few versions, then apply the change again to a clean/new version of the config every once in a while"-method then for now, only using sed instead of menuconfig... not too comfortable, but should do.

Offline

#16 2013-04-11 21:27:38

Roken
Member
From: South Wales, UK
Registered: 2012-01-16
Posts: 1,253

Re: override single kernel config option globally?

Well, there is an option that builds on the sed script - and that's to use an alias to make a custom command instead of make. Alias "fixconfig,sh; make" to something like buildkernel, and use buildkernel instead when you are ready to build.

Edit: You could even do away with the script.

alias buildkernel=`sed -i 's/OLDCOFNIG\=OLDOPTION/OLDCONFIG\=NEWOPTION/' < .config; make`

Last edited by Roken (2013-04-11 21:31:00)


Ryzen 5900X 12 core/24 thread - RTX 3090 FE 24 Gb, Asus Prime B450 Plus, 32Gb Corsair DDR4, Cooler Master N300 chassis, 5 HD (1 NvME PCI, 4SSD) + 1 x optical.
Linux user #545703

Offline

#17 2013-04-12 08:20:18

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: override single kernel config option globally?

whoops wrote:

Guess I'll just stick with my current chaotic "keep old config for a few versions, then apply the change again to a clean/new version of the config every once in a while"-method then for now, only using sed instead of menuconfig... not too comfortable, but should do.

Like I already said - incorporate the required sed command into your PKGBUILD. Then all you need to do is get the latest Arch config, drop it into your build directory, and run makepkg.

Offline

Board footer

Powered by FluxBB