Patched rkdeveloptool with full access to SPINOR device

Despite what is written in Radxa documentation (see Clear eMMC or SPI Flash) all my attempt to erase, read or write the SPINOR failed in maskrom mode. The eMMC as the only storage device we can work on.

It was a shame since the windows tool (RKDevTool) has the capability to select the storage device.

After looking at the RKDevTool USB transactions, I patched rkdeveloptool to gain the capability to select the storage device.
Source code is here: https://github.com/amouiche/rkdeveloptool
A pre-compiled binary here: https://github.com/amouiche/rkdeveloptool/releases/download/v1.32%2Bchange_storage/rkdeveloptool
A pull request has been submitted.

Usage example:

rkdeveloptool db rk3588_spl_loader_v1.15.113.bin

# select the SPINOR
rkdeveloptool cs 9

# clear the whole SPINOR device
rkdeveloptool ef

# write an image starting at block 0
rkdeveloptool wl 0 /tmp/spinor_image.bin
5 Likes

Where did you get the spinor_image.bin? Is it just all 0s?

spinor_image.bin is just any image you want to write. To clear the SPI NOR, use the following command from amouiche:

clear the whole SPINOR device

rkdeveloptool ef

I didn’t find any spinor image on Radxa’s website.

the SPINOR is 16MiB size. If you want to use it, you can, for example, store the bootloader (uboot or UEFI) in order to boot an OS somewhere else (eg. NVME).
I never tried to use images provided by Radxa. There were fine when the board was not supported by standard distribution (debian, armbian, ubuntu or whatever). But now, you should use those standard distributions I guess.

# empty partition table from 0 to 0x8000
dd if=/dev/zero of=/dev/zero.bin count=64
# bootloader extracted from the 16 first MiB of the SD image
dd if=Armbian_24.11.1_Rock-5-itx_bookworm_vendor_6.1.75_minimal.img \
   of=bootloader.bin \
   skip=64 count=$((16*1024*1024/512 - 64))
# concatenate to form the SPINOR image
cat zero.bin bootloader.bin > spinor_image.bin

I will soon re-install by radxa board this way on NVME. I should write a small howto.

BTW, it is not necessary to use the SPINOR to boot on NVME. the same SPINOR image produced in the small script described before, can also be flashed in eMMC. But be sure the one you not used is erased (spinor) or full of zeros (eMMC) to be sure of the boot order selected by the ROM.

I guess you didn’t look much:

https://dl.radxa.com/rock5/sw/images/loader/rock-5a/
https://dl.radxa.com/rock5/sw/images/loader/rock-5b/release/

and so on. There will be more links in docs.radxa.com.

2 Likes