Skip to main content

Flash BootLoader to SPI Nor Flash

The SPI NOR flash stores bootloader files like idbloader.img and u-boot.itb.

The PCIe NVMe SSD stores the system img/rootfs.

Introduction

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).
Notice:On the ROCK 5A, there is not a SPI flash on the board, it's a spi module like eMMC.

This page describe how to write/install the bootloader to the SPI flash on the ROCK 5B, ROCK 5A in a similar way.

Notice: As eMMC and spi module share a common interface on the ROCK 5A, please use microSD card when using simple method.

There are two methods available to flash the SPI:

Simple method

Preparation

  • ROCK 5B (Only ROCK 5B supported for now)
  • Power supply
  • 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. Boot linux from µSD card/eMMC

    Please check flash guides for guidance.

  2. Download required files on the ROCK 5

    You can download files by using wget DOWNLOADLINK.

    • Download the spi clearing files
    wget https://dl.radxa.com/rock5/sw/images/others/zero.img.gz
    • Downloadthe latest spi bootloader:

      with u-boot serial console disabled(Recommend)

    wget https://dl.radxa.com/rock5/sw/images/loader/rock-5b/release/rock-5b-spi-image-gbf47e81-20230607.img

    Use it when you need to install the armbian Image to M.2 NVME SSD

    wget https://github.com/huazi-yg/rock5b/releases/download/rock5b/rkspi_loader.img

    with u-boot serial console enabled(Use it when you need to troubleshoot booting issue)

    wget https://dl.radxa.com/rock5/sw/images/loader/rock-5b/debug/rock-5b-spi-image-gbf47e81-20230607-debug.img
  3. Check the integrity of the downloaded files:

    md5sum zero.img.gz

    it should report back:

    ac581b250fda7a10d07ad11884a16834  zero.img.gz
  4. 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
  5. check your desired bootloader image:

    md5sum rock-5b-spi-image-gd1cf491-20240523.img

    it should report back one of the following lines:

    cf53d06b3bfaaf51bbb6f25896da4b3a  rock-5b-spi-image-gd1cf491-20240523.img
    fa14c99718f55b66e82aa1661e43c1ec rock-5b-spi-image-gd1cf491-20240523-debug.img
    1b83982a5979008b4407552152732156 rkspi_loader.img
  6. Flash the SPI flash

    • Make sure the spi flash is available:
    ls /dev/mtdblock*
    # report
    /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
    # report
    2c7ab85a893283e98c931e9511add182 /dev/mtdblock0
    2c7ab85a893283e98c931e9511add182 zero.img
    • now write you desired bootloader to the spi flash (replace rkspi_loader.img with the name of your downloaded image again):
    sudo dd if=rkspi_loader.img of=/dev/mtdblock0
    sync
    # check if the flash was successfully
    sudo md5sum /dev/mtdblock0 rkspi_loader.img

    the checksums should be the same again - if not flash the bootloader again.

  7. 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.