Can't install edk2-rk3588 to SPI NOR flash

Hello.

To install edk2-rk3588 on Radxa Rock 5 ITX, I followed their official instructions.

Which brings me to https://wiki.radxa.com/Rock5/install/spi .

I. Simple method

I followed instructions for Simple method.

  1. Flashed armbian to the microSD, plugged it in and connected to the board as root over ssh.
  2. Got zero.img:
dd if=/dev/zero of=zero.img bs=1M count=16

md5sum zero.img 
# 2c7ab85a893283e98c931e9511add182  zero.img

Checksums are the same

  1. scp rock-5-itx UEFI file to Rock 5 ITX.
  2. Checked the availability of spi flash:
ls /dev/mtdblock*
# /dev/mtdblock0
  1. Cleared SPI flash and checked checksums:
dd if=zero.img of=/dev/mtdblock0

md5sum /dev/mtdblock0 zero.img

Checksums are the same

  1. Writed UEFI to the spi flash:
dd if=RK3588_NOR_FLASH.img of=/dev/mtdblock0
sync

The checksums are different this time. This is because the UEFI image is not exactly 16MB. So I didn’t flash the bootloader again.

  1. I removed the microSD, rebooted and… UEFI won’t boot.

The board starts up, the LED lights up, but does not pulse as it should according to the ekd2-rk3588 instructions.
And the platform’s boot logo doesn’t appear.
However, when the microSD was plugged back in, Armbian booted up and worked normally.

II. Advanced (external) method

So I decided to try this method.

  1. Installed rkdeveloptool.
  2. I then followed the instructions to connect in Maskrom mode:
    That is, power off the board, remove the microSD, press the Maskrom button, plug the cable into the card’s Type-C port and release the button.
sudo rkdeveloptool ld
# not found any devices!
lsusb
# not found either

I have changed the connectors and cables, but there is no connection between the board and the computer.
Eventually, through trial and error, I figured out how to do it: I had to press Maskrom, power up the board and only then the computer connected to the it.

Maybe you should fix the documentation so that others don’t have to struggle like I did.
Here, here and maybe somewhere else.

sudo rkdeveloptool ld
# DevNo=1 Vid=0x2207,Pid=0x350b,LocationID=304    Maskrom
  1. Now I tried to load the loader:
sudo rkdeveloptool db rk3588_spl_loader_v1.15.113.bin
# Creating Comm Object failed!

Got an error “Creating Comm Object failed!”. And the board disconnected from the computer.
Output of dmesg:

# Connecting the board
[44295.960228] usb 3-4: new high-speed USB device number 10 using xhci_hcd
[44296.084206] usb 3-4: New USB device found, idVendor=2207, idProduct=350b, bcdDevice= 1.00
[44296.084214] usb 3-4: New USB device strings: Mfr=0, Product=0, SerialNumber=0
# Attempting to load the loader
[44308.411593] usb 3-4: reset high-speed USB device number 10 using xhci_hcd
[44313.530451] usb 3-4: device descriptor read/64, error -110
[44324.284119] usb 3-4: device descriptor read/64, error -71
[44324.498072] usb 3-4: reset high-speed USB device number 10 using xhci_hcd
[44324.610392] usb 3-4: device descriptor read/64, error -71
[44324.827353] usb 3-4: device descriptor read/64, error -71
[44325.042234] usb 3-4: reset high-speed USB device number 10 using xhci_hcd
[44325.042353] usb 3-4: Device not responding to setup address.
[44325.250236] usb 3-4: Device not responding to setup address.
[44325.457937] usb 3-4: device not accepting address 10, error -71
[44325.570170] usb 3-4: reset high-speed USB device number 10 using xhci_hcd
[44325.570389] usb 3-4: Device not responding to setup address.
[44325.778366] usb 3-4: Device not responding to setup address.
[44325.986045] usb 3-4: device not accepting address 10, error -71
[44325.986327] usb 3-4: USB disconnect, device number 10
[44326.099313] usb 3-4: new high-speed USB device number 11 using xhci_hcd
[44326.211221] usb 3-4: device descriptor read/64, error -71
[44326.426311] usb 3-4: device descriptor read/64, error -71
[44326.642069] usb 3-4: new high-speed USB device number 12 using xhci_hcd
[44326.754191] usb 3-4: device descriptor read/64, error -71
[44326.970149] usb 3-4: device descriptor read/64, error -71
[44327.074274] usb usb3-port4: attempt power cycle
[44327.453060] usb 3-4: new high-speed USB device number 13 using xhci_hcd
[44327.453277] usb 3-4: Device not responding to setup address.
[44327.658250] usb 3-4: Device not responding to setup address.
[44327.866067] usb 3-4: device not accepting address 13, error -71
[44327.978133] usb 3-4: new high-speed USB device number 14 using xhci_hcd
[44327.978353] usb 3-4: Device not responding to setup address.
[44328.186098] usb 3-4: Device not responding to setup address.
[44328.394021] usb 3-4: device not accepting address 14, error -71
[44328.394229] usb usb3-port4: unable to enumerate USB device

III.

How the boot process works, in what order, I don’t know.

I have the feeling that the SPI NOR flash is not involved in the boot process at all.
There is probably a boot loader in the eMMC. And its priority is higher than the SPI NOR flash.
I can’t erase the eMMC as instructed because rkdeveloptool commands (except ld) give the same error (I’ve tried ppt, db, wl and rid).

As far as I understand, /dev/mmcblk0 is the eMMC.
I wanted to try erasing it as well as the SPI NOR flash, but decided not to risk it yet.
What if the Radxa Rock 5 ITX dies? At least I can use Armbian for now.

Perhaps this information is important: in my case, the motherboard came without the ROOBI OS pre-installed (at least board didn’t boot when I turned it on, I could only boot it by plugging in the microSD with armbian).

Thank you for your help.

for your point #2 (Creating Comm Object failed!)
I had the same issue and it was fixed with

sudo su
echo -1 > /sys/module/usbcore/parameters/autosuspend

for you point #3.

The boot order is defined by BOOT_SARADC_IN0 pin (see schematic)
So the default order, when maskrom key is not pressed, is:

  • FSPI_M2
  • FSPI_M1
  • FSPI_M0 (=> the one connected to SPINOR)
  • EMMC
  • SD Card
  • USB (maskrom)

The ROM is looking for DDR init and SPL images looking for a header at 0x8000 of those devices.

(Note: from the schematic, we understand we can change temporary the boot order, simply by applying a defined voltage to BOOT_SARADC_IN. This is really clever !)

All the remaining of the boot and the device order, depends on SPL content (ie. part of u-boot).
For what I found looking at various uboot provided in official armbian and radxa images, they are built to look for a header at 0x800000 where the place of various component is located (ATF, uboot, dtb…)
They are searching first on external MMC, then eMMC, then SPINOR.
This order can be modified by building a new uboot SPL.

In Linux:

  • SPINOR image is available through /dev/mtd0. You can you flashcp, flash_erase, flash_eraseall to modify the content.
  • for eMMC, you can write/read through /dev/mmcblk0, simply using dd tool.

Hello, amouiche.

This solution solves the “Creating Comm Object failed!” problem.

Unfortunately, it doesn’t solve the main problem.
I recently tried running edk2 from an SD card and it didn’t work, while armbian ran fine.
So maybe the problem is on the edk2 side.

Thanks for the explanation and the link to the boot order of the board.

Just try to boot rock-5-itx_UEFI_Release_v0.12.2.img from a microSD card.
It enters the UEFI screen but only on serial line, nothing through HDMI.
It also takes so long to enter.