Flashing The Raspberry Pi Compute Module
Whilst development kits come with the Demo OS pre-installed, this section describes how to write a new disk image to the Compute Module. This section mainly follows the procedure from the Raspberry Pi website guide here :
First of all download the windows USB boot installer, this will install a program we'll use later called RPi-Boot (New Version for CM1, CM3 & CM3+ November 2018) :
With the board powered off set USB Boot jumper link to Enable
Connect the mini USB connector by the HDMI connector to the PC using a USB A to micro B data cable.
Power up the board
Windows will then show the following stages as it locates and installs a driver :
Once that sequence has finished Windows has now installed the required drivers and you can power off the unit for a moment whilst we get the PC side ready for the next step.
Making sure you have the unit powered off start up RPi Boot, which you installed via CM-Boot-Installer.exe and can access via the Windows start menu, be sure to do a right click 'Run as administrator' on this program :
When the RPi-Boot starts up it’ll sit and wait for the attached board to boot up :
RPi-Boot essentially catches the board at power up and sends a series of commands to re-configure the compute module into mass-storage device mode, doing so allows Windows to recognise it as a new drive and we can then write the main OS image onto it.
So leave RPi-Boot running and waiting as shown above and power up the unit again.
If all goes well RPi-Boot will detect the attached board as it powers up, do it’s work and exit quickly, disappearing from the screen.
Here’s a grab of it in action :
Note : Sometimes RPi-Boot doesn’t correctly catch the board as it boots and as a result the re-config sequence doesn’t complete correctly. In this case the simplest thing to do is to switch the board off, close then restart RPi-Boot and then power the board back on to try again.
When done the compute module will alternate into mass storage mode (so behaving just as though it's a USB memory stick) and windows will then recognise the module as an external drive, this is what the compute module will do if it's blank :
Click cancel to close this Windows Format dialog box and we’ll load the OS next using another utility.
If the compute module has already been programmed Windows will recognise the FAT partition and assign that (at least) a drive letter, this is useful in the event that a config error with the boot files is made (e.g. dt-blob.bin or config.txt) and needs recovery actions to be performed.
There are a few ways we can load on the OS, but for simplicity we’ll use the recommended OS writing software and process from the main Raspberry Pi website here :
This process writes a disk image, containing the partition table and both FAT boot partition and Linux ext partitions, over the entire disk, the basic sequence we're following here is
- Download the Win32DiskImager utility from the Sourceforge Project page Note : For Windows 8/10 we would recommend using Etcher instead of Win32DiskImager -
- Install and run the Win32DiskImager utility. You will need to run the utility as administrator, right-click on the shortcut (or exe file) and select Run as administrator.
- Select the Raspbian image file you wish to write
Select the drive letter of the compute module in the device box (in our case F:) - Again note that the disk image is a 1:1 of the entire disk (containing the partition table, FAT & EXT partitions) We are writing the image to the entire disk, and not a partition.
Be careful to select the correct drive; if you get the wrong one you can destroy your data on the computer's hard disk!
- Click Write and wait for the write to complete.
Take care during this process not to dislodge any cabling as this will cause the program to error out and you’ll need to power off/on and start again from the RPI-Boot point.
Here's some grabs of this sequence :
Once complete power off the unit and set the USB Boot jumper link back to Disabled, and finally remove the USB cable. - Failing to do this will prevent the units onboard USB peripherals from working due to CM's USB master being still switched over to the programming socket and not the internal bus.
Power back on the unit and the board should now boot into the OS.
The same utility can also create snapshot images of the current image config to save time, although note this is a straight binary dump of the entire 4GB disk not just the parts with files in so the image files end up quite big and take a long time to read/write.
Note that the official Raspbian images can be found here :
The NoX/Lite image sizes work out to be approx 760MB in size
The MyPi default images can be downloaded here :
NOTE : Kernel 4.14 Currently Requires compatibility config added to cmdline.txt, see HERE
NOTE : The default MyPi root password is "root" please change this asap.