Failure on set with fw_env.config in yaml format

242 views
Skip to first unread message

Dietrich

unread,
Sep 23, 2023, 5:55:59 AM9/23/23
to swup...@googlegroups.com
Hi,

when fw_env.config is in yaml format, set_env fails.


File: uboot.c

do_env_set() calls

bootloader_initialize(*ctx = NULL)    // this is OK ... calls

        libuboot_initialize // ctx is initialized

        libuboot.read_config( with initialized ctx )

                -> read_config reads yaml only when ctx is NULL

                -> tries to read as list -> fails


Maybe it's better to rename the fw_env.config to fw_env.config.yml in
case of yaml format?

Thanks

Dietrich

Stefano Babic

unread,
Sep 23, 2023, 6:24:24 AM9/23/23
to Dietrich, swup...@googlegroups.com
Hi Dietrich,

On 23.09.23 11:55, Dietrich wrote:
> Hi,
>
> when fw_env.config is in yaml format, set_env fails.
>
>
> File: uboot.c
>
> do_env_set() calls
>
> bootloader_initialize(*ctx = NULL)    // this is OK ... calls
>
>         libuboot_initialize // ctx is initialized
>
>         libuboot.read_config( with initialized ctx )
>
>                 -> read_config reads yaml only when ctx is NULL
>
>                 -> tries to read as list -> fails
>

I cannot replicate this issue and it works on my site flawlessly. I have
a fw_env.config in yaml format with two namespaces. I can set and get
variables using fw_[print|set]env, I do not see any issue.

Best regards,
Stefano Babic

Dietrich

unread,
Sep 23, 2023, 11:55:17 AM9/23/23
to Stefano Babic, swup...@googlegroups.com

Hi, Stefano,

I tested again on the imx8-Board. fw_printenv and fw_setenv work successfull.

swupdate writes the new image, but is not able to set the uboot settings.

Here a log.

The lines marked with "PPPPPPP" are printfs in uboot_env.c (libuboot_read_config_ext).

You see calls with parse_yaml_config, which are OK.

But there are again calls with result -1 showing up on Line 1659: if(ndev == 0) - which is true.

> /usr/bin/swupdate -e stable,root_A -f /etc/swupdate.cfg --image /tmp/image-xxx-mx8mm.swu
[DEBUG] : SWUPDATE running :  [read_module_settings] : No config settings found for module logcolors
[DEBUG] : SWUPDATE running :  [read_module_settings] : No config settings found for module processes
SWUpdate v954e8c0
Licensed under GPLv2. See source distribution for detailed copyright notices.
[TRACE] : SWUPDATE running :  [print_registered_bootloaders] : Registered bootloaders:
[TRACE] : SWUPDATE running :  [print_registered_bootloaders] :  uboot   loaded.
[TRACE] : SWUPDATE running :  [print_registered_bootloaders] :  none    loaded.
[INFO ] : SWUPDATE running :  [main] : Using default bootloader interface: uboot
[INFO ] : SWUPDATE running :  [main] : Running on kontron-mx8mm Revision 1
[INFO ] : SWUPDATE running :  [print_registered_handlers] : Registered handlers:
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     dummy
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     archive
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     tar
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     uboot
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     bootloader
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     flash
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     diskformat
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     diskpart
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     toggleboot
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     gptswap
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     gptpart
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     raw
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     rawfile
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     shellscript
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     preinstall
[INFO ] : SWUPDATE running :  [print_registered_handlers] :     postinstall
[DEBUG] : SWUPDATE running :  [parse_image_selector] : Parsing selector: stable,root_A
[INFO ] : SWUPDATE running :  [main] : software set: stable mode: root_A
[DEBUG] : SWUPDATE running :  [read_module_settings] : No config settings found for module versions
[TRACE] : SWUPDATE running :  [network_initializer] : Main loop daemon
[TRACE] : SWUPDATE running :  [listener_create] : got no socket at /tmp/swupdateprog from systemd
[TRACE] : SWUPDATE running :  [listener_create] : creating socket at /tmp/swupdateprog
[TRACE] : SWUPDATE running :  [listener_create] : got no socket at /tmp/sockinstctrl from systemd
[TRACE] : SWUPDATE running :  [listener_create] : creating socket at /tmp/sockinstctrl
[TRACE] : SWUPDATE running :  [network_thread] : Incoming network request: processing...
[INFO ] : SWUPDATE started :  Software Update started !
[TRACE] : SWUPDATE running :  [network_initializer] : Software update started
[TRACE] : SWUPDATE running :  [extract_file_to_tmp] : Found file
[TRACE] : SWUPDATE running :  [extract_file_to_tmp] :   filename sw-description
[TRACE] : SWUPDATE running :  [extract_file_to_tmp] :   size 2946
[DEBUG] : SWUPDATE running :  [parse_cfg] : Parsing config file /tmp/sw-description
[TRACE] : SWUPDATE running :  [get_common_fields] : Version 0.0.3-dev
[TRACE] : SWUPDATE running :  [parse_hw_compatibility] : Accepted Hw Revision : 1
[TRACE] : SWUPDATE running :  [_parse_files] : Found File: fitImage --> /fitImage_A (/dev/mmcblk0p1)
[TRACE] : SWUPDATE running :  [_parse_files] : Found compressed File: image-xxx-mx8mm.tar.gz --> / (/dev/mmcblk0p2)
[TRACE] : SWUPDATE running :  [_parse_scripts] : Found Script: pre_post_script.sh
[TRACE] : SWUPDATE running :  [parse] : Number of found artifacts: 2
[TRACE] : SWUPDATE running :  [parse] : Number of scripts: 1
[TRACE] : SWUPDATE running :  [parse] : Number of steps to be run: 4
[TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware kontron-mx8mm Revision: 1
[TRACE] : SWUPDATE running :  [check_hw_compatibility] : Hardware compatibility verified
[DEBUG] : SWUPDATE running :  [preupdatecmd] : Running Pre-update command
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename pre_post_script.sh
[TRACE] : SWUPDATE running :  [extract_files] :         size 3050 required
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename fitImage
[TRACE] : SWUPDATE running :  [extract_files] :         size 9790596 required
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename image-hdm-java-bootfs-kontron-mx8mm-ked-kirkstone.tar.gz
[TRACE] : SWUPDATE running :  [extract_files] :         size 19107527 Not required: skipping
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename u-boot-initial-env-kontron-mx8mm
[TRACE] : SWUPDATE running :  [extract_files] :         size 6257 Not required: skipping
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename flash.bin
[TRACE] : SWUPDATE running :  [extract_files] :         size 1278800 Not required: skipping
[TRACE] : SWUPDATE running :  [extract_files] : Found file
[TRACE] : SWUPDATE running :  [extract_files] :         filename image-xxx-mx8mm.tar.gz
[TRACE] : SWUPDATE running :  [extract_files] :         size 178332249 required
[TRACE] : SWUPDATE running :  [extract_padding] : Expecting 296 padding bytes at end-of-file
[TRACE] : SWUPDATE running :  [network_initializer] : Valid image found: copying to FLASH
PPPPPPP ndev == 0
PPPPPPP return retval=-1
[ERROR] : SWUPDATE failed [0] ERROR uboot.c : bootloader_initialize : 47 : Configuration file /etc/fw_env.config wrong or corrupted
PPPPPPP ndev == 0
PPPPPPP return retval=-1
[ERROR] : SWUPDATE failed [0] ERROR uboot.c : bootloader_initialize : 47 : Configuration file /etc/fw_env.config wrong or corrupted
[WARN ] : SWUPDATE running :  [update_transaction_state] : Cannot persistently store in_progress update state.
[INFO ] : SWUPDATE running :  Installation in progress
[TRACE] : SWUPDATE running :  [read_lines_notify] : call do_preinst
[TRACE] : SWUPDATE running :  [read_lines_notify] : PPPPPPP parse_yaml_config=0
[TRACE] : SWUPDATE running :  [read_lines_notify] : PPPPPPP parse_yaml_config=0
[TRACE] : SWUPDATE running :  [read_lines_notify] : preinstall
[TRACE] : SWUPDATE running :  [read_lines_notify] : current partition /dev/mmcblk0p3
[TRACE] : SWUPDATE running :  [read_lines_notify] : Deleting old rootfs: /dev/mmcblk0p2
[TRACE] : SWUPDATE running :  [read_lines_notify] : Set Fallback root partition to B
[TRACE] : SWUPDATE running :  [read_lines_notify] : Set active root partition to A with Fallback on B
[TRACE] : SWUPDATE running :  [__run_cmd] : /tmp/scripts/pre_post_script.sh preinst  command returned 0
[TRACE] : SWUPDATE running :  [install_single_image] : Found installer for stream image-xxx-mx8mm.tar.gz archive
[TRACE] : SWUPDATE running :  [install_archive_image] : Installing file image-xxx-mx8mm.tar.gz on /tmp/datadst//, ignoring attributes
[TRACE] : SWUPDATE running :  [install_single_image] : Found installer for stream fitImage rawfile
[TRACE] : SWUPDATE running :  [install_raw_file] : Installing file fitImage on /tmp/datadst//fitImage_A
[TRACE] : SWUPDATE running :  [read_lines_notify] : call post
[TRACE] : SWUPDATE running :  [read_lines_notify] : postinstall
[TRACE] : SWUPDATE running :  [__run_cmd] : /tmp/scripts/pre_post_script.sh postinst  command returned 0
PPPPPPP ndev == 0
PPPPPPP return retval=-1
[ERROR] : SWUPDATE failed [0] ERROR uboot.c : bootloader_initialize : 47 : Configuration file /etc/fw_env.config wrong or corrupted
PPPPPPP ndev == 0
PPPPPPP return retval=-1
[ERROR] : SWUPDATE failed [0] ERROR uboot.c : bootloader_initialize : 47 : Configuration file /etc/fw_env.config wrong or corrupted
[WARN ] : SWUPDATE running :  [update_transaction_state] : Cannot persistently store installed update state.
[ERROR] : SWUPDATE failed [0] ERROR stream_interface.c : network_initializer : 672 : Cannot persistently store INSTALLED update state.
[ERROR] : SWUPDATE failed [1] Installation failed !
[TRACE] : SWUPDATE running :  [network_initializer] : Main thread sleep again !
[INFO ] : No SWUPDATE running :  Waiting for requests...
[ERROR] : SWUPDATE failed [0] ERROR install_from_file.c : endupdate : 55 : SWUpdate *failed* !


Am 23.09.23 um 12:24 schrieb Stefano Babic:

Stefano Babic

unread,
Sep 23, 2023, 12:50:19 PM9/23/23
to Dietrich, Stefano Babic, swup...@googlegroups.com
Hi Dietrich,

On 23.09.23 17:55, Dietrich wrote:
> Hi, Stefano,
>
> I tested again on the imx8-Board. fw_printenv and fw_setenv work
> successfull.
>
> swupdate writes the new image, but is not able to set the uboot settings.
>

SWUpdate is not yet updated to support the new format and the namespaces
that new format allows.

Best regards,
Stefano Babic
> --
> 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/2078d20d-70b9-b61f-0557-ded9ec956808%40mail-ft.de <https://groups.google.com/d/msgid/swupdate/2078d20d-70b9-b61f-0557-ded9ec956808%40mail-ft.de?utm_medium=email&utm_source=footer>.

Frieder Schrempf

unread,
Oct 9, 2023, 9:16:16 AM10/9/23
to swupdate
Hi Stefano,

Stefano Babic schrieb am Samstag, 23. September 2023 um 18:50:19 UTC+2:
Hi Dietrich,

On 23.09.23 17:55, Dietrich wrote:
> Hi, Stefano,
>
> I tested again on the imx8-Board. fw_printenv and fw_setenv work
> successfull.
>
> swupdate writes the new image, but is not able to set the uboot settings.
>

SWUpdate is not yet updated to support the new format and the namespaces
that new format allows.

Can you point out what is missing in SWUpdate to support the new format and namespaces?
As SWUpdate calls into libubootenv I would have expected this to work out of the box. Do you have an idea what needs to be done to get it working?

Thanks
Frieder

Stefano Babic

unread,
Oct 9, 2023, 10:15:17 AM10/9/23
to Frieder Schrempf, swupdate
Hi Frieder,

On 09.10.23 15:16, Frieder Schrempf wrote:
> Hi Stefano,
>
> Stefano Babic schrieb am Samstag, 23. September 2023 um 18:50:19 UTC+2:
>
> Hi Dietrich,
>
> On 23.09.23 17:55, Dietrich wrote:
> > Hi, Stefano,
> >
> > I tested again on the imx8-Board. fw_printenv and fw_setenv work
> > successfull.
> >
> > swupdate writes the new image, but is not able to set the uboot
> settings.
> >
>
> SWUpdate is not yet updated to support the new format and the
> namespaces
> that new format allows.
>
>
> Can you point out what is missing in SWUpdate to support the new format
> and namespaces?

First at all, I am working on. I am testing, I am not yet ready to push
patches to ML.

Frankly speking, support to new format is the least. This is just a
single patch for changing initialization, that's all.


However, I like to support different namespaces to have also
application's related variables that don't touch bootloader's env. This
requires some changes, because the parser needs a new section ("vars" is
what I draft), that can be used by application, but also by SWupdate if
there is something to be recorded after a restart (there is a use case
with Hawkbit, for example):

So I will support into sw-description:
bootenv: (
.....
// these are bootloader environment

}
vars: (
name = ...
value = ..
// this are stored on a separate namespace
// that should be configured in SWUpdate
)

As I said, I have mostly implemented, I am also working on to solve
Hawkbit's issue (action-id) with the introduced namespace, but this is
just WIP.

I could also start to post patches for review, the part related to
namespaces and vars is ready and already tested by me.

> As SWUpdate calls into libubootenv I would have expected this to work
> out of the box.

It never work with an open source project. I can raise the hand and say
that something should be done, but then I need a customer helping me to
work on and to finance the development. But I have this now, so it is
just WIP.

> Do you have an idea what needs to be done to get it working?

See above.

Best regards,
Stefano

Stefano Babic

unread,
Oct 9, 2023, 11:24:42 AM10/9/23
to Frieder Schrempf, swupdate
By the way, I already posted the fix for new format:


https://patchwork.ozlabs.org/project/swupdate/patch/20231004080725.165...@swupdate.org/

I have just merged now.

Best regards,
Stefano

Frieder Schrempf

unread,
Oct 12, 2023, 9:42:59 AM10/12/23
to swupdate
Hi Stefano,

Awesome, thanks!
 

Best regards,
Stefano

>
>> As SWUpdate calls into libubootenv I would have expected this to work
>> out of the box.
>
> It never work with an open source project. I can raise the hand and say
> that something should be done, but then I need a customer helping me to
> work on and to finance the development. But I have this now, so it is
> just WIP.

Thats all right. I didn't want to blame or put any pressure on you. I know well enough that there are no obligations arising from this.
I was simply asking to see if I could understand or fix the problem myself. I wasn't aware that you are already working on it!

Thanks for all the effort!

Best regards
Frieder
Reply all
Reply to author
Forward
0 new messages