Mainline U-Boot with Arch Linux PKGBUILD

I have been tweaking my Arch Linux setup since I described how to dirty hack Arch over Ayufans images in this forum a while back (

There is already a thread on compiling U-Boot for the RockPro64 in this forum by @TaborFife, but he did not create a PKGBUILD for easy reproduction and updates under Arch Linux. His build is rather described to be built from any host, but I think if anyone wants to install Arch Linux on their RockPro64, it is likely they also have an Arch Linux x86 machine running somewhere Big Grin

So, now I have created a PKGBUILD for building U-Boot for the RockPro64 from upstream U-Boot with ARM Trusted Firmware also built from source. The PKGBUILD and install files are based on the uboot PKGBUILD for the Rock64 which is already in the ArchLinuxARM repos.

According to the Rockchip wiki, this equals to Boot Flow 2 with the small exception that ATF is also compiled from source.

The PKGBUILD can be both cross compiled from an Arch Linux x86 machine (works out of the box) or directly on your RockPro64.

What is the advantage of doing everything from source: First for the fun of learning, and second, I can do the build without the Rockchiptools. I just find things more beautiful if you do not need special vendor tools for anything.

So, here is the HowTo (to do an initial build to bootstrap your SD card from your Arch Linux x86 PC):

1) Check out the PKGBUILD from my GitHub:

2) Make the package - for bootstrapping the SD card, you will need to go into the directory where the package sources have been build my makepkg

3) Partition your SD card as described by @TaborFife in his thread in Section 2, steps 0 to 4

4) From the directory where u-boot has been build (makepkg builds packages in the 'BUILDDIR' directory, described in /etc/makepkg.conf) burn the bootloader with dd to the SD card:
dd if=/usr/share/uboot/idbloader.img of=/dev/mmcblk0 seek=64 conv=notrunc
dd if=/usr/share/uboot/u-boot.itb of=/dev/mmcblk0 seek=16384 conv=notrunc

5) When you are done, check out the thread of @TaborFife again and continue with Step 5 from Section 2 until the end to bootstrap Arch Linux ARM on your SD card.

What to do if you already have Arch Linux installed on your RockPro64:

1) Either on your Arch Linux x86 machine or directly on the RockPro64, check out my GitHub repo

2) Make the package (When building on your RockPro64, please refrain from compiling on the SD card. That is terribly slow and cards are not really made to endure such write loads). If you cross compile from your x86, copy the resulting package to your RockPro64

3) Install the built package with pacman. You can choose if you want to directly burn it to your SD card or do it later manually. If you do it manually, the needed files are copied to the directory /usr/share/uboot

Closing remarks:

As of the writing of this post, my RockPro64 runs on the newest U-Boot release 2020.01

Configure the boot:
The package employs the file /boot/boot.scr, generated from /boot/boot.txt for boot configuration. If you want to use extlinux config file for booting, simply delete /boot/boot.scr and create a file /boot/extlinux/extlinux.conf with an extlinux.conf (you can create your own, copy one from Ayufan's images, whatever you like). Mainline U-Boot understands both files, seems to prefer /boot/extlinux/extlinux.conf if both are present.

I have not tried to burn U-Boot to the SPI flash, it would be nice if someone who tries this could post their results.

If you want just U-Boot for whatever distro, just head over to @TaborFife 's Thread for the general description of compiling U-Boot (Described in his Section 1)

Possibly Related Threads…
Thread Author Replies Views Last Post
  How I Got Fedora Linux to Boot From eMMC (or microSD, for that matter) whitecat23 4 196 01-03-2022, 10:32 AM
Last Post: whitecat23
  Vanilla mainline Debian 11 (Bullseye) on the RockPro64 Pete Tandy 21 3,216 11-06-2021, 06:42 AM
Last Post: Pete Tandy
  Overlays not loading at boot - ROCKPRO64 on Armbian rookieone 0 306 09-28-2021, 04:10 AM
Last Post: rookieone
  Boot/Shutdown on timer captainmorgan 7 1,343 08-27-2021, 09:08 AM
Last Post: captainmorgan
Question cannot boot openSUSE - what am I doing wrong? Mentaluproar 2 707 08-12-2021, 04:58 AM
Last Post: igorp
  Compiling ayufan mainline - DT-overlay missing Mentaluproar 0 486 07-24-2021, 09:46 PM
Last Post: Mentaluproar
  compiling a new kernel for overclocking on arch Mentaluproar 2 889 07-15-2021, 10:16 AM
Last Post: Mentaluproar
  Other boot options than Sdcard for linux 5.x kernel? MisterA 2 912 07-14-2021, 02:37 PM
Last Post: TRS-80
Brick Maintained Linux booting from eMMC ootoovak 5 1,527 07-06-2021, 02:28 PM
Last Post: TRS-80
  Booting Linux/Debian from the eMMC linuxha 4 1,877 03-02-2021, 07:01 PM
Last Post: linuxha

Forum Jump:

Users browsing this thread: 1 Guest(s)