我要评分
获取效率
正确性
完整性
易理解

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

  1. Install the dependencies for compiling the kernel.
    1
    2
    3
    4
    5
    6
    # sudo apt install -y build-essential
    # sudo apt install -y libncurses5-dev openssl libssl-dev
    # sudo apt install -y pkg-config
    # sudo apt install -y bison
    # sudo apt install -y flex
    # sudo apt install -y libelf-dev
    
  2. Copy the config file in the /boot directory to the source code directory and rename the file to .config.

    In the preceding command, the name of the configuration file in the /boot directory is only an example. Run the uname -r command to view the actual file name. The .config file version must match the OS kernel version.

    1
    # cp /boot/config-`uname -r` /usr/src/linux-kernel-5.15.98/.config
    
  3. Create a .config file.
    1
    2
    # cd /usr/src/linux-kernel-5.15.98/
    # sudo make menuconfig
    
  4. Click Load in the following window:

  5. Click OK in the following window:

  6. Click Save in the following window:

  7. Click OK in the following window:

  8. Click Exit in the following window:

  9. Go to the initial window and click Exit. The .config file is created in the current folder.