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:
Is U-boot + Debian a supported scenario by Mender ?
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. 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).
If you do not want to patch U-Boot there is also the possibility of adding the bootcount logic using scripting. To get the U-Boot glue updated when updating the kernel using a Debian package you can use some hook scripts.
Reporting back on the current evolution on the topic.
After investigating the scenario, we are currently in this situation:
Yes @TheYoctoJester , to answer to your question, our board was, fortunately, supported by upstream u-boot.
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.
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.
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.
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).
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.
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!