# Supporting various RPi Compute Modules in one image

**URL:** <https://hub.mender.io/t/supporting-various-rpi-compute-modules-in-one-image/6625>\
**Category:** General Discussions\
**Tags:** debian, raspberry-pi-3, raspberrypi-cm3, raspberry-pi-4\
**Created:** [March 14, 2024, 10:27am UTC](https://hub.mender.io/t/supporting-various-rpi-compute-modules-in-one-image/6625 "2024-03-14T10:27:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![bztry](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bztry](https://hub.mender.io/u/bztry)\
**Post date:** [March 14, 2024, 10:27am UTC](https://hub.mender.io/t/supporting-various-rpi-compute-modules-in-one-image/6625/1 "2024-03-14T10:27:13Z")

</div>

Hi there, I’m currently facing something similar.

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 🙂

Kind regards

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [March 14, 2024, 11:42am UTC](https://hub.mender.io/t/supporting-various-rpi-compute-modules-in-one-image/6625/2 "2024-03-14T11:42:57Z")

</div>

Hi @bztry,

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?

Greets,  
Josef

---

<div class="post-metadata">

**Author:** ![bztry](https://avatars.discourse-cdn.com/v4/letter/b/6a8cbe/32.png) [@bztry](https://hub.mender.io/u/bztry)\
**Post date:** [March 14, 2024, 12:32pm UTC](https://hub.mender.io/t/supporting-various-rpi-compute-modules-in-one-image/6625/3 "2024-03-14T12:32:23Z")

</div>

Hi @TheYoctoJester ,

thank you for this speedy feedback. Great forum with lots of tips here! Misused the word “fork” on my end, apologies 🙂

What I tried so far with my CM3 device:

Flashed the original RpiOS (Bullseye, 32-bit, latest version) to USB → Booted fine

Flashed the mender Rpi3 image from here: [Prepare a Raspberry Pi device | Mender documentation](https://docs.mender.io/get-started/preparation/prepare-a-raspberry-pi-device) to USB → Did not boot

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.

Which leads me to believe my issue is a duplicate of this thread?: [Booting a converted image from USB - #5 by sdynes](https://hub.mender.io/t/booting-a-converted-image-from-usb/4197/5)

I’ve also got some CM4 / CM4S devices (can only test with them next week) which have an integrated eMMC storage. Is eMMC also affected by this issue?

I can gladly test the workaround “kacf” mentioned in the other thread, but I do not know how 😃

Kind regards

---

<div class="post-metadata">

**Author:** ![TheYoctoJester](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/theyoctojester/32/1444_2.png) [@TheYoctoJester](https://hub.mender.io/u/TheYoctoJester)\
**Post date:** [March 19, 2024, 11:43am UTC](https://hub.mender.io/t/supporting-various-rpi-compute-modules-in-one-image/6625/4 "2024-03-19T11:43:50Z")

</div>

Hi @bztry,

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](https://www.get-edi.io) by @lueschem or [Home | Rugpi](https://oss.silitics.com/rugpi/) can make use of it. Maybe this is helpful for your use case.

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![Irfaane](https://avatars.discourse-cdn.com/v4/letter/i/90db22/32.png) [@Irfaane](https://hub.mender.io/u/Irfaane)\
**Post date:** [March 19, 2024, 2:12pm UTC](https://hub.mender.io/t/supporting-various-rpi-compute-modules-in-one-image/6625/5 "2024-03-19T14:12:46Z")

</div>

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](https://docs.u-boot.org/en/latest/build/gcc.html)  
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!
