How do I configure the Linux kernel within Buildroot?
I always do the following:
- configure Linux kernel:
make linux-menuconfig
- After leaving menuconfig your configuration will be stored in file:
output/build/linux-XYZ/.config
where XYZ is your kernel version. - After that you can copy file
output/build/linux-*XYZ*/.config
toboard/your_kernel_config/.config
- later in Buildroot menuconfig you can under kernel settings configure to use custom kernel config file and enter path:
board/your_kernel_config/.config
BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES
Adds extra configs to your existing one.
E.g., if you are using buildroot
as a submodule, the directory tree looks like:
.git/buildroot/.gitmoduleskernel-config-frag
E.g. to turn on CONFIG_DEBUG_FS
, do:
echo 'CONFIG_DEBUG_FS=y' > kernel-config-frag
and then configure buildroot with:
cd buildrootmake qemu_x86_64_defconfigecho 'BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES=../kernel-config-frag' >> buildroot/.configmake
This way you can git track just a diff between qemu_x86_64_defconfig
and your extra configs.
I believe this uses scripts/kconfig/merge_config.sh
form the kernel as mentioned at: How do you non-interactively turn on features in a Linux kernel .config file?
After you change the config fragment, just remember to do:
rm -rf buildroot/output/build/linux-*.*.*/
before the next build.
Minimal runnable example at: https://github.com/cirosantilli/linux-kernel-module-cheat/blob/bb8f4eb79565c9771356c80e0964c8fefc163e11/kernel-config-frag
BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
Selects the full .config
to be used.
For some reason I have to nuke the kernel's .config
for this to take effect? Why when I change BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE and run make linux-reconfigure the kernel .config does not change?