<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://wiki.radxa.com/mw/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://wiki.radxa.com/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Timbo</id>
		<title>Radxa Wiki - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://wiki.radxa.com/mw/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Timbo"/>
		<link rel="alternate" type="text/html" href="https://wiki.radxa.com/Special:Contributions/Timbo"/>
		<updated>2026-06-10T17:50:10Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.3</generator>

	<entry>
		<id>https://wiki.radxa.com/Zero/dev/u-boot</id>
		<title>Zero/dev/u-boot</title>
		<link rel="alternate" type="text/html" href="https://wiki.radxa.com/Zero/dev/u-boot"/>
				<updated>2022-10-18T13:18:43Z</updated>
		
		<summary type="html">&lt;p&gt;Timbo: Changed compiler flag to match installed libraries. Added warning as fastboot flashing does not work for current image (as long as nobody figures out the 'magic number' to U-Boot)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{zero_header}}&lt;br /&gt;
&lt;br /&gt;
{{Languages|zero/dev/u-boot}}&lt;br /&gt;
&lt;br /&gt;
    [[zero | Radxa Zero]] &amp;gt; [[zero/dev | Development]] &amp;gt; [[zero/dev/u-boot | U-Boot]]&lt;br /&gt;
&lt;br /&gt;
=== Build U-Boot and flash it on Radxa Zero ===&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;font color=&amp;quot;#FF0000&amp;quot;&amp;gt;WARNING!&amp;lt;/font&amp;gt; Flash bootloader incorrectly could result in unbootable system and loss of data. Do not replace bundled bootloader unless you understand the risk.&lt;br /&gt;
&lt;br /&gt;
==== Requirement ====&lt;br /&gt;
&lt;br /&gt;
* Radxa Zero&lt;br /&gt;
* USB A to C cable&lt;br /&gt;
* A computer running Ubuntu 18.04 or higher&lt;br /&gt;
&lt;br /&gt;
==== Build U-Boot ====&lt;br /&gt;
&lt;br /&gt;
===== Step 1: Get the source code =====&lt;br /&gt;
&lt;br /&gt;
We use git to fetch source code from internet. If you do not have git installed, try following commands:&lt;br /&gt;
&lt;br /&gt;
    sudo apt update&lt;br /&gt;
    sudo apt install git&lt;br /&gt;
&lt;br /&gt;
Once you have git installed, you can download the source code:&lt;br /&gt;
&lt;br /&gt;
    git clone -b radxa-zero-v2021.07 https://github.com/radxa/u-boot.git&lt;br /&gt;
&lt;br /&gt;
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:&lt;br /&gt;
&lt;br /&gt;
    git clone https://github.com/radxa/fip.git&lt;br /&gt;
&lt;br /&gt;
===== Step 2: Set up build environment =====&lt;br /&gt;
&lt;br /&gt;
Execute following commands to install build dependencies and the tool chain necessary for building.&lt;br /&gt;
&lt;br /&gt;
  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&lt;br /&gt;
  wget https://developer.arm.com/-/media/Files/downloads/gnu-a/10.3-2021.07/binrel/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz&lt;br /&gt;
  sudo tar xvf gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf.tar.xz -C /opt&lt;br /&gt;
&lt;br /&gt;
===== Step 3: Build U-boot =====&lt;br /&gt;
&lt;br /&gt;
  export CROSS_COMPILE=/opt/gcc-arm-10.3-2021.07-x86_64-aarch64-none-elf/bin/aarch64-none-elf-&lt;br /&gt;
  export ARCH=arm&lt;br /&gt;
  cd u-boot&lt;br /&gt;
  make radxa-zero_defconfig &lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
You will find &amp;lt;code&amp;gt;u-boot.bin&amp;lt;/code&amp;gt; under &amp;lt;code&amp;gt;u-boot&amp;lt;/code&amp;gt; folder if everything runs without error.&lt;br /&gt;
&lt;br /&gt;
===== Step 4: Pack U-boot =====&lt;br /&gt;
&lt;br /&gt;
  cp u-boot.bin ../fip/radxa-zero/bl33.bin&lt;br /&gt;
  cd ../fip/radxa-zero&lt;br /&gt;
  make&lt;br /&gt;
&lt;br /&gt;
This will generate &lt;br /&gt;
&lt;br /&gt;
    u-boot.bin u-boot.bin.sd.bin u-boot.bin.usb.bl2 u-boot.bin.usb.tpl&lt;br /&gt;
&lt;br /&gt;
==== Run U-boot ====&lt;br /&gt;
&lt;br /&gt;
* Sideloading from USB&lt;br /&gt;
&lt;br /&gt;
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.&lt;br /&gt;
&lt;br /&gt;
Install the maskrom usb download tool with pip&lt;br /&gt;
&lt;br /&gt;
  sudo apt install pip3&lt;br /&gt;
  sudo pip3 install pyamlboot&lt;br /&gt;
&lt;br /&gt;
Press and hold the [https://wiki.radxa.com/mw/images/e/e2/Radxa_zero_ports.jpg USB boot button] on the back of Radxa Zero, and connect Zero to your PC.&lt;br /&gt;
&lt;br /&gt;
You should see following device connected to your system:&lt;br /&gt;
&lt;br /&gt;
  $ lsusb&lt;br /&gt;
  Bus 002 Device 030: ID 1b8e:c003 Amlogic, Inc. GX-CHIP&lt;br /&gt;
&lt;br /&gt;
Sideloadng u-boot.bin:&lt;br /&gt;
&lt;br /&gt;
  boot-g12.py /path/to/'''fip/radxa-zero/u-boot.bin'''&lt;br /&gt;
&lt;br /&gt;
If you have serial console attached to Radxa Zero, you will see the boot message from U-Boot.&lt;br /&gt;
&lt;br /&gt;
* Flash U-Boot to microSD&lt;br /&gt;
&lt;br /&gt;
  bin=/path/to/'''fip/radxa-zero/u-boot.bin.sd.bin'''&lt;br /&gt;
  sudo dd if=$bin of=/dev/sdx conv=fsync,notrunc bs=1 count=444&lt;br /&gt;
  sudo dd if=$bin of=/dev/sdx conv=fsync,notrunc bs=512 skip=1 seek=1&lt;br /&gt;
&lt;br /&gt;
If your Zero has built-in eMMC, we recommend [[Zero/install/eMMC_erase | erase it]] so the microSD's U-Boot will be used.&lt;br /&gt;
&lt;br /&gt;
* Flash U-Boot to eMMC (ONLY FOR BRANCH 2021.01, DOES NOT WORK WITH ABOVE BUILD)&lt;br /&gt;
&lt;br /&gt;
We use '''fastboot''' to flash U-Boot to eMMC. Unplug microSD card from Zero and press &amp;amp; hold the [https://wiki.radxa.com/mw/images/e/e2/Radxa_zero_ports.jpg usb boot button], then connect Zero to your PC.&lt;br /&gt;
&lt;br /&gt;
  sudo apt install fastboot&lt;br /&gt;
  wget https://dl.radxa.com/zero/images/loader/rz-fastboot-loader.bin&lt;br /&gt;
  boot-g12.py rz-fastboot-loader.bin&lt;br /&gt;
  sudo fastboot flash 0x200 /path/to/'''fip/radxa-zero/u-boot.bin'''&lt;br /&gt;
  sudo fastboot reboot&lt;br /&gt;
&lt;br /&gt;
Some forum user also discover a method to [https://forum.radxa.com/t/install-os-direct-to-emmc-with-ubuntu/7435 flash U-Boot with dd] in USB mass storage mode:&lt;br /&gt;
&lt;br /&gt;
 curl -L https://dl.radxa.com/zero/images/loader/u-boot.bin | sudo dd of=/dev/sdX bs=512 seek=1 &amp;amp;&amp;amp; sync&lt;/div&gt;</summary>
		<author><name>Timbo</name></author>	</entry>

	</feed>