Can´t flash u-boot on rock64 v2.0 spi

Hi,
I have three Rock64 v2.0. They have been running different debian versions solid and stable as rock for years. Actually all them run debian 12 on micro sd cards. I’ve been updating for years from different debian versions without any issues fron an usb installer image to write a micro sd card thanks to spi u-boot that I’ve flashed long time ago with an Ayufan script.

Yesterday I’ve tried to install a fresh debian 13 but couldn’t make installer boot. I’ve connected by serial console to see an error message about kernel panic. I couldn’t boot any installer neither configured images included diet pi image. So i’ve decide to erase u-boot from spi with Ayufan erase script. After spi erase i can make diet pi and any image boot from sd card. I’ve know about the new u-boot from diet pi and tried to flash it to spi from Diet-pi config → update SPI bootloader to spi, but after some time and this message:

[ INFO ] DietPi-Config | Checking for required APT packages: mtd-utils
4153856 bytes (4.2 MB, 4.0 MiB) copied, 8 s, 519 kB/s4161536 bytes (4.2 MB, 4.0 MiB) copied, 8.012
21 s, 519 kB/s
It returns to dietpi-config window without any results. I’ve tried it several times with same results. If I connect a serial console without any sd card there is no output. With an bootable sd card it boots normally.
How can i write u-boot to spi flash?
Thanks in avance

This means, all went well :+1:. Booting via SPI (from USB or such) should work now.

Hi,

Now i dont get any output from serial console without sd card in sd card reader with or without a bootable usb device. Board only boot with a sd card on sd card reader. I think thats not right

Try again like this:

dd if=/usr/lib/linux-u-boot-current-rock64/rkspi_loader.img of=/dev/mtdblock0 conv=notrunc oflag=direct status=progress

If it does not work, it is probably an issue with the particular revision. The ROCK64 has so many revisions, and each of them has/had their individual boot issues.

Another attempt:

flashcp -v /usr/lib/linux-u-boot-current-rock64/rkspi_loader.img /dev/mtd0

However, U-Boot *.img images are usually flashed to the provided block device, while U-Boot *.bin binaries are flashed to the MTD device instead. Not sure whether there is a practical difference in this case.

Hi,

It doesn’t works. It looks like going well but same results. Any output in serial console without a sd card on its slot. Cant boot any usb but its a minor isssue.

root@DietPi:~# dd if=/usr/lib/linux-u-boot-current-rock64/rkspi_loader.img of=/dev/mtdblock0 conv=notrunc oflag=direct status=progress

4096512 bytes (4.1 MB, 3.9 MiB) copied, 63 s, 65.0 kB/s

8128+0 records in

8128+0 records out

4161536 bytes (4.2 MB, 4.0 MiB) copied, 64.0556 s, 65.0 kB/s

root@DietPi:~# flashcp -v /usr/lib/linux-u-boot-current-rock64/rkspi_loader.img /dev/mtd0

Erasing blocks: 1016/1016 (100%)

Writing data: 4064k/4064k (100%)

Verifying data: 4064k/4064k (100%)

Thanks!

Did you test it after each of the two commands separately? The flashcp overrides what dd does, I am just not sure whether it writes to the exact same offset.

Not sure whether anything can go wrong with the generic Rockchip SPI bootloader generation, which uses the very same build that obviously works well on SD card, and does some generic steps to produce an SPI flash image from that, which did work in the past when we enabled it for ROCK64 in our Armbian fork (vanilla Armbian doesn’t have it in their bootloader package).

The device node is defined in mainline Linux: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3328-rock64.dts#n341

I guess time will tell whether it is a general issue introduced with some recent update, an issue with a specific revision, if it uses a different SPI flash not supported by the driver (e.g. the case with ROCK 4B or some revisions of it, though patched by Armbian), or an issue with your particular board (though unlikely since it did boot into kernel, and flashing + verifying works).

Hi,

Thanks for your help.

Yes, I’ve tried to boot without SD card on slot and with an usb device plugged with an rock64 debian installer after each command. Didn’t get any output over serial console. I think something isnt working with rock64 v2.0. I"ve two more boards same version I’ll try tomorrow with them just to know if I have luck with them.

Thank a lot!