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

Dug into this a little more. I have tried a Mac (bigSur), a PC (Windows 10), and even a Raspberry Pi 4 and all have the exact same error. I've tried different USB cables, tried using usb3 and usb2 ports-- nothing seems to make a difference. Exact same error every time.

To note the official Raspberry Pi documentation notes an awareness of this bug:

"Note There is a bug in the BCM2835 (CM1) bootloader which returns a slightly incorrect USB packet to the host. Most USB hosts seem to ignore this benign bug and work fine; we do, however, see some USB ports that don't work due to this bug. We don't quite understand why some ports fail, as it doesn't seem to be correlated with whether they are USB2 or USB3 (we have seen both types working), but it's likely to be specific to the host controller and driver. This bug has been fixed in BCM2837."

However, it doesn't provide any solutions of how to approach it. I don't exactly have any BCM2837's lying around I can just solder to my CM4; XD.

I've sort of run out of ideas to try with this. Is there perhaps a way to just burn an SD card with my target image and then transfer that to the eMMC somehow?

Alright last post. I've figured it out but it was a little bit roundabout.

When I first tried to do this on my mac, I got the error above and an OS level warning saying the device I tried to attach isnt mountable. Great. I tried a few more times before moving on to my PC- where I saw the exact same error. However, I didn't bother to check if the device had actually mounted. If you carefully watch Jeff's video- he gets the exact same console error and it mounts fine.

I had the device plugged into and RP4 so I went over to check just now-- and sure enough, despite the error the device mounted fine.

TL;DR- Ignore this error regarding write length if you see it. Check if the device is actually mounted or not.

no matter how many times I unplugged / replugged, unplugged all the other devices in my Mac (and PC and Debian) system, the rpiboot would never recognize the CM4's on-board SSD.

I was using hobby cable jumpers; I switched to the standard PC board jumper plug.

I was using not-so-great microUSB cables, I switched to a high-quality one - eureka - it mounted

So if anyone is unsuccessful after following the above instructions, make sure you have a tight jumper and good quality microUSB cable.

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.

Hi Jeff,
I followed this blog carefully not to miss a step, however rpiboot cannot find my CM4/IO Board. The D1 LED lights up, there's a faint buzzing sound (high pitch, not sure whether its coming from the module or the IO board), but nothing else happens after that.
The company I bought the module and board from sold me a 5V power supply, for powering from the 12V jack. I have since been back and swapped it to a 12V power supply, but was told that 5V couldn't damage it as it simply wouldn't have enough energy to run.
What do you suggest I do in this case? I am thinking either the board or module is damaged, but I don't have any way of testing which one has the problem. Also, would plugging 5V into the 12V jack cause an issue? The company also referred me to the RPi forums once I said it wasn't working, and won't respond to my request to replace or have the module looked at. It's upsetting, because this is expensive gear so I can't just drop in and buy a replacement board and module to check each, but if I don't, they'll very soon run out of stock and I'll have to wait months to try again. I will try to boot from USB this morning, but beyond that I don't know what else I can try. Any help would be so very appreciated. Thanks

Are you sure you have the jumper placed in the right spot? And absolutely sure the Pi is an eMMC model, and you have a good USB A to micro-USB cable plugged into the USB Slave port on the IO Board?

I'd at least try swapping out your A-to-micro USB cable and see if that helps.

Yep, jumper is definitely correctly placed, and it is the 8GB eMMC 2GB RAM Wireless Board. Working from macOS same as you, but also tried my other raspberry pi, same issue. I've tried two different micro usb cables, but admittedly they've only been used for charging so I'm not sure how good they are for data transfer. I'll buy a new microUSB cable to try, but beyond that I don't have any variables left to try. I wonder if the eMMC chip is damaged/faulty?

I managed to boot the module from USB though.

Weird. I do have one eMMC CM4 (the original prototype I got for testing way back when) that doesn't boot off eMMC anymore—but it does at least work in usbboot mode for flashing or for reading/writing to it...

With the combined powers of our two boards, maybe we could come up with one working CM4 :)

If you use the IO board and a CM4 module with MMC storage how do you boot from an SD card containing the standard raspbian? Setting the jumper to disable eMMc seems to not enable the sd boot.

If you have an eMMC CM4, it can only ever boot off eMMC; the physical wires are unique to either the eMMC or Lite configuration microSD card. You can't use a microSD card on a Pi with eMMC.