RFC: Single universal Raspberry Pi gadget and image

During some recent work on kiosk appliance setups for Raspberry Pi devices i got annoyed enough about having to build three Pi images for the three devices that i looked into what it would take to have one single universal Pi image that can run equally on all Raspberry Pi devices Ubuntu Core supports today …

Apparently the newer Pi firmware blobs actually support a way to set per-device options in config.txt so it is possible to load the device specific u-boot binary based on the hardware that is booted.

Building all required u-boot binaries into this gadget and having them live all in /boot/uboot side by side then enables us to have the firmware blob switch to the right one based on this config.txt feature.

I’d like to propose that we start switching over to this mechanism for the Pi reference image and instead of producing three images for pi2, pi3 and cm3, move to a sigle unified raspberry pi image runnable on all supported boards.

The current code for the kiosk gadget snap that i used for this universal image can be found at:

(note that due to being designed for kiosk setups it does a few more things like showig a splash screen during boot by default, completely quietening all console messages and only allowing console access and configuring via console-config through serial, this would indeed not have to move over to the generic gadget if undesired)


On a device, how would we distinguish between a Pi2/Pi3/CM3 etc.?

If you want to determine the model from userspace you can check the devicetree:

cat /proc/device-tree/model 
Raspberry Pi 3 Model B Rev 1.2

but would there actually be a requirement to distinguish at all ?

GPIO setups are identical, graphics support through mir should also not differ per device, the only place where you really have differences are the available peripherials (no wlan on pi2, several peripherials missing on cm3 by default), but i dont think that matters much on a generic reference image. and for a product you will probably build your own board specific gadget anyway.

I like this approach, I think we should consider using it for the upcoming core18 images for the pi family. The only risk I can see is that when the pi4 is added there might be issues adding this for unforeseen reasons. However given that this is blessed by upstream (AIUI) the risk is very low?

1 Like

yes, it is blessed by upstream and documented at:

1 Like

Having a reference “one-for-all” gadget + image would help me a lot as well :blush: Already using @ogra 's pi-kiosk-gadget as inspiration.