Rate This Document
Findability
Accuracy
Completeness
Readability

Compiling and Installing the Kernel

  1. Compile the kernel.
    1
    2
    # cd /usr/src/linux-kernel-5.15.98/
    # sudo make -j64
    

    If the following information is displayed during the compilation, ensure that the server system time is the latest time:

    Run the tzselect command and enter the numbers corresponding to the following options in sequence: Asia->China->Beijing Time->YES. After the command is executed, copy the file to /etc/localtime.

    1
    2
    # tzselect
    # sudo cp /usr/share/zoneinfo/Asia/Beijing /etc/localtime
    
  2. Check whether the kernel is compiled successfully.
    Check whether a vmlinux file is generated in the compilation path. If a vmlinux file is generated, the compilation is successful. You can proceed to the next step. If not, check whether an error is reported during compilation, rectify the fault, and perform 1 again.
    1
    2
    3
    4
    # ll vmlinux*
    -rwxr-xr-x 1 root root 42919136 Mar 22 03:31 vmlinux*
    -rw-r--r-- 1 root root 64101280 Mar 22 03:30 vmlinux.o
    -rw-r--r-- 1 root root   678152 Mar 22 03:30 vmlinux.symvers
    
  3. Compile kernel modules.
    1
    # sudo make modules -j64
    
  4. Install the modules.
    1
    # sudo make modules_install
    
  5. Install the kernel.
    1
    # sudo make install
    
  6. Update the boot items.
    1
    # sudo update-grub2
    

    Restart the OS for the new kernel to take effect.

    1
    # sudo reboot
    
  7. Check the version of the new kernel. If the version is 5.15.98, the correct kernel is imported.
    1
    2
    # uname -a
    Linux ubuntu 5.15.98 #2 SMP Wed Mar 22 03:30:54 UTC 2023 aarch64 aarch64 aarch64 GNU/Linux