[PATCH 0/2] allow control DTB to double as "FIT image"

Rasmus Villemoes ravi at prevas.dk
Wed May 13 10:03:54 CEST 2026


On Tue, May 12 2026, Quentin Schulz <quentin.schulz at cherry.de> wrote:

> Hi Rasmus,
>
> On 5/12/26 6:16 PM, Rasmus Villemoes wrote:
>> The commit message for patch 1 explains what it is I'd like to be able
>> to do, but here's some more background:
>> 
>
> For reference:
>
> """
> Writing those scripts in the built-in environment leads to
> backslatitis and missing or wrong quoting and is generally not very
> readable or maintainable.
> """
>
>
> Have you tried to use the text-based environment mechanism as
> described in
> https://docs.u-boot.org/en/latest/usage/environment.html#text-based-environment?
> (I've learned about this only very recently with the Apple devices
> being migrated to it)
>

Hi Quentin

Thanks for the suggestion. However, not only do I know about that
concept, I'm the author of f3d8f7dd73a ("Allow providing default
environment from file") which is a slightly different mechanism from the
one you refer to (and predates it by a few years), and which we've been
using ever since.

While both represent a definite improvement in the handling of the
_environment variables_ over definining it as a giant C string, it is
still not a very good way of writing whole scripts.

So the "text-based environment" method does allow you to (and
encouarages) indentation, but you don't get your editor's help to do the
if/while/... nesting properly because it's not a real script, and you
can't run shellcheck on those embedded snippets.

Moreover, while it _looks_ like a normal, commands-terminate-at-newline,
script, the stuff you put in those env variables must have all
individual commands terminated by a semicolon. Which to some extent
makes it even worse, because that is extremely easy to forget or
overlook. Imagine something like

   if something something ; then
      echo "yay";
      go_on_to_other_stuff;
   else
      echo "uh oh, something failed"                         <----
      handle_that_error;
   fi

Writing "scripts" in an env variable that can be called with "run foo"
is a bit like having to write normal shell scripts in a one-liner one
can pass to "sh -c '...'".

So no, I don't that's really a useful substitute for having a way to
properly embed real scripts in U-Boot.

Rasmus


More information about the U-Boot mailing list