Got to boot a RPi Zero 2 W with Debian
About a month ago, I got tired of waiting for the newest member of the Raspberry product lineup to be sold in Mexico, and I bought it from a Chinese reseller through a big online shopping platform. I paid quite a bit of premium (~US$85 instead of the advertised US$15), and got it delivered ten days later…
Anyway, it’s known this machine does not yet boot mainline Linux. The vast majority of ARM systems require the bootloader to load a Device Tree file, presenting the hardware characteristics map. And while the RPi Zero 2 W (hey… what an awful and confusing naming scheme they chose!) is mostly similar to a RPi3B+, it is not quite the same thing. A kernel with RPi3B+’s device tree will refuse to boot.
Anyway, I started digging, and found that some days ago Stephan
Wahren sent a patch to the linux-arm-kernel mailing
with a matching device tree. Read the patch! It’s quite simple to read
(what is harder is to know where each declaration should go, if you
want to write your own, of course). It basically includes all basic
details for the main chip in the RPi3 family (BCM2837), pulls in also
the declarations from the BCM2836 present in the RPi2, and adds the
necessary bits for the USB OTG connection and the WiFi and Bluetooth
declarations. Registers the model name as
Raspberry Pi Zero 2 W,
which you can easily see in the following photo, informs the kernel it
has 512MB RAM, and… Well, really, it’s an easy device tree to read,
don’t be shy!
So, I booted my RPi 3B+ with a freshly downloaded Bookworm
installed and unpacked
linux-source-5.15, applied Stephan’s patch,
and added the following for the DTB to be generated in the arm64 tree
--- /dev/null 2022-01-26 23:35:40.747999998 +0000 +++ arch/arm64/boot/dts/broadcom/bcm2837-rpi-zero-2-w.dts 2022-02-13 06:28:29.968429953 +0000 @@ -0,0 +1 @@ +#include "arm/bcm2837-rpi-zero-2-w.dts"
Then, ran a simple
make dtbs, and… Failed, because
bcm283x-rpi-wifi-bt.dtsi is not yet in the kernel 😦.
OK, no worries: Getting wireless to work is a later step. I commented out the lines causing conflict (10, 33-35, 134-136), and:
root@rpi3-20220212:/usr/src/linux-source-5.15# make dtbs DTC arch/arm64/boot/dts/broadcom/bcm2837-rpi-zero-2-w.dtb
Just copied over that generated file to /boot/firmware/, moved the SD over to my RPiZ2W, and behold! It boots!
When I bragged about it in
#debian-raspberrypi, steev suggested me
to pull in the WiFi patch, that has also been
(but not yet accepted) for kernel inclusion. I did so, uncommented the
lines I modified, and built again. It builds correctly, and –again–
copied the DTB over. It still does not find the WiFi;
complains about a missing bit of firmware (
failed to load
pointed out it can be downloaded from RPi Distro’s GitHub
but I called it a night and didn’t pursue it any further ;-)
So… I understand this post is still a far cry from saying “our images properly boot under a RPi 0 2 W”, but… we will get there 😉