Rate This Document
Findability
Accuracy
Completeness
Readability

Creating and Configuring a .config File

Create a .config file and configure kernel compilation options. This file specifies the functions and features to be enabled.

  1. Copy the config file in the /boot directory to the source code directory and rename the file to .config.
    • In the command, the name of the config file in the /boot directory is only an example. You can use the uname -r command to view the actual file name. The config file version must match the OS kernel version.
    • If the config-`uname -r` file does not exist in the /boot directory, copy any file prefixed with config- in the /boot directory to the kernel source code directory on the server and rename the file .config.
    1
    cp /boot/config-`uname -r` /usr/src/kernels/kernel-5.10.0-136.12.0/.config
    
  2. Generate a .config file.
    1
    2
    cd /usr/src/kernels/kernel-5.10.0-136.12.0/
    make menuconfig
    
  3. Select Load in the following page:

  4. Select Ok in the following page:

  5. Configure the kernel compilation options.

    In the page shown in Figure 1, configure the kernel compilation options according to Table 1.

    Figure 1 Kernel configuration page
    Table 1 Kernel compilation options

    Configuration Item

    Required Value

    Configuration Prompt

    Configuration Result Written to the .config File

    KBOX

    Y

    [*] Kernel support for Kbox

    CONFIG_KBOX=y

    ANDROID_BINDER_DEVICES

    binder,hwbinder,vndbinder

    (binder,hwbinder,vndbinder) Android Binder devices

    CONFIG_ANDROID_BINDER_DEVICES="binder,hwbinder,vndbinder"

    HISI_PMU

    M

    <M> HiSilicon SoC PMU drivers

    CONFIG_HISI_PMU=m

    SYSTEM_TRUSTED_KEYS

    Clear out this field.

    ( ) Additional X.509 keys for default system keyring

    CONFIG_SYSTEM_TRUSTED_KEYS=""

    DEBUG_INFO

    N

    [ ] Compile the kernel with debug info

    # CONFIG_DEBUG_INFO is not set

    PID_RESERVE

    N

    [ ] Support for reserve pid

    # CONFIG_PID_RESERVE is not set

    PSI_DEFAULT_DISABLED

    N

    [ ] Require boot parameter to enable pressure stall information tracking

    # CONFIG_PSI_DEFAULT_DISABLED is not set

    Configuration methods:

    • Press the up, down, left, and right arrow keys to navigate the menu.
    • Press Enter to select a submenu or edit the content of a selected item.
    • Press Esc twice to exit.
    • Press / for search.
    • Press Y to compile the selected item into the kernel. The corresponding item is displayed as [*].
    • Press N to exclude the selected item. The corresponding item is displayed as [].
    • Press M to compile the selected item into a module (in KO format). The corresponding item is displayed as <M>.

    A configuration example is provided as follows:

    1. On the configuration page, press / to search, type STAGING, and press Enter. The search result is displayed, as shown in the following figure.

    2. Confirm the number of the configuration item, for example, (1) in the following figure. Press 1 to select the configuration item.

    3. Press y to compile the selected item into the kernel. Then use the left and right arrow keys to navigate to <Exit> and press Enter.

    4. On the kernel configuration home page, configure the next item as required.
  6. After the configuration is complete, choose Save on the kernel configuration home page.

  7. Select Ok in the following page:

  8. Select Exit in the following page:

  9. The home page is displayed. Choose Exit. The .config file is generated in the current directory.