Compiling the U-Boot

Follow the steps below to compile the U-Boot for VisionFive 2.

  1. Locate to your desired directory to store the U-Boot files. For example, the home directory.
    Example:
    cd ~ # home directory
  2. Download the source code for U-Boot compilation.
    git clone https://github.com/starfive-tech/u-boot.git
  3. Switch to the code branch by executing the following command:
    cd u-boot
    git checkout -b JH7110_VisionFive2_devel origin/JH7110_VisionFive2_devel
    git pull
  4. Type the following to compile U-Boot under the U-Boot directory.
    make <Configuration_File> ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
    make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu-
    Tip:

    Configuration_File: For VisionFive 2, the file is starfive_visionfive2_defconfig.

    Result:

    There will be these 3 files generated after compilation inside the u-boot directory:

    • u-boot.bin
    • arch/riscv/dts/starfive_visionfive2.dtb
    • spl/u-boot-spl.bin
    Figure 1. Example Output - u-boot.bin
    Figure 2. Example Output - visionfive2.dtb
    Figure 3. Example Output - u-boot-spl.bin
    Tip: Both starfive_visionfive2.dtb and u-boot.bin will be used later for OpenSBI compilation.
    Tip: u-boot-spl.bin will be used later for creating SPL file.