It's Pi all the way down...

The Pi Zero 2

Thu 28 October 2021
by Dave Jones

A quick run-down of the new Raspberry Pi Zero 2, and how to run Ubuntu on it (should you wish to!).

Small, but perfectly formed

While browsing the news last week I was particularly amused to come across several comments on Eben’s post about the first price increase of a Raspberry Pi in history (TL;DRglobal silicon shortage affects everyone, even Raspberry Pi”), each of which either speculated on designs for an updated Pi Zero, and/or the potential time-frames we might be looking at for such a thing. I’m sure each of the erstwhile Cassandra’s won’t be disappointed to learn how far out their predictions were! :)

I had to chuckle because for the better part of this year, I’ve had a production prototype of the Zero 2 lying somewhere on my desk for testing (and have had to be careful to move it out of shot during certain video calls!).

The initial plan was to release Ubuntu Impish with support for the Zero 2. However, as the global silicon shortage started to bite, the release date for the Zero 2 slipped beyond Impish’s release date, and the Impish release had to go ahead without support for it on the images.

Speaking of which … what’s actually required for support of the Zero 2? To understand that, we should first take a look at the hardware.

Zero History

The original Pi Zero (top left), the Pi Zero rev 1.3 (top right) with added camera interface, the Pi Zero W (bottom left) with added WiFi and Bluetooth antenna, and the Pi Zero 2 (bottom right) with new SoC

First, a quick visual tour of the Pi Zero’s history:

  • Top left is the original Pi Zero (board rev 1.2) with its 1GHz ARM6 SoC, and 512MB of RAM (the RAM is pretty much the only thing that hasn’t changed in terms of specs!)
  • Top right is the Pi Zero rev 1.3 which added the mini CSI connector for the camera interface
  • Bottom left is the Pi Zero W which added the triangular Proant WiFi/BT antenna and the WiFi chip (the shiny IC to the right of the SoC)
  • Finally, bottom right is the new Pi Zero 2 which replaced the venerable SoC with the new quad-core “RP3A0

The form factor is obviously based on previous Raspberry Pi Zero models. The major difference is that huge (for the Pi Zero) SoC labelled the “RP3A0” (and, slightly confusingly “2041” which is the manufacturing date and nothing to do with RP2040 on the Pico). It’s the good ol’ 2710 (aka 2837) SoC that powered the Raspberry Pi 3B, 3A+, and 3B+ packaged together with its RAM in Raspberry Pi branded silicon.

That’s pretty much the major headline right there: instead of the old single-core ARM6 chip that the Pi Zero shipped with, the new Zero 2 has a full quad-core arm64-capable SoC that the Pi 3B has. That also means it’s the first Pi in a Zero form-factor that Ubuntu’s compatible with (in either armhf or arm64 flavours).

There’s also the notable WiFi “can” sitting to the right of the SoC, like the 3A+ and 3B+. However, it’s worth noting that it doesn’t use the same WiFi chip as the 3A+/3B+ (Broadcom 43455 compatible); instead it uses a WiFi interface similar to the Pi 3B/Zero W (Broadcom 43430 compatible). Which just means: don’t go expecting 5GHz (it’s 2.4GHz only).

If you were to think of it as a cheaper, smaller version of the 3B … well, you wouldn’t be far wrong.

Ubuntu Impish

Ubuntu Impish armhf (the 32-bit image) will support the Zero 2 “out of the box” so you can just flash’n’go!

What about arm64? For that there’s a wrinkle (on which, more details below): you need an extra device-tree on the boot partition. On (or the day after? TBC) release day, we should have a kernel update that includes the new Zero 2 device-tree, so the “official” method of upgrading a card to work on the Zero 2 should simply be:

  • Boot your Ubuntu card on a supported Raspberry Pi (other than the Zero 2).
  • sudo apt update
  • sudo apt upgrade
  • Shut down the Pi. Put the card in your new Zero 2 and boot it!

What if you don’t have a spare non-Zero 2 Raspberry Pi? In that case there’s a bit of a hack you can use instead (which I’ve been using as a quick work-around during testing):

  • Flash a fresh Ubuntu Impish image to your choice of storage media (SD card, SSD, etc). Probably the easiest means of doing this is the Raspberry Pi Imaging utility (you’ll find Ubuntu under “Other general purpose OS”).
  • Once complete, safely remove the medium and re-insert. The boot partition (and potentially the root partition if you’re on Linux) will auto-mount.
  • Open the boot partition in your file-browser and find the bcm2710-rpi-3-b.dtb file. Make a copy of this file and rename it to bcm2710-rpi-zero-2.dtb. The trick here is simply that the Zero 2’s hardware is close enough to the 3B (minus the ethernet port, some RAM, and the DSI port) that the 3B’s device-tree works.
  • You’re done! You can now boot the card on your new Zero 2. Once you’ve done that, go through the usual sudo apt update, sudo apt upgrade dance to get the “proper” device-tree installed.

Ubuntu Focal

Ubuntu Focal, as the current LTS, will be received support for the Pi Zero 2 in the next kernel SRU cycle which is due out on Monday, November 8th. Once that lands, you can do the sudo apt update, sudo apt upgrade dance on another (non-Zero 2) Raspberry Pi to upgrade your card for compatibility with the Zero 2.

What if you don’t have another Pi? That gets a bit more tricky. First you have to get rid of u-boot from the boot sequence, then copy the 3B dtb as for Impish above. Once that’s done Focal seems to work reasonably happily (though I haven’t had time to do extensive testing, just make sure the basics like USB and WiFi are operating).

Pieces of 8²

Why isn’t all this copying of device trees necessary on the armhf image for Ubuntu Impish? It’s a funny story …

In order to get the Raspberry Pi Zero 2 to boot successfully (or any Pi for that matter), you need a device-tree for the board. That’s what all those “.dtb” files are on the boot partition. When the Pi starts up, the boot firmware checks what board it’s on, finds the appropriate device-tree file and loads it. The device-tree in turn tells the kernel what devices exist, what interfaces they’re connected to, bus addresses, etc. etc.

Obviously the device-tree for the Zero 2 has to be named bcm2710-rpi-zero-2.dtb. But that file doesn’t exist on the armhf image, so how can it boot?

In order to permit early testing, the Raspberry Pi developers sneaked in a hack of their own to the boot firmware. If the firmware finds itself running on a Zero 2, and also finds a bcm2708-rpi-zero-w.dtb (for the Raspberry Pi Zero W), it loads that then patches it to be equivalent to the appropriate Zero 2 device-tree. As it happens, despite not supporting the Zero W (which has an ARM6 processor; Ubuntu only supports the ARM7 arch and upward), our armhf images have always shipped with a (redundant) bcm2708-rpi-zero-w.dtb on the boot partition so by happy coincidence they “just work”.

However, the arm64 images didn’t ship with a (redundant) Zero W device-tree. And naturally, adding one would’ve looked … somewhat suspicious (“so Dave, why are you adding a device-tree for a board you definitely don’t support on any architecture?”), and obviously we couldn’t just shove a device-tree named bcm2710-rpi-zero-2.dtb on the boot partition without giving the whole thing away (and probably violating various NDAs)!

Fry from Futurama looks suspiciously at the new device-tree on the boot partition

Anyway, the 3B device-tree is a reasonably close match to the Zero 2’s hardware, and is sufficient for it to boot without further alteration. The only thing I’ve noticed that’s “off” when the 3B device-tree is in use is that /proc/asound/cards reports both the HDMI audio output, and the auxiliary headphone socket (the latter doesn’t exist on the Zero 2, and doesn’t appear when the “official” device-tree is in use).

And that’s all folks! Now, go treat yourself to the newest diminutive member of the ever-growing Pi family, and have some fun!