Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
92 lines (61 sloc) 3.81 KB

Flashing and Erasing the SPI

Traditionally, booting Linux on the ROCK64 required an eMMC or microSD card, however it is now possible to boot without those, assuming the SPI memory has been flashed. The ROCK64 contains an onboard 128Mbit SPI flash memory, which can be flashed with U-Boot in order to provide additional boot options:

  • USB2 / USB3 drive
  • PXE
  • microSD
  • eMMC

1. Write the U-Boot image

  1. Download the latest u-boot-flash-spi.img.xz image

  2. Write it to a microSD card using dd or Etcher

    # From Linux or macOS
    xz -k -d -c -v -T 3 u-boot-flash-spi.img.xz | dd of=/dev/<sdcard> bs=1M

Make sure you write to the correction location, it will destroy all data.

2. Boot the ROCK64

  1. Insert the microSD card

  2. Wait for it to boot. It will automatically erase the SPI memory, and flash U-Boot

  3. You should see: the power LED (white LED) flicker once per second, and:

    SF: ... bytes @ 0x8000 Written: OK
    
  4. Remove the microSD card

3. Prepare Linux

Tested successfully with Debian Stretch Minimal 0.6.15-175

  1. Prepare your device (USB drive, microSD, PXE, whatever) with your chosen Linux distribution

  2. Boot method:

    • Boot from microSD/eMMC/USB drive: write the image using dd or Etcher
    • Boot from PXE: we assume you already know what you're doing
  3. Reset the ROCK64

  4. You should see U-Boot starting from SPI memory, and then booting Linux

Make sure you remove the microSD card containing the u-boot-flash-spi image, otherwise on reset it will erase/write the SPI memory once again.

Boot order:

  1. SPI flash
  2. eMMC (disable with jumper)
  3. microSD
  4. USB drive
  5. PXE

If you're currently running the OS from microSD, and want to switch to a USB/SSD drive, follow the instructions on this page.

4. Fix for SPI Flashing failures

If, for any reason, your SPI flashing gets interrupted during its process, you may experience a "frozen" device.

To solve this, on the Rock64 follow these instructions:

  1. Go to this guide to create a new ayufan bootable Linux SD card Or, in short, download the latest ayufan Linux distribution from here, and use etcher to flash you SD card

  2. Insert the SD card to the Rock64.

  3. Connect other peripherals such as network to later control your device, such as via ssh.

    • ayufan’s Linux distro will connect to the network and you will be able to ssh to the device.
  4. Ground the SPI Clock (SPI_CLK_M2) on the Pi-2 Bus GPIO pins on the rock64

    • Pin 23 is SPI_CLK_M2
    • Pin 25 is GND
    • Pin layout of the rock64 can be found here
    • Other Rock64 documents can be found here
  5. Turn on the device and release the grounding of the SPI Clock 2-3 seconds after the device was turned on.

    • NOTE: This is a critical step If not done correctly you will not be able to flash the device
    • If unsuccessful turn of the device and try again.
  6. login and go to the folder with the flashing scripts

    • cd /usr/local/sbin
    • sudo ./rock64_erase_spi_flash.sh or sudo ./rock64_write_spi_flash.sh
    • Type "YES" to flash the device
  7. If the flashing failes with an error loader partition on MTD is not found repeat step 5.

Your device should now be able to boot without holding the SPI Clock.

You can’t perform that action at this time.