04-17-2020, 03:49 AM
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 @TaborFife : https://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
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:
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)
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 @TaborFife : https://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
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)