Hi,
> Christian and I discussed if we should simplify the state extraction
> after a failed update, i.e. when we booted the previous version again.
> bg_printenv will then report something like this:
>
>
> ----------------------------
> Config Partition #0 Values:
> in_progress: no
> revision: 2
> kernel: C:BOOT0:linux.efi
> kernelargs:
> watchdog timeout: 0 seconds
> ustate: 0 (OK)
>
> user variables:
>
>
>
> ----------------------------
> Config Partition #1 Values:
> in_progress: no
> revision: 0
> kernel: C:BOOT1:linux.efi
> kernelargs:
> watchdog timeout: 0 seconds
> ustate: 3 (FAILED)
>
> user variables:
>
>
> But there is no simple command to find out that we are not OK but rather
> back from a failed update. There is bg_printenv -o ustate -r -c, but
> that will only report USTATE=0. We don't have a nice way to query the
> "FAILED" state of the other env, only "bg_printenv | grep FAILED".
>
> Any ideas how to address that best?
In addition to $ bg_printenv -o ustate -r -c, there's also the
environment selector so that you can use something like this in
shell scripts, at least getting rid of the | grep:
for env in 0 1; do
eval "$(bg_printenv -o ustate -p $env --raw)"
case $USTATE in
0)
echo "OK"
;;
... whatever ...
esac
done
However, it's still (too much) pluming IMO. What about one bg_printenv
call that returns the values from *all* environments, e.g., [mockup]
$ bg_printenv -o ustate -p all --raw
ENV_COUNT=2
USTATE_0=0
USTATE_1=3
where the _<NUM> suffix is the config partition number and ENV_COUNT
gives the total config partition count? Otherwise, you have to know
or probe for the config partition count...
Kind regards,
Christian
--
Dr. Christian Storm
Siemens AG, Technology, T CED SES-DE
Otto-Hahn-Ring 6, 81739 München, Germany
--
You received this message because you are subscribed to the Google Groups "EFI
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/efibootguard-dev/20230221204750.gvp7x7yxrfbmfdd5%40cosmos.