We have some devices running CM3, some CM3+, some CM4S and CM4 (so everything across the board)
I was hoping you could point me in the direction of how I can make debian with mender run on all of these?
Do I have to rebuild u-boot for each different one? How would I be able to do that? I know mender has some specific u-boot fork, but unfortunately I’m still at the beginning of my mender-journey.
Any tips or just hints in some direction would be very appreciated
Mender does not have a u-boot fork, but a relatively small patchset
I’m not very familiar with the CMs, but in general the ones you mentioned should be able to run a common kernel, just differing device trees. Hence, the challenge is to provide a mechanism which loads the one matching your specific instantiation. From a Mender standpoint, building separate u-boot incarnations is not required.
As a starting point, have you tried using the generic mender-convert approach to your golden image? Did you encounter specific problems?
Run mender-convert on the original RpiOS from above, flashed to USB → Did not boot
And while writing this post, I decided to stick the USB in my normal rpi3 (not cm3) to try if it works and it looks like it does not, while it does work from sd-card. I just never noticed because I always run standard pis with sdcards and my CM3/CM4 devices have either USB or eMMC boot.
Not as speedy this time, sorry - but I think I found at least part of the problem. Using a single converted image for various board will not work, because the u-boot configurations differ. A board specific u-boot and device tree will not boot on another variant. Hence, you need separately converted images per board type.
Some additional thoughts and information:
the Raspberry Pi OS images can pull off that trick, because they do not use u-boot, and their binary blob bootloader employs some tricks to hand off to the kernel directly.
there is a Raspberry Pi specific A/B switching technique too. It can be used through an Update Module or state scripts, for example. There is no publicly available integration for this (yet) in mender-convert, but https://www.get-edi.io by @lueschem or Home | Rugpi can make use of it. Maybe this is helpful for your use case.
What I did was I downloaded the “forked” mender-boot from their git repo.
In the file configs/rpi_3_32b_defconfig, set CONFIG_DEFAULT_DEVICE_TREE to bcm2837-rpi-cm3-io3. Build the kernel like shown here: Building with GCC — Das U-Boot unknown version documentation
on ubuntu or vm running ubuntu. Copy the generated u-boot.bin to kernel7.img into the image from mender raspiOS you downloaded.
Unfortunately, they are using an older version of u-boot which does not contain the device tree for the RPI cm 4s. Wonder if they are planning to update this anytime soon so we can also use rpi cm4s with Mender!