8

Given a list of kernel features, I want to create a minimal linux configuration supporting all given features (and the corresponding dependencies) but nothing else.

Is there a way to create a allnoconfig and a tool to enable features one by one?

(I could edit the .config file but this would not get dependencies right. I could use make *config, but as far as I know those work only interactive or create some default config.)

1

If you need to do it non-interactively, you might be able to use make oldconfig or make olddefconfig. make *config will fix the dependencies and those aren't as verbose as, say menuconfig. (Otherwise menuconfig is perfectly fine for enabling features one by one, it even includes the help texts!)

make oldconfig will ask for any 'new' configuration options, so you would need to insert comments like this for any disabled options if you want to work non-interactively:

# CONFIG_KERNEL_GZIP is not set

make olddefconfig on the other hand doesn't seem to ask, but uses a default value. There's also silentoldconfig, but it also asks in some cases, so it's not that silent.

from make help:

oldconfig       - Update current config utilising a provided .config as base
silentoldconfig - Same as oldconfig, but quietly, additionally update deps
olddefconfig    - Same as silentoldconfig but sets new symbols to their default value

Disclaimer: I only tried the trivial test of removing the options for some libraries I know were needed. They were added back by olddefconfig and oldconfig. I don't know how this applies to doing a larger configuration.

In any case, I suppose you already considered using make localmodconfig or something like that before starting this? I haven't tried making a minimal config in years, but I seem to remember there were some rather non-obvious ways to create totally unusable kernels. :)

  • "olddefconfig" would probably work fine, too. Is there a way to get the default config options from a defconfig file? (In that case the defconfig file would give a suitable base and minimal custom option could be set in .config.) – michas May 24 '16 at 8:15
-1

Since kernel 2.6.29 there is a script that you can find in
/kernel_extracted_dir/scripts/config

For example

/kernel_extracted_dir/scripts/config --set-val CONFIG_LOG_BUF_SHIFT 14
/kernel_extracted_dir/scripts/config --enable CONFIG_PRINTK_TIME

(To give credit where it is due, I took the example from this blog)

You have the follwing options (copied from the help)

--enable|-e option   Enable option
--disable|-d option  Disable option
--module|-m option   Turn option into a module
--set-str option string
                     Set option to "string"
--set-val option value
                     Set option to value
--undefine|-u option Undefine option
--state|-s option    Print state of option (n,y,m,undef)

--enable-after|-E beforeopt option
                         Enable option directly after other option
--disable-after|-D beforeopt option
                         Disable option directly after other option
--module-after|-M beforeopt option
                         Turn option into module directly after other option commands can be repeated multiple times

options:
    --file config-file   .config file to change (default .config)
    --keep-case|-k       Keep next symbols' case (dont' upper-case it)
  • 1
    This seem great at the first look. Unfortunately it seems not to care about dependencies at all. :( – michas May 18 '16 at 17:53

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.