Arm64 - Install Openbsd on RockPro64 board

Rockchip - RK3399 (RockPro64)#


RP64, what’s it all about?#

RockPro64 or RP64 is a single board nano/microcomputer, running on a 64 bits arm architecture.

Objectives#

Cover the OpenBSD installation process on RP64 for the following purposes:

  • OpenBSD Current (6.7-beta):
    • Installation media: usb stick
    • Target: 64GB emmc card
    • nas: 2 disks in raid 1

The OpenBSD standard installation process will not be covered.

RP64 installation process#

Rockpro64 start-up sequence:

  1. SPI NOR flash memory
  2. emmc
  3. sdcard
  1. U-Boot environment access
  2. Clear SPI flash memory
  3. Allow RP64 to boot USB media
  4. Follow standard installation process

Why choose RP64?#

  • Low power consumption
  • Low price vs. computer
  • Small footprint
  • Playful
  • Less sensitive to threats: surface (quantitative footprint) of the ARM / OS architecture on the market
  • 1 PCIe x4 port (gen 2.0)
    • SATA card (nas)
    • ethernet card
    • USB card
    • (…)

Find out more about: RP64

Hardware requirements for NAS / Home Automation use;

The PCI bus still has some management issues.

Tested equipment :#

1. Cards / Chipsets OK:

  • Startech.com PEXSATA32 2 port SATA controller
    • ahci0 at pci1 dev 0 function 0 “Marvell 88SE9128 AHCI” rev 0x20: msi, AHCI 1.2
  • QNINE NVME PCIe Adapter M.2 2280 w/Samsung 970 EVO
    • nvme0 at pci1 dev 0 function 0 Samsung SM981/PM981 NVMe rev 0x00: msix, NVMe 1.3

2. Works but not recommended

  • ROCKPro64 PCI-e to Dual SATA-II Interface Card
    • ahci0 at pci1 dev 0 function 0 ASMedia ASM1061 AHCI rev 0x01: msi, AHCI 1.2

3. Does not work:

  • HighPoint Rocket 640L
    • ahci0 at pci1 dev 0 function 0 Marvell 88SE9230 AHCI rev 0x11: msi, AHCI 1.2
  • Dell PERC 6/ir
    • mpi0 at pci9 dev 0 function 0 Symbios Logic SAS1068E rev 0x08: msi

Current driver does not support pci-bridge-based boards

Technical requirements#


Pins jumper

  1. (16) : disable boot on emmc
  2. (23 & 25) : disable SPI flash on first boot.

In both cases, remove 2 seconds after boot, and before the white LED lights up.

Purpose: to enable sdcard boot for installation.

Present the technical tasks involved in downloading the OpenBSD version, as well as the integration of U-Boot and the Device Tree Blob required to boot and install the OpenBSD operating system on the arm64 RockPro64 platform.

Step 1: get resources#

  1. Image: miniroot68.img

code:

doas ftp -o miniroot68.img https://cdn.openbsd.org/pub/OpenBSD/6.8/arm64/miniroot68.img
  1. If not, install the following packages:

code:

doas pkg_add u-boot-aarch64
doas pkg_add dtb

Step 2: prepare installation USB key#

  1. Install the OpenBSD image on the USB key (if disk=sd1)

code:

doas dd if=miniroot68.img of=/dev/rsd1c bs=1m
  1. Install dtb firmware on USB key (if disk=sd1)

code:

doas mount /dev/sd1i /mnt
doas mkdir /mnt/rockchip
doas cp /usr/local/share/dtb/arm64/rockchip/rk3399-rockpro64.dtb /mnt/rockchip/
doas umount /mnt
Without installing dtb on the USB key, it’s impossible to write to the emmc card.

Step 3: prepare eMMC card (if emmc=sd2)#

  1. Install emmc on USB key
  2. Install U-BOOT & firmware on emmc

code:

doas dd if=/usr/local/share/u-boot/rockpro64-rk3399/idbloader.img of=/dev/sd2c seek=64
doas dd if=/usr/local/share/u-boot/rockpro64-rk3399/u-boot.itb of=/dev/sd2c seek=16384

Step 4: connect components#

  1. install the emmc card in its final slot (board)
  2. insert the key into one of the RP64’s USB 2.0 ports

Startup & installation#


Process steps#

  1. Place a jumper on GPIO pins 23 and 25 to bypass SPI flash start-up.
  2. Position the USB TTL cable and connect it to the console.
  3. Start
  4. Remove jumper within 2 seconds
  5. Access u-boot
  6. Clear SPI flash memory (or leave jumper in place forever)
  7. Manually detect USB key
  8. Quit u-boot
  9. Start OpenBSD installation

Console via USB-TTL serial cable#

To connect via a USB-TTL serial cable, simply connect the cable and run the command below to interact with the RocPro64 board.

doas cu -s 115200 -l /dev/cuaU0

Once powered on, we can visualize and interact with the platform.

u-boot#

Press any key to access u-boot, on the line:
Hit any key to stop autoboot
U-Boot TPL 2020.01 (Mar 31 2020 - 18:19:43)
Channel 0: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
Channel 1: LPDDR4, 50MHz
BW=32 Col=10 Bk=8 CS0 Row=15 CS1 Row=15 CS=2 Die BW=16 Size=2048MB
256B stride
256B stride
lpddr4_set_rate: change freq to 400000000 mhz 0, 1
lpddr4_set_rate: change freq to 800000000 mhz 1, 0
Trying to boot from BOOTROM
Returning to boot ROM...

U-Boot SPL 2020.01 (Mar 31 2020 - 18:19:43 -0600)
Trying to boot from MMC2
INFO:    GICv3 with legacy support detected. ARM GICv3 driver initialized in EL3
INFO:    BL31: cortex_a53: CPU workaround for 855873 was applied
INFO:    BL31: Preparing for EL3 exit to normal world
INFO:    Entry point address = 0x200000
INFO:    SPSR = 0x3c9


U-Boot 2020.01 (Mar 31 2020 - 18:19:43 -0600)

Model: Pine64 RockPro64
DRAM:  3.9 GiB
PMIC:  RK808 
MMC:   dwmmc@fe320000: 1, sdhci@fe330000: 0
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial@ff1a0000
Out:   serial@ff1a0000
Err:   serial@ff1a0000
Model: Pine64 RockPro64
rockchip_dnl_key_pressed: adc_channel_single_shot fail!
Net:   eth0: ethernet@fe300000
Hit any key to stop autoboot:  0

u-boot: erase SPI flash#

Erase SPI flash, so that it is no longer used at boot time.

at the u-boot prompt:

sf probe
sf erase 0 400000

u-boot: detect the usb key#

at the u-boot prompt:

=> usb start
starting USB...
Bus usb@fe380000: USB EHCI 1.00
Bus usb@fe3c0000: USB EHCI 1.00
Bus dwc3: Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
Bus dw3c:Register 2000140 NbrPorts 2
Starting the controller
USB XHCI 1.10
scanning bus usb@fe380000 for devices... 1 USB Device(s) found
scanning bus usb@fe3c0000 for devices... 2 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
scanning bus dwc3 for devices... 1 USB Device(s) found
scanning usb for storage devices... 1 Storage Device(s) found
At this point, press a key to interrupt the scan loop.

u-boot: boot phase#

At the u-boot prompt, issue the boot command.

=>  boot
switch to partitions #0, OK
mmc0(part 0) is current device
Scanning mmc 0:1...
Found EFI removable media binary efi/boot/bootaa64.efi
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Card did not respond to voltage select!
Scanning disk dwmmc@fe320000.blk...
Disk dwmmc@fe320000.blk not ready
Scanning disk sdhci@fe330000.blk...
** Unrecognized filesystem type **
Scanning disk usb_mass_storage.lun0...
** Unrecognized filesystem type **
Found 6 disks
BootOrder not defined
EFI boot manager: Cannot load any image
168758 bytes read in 55 ms (2.9 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
disks: sd0* sd1

Schedule boot on USB#

>> OpenBSD/arm64 BOOTAA64 0.21
boot> boot sd1a:/bsd
(...)
bootfile: sd1a:/bsd
boot device: sd1
root on rd0a swap on rd0b dump on rd0b
erase ^?, werase ^W, kill ^U, intr ^C, status ^T

Welcome to the OpenBSD/arm64 6.7 installation program.
(I)nstall, (U)pgrade, (A)utoinstall or (S)hell?

Now it’s time to install OpenBSD using the classic installation procedure

The disk management process creates a 16 MB MSDOS partition, do not delete.