Search code examples
linuxconfigurationlinux-kernelarmkbuild

How to extract the config from a kernel image file when CONFIG_IKCONFIG is set as a module (=m)?


How do I extract the kernel configuration from a kernel image file?

The kernel image file type is:

/boot/kernel7.img: Linux kernel ARM boot executable zImage (little-endian)

The kernel has been compiled with CONFIG_IKCONFIG enabled. However,

scripts/extract-ikconfig /boot/kernel7.img

returns

extract-ikconfig: Cannot find kernel config.

Note: I am trying the get the config without booting the kernel.


Solution

  • If the kernel has been compiled with CONFIG_IKCONFIG=m (note the m), the configuration in stored in a module (configs.ko) and not in the kernel itself. That's the reason why running extract-ikconfig on the kernel image fails.

    In this case, we can extract the config from the configuration module:

    /usr/src/$(uname -r)/scripts/extract-ikconfig \ 
       /lib/modules/$(uname -r)/kernel/kernel/configs.ko