41

When building a new kernel based on a previous config, is there a way to automate the make oldconfig process so that it sets new options to their default values?

Edit: What I mean is that when using a .config (from /boot/config-* or /proc/config.gz) on a newer kernel, the make oldconfig process will ask wether or not you want to enable options that were not available in your older kernel. You can answer Y/n/m or press enter to accept default. I would like to accept defaults automatically with no user interaction.

Flow
  • 958
  • 9
  • 15
  • @jscott This would only "press enter" for the first question, not all of them. You can use the 'yes' command to have a string printed indifinitly. – Laurent Parenteau Feb 24 '10 at 18:34

5 Answers5

67
make olddefconfig

is what you want. From the help (make help in the kernel source dir)

olddefconfig - Same as silentoldconfig but sets new symbols to their default value

Flow
  • 958
  • 9
  • 15
44

Use the command :

yes "" | make oldconfig

The 'yes' command repeatedly output a line with all specified string, or 'y' by default.

So, you can use it to simply "press enter", which will result in using the defaults value for the 'make oldconfig' command.

0

Yes. It's stored in ".config" in the top level of the source directory.

Additionally, if using distribution kernel, some distributions such as RedHat store it in /boot/config-$(uname -r). (kernel version) [1]

Finally, if compiled in the kernel you're running, it's available in /proc/config.gz. I forget what version introduced this option.

[1] These options:

CONFIG_IKCONFIG=y
CONFIG_IKCONFIG_PROC=y 

Edit

Check out /usr/src/linux/kernel/Documentation/kbuild/kconfig.txt (or appropriate path). You can use some of their recommendations to script a solution. I would use a combination of scripting and textutils to accomplish what you describe.

Edit 2

As an additional note, this is a bad idea. What if optional hardware support unique to your environment changes but isn't default? What if a negatively impacting changes occurs? This really is something that should be interactive. You can make the config and automate the rest.

"make silentoldconfig" is a little less verbose, which might be helpful. It is still interactive.

Warner
  • 23,440
  • 2
  • 57
  • 69
0

make silentoldconfig

0

Though an old question, I never found a good answer to OP's question.

I found another way around the interactive questions; rather than patching .config, I patch the defconfig file, i.e.

make ARCH=arm mrproper
patch -N -p1 < ../../patches/autofs.patch || true
make ARCH=arm xilinx_zynq_defconfig
make ARCH=arm UIMAGE_LOADADDR=0x8000 uImage
make ARCH=arm modules
make ARCH=arm INSTALL_MOD_PATH=target modules_install

The patch in my case:

--- a/arch/arm/configs/xilinx_zynq_defconfig    2019-12-12 08:31:42.985777534 +0100
+++ b/arch/arm/configs/xilinx_zynq_defconfig    2019-12-12 08:31:46.695777606 +0100
@@ -221,6 +221,7 @@
 CONFIG_XILINX_PR_DECOUPLER=y
 CONFIG_EXT2_FS=y
 CONFIG_EXT3_FS=y
+CONFIG_AUTOFS4_FS=y
 # CONFIG_DNOTIFY is not set
 CONFIG_MSDOS_FS=y
 CONFIG_VFAT_FS=y

This way no questions are asked.

Mike
  • 101