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

Preparations

This document describes how to compile the kernel source code on the default OS openEuler 22.03 LTS (kernel version 5.10.0).

For details about how to install the openEuler OS, see openEuler 22.03 LTS Installation Guide.

Before the compilation, configure the network environment, software source, and system time of the server for downloading the related compilation dependencies.

After Kbox-AOSP11.zip is decompressed, the one-click kernel installation script kbox11_install_kernel.sh is generated in the Kbox-AOSP11/deploy_scripts/openEuler_android11_deploy directory. This script contains all steps for compiling the kernel. You can run this script to quickly compile and install the kernel.

For details about how to use the script, see the comments at the beginning of the script.

During the compilation, use the root user to log in and perform operations.

  1. Disable the warning "your kernel does not support swap memory limit...".
    1. Open the /etc/default/grub file.
      vim /etc/default/grub
    2. Press i to enter the insert mode and change the value of GRUB_CMDLINE_LINUX in the file as follows:
      1
      GRUB_CMDLINE_LINUX="cgroup_enable=memory swapaccount=1"
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.

    If GRUB_CMDLINE_LINUX has other settings, add the preceding setting to the end.

  2. Disable SELinux.
    1. Open the /etc/selinux/config file. If the file does not exist, create one and open it.
      vim /etc/selinux/config
    2. Press i to enter the insert mode and change the value of SELINUX to disabled.
      1
      SELINUX=disabled
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  3. When multiple Kbox containers are started, the file access workload is heavy on the host. In this case, you need to adjust the maximum number of inotify instances that can be created.
    1. Open the /etc/sysctl.conf file.
      vim /etc/sysctl.conf
    2. Press i to enter the insert mode and specify the value of fs.inotify.max_user_instances in the end of the file.
      1
      fs.inotify.max_user_instances=8192
      
    3. Press Esc, type :wq!, and press Enter to save the file and exit.
  4. Update boot items.
    grub2-mkconfig -o /boot/efi/EFI/openEuler/grub.cfg
  5. Install base dependencies.
    yum install -y make dpkg dpkg-devel openssl openssl-devel ncurses ncurses-devel bison flex bc libdrm build elfutils-libelf-devel patch make gcc

    If a package fails to be obtained during the installation, manually obtain the package based on the address provided in the message and install it. After the installation is successful, continue to install the remaining dependency packages.

  6. Install Docker and lxcfs. If Docker and lxcfs have been installed, skip this step.

    Run the following commands to install Docker and lxcfs, start the lxcfs service, and set the lxcfs service to automatically start upon system startup:

    yum install -y docker lxc lxcfs lxcfs-tools 
    systemctl start lxcfs && systemctl enable lxcfs

    If an error is reported during lxcfs startup, restart the service or contact technical support.

  7. Upgrade linux-firmware. If the firmware has been upgraded, skip this step.

    Download linux-firmware-20210919.tar.gz using the link provided in Table 1.

    Upload the installation package to the server, for example, to the /root directory of the server, and decompress the package.
    cd ~ && tar -xvpf linux-firmware-20210919.tar.gz
    After the decompression, the linux-firmware-20210919 folder is generated in the root directory. Copy the firmware file to the standard Linux firmware directory.
    cp -ar linux-firmware-20210919/*gpu /usr/lib/firmware/
  8. Restart the system for the settings to take effect.
    reboot

    You can perform this step after operations in Compiling and Installing the Kernel are completed to make all settings take effect.