Follow the following steps to compile Linux Kernel for VisionFive.
Locate to your desired directory to store the Linux Kernel files. For example, the home
directory.
Example:
cd ~ # home directory
Download the source code for Linux Kernel.
git clone https://github.com/starfive-tech/linux
Type the following to set the default configuration settings for compiling Linux
Kernel.
cd linux
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv visionfive_defconfig
Type the following to set additional configuration settings for compiling Linux Kernel.
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv menuconfig
Compile the Linux Kernel.
make CROSS_COMPILE=riscv64-linux-gnu- ARCH=riscv -jx
Note: Here you need to change the -jx value
according to the number of cores in your CPU. If your CPU has 8 cores, change this to
-j8. This process will take some time and therefore please wait
patiently.
Result:
The kernel image will be generated inside the directory
linux/arch/riscv/boot as
Image.gz.Figure 1. Example Output The dtb files will be generated inside the directory
linux/arch/riscv/boot/dts/starfiveFigure 2. Generated dtb Files The Image.gz and .dtb files will be
used later in this guide when we try to move rootfs, dtb and kernel to VisionFive. Different boards use
different dtb files, and for the detailed information, refer to the dtb
Files table in StarFive 40-Pin
GPIO Header User Guide.