Flashing the Raspberry Pi Compute Module eMMC under Mac OS

Update on 13th November, 2014:

I tested it on my iMac (2009 early version) with Mac OS X Mavericks (10.9). According to some readers’ feedback, it may not work on some new Mac machines. I will investigate it and update accordingly.


The Raspberry Pi Compute Module has been released for a few months. Although the stand-alone compute module is not available yet, a lot of people have purchased the development kit, which includes a Raspberry Pi compute module. Different than other Raspberry Pi boards, the compute module has built-in 4GB eMMC, so you can directly install the OS on it. Yes, no more SD or TF card, yeah :-)

If you have the development kit for Raspberry Pi compute module, you can follow this document on the Raspberry Pi foundation website to flash the eMMC on your compute module. However that document assumes you have another Linux machine (e.g. another Raspberry Pi) running as a host to write the raw OS image into the eMMC, what if you don’t have one? Well, if you have a machine that has Mac OS installed, you can still make it, and this tutorial is going to show you how.

First off, you need the development kit for Raspberry Pi compute module, otherwise you don’t need to read on :-)

RPiCMDevKit

Mac OS is based on UNIX, so it is similar with Linux in some ways. You may already know that, the “dd” command is also available in Mac OS, so the solution is almost there! But wait, by lacking the “usbbootcode.bin” and “msd.bin” files in the eMMC, BCM2835 (the heart of Raspberry Pi) can not boot from USB, and your RPi CM will not be detected as a USB storage device, hence you don’t have the chance to “dd” it (yet).

The picture below shows that Mac OS knows there is a USB device, but could not initialize it as a USB storage device. Want to know why it is named BCM2708 instead of BCM2835? You can read this.

BCM2708

 

So the first task is to compile and run the “usbboot” tool on your Mac OS, which can detect your CM and write in those boot code files, so you can later treat it as a USB storage device.

You need to clone the project from github:

If you try to compile it directly:

It will fail because of the lack of the “libusb” library. In Mac OS you don’t have the “apt-get” command, so you need to install the library in a different way. You can download the latest source code of this library here, and then extract the *.tar.bz2 file to a directory. In the Terminal window, enter that directory and run “./configure” to configure the package for your system:

Then compile the package by typing “make”:

And then install it:

After that you can continue compiling the “usbboot” tool:

This time you should not see any error and you will see the “rpiboot” file is generated.

Now run the rpiboot tool, you may be asked to input your administrator password:

If you have correctly set J4 jumper on I/O board to “enable”, connect the slave port on I/O board to your machine, and power your I/O board, the rpiboot tool should detect your CM and write the required boot code files into it:

If rpiboot still doesn’t recognize your BCM2835, the first thing to check is the USB port you connect your I/O board to. Booting from USB will need to draw certain current from your host USB port, so if the USB port could not provide that current, the booting will fail and thus rpiboot tool could not see your RPi CM. On my iMac, I noticed that connecting the I/O board to the USB port on Apple keyboard doesn’t work, while connecting to any USB port on the rear of iMac can work.

boot_bcm2835

If everything goes right, you will soon see a new device appear in your Finder, and you can treat it like a normal USB storage device. Because the eMMC has the boot code files now, you don’t need the help from rpiboot tool any more. Next time when you connect your I/O board to your PC, it can be directly recognized as a USB storage device.

If you check the system report again, you will see that Mac OS correctly recognize Raspberry Pi Compute Module now:

RPi_CM_Found

Although the rpiboot tool suggest to use “lsblk” command to find the new disk, it does not exist in Mac OS, however you can use “diskutil” to check the new device:

You should be able to see a device like this:

Now you know the new disk’s name, so you can “dd” it. Make sure you have unmounted all volumes on the new disk before using “dd”:

Please be patient as it will take some time. On my iMac it took 22 minutes to finish the writing. After it is done, the OS is installed into the eMMC and you can unplug the USB slave port and reboot your Raspberry Pi Compute Module. Congratulations!

RPi_CM_Running

See also