Creating and Configuring a .config File
The first step to compile the kernel is to create a .config file in which the functions and features that need to be enabled are declared.
- 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.
1cp /boot/config-`uname -r` /usr/src/linux-kernel-5.15.98/.config
- Update the .config file content.
1 2
cd /usr/src/linux-kernel-5.15.98/ sudo 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
STAGING
Y
[*] Staging drivers
CONFIG_STAGING=y
ANDROID
Y
[*] Android Drivers
CONFIG_ANDROID=y
ASHMEM
Y
[*] Enable the Anonymous Shared Memory Subsystem
CONFIG_ASHMEM=y
ANDROID_BINDER_IPC
Y
[*] Android Binder IPC Driver
CONFIG_ANDROID_BINDER_IPC=y
ANDROID_BINDERFS
Y
[*] Android Binderfs filesystem
CONFIG_ANDROID_BINDERFS=y
ANDROID_ALARM
Y
<*> Android Alarm Driver
CONFIG_ANDROID_ALARM=y
ANON_VMA_NAME
Y
[*] Anonymous VMA name support
CONFIG_ANON_VMA_NAME=y
EXAGEAR_BT
Y
[*] Exagear binary translator support
CONFIG_EXAGEAR_BT=y
VFAT_FS
Y
<*> VFAT (Windows-95) fs support
CONFIG_VFAT_FS=y
INPUT_UINPUT
Y
<*> User level driver support
CONFIG_INPUT_UINPUT=y
HISI_PMU
Y
<*> HiSilicon SoC PMU drivers
CONFIG_HISI_PMU=y
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
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, 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 Save on the kernel configuration home page.

- Select OK in the following page:

- Select Exit in the following page:

- The home page is displayed. Select Exit. The .config file content is updated.

