bpi-f3: add support for SinoVoip BPI-F3 RISC-V board

Description

This is a continuation of MR !23075 (closed) to add support for BPI-F3 RISC-V board. New elements to enable support for this board are based on the SinoVoip downstream BSP. The BPI-F3 board is based on the spacemit-k1 SoC.

Progress is being tracked in #1780.

Also see wiki about booting the BPI-F3 board from an NVMe drive.

Following the steps to reproduce the build and the tests run so far.

Build

Bootloader

bst -o bootstrap_build_arch riscv64 -o target_arch riscv64 --option downstream_bsp spacemit_k1 build vm/firmware/bootloader-spacemit-k1.bst

EFI image (bootfs + rootfs)

bst -o bootstrap_build_arch riscv64 -o target_arch riscv64 --option downstream_bsp spacemit_k1 build vm/minimal/efi.bst

Flash

Bootloader

The bootoloader can be flashed either on an SD card or on a SPI NOR. In the first case dd can be used with sd.img as input.

For the SPI NOR, the image should be written with a MTD aware tool. This can be done with the stock image, either from u-boot or from linux.

  • From u-boot:

    Copy the nor.img into the rootfs of the bianbu stock image (e.g. in /nor.img). Then boot from SD and press 's' in u-boot to stop autoboot. Following the u-boot steps to write the image into the nor flash:

    load mmc 0:6 ${kernel_addr_r} nor.img
    mtd erase nor0
    mtd write nor0 ${kernel_addr_r} 0 ${filesize}
  • From linux:

    Note: this requires internet access on the board to download the mtd tools. Copy the nor.img into the rootfs of the bianbu stock image (e.g. in /nor.img) and boot from SD. The run the following steps:

    apt-get update && apt-get install mtd-utils
    flash_erase /dev/mtd0 0 0
    flashcp /nor.img /dev/mtd0

EFI image (bootfs + rootfs)

The image can be flashed on the NVMe SSD offline before attaching it to the board. Otherwise it can by copied into the rootfs of an SD card with the stock system and then flashed on the NVME SSD after booting the board from the SD.

Boot Test

After selecting NOR boot mode (first switch = 1), the board should load the DTB, kernel and EFI image from the NVMEe efi partition. The kernel command line set by the EFI loader does not set 115200 console baudrate. Either restart the console host with 9600 baudrate or change the command line console parameter to console=ttyS0,115200n8. The latter can be done by pressind 'e' in the EFI boot screen.

Hardware Tests

After booting the minimal fdsdk image, I quickly tested the following HW components:

  • both ethernet ports working (only ping tested)
  • HDMI working
  • SD card working
  • eMMC working
  • PCI+NVMe working
  • USB ports not working, not even with bianbu stock image: might be an HW fault on my board

Notes

By default u-boot, when booting though EFI, reserves memory areas based on the provided device-tree. I added a workaround patch on u-boot to disable memory reservation and let the kernel handle it. Note that this is not a proper long-term solution as the EFI loader might use memory areas reserved for special use.

Edited by Matteo Martelli

Merge request reports

Loading