User:Egberts/Drafts/Gentoo Kernel Configuration Guide

From Gentoo Wiki
Jump to:navigation Jump to:search
Note
Editor: this section gets inserted into Kernel/Gentoo Kernel Configuration Guide or into Kernel/Configuration

Advanced Kernel Configurations

Linux kernel also has provided two scripts to assist with updating kernel configuration settings (without having to tediously navigate through make menuconfig:

  • change a single setting; linux/scripts/config command (introduced 3.33rc1+)
  • change many kernel configuration settings; linux/scripts/kconfig/merge_config.sh command (introduced 2.6.29-rc1+)

Single Option approach

One way to change the .config at the command line is to change one-line per command evocation.

An example of changing four(4) settings is shown below:

root # cd /usr/src/linux
root #./scripts/config --set-val CONFIG_OPTION y
root #./scripts/config --enable CONFIG_BRIDGE
root #./scripts/config --enable CONFIG_MODULES
root #./scripts/config --disable CONFIG_X25
root #./scripts/config --module CONFIG_NFT make oldconfig

(updates dependencies; may prompt with new dependencies, but old deps silently goes away)

The [1].

Multiple-File Merge approach

When building and customizing Linux kernel repeatedly, it becomes a time-saver to incorporate all the settings into a single (but smaller) kernel configuration file. Each kernel configuration file would represent a certain feature, device, or functionality.

This makes grouping of many settings of kernel configurations less forgetful and easily referenced by a (descriptive) filename that can be easily inserted into a Linux kernel configuration.

Given the two example files:

FILE /usr/src/kernel-config-qemu-always-on.configSpecific Purpose Kernel Config file
CONFIG_HIBERNATION=n
CONFIG_AUTOSLEEP=n
CONFIG_ACPI_SLEEP=n
CONFIG_PM_SLEEP=n
FILE /usr/src/kernel-config-accessibility-readable.configReadable Terminal
# Terminus Font is a clean, fixed width bitmap font,
# designed for long (8 and more hours per day) work with
# computers.  This is the high resolution, large version
# for use with HiDPI screens.
CONFIG_FONTS=y
CONFIG_FONT_SUPPORT=y
CONFIG_FONT_TER16x32=y


root #./scripts/kconfig/merge_config.sh kernel-kconfig-accessibility-readability.config
root #./scripts/kconfig/merge_config.sh kernel-kconfig-qemu-always-on.config
root ## Auto-add/auto-remove CONFIG_ dependencies
root #make oldconfig

The command to update the default /usr/src/linux/.config file is:

root #cd /usr/src/linux
root #scripts/kconfig/merge_config.sh my-kernel-config-gkcg.config

Now the kernel will incorporate both readable terminals and ensure that it would never hibernate nor sleep.

References