Difference between revisions of "Rock5/install/spi"
(→Write U-Boot images to SPI Nor Flash or erase SPI Nor Flash) |
|||
(61 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
{{rock5_header}} | {{rock5_header}} | ||
− | {{Languages|rock5/ | + | {{Languages|rock5/install/spi}} |
− | + | ||
− | + | [[rock5 | ROCK 5]] > [[rock5/install | Installation]] > [[rock5/install/spi | Install the bootloader to the SPI NOR flash]] | |
− | |||
− | |||
− | |||
− | |||
− | * ROCK 5B | + | ROCK 5 has a SPI flash on the board, it contains the bootloader for backup booting and supports booting other media that the SoC maskrom mode itself does not direct support (such as NVMe, SATA or USB 3). |
+ | |||
+ | This page describe how to write/install the bootloader to the SPI flash on the ROCK 5B. | ||
+ | |||
+ | There are two methods available to flash the SPI: | ||
+ | *[[#Simple_method | simple method]] - flash the SPI from the ROCK 5 itself | ||
+ | *[[#Advanced_(external)_method | advanced method]] - flash the SPI with maskrom mode and an external computer | ||
+ | |||
+ | <br> | ||
+ | |||
+ | For advanced users: | ||
+ | [[#Additional:_erase_the_SPI_NOR_flash | How to erase the SPI]] | ||
+ | |||
+ | <br> | ||
+ | |||
+ | ---- | ||
+ | |||
+ | <br> | ||
+ | |||
+ | = Simple method = | ||
+ | |||
+ | <br> | ||
+ | |||
+ | == Requirements == | ||
+ | |||
+ | * ROCK 5B with proper power | ||
+ | * SD card or eMMC module | ||
+ | * Linux image for ROCK 5B - <i>(Android images are not supported yet)</i> | ||
+ | |||
+ | <br> | ||
+ | |||
+ | == Procedure == | ||
+ | |||
+ | <br> | ||
+ | |||
+ | === 1) Boot linux from µSD card/eMMC === | ||
+ | |||
+ | The first step is to boot the ROCK 5 with linux from an µSD card or an eMMC module. | ||
+ | |||
+ | <i>(check [[rock5/install/microSD | this guide]] to flash a new image to an µSD card</i> | ||
+ | <i>or check [[rock5/install/eMMC | this guide]] to flash a new image to an eMMC module)</i> | ||
+ | |||
+ | === 2) Download required files on the ROCK 5 === | ||
+ | |||
+ | You can download files by using <code>wget DOWNLOADLINK</code> | ||
+ | |||
+ | <i>for example to download the file to clear the spi: <code>wget https://dl.radxa.com/rock5/sw/images/others/zero.img.gz</code></i> | ||
+ | |||
+ | <u>Download the required files</u> | ||
+ | |||
+ | * [https://dl.radxa.com/rock5/sw/images/others/zero.img.gz spi clearing file] | ||
+ | |||
+ | <br> | ||
+ | |||
+ | and the latest spi bootloader: | ||
+ | * [https://dl.radxa.com/rock5/sw/images/loader/rock-5b/release/rock-5b-spi-image-gd1cf491-20240523.img normal bootloader] with u-boot serial console disabled - <i>(for advanced users: this has the u-boot serial console disabled)</i> | ||
+ | ** Also support booting armbian from the M.2 NVME SSD. | ||
+ | ** ''A better approach for armbian is to flash the spi with help of the armbian-install command like discribed here: https://fieldday.io/armbian-rock5b/'' | ||
+ | |||
+ | or for advanced users the | ||
+ | * [https://dl.radxa.com/rock5/sw/images/loader/rock-5b/debug/rock-5b-spi-image-gd1cf491-20240523-debug.img debuging bootloader] with u-boot serial console enabled <i>(This is an debug bootloader if you need to troubleshoot booting issue with serial)</i> | ||
+ | * [https://github.com/edk2-porting/edk2-rk3588/releases EDK2 bootloader] for booting UEFI-compatible operating system images (currently experimental) | ||
+ | |||
+ | <br> | ||
+ | |||
+ | <u>Check the integrity of the downloaded files:</u> | ||
+ | |||
+ | md5sum zero.img.gz | ||
+ | it should report back: | ||
+ | ac581b250fda7a10d07ad11884a16834 zero.img.gz | ||
+ | |||
+ | <br> | ||
+ | |||
+ | extract/uncompress the previous downloaded spi clearing file <i>(gzip should already be installed otherwise install it):</i> | ||
+ | gzip -d zero.img.gz | ||
+ | |||
+ | md5sum zero.img | ||
+ | it should report back: | ||
+ | 2c7ab85a893283e98c931e9511add182 zero.img | ||
+ | |||
+ | <br> | ||
+ | |||
+ | and finally check your desired bootloader image: <i>(replace <code>spi-image.img</code> with the name of your downloaded image - eg: <code>rock-5b-spi-image-gd1cf491-20240523.img</code> for the normal bootloader):</i> | ||
+ | md5sum spi-image.img | ||
+ | |||
+ | it should report back one of the following lines: | ||
+ | |||
+ | fa14c99718f55b66e82aa1661e43c1ec rock-5b-spi-image-gd1cf491-20240523-debug.img | ||
+ | cf53d06b3bfaaf51bbb6f25896da4b3a rock-5b-spi-image-gd1cf491-20240523.img | ||
+ | |||
+ | === 3) Flash the SPI flash === | ||
+ | |||
+ | Make sure the spi flash is available: | ||
+ | ls /dev/mtdblock* | ||
+ | |||
+ | it should report back: | ||
+ | /dev/mtdblock0 | ||
+ | |||
+ | completely clear the spi flash: <i>(be patient the flash can take 5mins)</i> | ||
+ | sudo dd if=zero.img of=/dev/mtdblock0 | ||
+ | |||
+ | check if the flash was successfully cleared | ||
+ | sudo md5sum /dev/mtdblock0 zero.img | ||
+ | |||
+ | the result should look exactly like this: | ||
+ | 2c7ab85a893283e98c931e9511add182 /dev/mtdblock0 | ||
+ | 2c7ab85a893283e98c931e9511add182 zero.img | ||
+ | |||
+ | |||
+ | now write you desired bootloader to the spi flash <i>(replace <code>spi-image.img</code> with the name of your downloaded image again):</i> | ||
+ | |||
+ | sudo dd if=spi-image.img of=/dev/mtdblock0 | ||
+ | sync | ||
+ | |||
+ | check if the flash was successfully <i>(replace <code>spi-image.img</code> with the name of your downloaded image again):</i> | ||
+ | sudo md5sum /dev/mtdblock0 spi-image.img | ||
+ | the checksums should be the same again - if not <b>flash the bootloader again</b>. | ||
+ | |||
+ | <br> | ||
+ | |||
+ | === 4) Reboot === | ||
+ | |||
+ | Now you are done flashing a bootloader supporting NVMe booting. | ||
+ | |||
+ | <i>If you do not flashed the NVMe already check [[Rock5/install/nvme | this guide]] to flash it. (again there are two options available)</i> | ||
+ | |||
+ | Otherwise power off the ROCK 5, remove the µSD card or eMMC module and power it back up. | ||
+ | |||
+ | It should boot now from your NVMe. 😉 | ||
+ | |||
+ | |||
+ | |||
+ | ---- | ||
+ | |||
+ | = Advanced (external) method = | ||
+ | |||
+ | == Requirements == | ||
+ | |||
+ | * ROCK 5B with proper power | ||
* Linux image for ROCK 5B, Android image is not supported yet | * Linux image for ROCK 5B, Android image is not supported yet | ||
− | * | + | * SD card or eMMC module |
− | * | + | * USB Type C cable |
* Windows/linux/macOS PC | * Windows/linux/macOS PC | ||
− | |||
− | |||
− | === Boot the board to Maskrom mode === | + | == Procedure == |
+ | |||
+ | |||
+ | |||
+ | === 1) Install Tools & Drivers === | ||
+ | |||
+ | Please check this guide, [[rock5/install/rockchip-flash-tools | Install rockchip flash tools under Windows/Linux/MacOS PC.]] | ||
+ | |||
+ | The PC tools we use to communicate with ROCK 5 in maskrom mode are the '''rkdeveloptool''' on Linux/macOS and '''RkDevtool''' on Windows PC. | ||
+ | |||
+ | === 2) Get RK3588 loader and U-Boot images === | ||
+ | |||
+ | * Download the loader image from: | ||
+ | ** [https://dl.radxa.com/rock5/sw/images/loader/rk3588_spl_loader_v1.15.113.bin RK3588 loader] - USB flashing helper | ||
+ | |||
+ | * Download the latest SPI image from: | ||
+ | ** [https://dl.radxa.com/rock5/sw/images/loader/rock-5b/release/rock-5b-spi-image-gd1cf491-20240523.img release version] with u-boot serial console disabled. Support Armbian OS as well.(Recommend) | ||
+ | ** [https://dl.radxa.com/rock5/sw/images/loader/rock-5b/debug/rock-5b-spi-image-gd1cf491-20240523-debug.img debug version] with u-boot serial console enabled(Use it when you need to troubleshoot booting issue) | ||
+ | ** [https://github.com/edk2-porting/edk2-rk3588/releases alternative bootloader based on EDK2] for booting UEFI-compatible operating system images (currently experimental) | ||
+ | |||
+ | === 3) Boot the board to Maskrom mode === | ||
[[File:Rock-5b-typec-maskrom.jpeg|400px]] | [[File:Rock-5b-typec-maskrom.jpeg|400px]] | ||
− | To boot ROCK 5B to | + | To boot ROCK 5B to maskrom mode is simple: |
* Power off the board. | * Power off the board. | ||
Line 33: | Line 184: | ||
* Release the golded button. | * Release the golded button. | ||
* Check usb device | * Check usb device | ||
− | ** For macOS host: lsusb result: | + | ** For macOS host: <code>lsusb</code> a result should be: <code>... ID 2207:350b Fuzhou Rockchip Electronics Co., Ltd. Composite Device</code> |
− | ** For Linux host: lsusb result: | + | ** For Linux host: <code>lsusb</code> a result should be: <code>... ID 2207:350b Fuzhou Rockchip Electronics Company</code> |
− | ** For Windows host: Open RKDevTool and you would see the device is in '''Found One MASKROM Device''' | + | ** For Windows host: Open RKDevTool and you would see the device is in '''Found One MASKROM Device''' |
− | === | + | === 4) Write u-boot images to SPI NOR flash or erase SPI NOR flash === |
− | ==== | + | ==== Option 1: Flash with Linux PC/Mac ==== |
− | + | On linux or Mac, run the rkdeveloptool | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | On | + | |
sudo rkdeveloptool ld | sudo rkdeveloptool ld | ||
DevNo=1 Vid=0x2207,Pid=0x350b,LocationID=106 Maskrom | DevNo=1 Vid=0x2207,Pid=0x350b,LocationID=106 Maskrom | ||
− | + | This will load the loader (flash helper, downloaded from 2) to run on ROCK 5B and init the ram and prepare the flashing environment etc. | |
sudo rkdeveloptool db /path/to/rk3588_spl_loader_v1.08.111.bin # will output: | sudo rkdeveloptool db /path/to/rk3588_spl_loader_v1.08.111.bin # will output: | ||
Downloading bootloader succeeded. | Downloading bootloader succeeded. | ||
− | + | Next, write SPI image from PC/Mac to ROCK 5B SPI flash | |
− | You can use | + | You can use the image download from Step 2. |
sudo rkdeveloptool wl 0 rock-5b-spi-image-g49da44e116d.img | sudo rkdeveloptool wl 0 rock-5b-spi-image-g49da44e116d.img | ||
Line 73: | Line 214: | ||
now, the device should boot on SPI Nor Flash. And '''the blue led is on'''. | now, the device should boot on SPI Nor Flash. And '''the blue led is on'''. | ||
− | + | ==== Option 2: Flash with Windows PC ==== | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | ==== Windows ==== | + | |
Double click the RKDevTool.exe and you will see the following interface: | Double click the RKDevTool.exe and you will see the following interface: | ||
Double click the '''RKDevTool.exe''' and you will see the following interface: | Double click the '''RKDevTool.exe''' and you will see the following interface: | ||
− | + | ==== Step 1: confirm that ROCK 5B is in maskrom mode ==== | |
If your ROCK 5B is in maskrom mode and connects to PC, you can see that the program detects it, as the red arrow below | If your ROCK 5B is in maskrom mode and connects to PC, you can see that the program detects it, as the red arrow below | ||
− | + | ==== Step 2: Load Configuration File ==== | |
+ | |||
+ | Right-click in the list box and select Load Config,Then select the configuration file in the resource management folder(The configuration file and RKDevTool are in the same directory) | ||
+ | |||
+ | ==== Step 3: Select Loader ==== | ||
Next, click the right last columns in the "Loader" row to select rk3588_spl_loader_v1.08.111.bin | Next, click the right last columns in the "Loader" row to select rk3588_spl_loader_v1.08.111.bin | ||
− | + | ==== Step 4: Select SPI image ==== | |
Next, click the right last columns in the "spi" row to select spi-image. | Next, click the right last columns in the "spi" row to select spi-image. | ||
− | + | ==== Step 5: Excute ==== | |
Finally, click the "Excute" button, and you will see the content in the red box on the right. When the progress reaches 100%, the download is completed. | Finally, click the "Excute" button, and you will see the content in the red box on the right. When the progress reaches 100%, the download is completed. | ||
[[File: rock-5b-spi-flash-1.png |1000px]] | [[File: rock-5b-spi-flash-1.png |1000px]] | ||
+ | [[File: configuration.png |1000px]] | ||
[[File: rock-5b-spi-flash-02.png |1000px]] | [[File: rock-5b-spi-flash-02.png |1000px]] | ||
− | |||
− | |||
− | Please notice that when you want to erase SPI | + | = Additional: erase the SPI NOR flash = |
+ | |||
+ | === Option 1: Operate on ROCK 5B === | ||
+ | |||
+ | Boot your ROCK 5B with linux running on µSD card or eMMC module: | ||
+ | |||
+ | Make sure the SPI flash is available: | ||
+ | ls /dev/mtdblock* | ||
+ | |||
+ | It should give <code>/dev/mtdblock0</code> back | ||
+ | |||
+ | sudo dd if=/dev/zero of=/dev/mtdblock0 | ||
+ | sync | ||
+ | |||
+ | === Option 2: Erase with Linux PC/Mac === | ||
+ | |||
+ | Please notice that when you want to erase SPI NOR flash, fire these commands. If you don't have zero.img, download this one please. [https://dl.radxa.com/rock5/sw/images/others/zero.img.gz zero.img] | ||
And extract it. | And extract it. | ||
Line 117: | Line 269: | ||
rkdeveloptool rd | rkdeveloptool rd | ||
− | === Windows === | + | === Option 3: Erase with Windows PC === |
− | Before Erasing, please | + | Before Erasing, please confirm that ROCK 5B is in maskrom mode |
==== Step 1: Download ==== | ==== Step 1: Download ==== | ||
− | Choose the "Advanced features" button, then select rk3588_spl_loader_v1.08.111.bin, next click the "Download" button | + | Choose the "Advanced features" button, then select <code>rk3588_spl_loader_v1.08.111.bin</code>, next click the "Download" button |
==== Step 2: Erase all ==== | ==== Step 2: Erase all ==== | ||
Line 129: | Line 281: | ||
==== Step 3: Reboot device ==== | ==== Step 3: Reboot device ==== | ||
− | [[File: | + | [[File: eraseall_new.png |700px]] |
− | = | + | = Troubleshooting = |
− | + | * If you have issue with flashing via USB OTG, start a new post on the forum, https://forum.radxa.com/c/rock5. | |
− | + | ||
− | + | ||
− | + | <br> | |
− | + | ||
− | + |
Latest revision as of 12:24, 23 May 2024
ROCK 5 > Installation > Install the bootloader to the SPI NOR flash
ROCK 5 has a SPI flash on the board, it contains the bootloader for backup booting and supports booting other media that the SoC maskrom mode itself does not direct support (such as NVMe, SATA or USB 3).
This page describe how to write/install the bootloader to the SPI flash on the ROCK 5B.
There are two methods available to flash the SPI:
- simple method - flash the SPI from the ROCK 5 itself
- advanced method - flash the SPI with maskrom mode and an external computer
For advanced users: How to erase the SPI
Contents
- 1 Simple method
- 2 Advanced (external) method
- 3 Additional: erase the SPI NOR flash
- 4 Troubleshooting
Simple method
Requirements
- ROCK 5B with proper power
- SD card or eMMC module
- Linux image for ROCK 5B - (Android images are not supported yet)
Procedure
1) Boot linux from µSD card/eMMC
The first step is to boot the ROCK 5 with linux from an µSD card or an eMMC module.
(check this guide to flash a new image to an µSD card or check this guide to flash a new image to an eMMC module)
2) Download required files on the ROCK 5
You can download files by using wget DOWNLOADLINK
for example to download the file to clear the spi: wget https://dl.radxa.com/rock5/sw/images/others/zero.img.gz
Download the required files
and the latest spi bootloader:
- normal bootloader with u-boot serial console disabled - (for advanced users: this has the u-boot serial console disabled)
- Also support booting armbian from the M.2 NVME SSD.
- A better approach for armbian is to flash the spi with help of the armbian-install command like discribed here: https://fieldday.io/armbian-rock5b/
or for advanced users the
- debuging bootloader with u-boot serial console enabled (This is an debug bootloader if you need to troubleshoot booting issue with serial)
- EDK2 bootloader for booting UEFI-compatible operating system images (currently experimental)
Check the integrity of the downloaded files:
md5sum zero.img.gz
it should report back:
ac581b250fda7a10d07ad11884a16834 zero.img.gz
extract/uncompress the previous downloaded spi clearing file (gzip should already be installed otherwise install it):
gzip -d zero.img.gz
md5sum zero.img
it should report back:
2c7ab85a893283e98c931e9511add182 zero.img
and finally check your desired bootloader image: (replace spi-image.img
with the name of your downloaded image - eg: rock-5b-spi-image-gd1cf491-20240523.img
for the normal bootloader):
md5sum spi-image.img
it should report back one of the following lines:
fa14c99718f55b66e82aa1661e43c1ec rock-5b-spi-image-gd1cf491-20240523-debug.img cf53d06b3bfaaf51bbb6f25896da4b3a rock-5b-spi-image-gd1cf491-20240523.img
3) Flash the SPI flash
Make sure the spi flash is available:
ls /dev/mtdblock*
it should report back:
/dev/mtdblock0
completely clear the spi flash: (be patient the flash can take 5mins)
sudo dd if=zero.img of=/dev/mtdblock0
check if the flash was successfully cleared
sudo md5sum /dev/mtdblock0 zero.img
the result should look exactly like this:
2c7ab85a893283e98c931e9511add182 /dev/mtdblock0 2c7ab85a893283e98c931e9511add182 zero.img
now write you desired bootloader to the spi flash (replace spi-image.img
with the name of your downloaded image again):
sudo dd if=spi-image.img of=/dev/mtdblock0 sync
check if the flash was successfully (replace spi-image.img
with the name of your downloaded image again):
sudo md5sum /dev/mtdblock0 spi-image.img
the checksums should be the same again - if not flash the bootloader again.
4) Reboot
Now you are done flashing a bootloader supporting NVMe booting.
If you do not flashed the NVMe already check this guide to flash it. (again there are two options available)
Otherwise power off the ROCK 5, remove the µSD card or eMMC module and power it back up.
It should boot now from your NVMe. 😉
Advanced (external) method
Requirements
- ROCK 5B with proper power
- Linux image for ROCK 5B, Android image is not supported yet
- SD card or eMMC module
- USB Type C cable
- Windows/linux/macOS PC
Procedure
1) Install Tools & Drivers
Please check this guide, Install rockchip flash tools under Windows/Linux/MacOS PC.
The PC tools we use to communicate with ROCK 5 in maskrom mode are the rkdeveloptool on Linux/macOS and RkDevtool on Windows PC.
2) Get RK3588 loader and U-Boot images
- Download the loader image from:
- RK3588 loader - USB flashing helper
- Download the latest SPI image from:
- release version with u-boot serial console disabled. Support Armbian OS as well.(Recommend)
- debug version with u-boot serial console enabled(Use it when you need to troubleshoot booting issue)
- alternative bootloader based on EDK2 for booting UEFI-compatible operating system images (currently experimental)
3) Boot the board to Maskrom mode
To boot ROCK 5B to maskrom mode is simple:
- Power off the board.
- Remove bootable device like MicroSD card, eMMC module, etc.
- Press the golden (or silver on some board revisions) button and hold it.
- Plug the USB-A to Type-C cable to ROCK 5B Type-C port, the other side to PC.
- Release the golded button.
- Check usb device
- For macOS host:
lsusb
a result should be:... ID 2207:350b Fuzhou Rockchip Electronics Co., Ltd. Composite Device
- For Linux host:
lsusb
a result should be:... ID 2207:350b Fuzhou Rockchip Electronics Company
- For Windows host: Open RKDevTool and you would see the device is in Found One MASKROM Device
- For macOS host:
4) Write u-boot images to SPI NOR flash or erase SPI NOR flash
Option 1: Flash with Linux PC/Mac
On linux or Mac, run the rkdeveloptool
sudo rkdeveloptool ld DevNo=1 Vid=0x2207,Pid=0x350b,LocationID=106 Maskrom
This will load the loader (flash helper, downloaded from 2) to run on ROCK 5B and init the ram and prepare the flashing environment etc.
sudo rkdeveloptool db /path/to/rk3588_spl_loader_v1.08.111.bin # will output: Downloading bootloader succeeded.
Next, write SPI image from PC/Mac to ROCK 5B SPI flash
You can use the image download from Step 2.
sudo rkdeveloptool wl 0 rock-5b-spi-image-g49da44e116d.img Write LBA from file (100%)
Reboot the device
rkdeveloptool rd
now, the device should boot on SPI Nor Flash. And the blue led is on.
Option 2: Flash with Windows PC
Double click the RKDevTool.exe and you will see the following interface: Double click the RKDevTool.exe and you will see the following interface:
Step 1: confirm that ROCK 5B is in maskrom mode
If your ROCK 5B is in maskrom mode and connects to PC, you can see that the program detects it, as the red arrow below
Step 2: Load Configuration File
Right-click in the list box and select Load Config,Then select the configuration file in the resource management folder(The configuration file and RKDevTool are in the same directory)
Step 3: Select Loader
Next, click the right last columns in the "Loader" row to select rk3588_spl_loader_v1.08.111.bin
Step 4: Select SPI image
Next, click the right last columns in the "spi" row to select spi-image.
Step 5: Excute
Finally, click the "Excute" button, and you will see the content in the red box on the right. When the progress reaches 100%, the download is completed.
Additional: erase the SPI NOR flash
Option 1: Operate on ROCK 5B
Boot your ROCK 5B with linux running on µSD card or eMMC module:
Make sure the SPI flash is available:
ls /dev/mtdblock*
It should give /dev/mtdblock0
back
sudo dd if=/dev/zero of=/dev/mtdblock0 sync
Option 2: Erase with Linux PC/Mac
Please notice that when you want to erase SPI NOR flash, fire these commands. If you don't have zero.img, download this one please. zero.img And extract it.
rkdeveloptool db rk3588_spl_loader_v1.08.111.bin rkdeveloptool wl 0 zero.img rkdeveloptool rd
Option 3: Erase with Windows PC
Before Erasing, please confirm that ROCK 5B is in maskrom mode
Step 1: Download
Choose the "Advanced features" button, then select rk3588_spl_loader_v1.08.111.bin
, next click the "Download" button
Step 2: Erase all
Click the "erase all" button
Step 3: Reboot device
Troubleshooting
- If you have issue with flashing via USB OTG, start a new post on the forum, https://forum.radxa.com/c/rock5.