Please enable javascript, or click here to visit my ecommerce web site powered by Shopify.
Jump to: navigation, search


< Zero‎ | dev
    Radxa Zero >  Development >  U-Boot

Build U-Boot and flash it on Radxa Zero

This guide describes how to build U-Boot and flash it on Radxa Zero. U-Boot image can be flashed on eMMC or microSD, and it can be sideload from USB as well.

WARNING! Flash bootloader incorrectly could result in unbootable system and loss of data. Do not replace bundled bootloader unless you understand the risk.


  • Radxa Zero
  • USB A to C cable
  • A computer running Ubuntu 18.04 or higher

Build U-Boot

Step 1: Get the source code

We use git to fetch source code from internet. If you do not have git installed, try following commands:

   sudo apt update
   sudo apt install git

Once you have git installed, you can download the source code:

   git clone -b radxa-zero-v2021.07

FIP(Firmware in Package) is a collection of scripts and pre-built binaries (such as first stage loader and so on) for Radxa Zero U-Boot. Get them with following command:

   git clone
Step 2: Set up build environment

Execute following commands to install build dependencies and the tool chain necessary for building.

 sudo apt install bc nano mc build-essential autoconf libtool cmake pkg-config git python python-dev swig libpcre3-dev libnode-dev gawk wget diffstat bison flex device-tree-compiler libncurses5 libncurses5-dev gcc-aarch64-linux-gnu g++-aarch64-linux-gnu binfmt-support qemu-user-static dosfstools libssl-dev mtools
 sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt
Step 3: Build U-boot
 export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
 export ARCH=arm
 cd u-boot
 make radxa-zero_defconfig 

You will find u-boot.bin under u-boot folder if everything runs without error.

Step 4: Pack U-boot
 cp u-boot.bin ../fip/radxa-zero/bl33.bin
 cd ../fip/radxa-zero

This will generate

   u-boot.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl

Run U-boot

  • Sideloading from USB

When your U-Boot is broken you can sideload a working image to recover an unbootable system. This can also be used to verify the newly generated image is working before flashing it permanently on storage media.

Install the maskrom usb download tool with pip

 sudo apt install pip3
 sudo pip3 install pyamlboot

Press and hold the USB boot button on the back of Radxa Zero, and connect Zero to your PC.

You should see following device connected to your system:

 $ lsusb
 Bus 002 Device 030: ID 1b8e:c003 Amlogic, Inc. GX-CHIP

Sideloadng u-boot.bin: /path/to/fip/radxa-zero/u-boot.bin

If you have serial console attached to Radxa Zero, you will see the boot message from U-Boot.

  • Flash U-Boot to microSD
 sudo dd if=$bin of=/dev/sdx conv=fsync,notrunc bs=1 count=444
 sudo dd if=$bin of=/dev/sdx conv=fsync,notrunc bs=512 skip=1 seek=1

If your Zero has built-in eMMC, we recommend erase it so the microSD's U-Boot will be used.


We use fastboot to flash U-Boot to eMMC. Unplug microSD card from Zero and press & hold the usb boot button, then connect Zero to your PC.

 sudo apt install fastboot
 wget rz-fastboot-loader.bin
 sudo fastboot flash 0x200 /path/to/fip/radxa-zero/u-boot.bin
 sudo fastboot reboot

Some forum user also discover a method to flash U-Boot with dd in USB mass storage mode:

curl -L | sudo dd of=/dev/sdX bs=512 seek=1 && sync