Double-Copy Multi-Revision SW-Description File

318 views
Skip to first unread message

Helios Lyons

unread,
Jun 24, 2022, 8:16:08 AM6/24/22
to swupdate
Hello! I am trying to implement a dual-copy strategy which also accounts for the different revisions of a board I am working with. 

I cannot seem to get the SWUpdate / libconfig parser to understand my layout, and so after many hours of scratching my head with the documentation I have decided to ask here. 

My current layout is shown below (with all the details removed, and please ignore incorrect semicolons at the bottom, they are correct on my local copy):

software =
{
    version = "1.0.2";
    description = "xxx";

    hardware-compatibility: [ "revA","revB" ];

    boardname =
    {
        stable:
        {
            revA: {
                main:
                {
                    images: ( );
                    files: ( );
                    scripts: ( );
                    bootenv: ( );
                };
               
                alt:
                {
                    images: ( );
                    files: ( );
                    scripts: ( );
                    bootenv: ( );
                };
            }

          revB: {
                   main:
                {
                    images: ( );
                    files: ( );
                    scripts: ( );
                    bootenv: ( );
                };
               
                alt:
                {
                    images: ( );
                    files: ( );
                    scripts: ( );
                    bootenv: ( );
                };

My only goal is to specify files that depend on revision (different .dtbs for each board) but was not able to get the parser to recognise each revision and apply the files. When trying to update, I always receive the same error from the parser:

[parse_cfg] : Parsing config file /tmp/sw-description

ERROR parser/parser.c : parse_cfg : 977 : ..exiting

ERROR core/parser.c : parse : 164 : no parser available to parse sw-description!

ERROR core/stream_interface.c : extract_files : 165 : Compatible SW not found

Image invalid or corrupted. Not installing ...

[network_initializer] : Main thread sleep again !

Waiting for requests...

ERROR mongoose/mongoose_interface.c : upload_handler : 369 : Writing to IPC fails due to Broken pipe 

Please let me know if any further information is required, I look forward to discussing this with someone, thanks, Helios.

Stefano Babic

unread,
Jun 24, 2022, 9:40:38 AM6/24/22
to Helios Lyons, swupdate
On 24.06.22 14:16, Helios Lyons wrote:
> Hello! I am trying to implement a dual-copy strategy which also accounts
> for the different revisions of a board I am working with.
>
> I cannot seem to get the SWUpdate / libconfig parser to understand my
> layout, and so after many hours of scratching my head with the
> documentation I have decided to ask here.
>
> My current layout is shown below (with all the details removed, and
> please ignore incorrect semicolons at the bottom, they are correct on my
> local copy):

You can then check this by running SWUpdate with -c (check) parameter
and -l 5.
It is impossible for SWUpdate to reach the root of the config to be
parsed. SWUpdate looks for boardname and selection, mode if -e is
passed. That leads to two possible leaves in the tree, but you have
three (i.e. stable ==> revA ==> main).

Drop "stable" at all, so that each part can be reached with -e
"revA,main", -e "revA, alt", etc.

Think about to use links - they are supported, too.

>
> [parse_cfg] : Parsing config file /tmp/sw-description
>
> ERROR parser/parser.c : parse_cfg : 977 : ..exiting
>
> ERROR core/parser.c : parse : 164 : no parser available to parse
> sw-description!
>
> ERROR core/stream_interface.c : extract_files : 165 : Compatible SW not
> found
>
> Image invalid or corrupted. Not installing ...
>
> [network_initializer] : Main thread sleep again !
>
> Waiting for requests...
>
> ERROR mongoose/mongoose_interface.c : upload_handler : 369 : Writing to
> IPC fails due to Broken pipe
>
> Please let me know if any further information is required, I look
> forward to discussing this with someone, thanks, Helios.
>

Best regards,
Stefano Babic


--
=====================================================================
DENX Software Engineering GmbH, Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, 82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=====================================================================

Helios Lyons

unread,
Jun 24, 2022, 10:01:07 AM6/24/22
to swupdate
Thank you very much for your response, this has been very useful. I am unclear on one part; how I do I use the -e flag to signify that alt can be found in 2 places: under revA, and under revB? Is it ok to use consecutive -e statements like "-e revA,alt -e revB,alt"? 

Many thanks,
Helios

Stefano Babic

unread,
Jun 24, 2022, 10:21:52 AM6/24/22
to Helios Lyons, swupdate
Hi Helios,

On 24.06.22 16:01, Helios Lyons wrote:
> Thank you very much for your response, this has been very useful. I am
> unclear on one part; how I do I use the -e flag to signify that alt can
> be found in 2 places: under revA, and under revB? Is it ok to use
> consecutive -e statements like "-e revA,alt -e revB,alt"?

You can't, but you should have your own rule to switch between "main" or
"alt". Depending on this rule, you start swupdate accordingly.

Best regards,
Stefano Babic
> Phone: +49-8142-66989-53 <tel:+49%208142%206698953> Fax:
> +49-8142-66989-80 <tel:+49%208142%206698980> Email: sba...@denx.de
> =====================================================================
>
> --
> You received this message because you are subscribed to the Google
> Groups "swupdate" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to swupdate+u...@googlegroups.com
> <mailto:swupdate+u...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/swupdate/4b610ba5-1fae-4375-9d34-6f9513ab07f7n%40googlegroups.com
> <https://groups.google.com/d/msgid/swupdate/4b610ba5-1fae-4375-9d34-6f9513ab07f7n%40googlegroups.com?utm_medium=email&utm_source=footer>.
Message has been deleted

Helios Lyons

unread,
Jun 24, 2022, 10:55:11 AM6/24/22
to swupdate
Hello, I have implemented a temporary workaround, but am still not managing to get the update to work. It includes the changes you suggest, and a script implementation to make sure the right -e path is added: 

if [ $currentbootpart = 2 ]
  then
    echo "Starting update server for ALT" &> /dev/kmsg
    currentAltVersion=$(cat /etc/hwrevision)
    if [ currentAltVersion == "$remora revA" ]
    then
      (/usr/bin/swupdate -N 5.0.2 -l 5 -k /etc/swupdate/swupdate-public.pem -w '-r /var/www/swupdate -p 9998' -e revA,alt -p 'reboot') &> /dev/kmsg &
    else
      (/usr/bin/swupdate -N 5.0.2 -l 5 -k /etc/swupdate/swupdate-public.pem -w '-r /var/www/swupdate -p 9998' -e revB,alt -p 'reboot') &> /dev/kmsg &
    fi
  // And same for MAIN update server after this 

However when trying to upload, I receive the following error, which makes me believe my issue is still with the layout of the sw-description file.
ERROR parser/parser.c : parser : 949 : Found nothing to install

As such, what layout is required for the parser to correctly recognise my revisions? Here is the one I am currently using:

boardname = {
    revA: {
        main: {
          # Main contents: images, files, scripts, bootenv
        }
       alt: {
          # Alt contents: images, files, scripts, bootenv
        }

    revB: {
        main: {
          # Main contents: images, files, scripts, bootenv
        }
       alt: {
          # Alt contents: images, files, scripts, bootenv
        }
    }
}

Apologies for the many questions, thank you for answering,
Helios
On Friday, 24 June 2022 at 15:28:48 UTC+1 Helios Lyons wrote:
My current script works like this:
if [ $currentbootpart = 2 ]
  then
    echo "Starting update server for ALT" &> /dev/kmsg
    (/usr/bin/swupdate -N X.X.X-l 5 -k /etc/swupdate/swupdate-public.pem -w '-r /var/www/swupdate -p 9998' -e alt,revB -e alt,revA -p 'reboot') &> /dev/kmsg &
  else
    echo "Starting update server for MAIN" &> /dev/kmsg
    (/usr/bin/swupdate -N X.X.X -l 5 -k /etc/swupdate/swupdate-public.pem -w '-r /var/www/swupdate -p 9998' -e main,revA -e main,revB -p 'reboot') &> /dev/kmsg &
  fi

What I don't understand, is that while I already start ALT and MAIN separately, I need to create 2 branches in alt - one for revA, and one for revB. I do not see how to do this with -e if I cannot make 2 statements, as I need to declare 2 paths ( in this case: ALT,revB  AND ALT,revA ). Would you have any recommendations for internal mechanisms I could use to do this?

Looking forward to hearing from you,
Helios
Reply all
Reply to author
Forward
0 new messages