[SWupdate] sw-description: Different bootloader settings for different hardware?

15 views
Skip to first unread message

h wulff

unread,
Oct 8, 2025, 1:16:26 PM (14 days ago) Oct 8
to swup...@googlegroups.com
Hi!

I struggle with the sw-description file: My goal is to have different
bootloader settings for different hardware revisions but for the same
Image.

So, I tried to build a sw-description file reflecting my goal. Based
on the "Using links" example
(https://sbabic.github.io/swupdate/2024.12/sw-description.html#using-links)
I tried the following sw-description file (variables with @@ are
processed beforehand):

software =
{
version = "@@MAJOR@@.@@MINOR@@.@@PATCH@@.@@BUILDNUMBER@@.@@HASH@@";

      @@MACHINE@@ = {

            stable = {

                  hardware-compatibility: [ "1.0", "2.0" ];

                  rev1: {

                        hardware-compatibility: [ "1.0" ];

                        files: (
                              {
                                    filename =
"@@VAR_SWUPDATE_TARGET_IMAGE_FILE@@";
...
                              }
                        );

                        scripts: (
                              {
...
                              }
                        );

                        bootenv: (
                              {
                                    name = "dtbfile";
                                    value = "oldDeviceTree.dtb";
                              }
                        );
                  },

                  rev2: {

                        hardware-compatibility: [ "2.0" ];

                        files: (
                              {
                                    filename =
"@@VAR_SWUPDATE_TARGET_IMAGE_FILE@@";
...
                              }
                        );

                        scripts: (
                              {
...
                              }
                        );

                        bootenv: (
                              {
                                    name = "dtbfile";
                                    value = "newDeviceTree.dtb";
                              }
                        );
                  }
            }
      }
}

The first error is

> [ERROR] : SWUPDATE failed [0] ERROR parser.c : parse_hw_compatibility : 282 : HW compatibility not found


followed by more errors. The error remains on different variations of
my sw-description file.

My first sw-description file is still working:

software =
{
version = "@@MAJOR@@.@@MINOR@@.@@PATCH@@.@@BUILDNUMBER@@.@@HASH@@";

      @@MACHINE@@ = {
            hardware-compatibility: [ "1.0" ];

            files: (
                  {
                        filename = "@@VAR_SWUPDATE_TARGET_IMAGE_FILE@@";
...
                  }
            );

            scripts: (
                  {
...
                  }
            );
      };
}

So, I assume my /etc/hwrevision file is correct.

If I call

> swupdate -e stable,rev1 -n -i /dev-50a3df4-20251008123921.swu


the sw-description file is processed fine. If I rely on
/etc/hwrevision I get the error mentioned above.

Can anyone give me a hint how a sw-description file must look like to
have different bootloader settings for different hardware revisions
based on /etc/hwrevision?

Thanks in advance.
--
h.wulff

Stefano Babic

unread,
Oct 9, 2025, 5:28:39 AM (13 days ago) Oct 9
to h wulff, swup...@googlegroups.com
Hi h.,
Apart the specific solution (why are you not putting all DTB inside the
same fitImage and choose during boot), you are misunderstanding the role
of the hardware-compatibility check. It is a "check", it does not "select".

You want to "select" a specific part of sw-description based on the
revision number, you do not want just to check if the hardware is
compatible with the software. So if you want to "select", the right way
is to use (no surprise) "selections". See documentation for this.

Your board already knows which revision is running. You should then
adjust the start of the service and add the selection parameter, as

-e <board>,rev1

or
-e <board>,rev2

> followed by more errors. The error remains on different variations of
> my sw-description file.
>
> My first sw-description file is still working:
>
> software =
> {
> version = "@@MAJOR@@.@@MINOR@@.@@PATCH@@.@@BUILDNUMBER@@.@@HASH@@";
>
>       @@MACHINE@@ = {
>             hardware-compatibility: [ "1.0" ];
>
>             files: (
>                   {
>                         filename = "@@VAR_SWUPDATE_TARGET_IMAGE_FILE@@";
> ...
>                   }
>             );
>
>             scripts: (
>                   {
> ...
>                   }
>             );
>       };
> }
>
> So, I assume my /etc/hwrevision file is correct.
>
> If I call
>
>> swupdate -e stable,rev1 -n -i /dev-50a3df4-20251008123921.swu
>
>
> the sw-description file is processed fine. If I rely on
> /etc/hwrevision I get the error mentioned above.

As it should be.

>
> Can anyone give me a hint how a sw-description file must look like to
> have different bootloader settings for different hardware revisions
> based on /etc/hwrevision?

/etc/hwrevision is called for "hardware compatibility" check. If it does
not match, an error is raised and update fails. You *have* to use
selections.

Best regards,
Stefano Babic



>
> Thanks in advance.

Reply all
Reply to author
Forward
0 new messages