Bewertung: 5 / 5

Stern aktivStern aktivStern aktivStern aktivStern aktiv
 

I recently got a compute module 4 (CM4) donated for raspiBackup to add support for NVMe (See here for details). I'm used to use a Raspberry but never used a CM4 before so I had to ramp up on CM4 first. The following page describes how I managed to get a RaspbianOS (Buster) up and running on the CM4 and to boot from NVMe. My CM4 specs: 1GB main memory, 32GB eMMC and 128GB NVMe and no WiFi.

CM4

 

 

Docs about compute model 4 I read first

 

First of all I read the CM4 manual to get an idea about the HW. Next I read Raspberry Pi HW Doc and was used as a reference doc in further steps.

 

How I primed the compute model 4 with RaspbianOS on eMMC

 

Then I found Full Compute Module 4 (Raspberry Pi) Setup / Imaging Guide from James Chambers from 8/2/2021. I executed all the steps described there. I used the RaspberryOS lite version because I just need to run the CM4 headless and thus had to create file ssh in /boot. WiFi config was not required. i also used the default /boot/config.txt  with no

dtoverlay=dwc2,dr_mode=host

Finally I was able to boot my CM4 from eMMc.

 

How I primed the compute model 4 with RaspbianOS on NVMe

 

Now I had to prime the NVMe device. There are multiple pathes you can go in order to get an OS on the NVMe:

1) Boot your CM4 from eMMC, download an RaspberryOS Image and copy the image on the NVMe with dd.

2) Boot your CM4 in mass mode and mount the discovered NVMe on a Linux box, download an RaspberryOS Image and copy the image on the NVMe with dd.

 

I went the second path:

in the usbboot directory of the downloaded github repo I executed on my Linux box with CM4 USB boot mode on and the CM4 connected via a USB data cable

cd mass-storage-gadget
sudo ../rpiboot -d .

Then I was able to see bot eMMC storage and NVMe storage on my Linux box. Finally I copied the RaspbianOS with dd on the NVMe. When I then booted the CM4 still the eMMC was used. Root cause is the default BOOT_ORDER which is 0xf25641. The boot sequence is defined from right to left so SD card is tried first (#1). Because I have an eMMC and thus the SD card is a dummy the system boots from eMMC. Next (#4) USB mass storage is used (e.g. USB attached disk) and next (#6) NVMe boot is used. When the boot sequence is changed to 0xf25416 with NVMe first it will boot from NVMe.

Note: If you use the bootcode from msd subdirectory you will not be able to access NVMe but eMMC only.

 

How I changed the boot sequence to boot from NVMe

 

Go into the usbboot directory and edit recovery/boot.conf. Change the BOOT_ORDER line and move #6 to the right. Next execute ./recovery/update-pieeprom.sh which will create a new pieeprom.bin. Finally connect the CM4 in USB boot mode to your Linux box and execute ./rpiboot -d recovery. This will update the boot sequence in EEPROM. Now turn off USB boot mode and your CM4 will boot from NVMe. If you want to boot from eMMC either change teh BOOT_ORDER agein or just unplug the NVMe.

 

if for some reasons CM4 doesn't boot from NVMe double check the current BOOT_ORDER is correct with rpi-eeprom-config.

Kommentar schreiben

*** Hinweis ***

Kommentare sind erwünscht. Aber um lästige Spamposts abweisen zu können gibt es ein paar Dinge die zu beachten sind:
  1. Kommentare mit dem Text http werden sofort zurückgewiesen mit der Meldung Sie sind nicht berechtigt den Tag zu verwenden. zz
  2. Kommentare werden manuell überprüft und es dauert deshalb in der Regel einen Tag bis sie veröffentlicht werden.