Ubuntu Mate USB boot for RPi4 (No SD card required)

I originally posted this on the Raspberry Pi Forums, but found that this works with this image as well.
"https://www.raspberrypi.org/forums/viewtopic.php?f=131&t=278791"

I will upload a working image very shortly, and I will post a link.
Here is the download link with an image that I have confirmed works with one of my USB drives. I have already completed the process as outlined below in this image. You can now follow the guide, or download the image.
MD5: 30cc54b49713f7b2ba078e4cfdf77383

So Here are the steps:

  1. Download the Ubuntu Mate image for raspberry pi 4 from the official website.

  2. Flash the image to a USB drive (USB 3.0 SSD or USB flash drive).

  3. Download the updated firmware files from the raspberry pi github site.

Copy all *.dat and *.elf files to the Ubuntu boot partition. (Overwrite the files that were previously there).
NOTE: You must have MSD Booting EEPROM flashed onto your RPI4, or else this will not work!!!

Note: As of August 2020, you may not need to perform step 3. It has been reported that the current Ubuntu image contains the correct firmware files. I will leave this step here in case it does help someone. Be aware that it may not be necessary, but does not hurt to do anyway.

  1. Decompress vmlinuz on the boot partition
zcat vmlinuz > vmlinux
  1. Update the config.txt as follows for the [pi4] section:
[pi4]
max_framebuffers=2
dtoverlay=vc4-fkms-v3d
boot_delay
kernel=vmlinux
initramfs initrd.img followkernel
  1. Add a new script to the boot partition called auto_decompress_kernel with the following:
#!/bin/bash -e

#Set Variables
BTPATH=/boot/firmware
CKPATH=$BTPATH/vmlinuz
DKPATH=$BTPATH/vmlinux

#Check if compression needs to be done.
if [ -e $BTPATH/check.md5 ]; then
	if md5sum --status --ignore-missing -c $BTPATH/check.md5; then
	echo -e "\e[32mFiles have not changed, Decompression not needed\e[0m"
	exit 0
	else echo -e "\e[31mHash failed, kernel will be compressed\e[0m"
	fi
fi

#Backup the old decompressed kernel
mv $DKPATH $DKPATH.bak

if [ ! $? == 0 ]; then
	echo -e "\e[31mDECOMPRESSED KERNEL BACKUP FAILED!\e[0m"
	exit 1
else 	echo -e "\e[32mDecompressed kernel backup was successful\e[0m"
fi

#Decompress the new kernel
echo "Decompressing kernel: "$CKPATH".............."

zcat $CKPATH > $DKPATH

if [ ! $? == 0 ]; then
	echo -e "\e[31mKERNEL FAILED TO DECOMPRESS!\e[0m"
	exit 1
else
	echo -e "\e[32mKernel Decompressed Succesfully\e[0m"
fi

#Hash the new kernel for checking
md5sum $CKPATH $DKPATH > $BTPATH/check.md5

if [ ! $? == 0 ]; then
	echo -e "\e[31mMD5 GENERATION FAILED!\e[0m"
	else echo -e "\e[32mMD5 generated Succesfully\e[0m"
fi

#Exit
exit 0
  1. Create a script in the /etc/apt/apt.conf.d/ directory and call it 999_decompress_rpi_kernel . The script should contain the following:
DPkg::Post-Invoke {"/bin/bash /boot/firmware/auto_decompress_kernel"; };
  1. Make the script executable
sudo chmod +x 999_decompress_rpi_kernel

Steps 7 and 8 can be done before first boot if you can mount the root file system on your computer. If you cannot, you can do them after you boot up the pi and log on to Ubuntu for the first time . I recommend that you do it before first boot, but if you cannot, once you have the files in the correct place, please run the script auto_decompress_kernel from the /boot/firmware directory. If you do not, and you cannot boot after a restart, you will need to manually decompress your kernel again before this script will actually work (step 3).

  1. Enjoy Ubuntu on the RPI4 without hassle ![:D|15x17]
3 Likes

RaspberryPi Github page:


RaspberryPi EEPROM update information page:
https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md

Thank You. Finally, I am able to use SSD as a boot device( using MATE).
Previously, other OS were able boot from SSD but not Ubuntu Mate.
You did a huge favor.
But i am unable to Overclock it with this Mod.
Did you Overclock your Pi on this Modded OS?