Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I configure the Linux kernel within Buildroot?

I'm trying to build a rootfs for an x86 target, which is all simple enough. However I can't figure out how I configure the kernel that buildroot produces. The first run through came up with menuconfig, but it's cached the .config since then and I can't see where to change it.

~650MB of kernel modules don't do good things to an embedded target :P

Is there an easy way to configure the kernel within buildroot? Something like the uclibc-menuconfig target would be perfect.

like image 924
Cogsy Avatar asked Sep 12 '09 12:09

Cogsy


People also ask

What is Linux buildroot?

Buildroot is a set of Makefiles and patches that simplifies and automates the process of building a complete and bootable Linux environment for an embedded system, while using cross-compilation to allow building for multiple target platforms on a single Linux-based development system.

How do I enable buildroot packages?

There are two main methods to add a custom package into buildroot. The first method includes adding a package directly into the source tree and is described here. The second involves the use of an external package tree. A reference to using the second method is provided at the end of this article.

Is buildroot a Linux distribution?

Buildroot is a tool for automating the creation of Embedded Linux distributions. It builds the code for the architecture of the board so it was set up, all through an overview of Makefiles. In addition to being open-source, it is licensed under GPL-2.0-or-later.


3 Answers

I always do the following:

  1. configure Linux kernel: make linux-menuconfig
  2. After leaving menuconfig your configuration will be stored in file: output/build/linux-XYZ/.config where XYZ is your kernel version.
  3. After that you can copy file output/build/linux-*XYZ*/.config to board/your_kernel_config/.config
  4. later in Buildroot menuconfig you can under kernel settings configure to use custom kernel config file and enter path: board/your_kernel_config/.config
like image 164
Aleksandar Avatar answered Oct 20 '22 04:10

Aleksandar


Do not forget to set also defconfig to i386 in menuconfig:

  Kernel  —>
  [*] Linux Kernel
  (i386) Defconfig name 
like image 20
TadejP Avatar answered Oct 20 '22 03:10

TadejP


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/
.gitmodules
kernel-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 buildroot
make qemu_x86_64_defconfig
echo 'BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES=../kernel-config-frag' >> buildroot/.config
make

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?