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

Zero/dev/u-boot

< Zero‎ | dev
Revision as of 06:09, 9 September 2021 by Jack-ma (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
    Radxa Zero >  Development >  U-Boot

Build U-Boot and run it on Radxa Zero

This guide describes how to build U-Boot and run it on Radxa Zero. U-Boot images could be installed into eMMC or Micro SD Card or USB boot.

Requirement

  • Radxa Zero
  • USB A to C cable
  • A PC/laptop running Linux(Ubuntu 18.04 or higher)

Build U-Boot

Step 1: Get the source code

You need Git to get multiple git repositories to build the image.

Install Git if you don't have it.

   sudo apt-get update && sudo apt-get install -y git

Clone the source code

   git clone -b radxa-zero-v2021.07 https://github.com/radxa/u-boot.git

FIP(Firmware in Package) is a bunch of scripts and prebuilt binaries(first stage loader etc) for Radxa Zero u-boot.

   git clone https://github.com/radxa/fip.git
Step 2: Install necessary tools
 sudo apt-get install -y gcc-aarch64-linux-gnu device-tree-compiler libncurses5 libncurses5-dev
 sudo apt-get install -y bc python dosfstools flex build-essential libssl-dev mtools

Get the toolchain

 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
 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.2-2020.11-x86_64-aarch64-none-elf/bin/aarch64-none-elf-
 export ARCH=arm
 cd u-boot
 make radxa-zero_defconfig 
 make

You will have u-boot.bin built.

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

This will generate

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

Run U-boot

  • Download and run in RAM from USB
 pip3 install git+https://github.com/superna9999/pyamlboot
 
  • Write the u-boot to Micro SD card and run
 bin=u-boot.bin.sd.bin
 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
  • Write the u-boot to eMMC and run
 /path/to/fip/radxa-zero/u-boot.bin