BPI-R3 u-boot build help (with NVMe support, hopefully)

Wow, these are some nice updates. Thanks @ericwoud for setting up the tutorial. I am also a big fan of Archlinux so this is quite fortuitous. Definitely saves me a lot of time migrating things.

@ericwoud , @frank-w. If/when the u-boot driver becomes available would you mind posting a message here? I have been checking the commit history @GitHub - frank-w/u-boot: U-Boot-Bootloader for BananaPI-R2/R64/R2Pro/R3 regularly (hoping for a stealthy pcie driver update), but some commits are quite large and difficult to follow.

So anyway, the kexec experiment stranded at pcie not initializing correctly. Although a have a custom ‘hack’ / feature in mind of arm trusted firmware, to do something similar as kexec. But more of a proof of concept and for my own use and anyone interested

Best way, indeed wait for pcie uboot support.

In case, porting GitHub - open-power/petitboot would be very nice.

got info from john, bug seems fixed and he will cleanup the pcie patch and send it soon to upstream uboot

So I have the atf based ‘kexec’ functional. Can now boot with bootfiles on nvme, without using u-boot. But this is an experimental proof of concept.

Still easier to use u-boot with pcie support though…

Hi @ericwoud. I had a look at your guide and I’d like to try the “2. ATF - KERNEL using boot partition.” boot method. However I do have three questions before I start and mess up my system.

  1. All the code references in https://github.com/ericwoud/buildR64arch/blob/main/README.md#setup-booting-from-nvme-on-r3r3minir4-using-boot-partition-on-emmc refer to the r64. I have a bpi-r3, do I have to change anything, or the r64 and the r3 have the same codebase/configs?
  2. I would like to attempt this first on a sd-card. I feel like that is easier to swap-in/out while I test out things. Do you think your guide will work with that? (I plan to run the commands manually first to figure out what happens, and can swap emmc references with the sd-card).
  3. I am building my own kernel and would like to keep using that if possible. Do I need any specific config enabled in the kernel to support the ATF - KERNEL method or your method will work with any kernel itb image (assuming things are configured correctly)?

Hi Meehien,

I will answer your question here:

Would it be possible to write step by step instructions for us simple users? Please… I would like to try this. Thanks!

i’m about to add this patch and the config-options to my uboot-repo (2024-01-bpi) tree…already cleaned it in my r3mini test-branch.

edit: added…when pipeline finished you can update uboot (at least on my images) with the built one

@frank-w you might also add something along the lines of the patch attached in the uEnv_r3. u3dev.patch (1.5 KB)

Also, going a bit off-topic here, but I think the NOR memory would be perfect for this. I have been trying to follow your tutorial at en:bpi-r3:uboot [FW-WEB Wiki] but can’t seem to get a bootable NOR setup. Do you think I need to change anything from the linked tutorial, or it should work as is?

If i not miss anything it should work as such,make sure you use the bl2.img to have the bootrom header. What happens when you try to boot nor? Make sure all bootswitches are right.

And you have to erase the parts written later.

Why have you changed useinitrd in your patch? It then misses the “root=/dev/ram rw”

Why have you changed useinitrd in your patch? It then misses the “root=/dev/ram rw”

My initrd (Archlinux auto generated) was getting confused by that was halting the boot. Seemed easier to remove than figure out exactly what’s going on. This however was always the case for me and it’s not related to the NVME.

If i not miss anything it should work as such,make sure you use the bl2.img to have the bootrom header. What happens when you try to boot nor? Make sure all bootswitches are right.

Switches seem to be right. Triple checked. I am using your repo to generate the bl2 and fip. I suspect my atf build command might be invalid, see below, but I am not sure what I can use instead.

make -f ./Makefile PLAT="mt7986" BOOT_DEVICE="${device}" DRAM_USE_DDR4=1 DDR4_FREQ_3200=1 LOG_LEVEL=20 BL33="../u-boot/u-boot.bin" all fip

For ${device} I currently have sdmmc and emmc. Not sure what the correct device value is for NOR. I was assuming emmc.

i only use emmc defconfig for nor/nand and drop the ENV_IS_IN_MMC from it…

Do you use the useinitrd? It is supposed to be called manually for testing…else root is set to the mmc-partition,i’m not sure if the initrd is used if the root is set to mmc

Thanks, that helps. Hopefully I’ll track down whatever’s wrong.

Edited: Fixed. I was not using the compressed uboot for my bl33.

Do you use the useinitrd? It is supposed to be called manually for testing…else root is set to the mmc-partition,i’m not sure if the initrd is used if the root is set to mmc

Ah, that definitely explains the configs. I do actually use it as part of the normal boot. I find it useful for loading modules like rtc_ds1307, fonts, etc…