DEV Community

Luca Barbato
Luca Barbato

Posted on

Bringing up BPI-F3 - Part 1

I like a lot non-x86 architectures, I still enjoy writing software for PowerPC even nowadays and I'm looking forward to see how SVE will be once there is hardware in the right price range.
Today it is the turn of RISC-V since there is eventually a, hopefully, nice board sporting a cpu with the RISC-V Vector Extension 1.0 that is now part of the RISC-V.

Where to start

The official documentation is available here.

The board comes with an empty eMMC, so either you start with a SD, or you need to upload a valid image using dfu.

Sadly the usb-c does not multiplex also the serial, so you'll need to connect the usual 3 pins with a 3.3V usbserial.

ERROR:   CMD8
ERROR:   sd f! l:76
bm:0
ERROR:   emmc: invalid bootinfo magic code:0x0
ERROR:   invalid bootinfo image.
ERROR:   entering download mode.
ROM: usb download handler
usb2d_initialize : enter
Force usb FS mode!
Controller Run
usb rst int
SETUP: 0x0 0x5 0x1
SETUP: 0x80 0x6 0x100
SETUP: 0x80 0x6 0x100
SETUP: 0x80 0x6 0x302
SETUP: 0x80 0x6 0x302
SETUP: 0x80 0x6 0x301
SETUP: 0x80 0x6 0x301
SETUP: 0x80 0x6 0x30a
SETUP: 0x80 0x6 0x30a
SETUP: 0x80 0x6 0x200
SETUP: 0x80 0x6 0x200
SETUP: 0x80 0x6 0x300
Enter fullscreen mode Exit fullscreen mode

Their images are Debian derivatives, I prefer Gentoo and since we have stage3 for rv64_lp64d-openrc, I guess I can give it a try.

Vendor-sources for kernel and bootloaders are available and I can piggy back over that image if I stumble over opensbi or u-boot or I run out of time sorting out the patches for linux-6.1.15

Prerequisites

Lazy Setup

The base images share this layout:

Number  Start (sector)    End (sector)  Size       Code  Name
   1             256             767   256.0 KiB   8300  fsbl
   2             768             895   64.0 KiB    8300  env
   3            2048            4095   1024.0 KiB  8300  opensbi
   4            4096            8191   2.0 MiB     8300  uboot
   5            8192          532479   256.0 MiB   8300  bootfs
   6          532480              <>   <> GiB     8300  rootfs
Enter fullscreen mode Exit fullscreen mode

With the rootfs taking the space it needs.

The easiest way is to copy the first 5 partitions to the eMMC

# dd if=/dev/mmcblk0 of=/dev/mmcblk2 bs=1M count=256
Enter fullscreen mode Exit fullscreen mode

And then recreate the rootfs partition.

[!note] the initramfs does not support btrfs, nor the u-boot configuration. Until kernel and initramfs are replaced it is safer to stick to ext4 (I made this mistake).

Then the usual manual unpack of a stage3 and chroot described in Gentoo Handbook works.

Pitfalls known so far

  • Make sure to enable the serial ports in /etc/inittab
s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100
s1:12345:respawn:/sbin/agetty -L 115200 ttyS1 vt100
Enter fullscreen mode Exit fullscreen mode
  • The default u-boot command script is incomplete, if you want to use the nvme, you have to enter the u-boot console (press s)
=> nvme scan
=> run nor_boot
Enter fullscreen mode Exit fullscreen mode

Coming next

I hadn't tried yet to:

  • update u-boot and change a bit its configuration
  • build a new kernel
  • put everything together to have btrfs on nvme

Top comments (0)