Mainline U-Boot with Arch Linux PKGBUILD
#1
Hello,

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 (https://forum.pine64.org/showthread.php?tid=6333).

There is already a thread on compiling U-Boot for the RockPro64 in this forum by @TaborFifehttps://forum.pine64.org/showthread.php?tid=7992, 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 http://opensource.rock-chips.com/wiki_Boot_option, 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: https://github.com/matyas1995/u-boot-PKGBUILD.git

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 https://forum.pine64.org/showthread.php?tid=7992 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:
Code:
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
  irradium (based on crux linux) RockPro64 riscv64, aarch64 mara 1 342 03-25-2024, 12:12 PM
Last Post: mara
  Boot/Shutdown on timer captainmorgan 8 5,836 11-01-2023, 12:08 PM
Last Post: Nikolay_Po
Exclamation Ethernet regression on Linux Kernel 6.5.4? Deathcrow 3 742 09-22-2023, 04:27 AM
Last Post: diederik
  Vanilla mainline Debian 11 (Bullseye) on the RockPro64 Pete Tandy 22 16,822 08-16-2023, 01:34 AM
Last Post: varac
  Installing CH431SER on Ayufan 0.9.14: gitlab-ci-linux-build-159 Thisone 4 1,183 07-14-2023, 04:22 AM
Last Post: hunderteins
Question How do I compile an arbitrary kernel for U-Boot? Valenoern 3 1,016 06-16-2023, 10:54 AM
Last Post: CounterPillow
  Linux laptop does not detect the board when plugged in via USB soupy 1 3,920 04-13-2023, 03:01 AM
Last Post: Reynold Grady
  RockPro64 boot questions misterc 3 1,488 01-13-2023, 06:21 PM
Last Post: misterc
  Is some u-boot required on the SPI for installing debian with the official installer? callegar 1 1,284 10-25-2022, 10:07 AM
Last Post: ratzzupaltuff
  RockPro64 linux console video mode callegar 0 834 09-06-2022, 02:32 PM
Last Post: callegar

Forum Jump:


Users browsing this thread: 1 Guest(s)