Booting a Raspberry Pi OS on a CM4 from a SATA controller


  1. Image CM4 onboard eMMC or attached SD card AND SATA drive with Raspberry Pi OS using Raspberry Pi Imager, use the same options in Imager for both.
  2. To image CM4 eMMC - connect CM4 to PC and run rpi-mass-storage-gadget.bat from raspberrypi/usbboot
  3. Boot CM4 as normal from eMMC / SD card
  4. apt update && apt full-upgrade
  5. Reboot
  6. Add “ahci” to end of /etc/initramfs-tools/modules
  7. sudo update-initramfs -c -k uname -r
  8. No need to add an “initramfs” line to /boot/config.txt because auto_initramfs=yes should find the new image
  9. Update /boot/cmdline.txt with the contents of the /boot/cmdline.txt from the SATA drive, and update the ROOT= to be the new root file system (probably /dev/sda2)
  10. Also update /etc/fstab on the SATA drive root partition (probably /dev/sda2) to have the root partition pointing to the SATA drive root partition and also the /boot/firmware partition pointing to the eMMC or SD card partition (probably /dev/mmcblk0p1)
  11. Copy /boot/firstrun.sh from SATA drive or SD Card (probably /dev/sda2) to /boot/firmware/firstrun.sh (probably /dev/mmcb0p1)
  12. Reboot - should now be using /dev/sda2 as root drive
  13. Repeat lines 4 to 7 using new root device to ensure that initramfs is up-to-date in /boot and /boot/firmware