# Linux Kernel Module Cheat

#### 17.1.3. About our Linux kernel configs

By default, build-linux generates a `.config` that is a mixture of:

- a base config extracted from Buildroot’s minimal per machine `.config`, which has the minimal options needed to boot as explained at: Section 17.1.3.1, “About Buildroot’s kernel configs”.

- small overlays put top of that

To find out which kernel configs are being used exactly, simply run:

    ./build-linux --dry-run

and look for the `merge_config.sh` call. This script from the Linux kernel tree, as the name suggests, merges multiple configuration files into one as explained at: https://unix.stackexchange.com/questions/224887/how-to-script-make-menuconfig-to-automate-linux-kernel-build-configuration/450407#450407

For each arch, the base of our configs are named as:

    linux_config/buildroot-<arch>

e.g.: linux_config/buildroot-x86_64.

These configs are extracted directly from a Buildroot build with update-buildroot-kernel-configs.

Note that Buildroot can `sed` override some of the configurations, e.g. it forces `CONFIG_BLK_DEV_INITRD=y` when `BR2_TARGET_ROOTFS_CPIO` is on. For this reason, those configs are not simply copy pasted from Buildroot files, but rather from a Buildroot kernel build, and then minimized with `make savedefconfig`: https://stackoverflow.com/questions/27899104/how-to-create-a-defconfig-file-from-a-config

On top of those, we add the following by default:

- linux_config/min: see: Section 17.1.3.1.2, “Linux kernel min config”

- linux_config/default: other optional configs that we enable by default because they increase visibility, or expose some cool feature, and don’t significantly increase build time nor add significant runtime overhead

  We have since observed that the kernel size itself is very bloated compared to `defconfig` as shown at: Section 17.1.3.1.1, “Linux kernel defconfig”.

- About Buildroot’s kernel configs

- Notable alternate gem5 kernel configs