How to flash Raspberry Pi OS onto the Compute Module 4 eMMC with usbboot

The Raspberry Pi Compute Module 4 comes in two main flavors: one with built-in eMMC storage, and one without it. If you opt for a Compute Module 4 with built-in eMMC storage, and you want to write a new OS image to the Compute Module, or manually edit files on the boot volume, you can do that just the same as you would a microSD card—but you need to first make the eMMC storage mountable on another computer.

This blog post shows how to mount the eMMC storage on another computer (in my case a Mac, but the process is very similar on Linux), and then how to flash a new OS image to it.

Video Instructions

In addition to the tutorial below, I published a video version of this post covering installation and usage of rpiboot for flashing the eMMC on Windows, Ubuntu, Raspberry Pi OS, or macOS:

Preparing the IO Board for mounting

Before you can set the eMMC storage into 'USB mass storage' mode, you have to put a jumper over the first set of pins on the 'J2' jumper—the jumper labeled "Fit jumper to disable eMMC boot":

J2 jumper for fit to disable eMMC Boot Raspberry Pi Compute Module 4 IO Board

Don't have a jumper? I bought a huge pack of jumpers years ago, and grabbed one from that bag. You could also pop any kind of conductor between the two pins, like a female-to-female jumper.

Then, plug a USB cable from your computer (in my case, my Mac—but it could be a Windows or Linux computer too) into the 'USB Slave' micro USB port on the IO Board, and plug in power:

Plug in USB Slave and power on Raspberry Pi Compute Module 4 IO Board for eMMC flashing

The board will power on, and you'll see the red 'D1' LED turn on, but the Compute Module won't boot. The eMMC module should now be ready for the next step.

Using usbboot to mount the eMMC storage

The next step is to download the Raspberry Pi usbboot repository, install a required USB library on your computer, and build the rpiboot executable, which you'll use to mount the storage on your computer. I did all of this in the Terminal application on my Mac.

First, make sure you have the libusb library installed:

  • On my Mac, I have Homebrew installed, so I ran: brew install libusb
  • On Linux (e.g. another Raspberry Pi), run: sudo apt install libusb-1.0-0-dev

Second, clone the usbboot repository to your computer:

$ git clone --depth=1

Third, cd into the usbboot directory and build rpiboot:

$ cd usbboot
$ make

Now there should be an rpiboot executable in the directory. To mount the eMMC storage, run:

$ sudo ./rpiboot

And a few seconds later, after it finishes doing its work, you should see the boot volume mounted on your Mac (or on whatever Linux computer you're using). You might also notice the D2 LED lighting up; that means there is disk read/write activity on the eMMC.

Flashing Raspberry Pi OS onto the eMMC

At this point, the eMMC storage behaves just like a microSD card or USB drive that you plugged into your computer. Use an application like the Raspberry Pi Imager to flash Raspberry Pi OS (or any OS of your choosing) to the eMMC:

Raspberry Pi Imager choose eMMC storage to flash

Raspberry Pi Imager writing disk image to Raspberry Pi Compute Module 4 eMMC

At this point, if you don't need to make any modifications to the contents of the boot volume, you could disconnect the IO board (eject the boot volume if it's still mounted!) USB slave port connection, disconnect power, then remove the eMMC Boot disable jumper on J2.

Then plug power back in, and the CM4 should now boot off it's (freshly-flashed) eMMC storage!

If you ever need to mount the boot volume or re-flash the eMMC storage, just run sudo ./rpiboot again.


Nice post Jeff! One question: is it safe to provide 5V power to the module for this flashing task and for normal use through the floppy connector? Are there all the needed circuit protections like when powering the 12V barrel? (I understand that PCIe and fan will not be active when providing 5V only).

Yes, you can provide power through the fan connector or the barrel connector, and everything seems to function the same either way (in my limited testing, at least).

Interesting bootstrap thanks.

Can you USB boot a compute module ?

Hi Jeff, is there a way to flash the eMMC onto the Computer Module in parallel to reduce the unit cycle time? Thanks.

Thanks, nice tutorial and well explained!

Have you tried to install Fedora or Ubuntu onto the eMMC storage? I assume the process would be the same, correct?

Hi peeps. Can anyone sat what this is? It's happening when I run sudo ./rpiboot. Tried a few restarts and such.
$ sudo ./rpiboot
Waiting for BCM2835/6/7/2711...
Loading embedded: bootcode4.bin
Sending bootcode.bin
Successful read 4 bytes
Waiting for BCM2835/6/7/2711...
Loading embedded: bootcode4.bin
Sending bootcode.bin
Failed control transfer (-1,24)
Failed to write correct length, returned -1
Waiting for BCM2835/6/7/2711...
Loading embedded: bootcode4.bin
Second stage boot server
Loading embedded: start4.elf
File read: start4.elf
Second stage boot server done

OK, mea culpa. If you see this error, it may well mean you ordered the only module that was still available at the time which was the Lite version. Without EMMC. And then forgot. My thanks to Mr Geerling for comparing two boards - with and without - on the video, which illuminated my problem.

I hope this helps someone else

Hi Jeff.

I added this query to your Youtube site so apologies for the overkill.

I'm stuck. I was able to flash the Raspberry Emmc on Pi Compute Module 4 but its not detecting a keyboard. I am aware that you must add a line to the config.txt file to power the USB hub. This is where I become stuck. On rpiboot I can see a config.txt file which I have edited and included the txt to enable power to the USB hub. However, I think that it might be the wrong config.txt file as it's not working. I think I need to access the config.txt file in the boot folder but I am unable to access or view same from within windows 10.

I've loaded other Raspberry OS systems and the keyboard lights up but an error is showing on the screen that it doesn't detect the keyboard.

Thanks in advance.