How to upgrade SPI Flash from SD Boot

This wiki page describes instructions to configure a recovery image for SPI Flash and update it.
You can download a pre-built recovery image instead of building recovery image.

Release versions Release Information Downloads Note
v1.2 (2020/06/09) release note temporary KR US Add support for OGA Rev1.1
v1.1 (2020/02/11) release note of v1.1 KR US Please use sd card u-boot of Feb 06, 2020
or higher version with this image.
v1.0 (2020/01/02) release note of v1.0 KR US The First Release

Required packages

Before building kernel for Odroid Go advance on Ubuntu desktop, you need to install the required packages as follows.

$ sudo apt-get update &&\
sudo apt-get install -y git lzop build-essential gcc \
    bc libncurses5-dev libc6-i386 lib32stdc++6 zlib1g:i386

Toolchain (6.3.1)

Download toolchain and extract the tarball to /opt/toolchains/.

$ sudo mkdir -p /opt/toolchains &&\
wget https://releases.linaro.org/components/toolchain/binaries/6.3-2017.05/aarch64-linux-gnu/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz &&\
sudo tar Jxvf gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu.tar.xz -C /opt/toolchains/

To set up information for compilation, paste below lines to $HOME/.bashrc.

export ARCH=arm64
export CROSS_COMPILE=aarch64-linux-gnu-
export PATH=/opt/toolchains/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu/bin/:$PATH

Execute the below command to apply the setting.

$ source ~/.bashrc

Check the toolchain version to confirm compatibility.

$ aarch64-linux-gnu-gcc -v
...
COLLECT_LTO_WRAPPER=/opt/toolchains/gcc-linaro-6.3.1-2017.02-x86_64_aarch64-linux-gnu/bin/../libexec/gcc/aarch64-linux-gnu/6.3.1/lto-wrapper
...
gcc version 6.3.1 20170109 (Linaro GCC 6.3-2017.02)

Build

1. Build uboot for SD boot

$ git clone https://github.com/hardkernel/u-boot.git -b odroidgoA-v2017.09
$ cd u-boot
$ make distclean
$ ./make.sh odroidgo2

2. Build uboot for SPI boot
U-Boot source repository for SPI boot is same as SD boot.
Now make bootloader images for SPI boot.

$ make distclean
$ ./make.sh odroidgo2-spi

3. Prepare a recovery image by running this script
During this process, root permission will be asked to mount a temporary file-system.

$ cd u-boot
$ ./build_recovery.sh

Then, sdcard_recovery.img will be generated in sd_fuse folder.
This image contains all related binaries for spi recovery process.

  • bootloaders for SD boot
  • a whole image of SPI flash and its md5sum
  • other necessary images

1. Write sdcard_recovery.img to a blank sd card
Check the device path of your USB card reader and write sdcard_recovery.img to your blank sd card using dd.

$ sudo dd if=sd_fuse/sdcard_recovery.img of=<device/path/of/your/card> conv=fsync
$ sync

2. Boot from SD card
Insert the SD card into the SD slot of GO Advanced board and turn power on.
Then, recovery will start automatically.
And you can see the progress and error messages on LCD display.

partition start size requirement
sector bytes sector bytes
mbr 0 0 1 512 bytes rk3326_header_miniloader_spiboot.img
primary gpt 1 512 bytes 33 16.5 kB
reserved 30 15 kB
env 64 32 kB 64 32 kB
miniloader 128 64 kB 1920 960 kB
uboot 2048 1 MB 2048 1 MB uboot_spi.img
trust 4096 2 MB 4096 2 MB trust_spi.img
dtb 8192 4 MB 200 100 kB odroidgo2-kernel.dtb
logo1 8392 4196 kB 400 200 kB logo_hardkernel.bmp.gz
logo2 8792 4396 kB 400 200 kB low_battery.bmp.gz
logo3 9192 4596 kB 400 200 kB recovery.bmp.gz
logo4 9592 4796 kB 400 200 kB system_error.bmp.gz
logo5 9992 4996 kB 400 200 kB no_sdcard.bmp.gz
reserved 2 10392 5196 kB - -