This setup works fine on the official Orange PI Debian distribution as it uses only the SATA drive to boot, and nothing else. However, it does not work on Armbian. I am aware that the paths and files are different in Armbian, and I have tried various methods, but no one has confirmed that it works.
My question is, how can I activate SATA on DietPI? I need to know because I am running only one instance of this board, and it serves a rather extensive home automation installation. I would like to migrate from Orange PI Debian to DietPI, and I need instructions on how to replicate the same functionality (SATA SSD) on this operating system.
Seems so. I was not aware that it supports SATA on the M.2 port even hardware-wise. @Joulinar did you not buy an NVMe because we thought SATA can simply not work?
Actually we might be able to add some check to boot.scr to pick the SATA overlay automatically. @Joulinar when you find time, could you paste the env print again from serial console, e.g. when breaking boot by renaming the kernel image or so. There should be some variable indicating whether it is NVMe or SATA when the boot.scr runs from thia drive already.
The bootloader itself must support SATA, and it seems the one from Armbian we use does not, while the one from Orange Pi does. Since also Armbian’s “legacy” bootloader package is based on vendor sources, I see no issue to instead use the one from Orange Pi. We could create a package from it to make it transparent: https://github.com/orangepi-xunlong/orangepi-build/tree/next/external/packages/bsp/rk3588/usr/share/orangepi5
What needs to be tested is whether it does not break NMVe or USB boot. I can test USB, would be great if someone could test NVMe.
The second thing is adding the SATA device tree overlay, so that also the kernel/OS can detect and mount the rootfs on the SATA SSD. I am pretty sure that it disables NVMe support in the same turn, so we cannot enable it OOTB. But as said, since we use a boot script instead of limited extlinux or similar, we should be able to auto-detect the boot media and select the overlay automatically on demand. For this, I need help form someone with an NVMe and/or SATA SSD to past the output of env print from U-Boot console here, so I can check which variable to check for.
And some simplified instructions to enable SATA boot, which do not require flashing the Orange Pi image or Armbian:
Flash a DietPi image to SD card, eMMC or USB to boot from. Do just a speedy first run setup, or hit CRTL+C at some point to abort and get to a shell prompt quickly.
Download and flash the Orange Pi SPI bootloader:
cd /tmp
curl -fO 'https://raw.githubusercontent.com/orangepi-xunlong/orangepi-build/next/external/packages/bsp/rk3588/usr/share/orangepi5/rkspi_loader_sata.img'
dd if=rkspi_loader_sata.img of=/dev/mtdblock0 conv=notrunc,fdatasync
Flash DietPi image to SATA (attach it if not done yet). PLEASE verify that /dev/sda really is the SATA SSD and not e.g. the USB drive you are booting from . Check e.g. via lsblk.
mkdir sata
mount /dev/sda1 sata
G_CONFIG_INJECT 'overlay_prefix=' 'overlay_prefix=orangepi-5' sata/boot/dietpiEnv.txt
G_CONFIG_INJECT 'overlays=' 'overlays=sata' sata/boot/dietpiEnv.txt
poweroff, detach the SD card/eMMC module/USB drive you booted from to boot from the attached SATA SSD.