raspberrypi / firmware

This repository contains pre-compiled binaries of the current Raspberry Pi kernel and modules, userspace libraries, and bootloader/GPU firmware.
5.19k stars 1.68k forks source link

Can't boot Raspberry Pi Compute Module 4 from SATA #1653

Open geerlingguy opened 3 years ago

geerlingguy commented 3 years ago

Is this the right place for my bug report?

Yes

Describe the bug

When I attempt to boot my Raspberry Pi Compute Module 4 from a SATA hard drive (SSD or HDD), it does not boot.

To reproduce

  1. Plug a compatible SATA controller card into the Compute Module 4 IO board.
  2. Flash Pi OS onto a SATA SSD or HDD.
  3. Plug that drive into the SATA controller.
  4. Attempt to boot the Pi.

Expected behaviour

The Pi's firmware is able to detect a valid image on any of the attached SATA devices and boot from it.

Actual behaviour

The Pi loops through looking for emmc/usb/nvme boot devices.

System

Compute Module 4

Generated using pi-gen, https://github.com/RPi-Distro/pi-gen, 071d3956353f2be964d2d337d3b123f1872b7f53, stage2
Oct 29 2021 10:47:33 
Copyright (c) 2012 Broadcom
version b8a114e5a9877e91ca8f26d1a5ce904b2ad3cf13 (clean) (release) (start)
Linux taco 5.10.63-v8+ #1459 SMP PREEMPT Wed Oct 6 16:42:49 BST 2021 aarch64 GNU/Linux

Logs

N/A

Additional context

Some people have been asking my why SATA boot isn't working, and I wanted to be able to point them to a more definitive 'status' of the feature, so I'm posting this issue—if it's not something that will likely be implemented soon, that's fine, I just wanted to make a more official feature request/report than random musings on the forums.

pelwell commented 3 years ago

From what I remember, SATA's a nightmare compared to NVME. In an EEPROM which is already a bit short on space I really can't see this happening.

6by9 commented 3 years ago

Which SATA card(s) would you support?

Yes the AHCI interface covers lots, but then what about the RAID controllers from various vendors, or the other random vendors that have their own interfaces? Where do you stop? IIRC There isn't support for NVMe behind a PCIe switch either, as enumeration there becomes more entertaining, and everything balloons in scale and complexity.

So as pelwell says, I can't see it happening.

geerlingguy commented 3 years ago

It can't hurt to ask ;)

I do think there's a bright future, though, for a Pi + SATA SSD since the footprint is similar and you could fit it in what I'd call a "Mini SFF" size box, barely larger than the SSD itself. And SATA is a better fit for the Pi's PCIe 2 lane than NVMe drives, since less of the performance is wasted.

I totally understand the space constraints, though. Would be a fun and interesting thing to think about when it comes time for a new EEPROM with more space!

jlinton commented 2 years ago

You can turn on the Ahci driver (or the x86 PCIe option ROM emulator) in edk2/pftf, and try that. It should work with DT, and if you apply the linux/ACPI/PCIe patches will work in ACPI mode.

rcfa commented 2 years ago

You can turn on the Ahci driver (or the x86 PCIe option ROM emulator) in edk2/pftf, and try that. It should work with DT, and if you apply the linux/ACPI/PCIe patches will work in ACPI mode.

Sorry, that’s a bit too terse for me to grok. Could you please be a bit more specific as to what steps to follow to try this? Also, what do you expect to work or not work? Boot off SATA, or have rootfs on SATA, but /boot on eMMC/SD card?

RassK commented 1 month ago

@geerlingguy

Do you know if there have been any updates?

I don't have much knowledge about Linux booting but I just discovered that If you flash Ubuntu Server to eMMC and SATA SSD, then without any boot changes it prefers to boot from SSD. I have SATA SSD (ADATA SU650) in TuringPi 2 SATA port and CM4 in slot 3. Seems like similar thing with RK1 and NVME, where you need minimal boot img on eMMC.

timg236 commented 1 month ago

There are no plans to support SATA boot on CM4 (or CM5) since it would an unnecessary size and complexity. For high capacity / high performance storage we recommend NVMe. For alternate root file-systems we recommend eMMC boot and letting the Linux kernel handle this via an initramfs since this can handle more exotic storage e.g. RAID

RassK commented 1 month ago

@timg236 Sorry for my lack of knowledge about the issue. Very new world for me. How does my example work then? Is it not recommended way to go forward?

I just see that Turing RK1 is using similar pattern. Bootloader in eMMC and everything else in external drive. Unfortunately TuringPi2 does not support NVME for CM4, so I had to use SATA (unless it's an old issue now?).

ubuntu@cm4-ubuntu-server-3:~$ lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0  33.7M  1 loop /snap/snapd/21761
sda            8:0    0 238.5G  0 disk
├─sda1         8:1    0   512M  0 part /boot/firmware
└─sda2         8:2    0   238G  0 part /
mmcblk0      179:0    0  29.1G  0 disk
├─mmcblk0p1  179:1    0   512M  0 part
└─mmcblk0p2  179:2    0  28.6G  0 part
mmcblk0boot0 179:32   0     4M  1 disk
mmcblk0boot1 179:64   0     4M  1 disk
timg236 commented 1 month ago

When you say SATA, how is it physically connected to the CM4? e.g. via a USB/SATA adapter or PCIe ?

RassK commented 1 month ago

Directly to the Turing Pi 2 board, which work only with node 3.

timg236 commented 1 month ago

There is no direct support for SATA so you would need to boot from EMMC / NVMe instead