Compile Debian and Update Kernel

Execute the first 3 steps in Software Environment, and choose the compile method according to your compilation environment:

Local compile and Install

  1. Use bindeb-pkg to creat kernel:
    cd linux/
    cp arch/riscv/configs/starfive_visionfive2_defconfig .config
    make ARCH=riscv olddefconfig
    make ARCH=riscv -j$(nproc) bindeb-pkg
  2. After compilation, install the .deb kernel package.
    dpkg -i *.deb

Cross compile and Install

  1. Execute the following command to set the default configuration of compiling Linux kernel:
    make <Configuration_File> CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv
    Tip: <Configuration_File>: This file is starfive_visionfive2_defconfig on VisionFive 2.
  2. Execute the following command to compile the kernel image and header files, and then package them as Debian packages:
    $ nice make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- bindeb-pkg -j$(nproc)  
    KDEB_COMPRESS=xz LOCALVERSION=’local_version’
    Tip: local_version is the version of the compiled kernel, which sets to -performance in this example, so the whole command is:
    $ nice make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- bindeb-pkg -j$(nproc)  
    KDEB_COMPRESS=xz LOCALVERSION=-performance
  3. After compilation, the following files and dtb files will be generated in the upper directory:
    Figure 1. File
    Figure 2. Dtb Files
  4. Transfer the compiled Debian package and dtb files through network (SCP) or portable storage medium (USB) to VisionFive 2. The following figure shows an example output of file transfer over the network:
    Figure 3. Example Output
  5. Execute the following command to install Debian:
    $ dpkg -i linux-headers-5.15.0-performance_5.15.0-performance-1_riscv64.deb
    $ dpkg -i linux-image-5.15.0-performance_5.15.0-performance-1_riscv64.deb
    $ dpkg -i linux-libc-dev_5.15.0-performance-1_riscv64.deb
  6. After installation, the files under /boot will be updated into:
    Figure 4. Files under /boot