Table of Contents
AVH supports running custom Linux firmware packages.
This guide outlines the contents of a valid Ubuntu firmware package, provides a script for building the Ubuntu Desktop firmware, and walks through the installation on a virtual Raspberry Pi 4 board.
This packaging process follows the Understanding Firmware on AVH knowledge base article and uses the Raspberry Pi image of Ubuntu Desktop available directly from Ubuntu.
Please also refer to our companion guide Package Ubuntu Server Firmware for AVH.
Firmware Package Contents
A proper Ubuntu Desktop firmware package file contains the following:
Info.plist
- the version, type, build, unique identifier, and device identifiernand
- the preinstalled Ubuntu Desktop arm64 image filedevicetree
- hardware components data for the Linux kernelkernel
- the Linux kernel fileramdisk.img
(optional) - the initrd root file system image
Although specifying a ramdisk.img
is generally optional, we need to add a reboot command in this case because of how this virtual device handles the first pass.
Firmware Packaging Script
The following script creates a custom firmware package in your working directory:
#!/bin/bash
set -e
mkdir rpi_ubuntu_desktop_firmware
cd rpi_ubuntu_desktop_firmware
# Download and extract the "Ubuntu 22.04.1 Desktop for RPi" image
wget https://cdimage.ubuntu.com/releases/22.04.1/release/ubuntu-22.04.1-preinstalled-desktop-arm64+raspi.img.xz
xz -dv ubuntu-22.04.1-preinstalled-desktop-arm64+raspi.img.xz
mv ubuntu-22.04.1-preinstalled-desktop-arm64+raspi.img nand
# Attach the image file
LO="$(losetup -f)"
losetup -P "${LO}" nand
# Mount partition 1 to directory boot
mkdir boot
mount "${LO}p1" boot
# Copy the rpi4b devicetree
cp boot/bcm2711-rpi-4-b.dtb devicetree
# Extract the Linux kernel
zcat boot/vmlinuz > kernel
# Extract initrd
lz4 -d boot/initrd.img initrd.cpio
umount boot
rm -r boot/
mkdir rootfs
# Mount partition 2 to directory rootfs
mount "${LO}p2" rootfs
# Use aarch64 Linux sssd.conf and set permission to 600
cp rootfs/usr/lib/aarch64-linux-gnu/sssd/conf/sssd.conf rootfs/etc/sssd/.
chmod 600 rootfs/etc/sssd/sssd.conf
umount rootfs
rm -r rootfs/
losetup -d "${LO}"
mkdir ramdisk
cd ramdisk
# Extract initrd
cat ../initrd.cpio | cpio -idm
rm ../initrd.cpio
# Add reboot conditional to init before matching string
sed -i '/Move virtual filesystems over to the real filesystem/i \
if /bin/grep init_resize /proc/cmdline; then\
/bin/reboot -f\
fi\
' init
# Create ramdisk.img from directory
find . | cpio -o -H newc -R root:root | lz4 -l > ../ramdisk.img
cd ..
rm -r ramdisk/
# Create the Info.plist file
cat << EOF > Info.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Type</key>
<string>iot</string>
<key>UniqueIdentifier</key>
<string>Ubuntu Desktop on RPi</string>
<key>DeviceIdentifier</key>
<string>rpi4b</string>
<key>Version</key>
<string>22.04.1</string>
<key>Build</key>
<string>Ubuntu Desktop</string>
</dict>
</plist>
EOF
zip -rm ../rpi4b-ubuntu-desktop.zip Info.plist nand devicetree kernel ramdisk.img
cd ..
rm -r rpi_ubuntu_desktop_firmware/
Install the Package
Run the above shell script on your local Linux environment to create the firmware package
rpi4b-ubuntu-desktop.zip
.On the AVH web interface, click CREATE DEVICE.
In Step 1, choose the Raspberry Pi 4 and click NEXT.
In Step 2, upload the custom firmware package. When the process is complete, click NEXT.
Create the device without enabling advanced boot options.
The virtual board will boot to the Ubuntu Desktop setup screen.
Note: After initial setup and device restart, enable SSH using
sudo apt install openssh-server
. Since we are using a custom configuration, you will need to adjust the SSH commands under the CONNECT tab to use the username and password you specified during setup instead of the default credentials (pi
/raspberry
).