[BPI-R4] How to use frank-w u-boot to boot from Nvme on BPI-R4?

I boot from SD, It’s boot ok, and I see

image

But When I use boot from Nvme, kernel name key in “bpi-r4.itb”, I can’t boot and display “Can’t set block device”

How to boot from Nvme? What files or images need put Nvme partition 1?

I success to boot from Nvme.

The installation steps as follows:

  1. Flush frank-w u-boot to NAND or SD.
    After flush, we can see this screen: image

  2. Use normal frank-w BPI-R4 Debian boot

  3. Fdisk Nvme For Nvme boot requirements,
    First Partition must FAT32
    Second Partition must ext4

    Use fdisk maybe better.
    image

  4. Put frank-w BPI-R4 Debian to Nvme
    BPI-BOOT/ => nvme0n1p1/
    Debian rootfs => nvme0n1p2/

image

  1. umount & reboot to u-boot menu image

  2. Boot from Nvme image

kernel name: bpi-r4.itb

That’s finish, we use Nvme to boot.

How to debug u-boot boot?

u-boot menu and boot scripts are defined in printenv.

  1. Boot to u-boot menu and Select Exit to u-boot cmd image

  2. printenv

  3. Nvme boot script
    run askbootnvme
    askbootnvme=run usenvme; if test “$device” = “nvme”; then run askkernel;if printenv kernelinput; then setenv fit $kernelinput;run newboot;fi;fi
    run usenvme
    run askkernel
    setenv fit $kernelinput (here is bpi-r4.itb)
    run newboot
    newboot=run checkrd; run setbootconf; run buildargs;if printenv fit;then setenv kernel ${fit};if run loadkernel; then bootm ${kaddr}${bootconf}; fi;fi;
    loadkernel=fatload $device $partition $kaddr ${kernel}

Error message “Can’t set block device” occurred at stage “loadkernel”.
fatload $device $partition $kaddr ${kernel}

So, we fdisk Nvme first partition as FAT32 and boot ok.

You can overwrite the defaults when booting from mmc using a uEnv.txt.

Or change builtin env when compile your own

See ci pipeline for compile steps

Of course you can patch out the askkernel to boot fixed file automaticly.

Thanks.

I will try it.