Compile Kernel, Device Tree, and Driver Module
Follow the steps below to compile kernel, device tree, and driver module:
- 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. - After setting up the software environment, execute the following command to compile the source code:
$ make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv -j$(nproc)
- Execute the following command to create a directory for storing the generated kernel files:
$ mkdir ../compiled
- Execute the following command to compile and generate files such as config, system.map, and vmlinuz to the specified path:
$ make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv INSTALL_PATH=../compiled zinstall -j$(nproc)
The following figure is an example output: - Execute the following command to copy dtb files:
$ cp arch/riscv/boot/dts/starfive/jh7110-visionfive-v2.dtb ../compiled
- (Optional) Execute the following command to compile and generate files to the specified path:
$ make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- INSTALL_MOD_PATH=../compiled modules_install
Note: If the new kernel does not involve changes to the driver module, it can be omitted and the default kernel's driver module will still be used.The following figure is an example output:Note: There is no link between build and source in the corresponding path of the Debian image. The corresponding item in the above figure can be deleted.