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)
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Question Mainline Debian Buster on RockPro64 ? chrestomanci 15 2,436 09-05-2020, 03:21 PM
Last Post: kuleszdl
  Xen EFI with Alpine Linux dom0 sir.lami 0 165 08-26-2020, 12:25 PM
Last Post: sir.lami
  Linux Host - QEMU Android Guest? rik-shaw 0 224 07-09-2020, 08:02 PM
Last Post: rik-shaw
  Official Debian release won't boot!?! Faradn 4 768 07-06-2020, 09:29 AM
Last Post: Bullet64
  RETRO GAMING BATOCERA LINUX + ROSHAMBO CASE - Tutoriel Fr TheMiniCakeTV 0 946 07-02-2020, 12:45 PM
Last Post: TheMiniCakeTV
  Arch Linux on RockPro64 mmatyas 30 14,409 05-30-2020, 12:08 PM
Last Post: mmatyas
  RockPro64 Linux Manjaro HDMI 4K mkne 12 1,360 05-03-2020, 07:23 AM
Last Post: PakoSt
Thumbs Up First Manjaro Mainline build! Luke 8 2,412 05-03-2020, 02:35 AM
Last Post: Bullet64
  Slow/dead ethernet on (non-Ayufan) Linux Mainline (fixed) mmatyas 1 388 04-17-2020, 02:53 AM
Last Post: Thra11
  Rockpro64 and stock arch linux TaborFife 6 1,596 01-15-2020, 05:17 PM
Last Post: dragop

Forum Jump:


Users browsing this thread: 1 Guest(s)