androidlinuxlinux-kernelkernelandroid-kernel

Modify Linux kernel config file


How do I modify .config file in linux kernel?

When I type make device_defconfig a .config file is in created in the kernel directory. But when I type make menuconfig the .config file is modified. I would like to modify the <device>_defconfig in menuconfig.


Solution

  • The .config file is not generally supposed to be modified manually, event though you can.

    The clean and simple way is:

    1. make <device>_defconfig
    2. make menuconfig
      • edit
      • exit saving changes
    3. make savedefconfig
      • creates a file named defconfig
    4. cp defconfig arch/$ARCH/configs/<device>_defconfig
      • where $ARCH is the CPU architecture, e.g. arm

    A defconfig is similar to .config, except it contains only values that differ from their default values. As such they are much shorter and readable. The entire .config is very verbose but it's what make menuconfig edits and what the kernel needs to build.