# U-BOOT + Debian Family?

**URL:** <https://hub.mender.io/t/u-boot-debian-family/6931>\
**Category:** Debian family\
**Tags:** debian, boot, uboot\
**Created:** [June 11, 2024, 8:15am UTC](https://hub.mender.io/t/u-boot-debian-family/6931 "2024-06-11T08:15:57Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![fce](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/fce/32/2308_2.png) [@fce](https://hub.mender.io/u/fce)\
**Post date:** [June 11, 2024, 8:15am UTC](https://hub.mender.io/t/u-boot-debian-family/6931/1 "2024-06-11T08:15:57Z")

</div>

Hi everyone !

We are testing Mender Enterprise for our embedded solution, with the following use case:

- **U-BOOT + Debian** (bookworm)
- embedded devices, u-boot+debian is the OEM choice, x86 and aarch64. We can re-generate images and customize them, though.

Reading along the Mender documentation, it seems that U-Boot is **generally** supported, although, I have **only** read about u-boot on the **Yocto** part of the documentation.

We are trying to figure out:

1. Is U-boot + Debian a **supported scenario** by Mender ?

2. Is there a **documentation** for such scenario ? (i could only find [this yocto page as current guideline](https://docs.mender.io/operating-system-updates-yocto-project/board-integration/bootloader-support/u-boot/manual-u-boot-integration))

3. Will there be Debian-oriented **patching** tools for debian replicating [those in meta-mender](https://github.com/mendersoftware/meta-mender/tree/master/meta-mender-core/recipes-bsp/u-boot/patches) ?

Thank you very much in advance,  
Wishing you a great day.

---

<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:** [June 12, 2024, 1:27pm UTC](https://hub.mender.io/t/u-boot-debian-family/6931/2 "2024-06-12T13:27:20Z")

</div>

Hi @fce,

The question is not that much about Debian + U-Boot, it’s more like - is U-Boot available for the device/platform in question?  
Our usual recommendation for Debian is using the `mender-convert` tool as described [here](https://docs.mender.io/operating-system-updates-debian-family/convert-a-mender-debian-image). On the Raspberry Pi, for example it injects a patched u-boot binary.

So it is definitely supported, but I don’t think we have a patching guide (yet).

Greets,  
Josef

---

<div class="post-metadata">

**Author:** ![fce](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/fce/32/2308_2.png) [@fce](https://hub.mender.io/u/fce)\
**Post date:** [June 14, 2024, 9:26am UTC](https://hub.mender.io/t/u-boot-debian-family/6931/3 "2024-06-14T09:26:47Z")

</div>

Hi @TheYoctoJester,

thank you for the prompt response.

> [@TheYoctoJester](#):
>
> On the Raspberry Pi, for example it injects a patched u-boot binary.

Ok. We will take an look at the usage of those binaries in order to make a similar u-boot patch, and integrate it in an homogeneous way.

I will report back here.

Thank you.  
Have a nice week-end,

---

<div class="post-metadata">

**Author:** ![lueschem](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/lueschem/32/214_2.png) [@lueschem](https://hub.mender.io/u/lueschem)\
**Post date:** [June 14, 2024, 9:16pm UTC](https://hub.mender.io/t/u-boot-debian-family/6931/4 "2024-06-14T21:16:20Z")

</div>

If you do not want to patch U-Boot there is also the possibility of adding the bootcount logic [using scripting](https://github.com/lueschem/edi-cl/blob/master/plugins/playbooks/board_support/roles/bootloader/files/boot.scr.txt). To get the U-Boot glue updated when updating the kernel using a Debian package you can use [some hook scripts](https://github.com/lueschem/edi-boot-shim).

---

<div class="post-metadata">

**Author:** ![fce](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/fce/32/2308_2.png) [@fce](https://hub.mender.io/u/fce)\
**Post date:** [August 7, 2024, 3:35pm UTC](https://hub.mender.io/t/u-boot-debian-family/6931/5 "2024-08-07T15:35:20Z")

</div>

Hi @TheYoctoJester and @lueschem,

Reporting back on the current evolution on the topic.

After investigating the scenario, we are currently in this situation:

1. Yes @TheYoctoJester , to answer to your question, our board was, fortunately, supported by upstream u-boot.
2. So, what we were missing was the mender boot partition switch logic, which we investigated looking at how it was done in meta-mender and the RPI custom u-boot provided by mender.
3. In the end, we are currently using a solution just as @lueschem suggested. Carrying with us a boot script, very very similar to [the one posted by @lueschem](https://github.com/lueschem/edi-cl/blob/master/plugins/playbooks/board_support/roles/bootloader/files/boot.scr.txt).

**pros:**

- This provided to be a solution that required no forking or patching of u-boot.
- The script that we ended up with is quite short, and simple, just as the one by @lueschem

**cons**

- we had to implemented such script by re-verse engineering the u-boot patch
- we are concerned, therefore, with the fact that it is now up to us to guarantee that such script keeps being in line and in sync with mender’s update logic, both in terms of algorithm, and even the exact name of u-boot variables, which are set by the client through fw\_setenv.
- we will have, yet, to thoroughly test the rollback logic with our script, still.

**proposal:**

@TheYoctoJester Could **Mender** provide an **official boot script** in the mender-convert github repo, or a _section_ of boot-script with the main boot switch _algorithm_ ?  
Such script could be just the extraction in a text file of the u-boot functions that are already written in the u-boot patches by meta-mender.

In such way we would know that those officially work, and could better follow eventual modifications.

Thank you in advance,

Have a nice day,

---

<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:** [August 7, 2024, 5:57pm UTC](https://hub.mender.io/t/u-boot-debian-family/6931/6 "2024-08-07T17:57:01Z")

</div>

Hi @fce,

Thanks a lot for the elaborate and detailed answer. Glad to hear that things are working well for you, and thanks @lueschem for the thought kickstart 🙂

If I understood your post correctly, there are effectively two action points. Should I have missed something, please kick me (virtually).

1. the request to document a complete view of the A/B logic, possibly using the `u-boot` start script. This is a good idea! I thought a bit about it, and indeed, the bits to understand it fully are scattered across three different locations as far as I can tell right now. I‘ll try to assemble something better here tomorrow.
2. Using the RPi-style boot mechanism to do the A/B switching. This one I looked a bit into, and it did not immediately strike me as easy to merge with the Mender approach. We have talked about it, and definitely want to go for it. However the required effort to really make it upstream and production is not fully known, and as it does not provide any immediate value, also not very high on the priority list. If somebody makes a proposal on how a community contributed incarnation could look for it, and where it could be located, I‘m all ears on helping it. But I don‘t have a good grip on it right now, sorry.

Hope this help further undersanding, and if you have an idea on how to proceed, let me know!

Greetz,  
Josef

---

<div class="post-metadata">

**Author:** ![fce](https://yyz2.discourse-cdn.com/flex036/user_avatar/hub.mender.io/fce/32/2308_2.png) [@fce](https://hub.mender.io/u/fce)\
**Post date:** [August 22, 2024, 3:43pm UTC](https://hub.mender.io/t/u-boot-debian-family/6931/7 "2024-08-22T15:43:35Z")

</div>

Hi @TheYoctoJester,

Thank you for your response. I will retrieve the information and will be back to you.
