I have a Linux kernel image in elf format and I want to find out what .config
file was used to build this kernel. When I do an objdump of the image, I see a section called kernel_config_data
that contains text but does not look like the config file. Is there a way to retrieve this information?
The Linux kernel configuration is usually found in the kernel source in the file: /usr/src/linux/. config . It is not recommended to edit this file directly but to use one of these configuration options: make config - starts a character based questions and answer session.
The configuration file (/boot/grub/grub. conf), which is used to create the list of operating systems to boot in GRUB's menu interface, essentially allows the user to select a pre-set group of commands to execute.
/proc/config. gz is a compressed copy of the kernel configuration that was used when the kernel was build. To modify kernel configuration you have to recompile the kernel.
Assuming your kernel was built with the IKCONFIG option, you can use the scripts/extract-ikconfig
tool to extract the original .config
file.
Alternately, you can boot that kernel and find the embedded configuration in /proc/config.gz
.
You can zcat
/proc/config.gz
, for example:
zcat /proc/config.gz | grep 'CONFIG_PRINTK_TIME'
To dump this into the .config
used in the kernel build process:
zcat /proc/config.gz > .config
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With