Difference between revisions of "Quartz64 Building U-Boot"

From PINE64
Jump to navigation Jump to search
(Create a guide on how to compile mainline U-Boot for Quartz64/SOQuartz)
 
(Add Debian dependencies)
 
(One intermediate revision by the same user not shown)
Line 4: Line 4:


You will need either an x86 machine with an aarch64 cross-compiler installed, or an existing aarch64 system. You will also need the device tree compiler dtc, python3 (including setuptools and pyelftools), swig, GNU make and git.
You will need either an x86 machine with an aarch64 cross-compiler installed, or an existing aarch64 system. You will also need the device tree compiler dtc, python3 (including setuptools and pyelftools), swig, GNU make and git.
=== Arch Linux ===


On an x86_64 Arch Linux system, you can install the required dependencies with:
On an x86_64 Arch Linux system, you can install the required dependencies with:


  pacman -S --needed base-devel aarch64-linux-gnu-gcc aarch64-linux-gnu-binutils git dtc python-setuptools swig python-pyelftools
  pacman -S --needed base-devel aarch64-linux-gnu-gcc aarch64-linux-gnu-binutils git dtc python-setuptools swig python-pyelftools
=== Debian (or Derivates like Ubuntu) ===
On an x86_64 Debian system, you can install the required dependencies with:
apt install device-tree-compiler build-essential gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu make python3 python3-dev libssl-dev python3-pyelftools python3-setuptools swig git


== Fetching The Repositories ==
== Fetching The Repositories ==
Line 15: Line 23:
  git clone https://source.denx.de/u-boot/u-boot.git
  git clone https://source.denx.de/u-boot/u-boot.git


You can use <code>git checkout <var>tagname</var></code> to check out a specific git tag (release), you can list all of them with <code>git tag -l</code> (but do keep in mind we only have device support since v2023.10).
You can use <code>git checkout <var>tagname</var></code> inside the ''u-boot'' directory to check out a specific git tag (release), you can list all of them with <code>git tag -l</code> (but do keep in mind we only have device support since v2023.10).


Then, also use git to clone the rockchip firmware binaries repository into the directory ''rkbin'':
Then, also use git to clone the rockchip firmware binaries repository into the directory ''rkbin'':

Latest revision as of 11:09, 31 August 2023

This article guides you through compiling U-Boot for a Quartz64 or SOQuartz device.

Prerequisites

You will need either an x86 machine with an aarch64 cross-compiler installed, or an existing aarch64 system. You will also need the device tree compiler dtc, python3 (including setuptools and pyelftools), swig, GNU make and git.

Arch Linux

On an x86_64 Arch Linux system, you can install the required dependencies with:

pacman -S --needed base-devel aarch64-linux-gnu-gcc aarch64-linux-gnu-binutils git dtc python-setuptools swig python-pyelftools

Debian (or Derivates like Ubuntu)

On an x86_64 Debian system, you can install the required dependencies with:

apt install device-tree-compiler build-essential gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu make python3 python3-dev libssl-dev python3-pyelftools python3-setuptools swig git

Fetching The Repositories

Use git to clone the mainline U-Boot repository into the directory u-boot:

git clone https://source.denx.de/u-boot/u-boot.git

You can use git checkout tagname inside the u-boot directory to check out a specific git tag (release), you can list all of them with git tag -l (but do keep in mind we only have device support since v2023.10).

Then, also use git to clone the rockchip firmware binaries repository into the directory rkbin:

git clone https://github.com/rockchip-linux/rkbin.git

Setting Up Your Environment

Next, we need to set two environment variables: ROCKCHIP_TPL for the DRAM init binary, and BL31 for the ARM Trusted Firmware binary.

cd u-boot
export ROCKCHIP_TPL="$(ls ../rkbin/bin/rk35/rk3566_ddr_1056MHz_v*.bin | sort | tail -n1)"
export BL31="$(ls ../rkbin/bin/rk35/rk3568_bl31_v*.elf | sort | tail -n1)"

Configuring U-Boot

First, we need to use the right default config for our device. Please choose defconfig from the following table depending on your device:

Board defconfig
Quartz64 Model A quartz64-a-rk3566_defconfig
Quartz64 Model B quartz64-b-rk3566_defconfig
SOQuartz on Model A soquartz-model-a-rk3566_defconfig
SOQuartz on Blade soquartz-blade-rk3566_defconfig
SOQuartz on CM4 I/O Board soquartz-cm4-rk3566_defconfig

In the u-boot directory with your environment variables set, run:

make CROSS_COMPILE=aarch64-linux-gnu- defconfig

with defconfig being the value from the previous table.

Building U-Boot

In the u-boot directory, after configuring, and with your environment variables set, run:

make CROSS_COMPILE=aarch64-linux-gnu- -j$(nproc)

This will output a u-boot-rockchip.bin, which is your freshly built SPL+U-Boot combined image.