For an upcoming project, I needed to compile my own version of upstream u-boot. If you didn’t know I already: u-boot is a small cross-platform bootloader especially designed to work in restricted environments like embedded systems.

I choose Arch Linux as my compiling host because it is my daily driver. Also, it has a rich package base for my use cases. Installing the required cross-compiler toolchain on Arch is a breeze.

Install dependencies

Our first step is to install all the required dependencies for compiling u-boot. As always make sure that you have your system up to date:

pacman -Syu # Update package database and install upgrades

Next, come our actual dependencies (bc is required for some calculation done in the make step of the build process):

pacman -Sy base-devel git aarch64-linux-gnu-gcc bc

Now you should have all dependencies installed to build u-boot.

Clone & Compile

We now use git to get the latest master branch from u-boot. If you require a specific version you can check out a specific branch or tag to do so. Git clean -fdx is used to clean our workspace. It shouldn’t be needed because we just cloned the repository. If you have already tried something in here, use it to clean the mess up:

git clone
git clean -fdx

Our next step is to export an environment variable that specifies which compiler toolchain make will use to build the project. This variable is a prefix for all compiler commands:

export CROSS_COMPILE=aarch64-linux-gnu-

Because u-boot is a cross-platform bootloader for a wide variety of boards, processors and instruction sets you will need to configure the build. We will do so by utilizing a make defconfig call with our specific board. Have a look at the configs directory to see all possible configurations available. Make “Config File” will then create the appropriate configuration. My choice was the u200 AmLogic reference board because most g12a based processors (AmLogic S905X2/S905Y2/S905D2) use the same board design:

make u200_defconfig

The last step is to compile the project. We will leverage multiple CPUs to compile faster. My build system has 32 cores so a value of 48 concurrent compiler tasks is a reasonable choice (1.5xCPU Count to maximize efficiency):

make -j 48

You should now see the make progress. A few warnings here and there are normal, don’t worry. After a while, you will get some files including u-boot.bin ready to use for flashing.


Now you have a bootloader ready to work on a wide variety of devices, from embedded devices to single-board computers. I will use this bootloader for a future project including an x96s HDMI Stick SBC.

Comments are closed