I have an Orange PI 5 board with a SATA SSD installed (two gaps, not NVMe).
Instructions on how to activate SATA are available in the official manual, which can be found at http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-pi-5.html
A simplified version of the instructions is as follows:
Write the image to SPI flash:
dd if=/usr/share/orangepi5/rkspi_loader_sata.img of=/dev/mtdblock0
Activate the SATA overlay in orangepiEnv.txt:
Copy the system from the SD card to the SSD.
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.
hmm we use the Armbian image as well if I’m not mistaken. If it is not working there, it might not be working on DietPi as well.
Some guide even for armbian (maybe it will work on dietpi?) Reddit - Dive into anything
EDIT: On dietpi image (bookworm) for Orange PI 5, there is overlay named “orangepi-5-sata.dtbo”. Could it be that?
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.
Another report via Twitter (ah “X”, after this maniac renamed the established brand): https://twitter.com/Open_Media/status/1706117397114134926
Actually there is two dedicated issues:
- 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:
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
- Download and decompress a fresh DietPi image:
curl -fO 'https://dietpi.com/downloads/images/DietPi_OrangePi5-ARMv8-Bookworm.img.xz'
# Optional: Check integrity
sha256sum -c <(curl -sSf 'https://dietpi.com/downloads/images/DietPi_OrangePi5-ARMv8-Bookworm.img.xz.sha256')
# Optional: Check authenticity
curl -sSf 'https://github.com/MichaIng.gpg' | gpg --import
gpg --verify <(curl -sSf 'https://dietpi.com/downloads/images/DietPi_OrangePi5-ARMv8-Bookworm.img.xz.asc') DietPi_OrangePi5-ARMv8-Bookworm.img.xz
apt install xz-utils
xz -d DietPi_OrangePi5-ARMv8-Bookworm.img.xz
- 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
dd if=DietPi_OrangePi5-ARMv8-Bookworm.img of=/dev/sda conv=notrunc
- Mount it and apply the SATA overlay:
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.