megi's PinePhone Development Log RSS

+972

2023–07–31: rk2aw released along with new U-Boot builds

I've been running rk2aw on 7 different boards for about a month and something, flashed to SPI NOR flash where possible, and ironing out quirks of SPI NOR flash updates.

Initially I thought dynamic layout of bootloaders in flash was a good idea, but I changed it to static layout in the end, because simple things like kernel configuration can affect erase block sizes, and thus the calculated optimal layout of things in flash. It's more predicatble to have a static layout of bootlooader images optimized for a specific device.

I've also extended the flashing tool to be able to identify contents of bootable blocks on all supported SoCs, based on the same algorithm BROM uses.

You can now just run the flashing tool without any arguments:

./rk2aw-spi-flasher

and it will show you current contents of the flash:

Machine: Pine64 PinePhonePro (pine64,pinephone-pro)

SPI NOR Flash:

- Total size: 16384 KiB
- Erase block size: 64 KiB
- Write size: 1
- Manufacturer: gigadevice
- Part name: gd25lq128e
- JEDEC ID: 257018

Bootable images currently present in SPI NOR flash:

Idx Header     Off 1      Size 1     Off 2      Size 2     Notes/content
-------------------------------------------------------------------------------
0   0          2048       6144       0          0          (padded) 0='rk2aw'
5   131072     133120     147456     280576     126976     0='ddrbin' 1='U-Boot SPL'
7   524288     526336     75776      0          0          0='levinboot'

Auto-calculated layout for rk2aw dual bootloader scheme:

Area                 Offset     Size
---------------------------------------------------
rk2aw primary        0          65536
rk2aw backup         65536      65536
spl fallback         131072     393216
spl primary          524288     393216
itb fallback         917504     2097152
itb primary          3014656    2097152

So in this case, three BROM boot blocks are filled:

The tool also detects whether the image is padded for use on SPI NOR flash, or not. Padding is a workaround for silicon bug in Rockchip boot ROM code of RK3399, which rk2aw fixes. Only rk2aw itself needs to be padded, the rest of the images must not be.

Flashing algorithm was updated to take into account Rockchip SPI/SFC driver bugs, that I encountered during the last month.

rk2aw itself did not see many changes during the last month. I've only expanded it with new supported boards. Core functionality seems to be sound.

When trying rk2aw with RK3566 SoC in a brand new Pinetab2 that Pine64 sent me recently, I noticed that rk2aw did nothing, leading to startup of fallback bootloader image.

Turns out, Rockchip made a new RK3566 silicon revision with a different BROM version sometime last year, which triggered a safety mechanism I designed into rk2aw to do nothing and pass execution to the next boot blocks in case a non-supported BROM version is detected.

The new SoC/BROM revision expands supported set of SPI NOR/NAND chips. I had to dump the new BROM contents and reverse engineer it, to add support for it to rk2aw. rk2aw will automatically detect the BROM version on RK3566 and adapts itself to it. You don't need to worry about different SoC revisions at all, and rk2aw will work fine on both Pinetab 2 as well as older Quartz64 boards.

Where to find rk2aw

Information about rk2aw is on a separate website: https://xnux.eu/rk2aw/

Builds are available on my server: https://xff.cz/kernels/rk2aw/

Only board specific builds will be available at this time. Feel free to contact me if you'd like rk2aw support for your board. Anything RK3399/3566/3588 bsaed can be readily supported maybe just based on a schematic. Anything else would require dumping and reverse engineering boot ROM on a desired SoC to see if support can be added.

If you want a more complete package with a bootloader, and some sample scripts to help with bootloader installation/updates, check the next log entry about new bootloader builds that I use on my various boards.

Current list of supported boards is: