Orange Pi 5 - Boot from NVME

Thanks. I just tested again. Indeed dietpi-config update and write_uboot_platform_mtd do the same thing. Some observations below:

  1. Reboot in fact does not boot back from NVMe.
  2. A power cycle did not work initially. I took three tentatives to achieve a successful boot from NVMe.
  3. In a second test, it took 5 power cycles for the NVMe boot to work.

if possible, flash the Orange Pi Debian image on a spare SD card and update firmware + SPI using Orange Pi config tool. This way you should get regular reboot functionality back.

1 Like

Coincidently I had just done this before reading your post! (but used Orange Pi Ubuntu Jammy Server image instead of Debian).

After manually erasing SPI and flashing it via orangepi-config from Orange Pi Ubuntu Server image, now dietpi is booting normally from NVMe (also reboot is working now).

Thanks!

ok probably the U-Boot from Armbian we use is not working well. We need to have a look.

1 Like

Armbian uses the Radxa U-Boot sources for all RK3588 SBCs, which may be the problem: build/rockchip-rk3588.conf at 40fa40ebaaa9d450033e6a1c7394028448dae2ee Ā· armbian/build Ā· GitHub
Orange Pi have their own sources which are also used by their own build scripts (which are an Armbian fork): GitHub - orangepi-xunlong/u-boot-orangepi

Since Iā€™m not keen to compile it myself yet, checking for compiled binaries. But their website is currently down. Uff, and why is it all plain HTTP (no encryption, no authentication) :thinking:.

Just as reference, this is the original OrangePi 5 /usr/lib/u-boot/platform_install.sh file from the Ubuntu Jammy Server image:

/usr/lib/u-boot/platform_install.sh
DIR=/usr/lib/linux-u-boot-legacy-orangepi5_1.1.4_arm64
write_uboot_platform ()
{
    if [[ -f $1/rksd_loader.img ]]; then
        dd if=$1/rksd_loader.img of=$2 seek=64 conv=notrunc status=none > /dev/null 2>&1;
    else
        if [[ -f $1/u-boot.itb ]]; then
            dd if=$1/idbloader.img of=$2 seek=64 conv=notrunc status=none > /dev/null 2>&1;
            dd if=$1/u-boot.itb of=$2 seek=16384 conv=notrunc status=none > /dev/null 2>&1;
        else
            if [[ -f $1/uboot.img ]]; then
                dd if=$1/idbloader.bin of=$2 seek=64 conv=notrunc status=none > /dev/null 2>&1;
                dd if=$1/uboot.img of=$2 seek=16384 conv=notrunc status=none > /dev/null 2>&1;
                dd if=$1/trust.bin of=$2 seek=24576 conv=notrunc status=none > /dev/null 2>&1;
            else
                echo "[write_uboot_platform]: Unsupported u-boot processing configuration!";
                exit 1;
            fi;
        fi;
    fi
}
write_uboot_platform_mtd ()
{
    if [[ -f $1/rkspi_loader.img ]]; then
        dd if=$1/rkspi_loader.img of=$2 conv=notrunc status=none > /dev/null 2>&1;
    else
        echo "SPI u-boot image not found!";
        exit 1;
    fi
}
setup_write_uboot_platform ()
{
    if grep -q "ubootpart" /proc/cmdline; then
        local tmp=$(cat /proc/cmdline);
        tmp="${tmp##*ubootpart=}";
        tmp="${tmp%% *}";
        [[ -n $tmp ]] && local part=$(findfs PARTUUID=$tmp 2>/dev/null);
        [[ -n $part ]] && local dev=$(lsblk -n -o PKNAME $part 2>/dev/null);
        [[ -n $dev ]] && DEVICE="/dev/$dev";
    fi
}

The contents of the /usr/lib/linux-u-boot-legacy-orangepi5_1.1.4_arm64 is as follows:

linux-u-boot-legacy-orangepi5_1.1.4_arm64
root@orangepi5:/# uname -a
Linux orangepi5 5.10.110-rockchip-rk3588 #1.1.4 SMP Wed Mar 8 14:50:47 CST 2023 aarch64 aarch64 aarch64 GNU/Linux
root@orangepi5:/# cd /usr/lib/linux-u-boot-legacy-orangepi5_1.1.4_arm64
root@orangepi5:/usr/lib/linux-u-boot-legacy-orangepi5_1.1.4_arm64# ls -l
total 18248
-rw-rw-r-- 1 root root   292864 Mar  8 14:49 idbloader.img
-rw-rw-r-- 1 root root 16777216 Mar  8 14:49 rkspi_loader.img
-rw-rw-r-- 1 root root  1613312 Mar  8 14:49 u-boot.itb
root@orangepi5:/usr/lib/linux-u-boot-legacy-orangepi5_1.1.4_arm64# shasum *
3226e017ff58278dcae1d25dff115c24dde83ddf  idbloader.img
ab0546224890f4b2e858941e263bd134298578de  rkspi_loader.img
6af24326f11c194edceef24ec760af3a03a8114c  u-boot.itb
root@orangepi5:/usr/lib/linux-u-boot-legacy-orangepi5_1.1.4_arm64#

Iā€™ve create a tar.gz file with the above images and it is avaiable for download at:

linux-u-boot-legacy-orangepi5_1.1.4_arm64.tar u-boot images (password ā€œopi5ubootā€)

1 Like

Howdy folks! It seems that this issue has not been resolved. :frowning:

I recently installed DietPi on a fresh pair of Orange Pi 5Bs and they take up to 5 power cycles to boot from NMVE. :sob:.

Is the only current solution to follow @Joulinar 's instructions above? (Orange Pi 5 - Boot from NVME - #22 by Joulinar)

Thank you all for investing your time in this great operating system. <3

You could try booting from the SD card to get your system up and running. Once the system is online, there should be an option to flash SPI/Bootloader in the configuration menu. Does anything change after that? If not, you will have to use the workaround via OrangePi Debian.

For me the most simple solution to get my orange pi boot from nvme :
flash the micro sd card with armbian
flash the nvme with armbian

sudo armbian config
system and security settings
install/update the boot loader on mtd flashen

after that you can flash you nvme with any os and boot from it

Just out of interest, what is the reason for flashing Armbian on the NVMe? For me, it was enough to flash the SD card with OrangePi Debian and update the bootloader.

1 Like

i tried different os for the bootloader update, and it seemed they have different effect on system security settings.

My experience is the same as @Joulinar mentioned above.

I booted OrangePi Debian via SD card and updated the SPI bootloader (donā€™t recall the command Iā€™ve used).

After this, I installed DietPi on NVMe and it is booting fine (without SSD). It works every rebootā€¦

I believe the issue is the SPI bootloader image included in DietPi - you should not use DietPi to flash the SPI.

We donā€™t have/create own bootloader. Iā€™m not 100% sure which one we use, but for sure @MichaIng know

Very strange that flashing the SPI from Armbian works and in our case not, as we do exactly the same in dietpi-config :thinking:. The only reason I can think of is that Armbianā€™s APT repository is currently stuck since February for some reasons, while their images are shipped with more recent kernel and bootloader builds/packages. So probably the newer SPI U-Boot build works.

Iā€™ll extract a DEB file from the current Armbian Orange Pi 5 image for testing.

1 Like

Orange Pi 5 systems will get a kernel and U-Boot update with next DietPi update, which should also enable NVMe support, after flashing the new bootloader binary to SPI via dietpi-config > Advanced Settings > Update SPI bootloader: Orange Pi 5/ROCK 5B | Kernel update and migration by MichaIng Ā· Pull Request #6532 Ā· MichaIng/DietPi Ā· GitHub

USB boot works fine afterwards, would be great if some could test it with NVMe. We should then add an entry in our documentation about this and a link from the download page.

New images with this kernel to test are available here: Index of /downloads/images/testing

Another bonus is that this kernel should fully support the Orange Pi 5B as well, i.e. its onboard WiFi.

2 Likes