A few weeks ago, the Ubuntu team released a pre-built 64-bit Ubuntu Arm Server Raspberry Pi image that can be downloaded and flashed to an SD Card, that is compatible with both the Raspberry Pi 3B and Raspberry Pi 3B+ single board computers. As we documented in our original article detailing the new Ubuntu build, in the past you needed to build a kernel, create a root filesystem, and then install the necessary firmware and drivers. But now with this new ready-made image, there is no longer a need for any of those difficult and time consuming tasks. While the image was intended to be run on standard Raspberry Pi 3B and 3B+ hardware, with some small modifications it can be installed and run on the Raspberry Pi Compute Module 3 as well.
First and foremost, you will need to start with the new 64-bit Raspberry Pi 3 Ubuntu Arm Server image, which can be downloaded here: http://cdimage.ubuntu.com/releases/18.04/beta/
Once downloaded, you will need to unzip / extract the image file from the compressed archive file.
Next, using a Raspberry Pi Compute Module IO Board or Waveshare Compute Module IO Board Plus, you will need to flash the image file to the Compute Module 3’s onboard eMMC. Instructions for that process can be found here: https://www.raspberrypi.org/documentation/hardware/computemodule/cm-emmc-flashing.md
After the flash process is complete, there should be 2 partitions on the eMMC, ‘boot’ and ‘system’. Mount the ‘boot’ partition of the eMMC so that you can view and edit the files on it.
The first change to be made is to the ‘config.txt’ file. Open it up and change the kernel line, add an initramfs, add an arm_control line, and comment out the device tree address as such:
initramfs initrd.img followkernel
Save and exit.
While the partition is still mounted, you need to add an additional file to the top level directory of the partition as well. In this ‘boot’ partition, you will notice there are .dtb files for the Raspberry Pi 3B. But since we are adapting this Ubuntu image for the Compute Module 3, we need to add the CM3’s .dtb file here as well. A copy of the Compute Module 3’s .dtb can be extracted from a stock Raspbian image, but for convenience a copy can be downloaded from the Raspberry Pi GitHub here: https://github.com/raspberrypi/firmware/blob/master/boot/bcm2710-rpi-cm3.dtb
Simply download it, then copy it to the mounted ‘boot’ partition.
At this point, all necessary changes are complete, and it’s time to boot up and check our work! Unmount the ‘boot’ partition, power down the Compute Module, and then change the IO Board to standard boot mode via it’s jumper setting. Reapply power, and the boot process should begin! The first boot takes a few minutes, as cloud-init runs a series of one-time setup processes to resize the rootFS, setup networking, generate SSH keys, create a container environment, and other tasks. But, after a few minutes you should be able to login to your new 64-bit Ubuntu Arm Server for Raspberry Pi Compute Module with a default username and password of ‘ubuntu’ via SSH or a console!