Skip to content
Snippets Groups Projects
Commit fac7cc45 authored by Christopher Obbard's avatar Christopher Obbard
Browse files

Update rockpi4 flashing documentation


Signed-off-by: default avatarChristopher Obbard <chris.obbard@collabora.com>
parent 1f33fb51
No related branches found
No related tags found
1 merge request!79Update rockpi4 flashing documentation
Pipeline #97818 passed with stages
in 7 seconds
---
title: ROCK Pi 4
title: ROCK 4
---
Note: A lot of the information here was taken from [Collabora's RockPi4
repository][2].
ROCK Pi 4 is a Rockchip RK3399 based SBC (Single Board Computer) by Radxa.
ROCK 4 is a family of Rockchip RK3399 based SBC (Single Board Computer)
by Radxa.
There are three variants: A, B and C. With the main difference being the
presence of WiFi and Bluetooth on B and C, and the presence of DP and HDMI mini
on C. More information on https://wiki.radxa.com/Rockpi4/getting_started.
There are multiple variants of the board: A, B, C, SE, C+. The main
difference between the boards being different WiFi and Bluetooth chips and
the presence of DP and HDMI mini on C and C+. More information and schematics
are available from [Radxa Documentation](https://wiki.radxa.com/Rockpi4/getting_started).
Specification:
* Rockchip Rk3399 SoC
......@@ -32,7 +30,7 @@ This board is available from [Radxa distributors](https://wiki.radxa.com/Buy).
### Power control
The board can be powered on with 5V via pins 2 or 4 in the GPIO header (as shown
in the [GPIO pinout][1]), and GND on pin 6 for example. The pins are colored
in the [GPIO pinout][1]) and GND on pin 6 for example. The pins are colored
accordingly on the latest board revision:
![Power through GPIO](/img/rockpi4-power-gpio.jpg)
......@@ -55,28 +53,134 @@ There's a standard Gigabit Ethernet port on the board that can be used.
### Bootloader
For the bootloader setup, a ready-to-use image is available at [Collabora's Rock
Pi 4 repository][2] as an artifact from the CI. In addition to u-boot (and
idbloader and trust img), it also contains a kernel and rootfs, but after
flashing and dropping to the u-boot prompt, tftp and nfs can be configured to
retrieve the kernel and rootfs, ignoring the ones flashed.
The boot order for RK3399 is generally:
1) SPI Flash (not populated on all ROCK 4 variants)
1) eMMC
1) SD card
1) maskrom (Rockchip-specific USB download mode)
If any device is not found or cannot be booted from, the next one is the
list is chosen until the device falls into Maskrom mode (Rockchip-specific
USB flashing mode).
### Building U-Boot
Mainline U-Boot version v2024.07-rc4 supports booting ROCK 4 from SPI flash.
```
sudo apt install git crossbuild-essential-arm64
cd rkbin
./tools/boot_merger RKBOOT/RK3399MINIALL.ini
./tools/boot_merger RKBOOT/RK3399MINIALL_SPINOR.ini
cd trusted-firmware-a
git checkout v2.9.0
make CROSS_COMPILE=aarch64-linux-gnu- PLAT=rk3399 -j$(nproc) bl31
cd u-boot
git checkout v2024.07-rc4
make CROSS_COMPILE=aarch64-linux-gnu- BL31=../trusted-firmware-a/build/rk3399/release/bl31/bl31.elf rock-pi-4-rk3399_defconfig all -j$(nproc)
```
### Flashing U-Boot
There are three choices of where to install the bootloader, listed here in order
of boot priority. The bootloader only needs to be installed to one device. The
SPI flash is preferred. The boot devices are as follows:
![Boot devices](/img/rockpi4-flash.jpg)
Maskrom flashing is required for SPI Flash and eMMC booting. For SD card booting,
ensure there is no SPI flash and eMMC connected (or they are blank) and skip to the
`Flashing bootloader to SD Card` section.
Install the required packages to flash the device:
```
sudo apt install rkdeveloptool
```
To force the device into Maskrom flashing, before powering the device:
1) remove the SD card
1) remove the eMMC
1) add a jumper to disable the SPI Flash (see below)
To disable booting from the SPI flash, place a 0.1" pitch jumper between GPIO
header pins 23 and 25 as follows:
![Disable SPI flash](/img/rockpi4-disable-spi.jpg)
You need a USB A-A cable to flash the bootloader to the SPI flash or eMMC using
the rockusb protocol. The rockusb flashing port is the top USB3 port (but flashing
occurs over USB2). Power is not provided from this port, so make sure to power
over USB-C using a dumb PSU (e.g Raspberry Pi 4 PSU).
Plug a USB-2 A-A cable into the top USB-3 socket.
Apply power through the USB-C socket and check it is in maskrom mode:
```
rkdeveloptool ld
DevNo=1 Vid=0x2207,Pid=0x330c,LocationID=602 Maskrom
```
### Flashing bootloader to SPI Flash
Not all devices have an SPI flash. If it is not present on the board, it needs
to be soldered to the board OR boot from alternative media.
Force the device into Maskrom flashing following the steps in `Flashing U-Boot`.
Unplug the SPI flash jumper.
Download the SPI NOR loader:
```
$ rkdeveloptool db rk3399_loader_spinor_v1.30.114.bin
Downloading bootloader succeeded.
```
Flash the bootloader to the SPI flash:
```
$ rkdeveloptool wl 0 u-boot-rockchip-spi.bin
```
All done.
#### Flashing bootloader to eMMC
Force the device into Maskrom flashing following the steps in `Flashing U-Boot`.
Leave the SPI flash jumper connected, if there is an SPI flash placed on the board.
Plug the eMMC into the board.
Download the eMMC loader:
```
$ rkdeveloptool db rk3399_loader_v1.30.114.bin
Downloading bootloader succeeded.
```
Flash the bootloader to the eMMC:
```
$ rkdeveloptool wl 64 u-boot-rockchip.bin
```
All done.
Load addresses:
* Kernel: 0x280000
* DTB: 0x8300000
* Ramdisk: 0xa200000
The main bootloader is stored in eMMC.
#### Flashing bootloader to SD Card
### Health checks
```
$ dd if=u-boot-rockchip.bin of=/dev/sdb seek=64
```
Mainline kernel and defconfig don't have working NFS. For that, [this custom
config](https://people.collabora.com/~nfraprado/config-rockpi4-v5_12) can be
used with mainline v5.12 kernel.
### Lab notes and trouble shooting
None.
[1]: https://wiki.radxa.com/Rockpi4/hardware/gpio
[2]: https://gitlab.collabora.com/rockpi/rockpi4
static/img/rockpi4-disable-spi.jpg

52.5 KiB

static/img/rockpi4-flash.jpg

172 KiB

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment