Installing Raspberry Pi OS on the Raspberry Compute Module 4

Introduction

This is a guide for installing Raspberry Pi OS Lite on the Compute Module 4. For my working computer, I use Ubuntu 20, installed on a virtual machine.

Sources

For these instructions, I have been strongly guided by the description by Jeff Geerling:
- Jeff Geerling: https://www.jeffgeerling.com/blog/2020/how-flash-raspberry-pi-os-compute-module-4-emmc-usbboot

Installing Raspberry Pi OS on the Compute Module 4

Requirements

I am using a Raspberry Compute Module 4 with 1 GB RAM and 8 GB eMMC storage. On top of that, I have a Raspberry Compute Module 4 IO Board on which the Compute Module is plugged in so as to make corresponding interfaces such as USB, Ethernet, etc., available.
To flash the software on the Compute Module, I use balenaEtcher, which you can download here:https://www.balena.io/etcher/.
As an operating system, I use "Raspberry Pi OS Lite" – which is based on Debian Buster – and which you can download here:https://www.raspberrypi.org/software/operating-systems/.

Preparing the eMMC storage for mounting

In order to be able to flash the Raspberry IO on the Compute Module, the storage must first be mounted – like an SSD card.
To do this, you have to fit a jumper at pins J2 on the Compute Module IO board. The text "Fit jumper to disable eMMC Boot" is printed on the IO board as a note.

Raspberry Compute Module 4 Jumper

Then connect the "USB slave" to the computer and supply the IO board with power using a power supply unit.

Raspberry Compute Module 4 USB Slave

Installing the software for the eMMC mount

On Linux, you need the library "libusb" and the program "usbboot" to do this.

Installing libusb

You can easily install libusb on Ubuntu using

sudo apt install libusb-1.0-0-dev

Installing usbboot

To install usbboot, you first have to clone the Git repository.

git clone --depth=1 https://github.com/raspberrypi/usbboot

Then switch to the usbboot directory and compile using "make usb boot".

cd usbboot
make

Now you can mount the eMMC storage using

sudo ./rpiboot

Flashing Raspberry Pi OS on the eMMC

Now you can call up "balenaEtcher", select the Raspberry Pi OS Image and "Compute Module/dev/sdb", and start the copying process using "Flash".
Once the copying process is complete, unmount the two partitions "boot" and "rootfs", unplug the IO board and disconnect it from the power supply, and then remove the jumper at J2 again.
Now you can connect the Raspberry Compute Module to your screen, network and keyboard via HDMI, Ethernet and USB and use it with them just like normal.

In the nextblog post, I explain how to install Qt 5.15 on the Compute Module 4 and cross-compile it with Ubuntu 20.