I originally posted this on reddit after seeing a lot of posts trying to use a SATA M.2 SSD and saying it wouldn't boot with replies telling them to go buy a NVME M.2 SSD which isn't necessary when the board does support SATA M.2 with flashing the correct bootloader. This guide has 3 different sections, 1 being booting with Orange pi OS and 2 being with Armbian OS
Orange Pi OS Instructions
Download Orange Pi OS Ubuntu or Debian from their website http://www.orangepi.org/html/hardWare/computerAndMicrocontrollers/service-and-support/Orange-pi-5.html unzip the 7z file to get the .img file and flash it to your sd card with your preferred flasher i.e balenaetcher. Once flashed put it into orange pi 5 and boot from sd card first
once booted, the rest will be done in a terminal. go ahead and do your usual update
sudo apt update
sudo apt upgrade -y
3. then make sure to wipe your SPI of any previous bootloader (give it time to complete, you'll know it's done when you get your cursor back in terminal)
sudo dd if=/dev/zero of=/dev/mtdblock0 bs=1M count=1
4. Write sata bootloader to SPI
sudo dd if=/usr/share/orangepi5/rkspi_loader_sata.img of=/dev/mtdblock0 && sudo sync
5. Edit boot file on sd card to recognize sata by adding overlays line to the bottom, save then reboot
sudo nano /boot/orangepiEnv.txt
overlays=ssd-sata
sudo reboot
6. On reboot you will still boot into SD card but now you should see "sda" (your sata SSD) show up on your list of devices when typing:
lsblk
7. Put the same Orange Pi OS image you used in step 1 in any directory on your orange pi making sure it is unzipped and is in .img format. I just used the web browser in orange pi os to redownload from the website which for me put it in directory /home/orangepi/Downloads
8. Flash your downloaded .img to your sata ssd with this command (substitute with your directory to .img)
sudo dd bs=1M if=/path/your/orangepi.img of=/dev/sda status=progress && sudo sync
9. Mount your ssd so you can edit the ssd’s boot file to support sata and reboot
sudo mount /dev/sda1 /mnt/
sudo nano /mnt/boot/orangepiEnv.txt
overlays=ssd-sata
sudo umount /mnt/ && sudo sync
sudo poweroff
10. Remove SDcard, turn on orange pi and it should boot orange pi OS from your M.2 sata ssd now
Armbian OS Instructions
Relatively same instructions with different file names
write armbian .img file to your sd card with balenaetcher, I chose to use the more up to date imags from their github here https://github.com/armbian/build/releases/ make sure to unzip
boot armbian from sd card, wipe spi
sudo dd if=/dev/zero of=/dev/mtdblock0 bs=1M count=1
3 Download sata spi bootloader from orange github, place it on your sd card (mine is in downloads directory) and write to spi
https://github.com/orangepi-xunlong/orangepi-build/blob/next/external/packages/bsp/rk3588/usr/share/orangepi5/rkspi_loader_sata.img
sudo dd if=/home/pi/Downloads/rkspi_loader_sata.img of=/dev/mtdblock0 status=progress && sudo sync
4. Edit boot file to recognize sata then reboot
sudo nano /boot/armbianEnv.txt
overlays=opi5-sata
sudo reboot
5. Once rebooted you can check sda shows up with command:
lsblk
6. download the same armbian.img you used for step 1 to your orange pi making sure it's unzipped in .img format, then flash it to your ssd
sudo dd bs=1M if=/path/your/armbian.img of=/dev/sda status=progress && sudo sync
7. Mount /boot/ of ssd so you can edit the ssd’s boot file to support sata and reboot
sudo mount /dev/sda1 /mnt/
sudo nano /mnt/boot/armbianEnv.txt
overlays=opi5-sata
sudo umount /mnt/ && sudo sync
sudo poweroff
8. Remove SDcard and start SBC, resize filesystem to use all available space
sudo systemctl enable armbian-resize-filesystem