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.
- 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.
1cp /boot/config-`uname -r` /usr/src/kernels/kernel-5.10.0-136.12.0/.config
- Generate a .config file.
1 2
cd /usr/src/kernels/kernel-5.10.0-136.12.0/ make menuconfig
- Select Load in the following page:

- Select Ok in the following page:

- Configure the kernel compilation options.
In the page shown in Figure 1, configure the kernel compilation options according to Table 1.
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:
- On the configuration page, press / to search, type STAGING, and press Enter. The search result is displayed, as shown in the following figure.

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

- 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.

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

- Select in the following page:

- Select in the following page:

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

