[PATCH 1/1] sandbox: keep time offset when resetting

Simon Glass sjg at chromium.org
Thu Jan 21 16:48:42 CET 2021


Hi Heinrich,

On Thu, 21 Jan 2021 at 02:19, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
>
> On 07.01.21 13:35, Simon Glass wrote:
> > Hi Heinrich,
> >
> > On Wed, 30 Dec 2020 at 10:07, Heinrich Schuchardt <xypron.glpk at gmx.de> wrote:
> >>
> >> The UEFI Self Certification Test (SCT) checks the SetTime() service with
> >> the following steps:
> >>
> >> * set date
> >> * reset
> >> * check date matches
> >>
> >> To be compliant the sandbox should keep the offset to the host RTC during
> >> resets. The implementation uses the environment variable
> >> UBOOT_SB_TIME_OFFSET to persist the offset.
> >>
> >> Signed-off-by: Heinrich Schuchardt <xypron.glpk at gmx.de>
> >> ---
> >>  arch/sandbox/cpu/os.c      | 25 +++++++++++++++++++++++++
> >>  doc/arch/sandbox.rst       |  7 +++++++
> >>  drivers/rtc/i2c_rtc_emul.c |  4 +++-
> >>  include/os.h               | 18 ++++++++++++++++++
> >>  4 files changed, 53 insertions(+), 1 deletion(-)
> >
> > Sandbox writes driver settings to a state file that can be read on
> > start-up. Is that suitable here?
>
> The sandbox only reads the state from file when using the -r and only
> writes the state to while when using the -w option.
>
> This should be documented in
> https://u-boot.readthedocs.io/en/latest/arch/sandbox.html?highlight=sandbox#command-line-options
>
> The RTC offset needs to be kept irrespective of command line arguments
> during resets. I could not find a simpler way then using an environment
> variable.

Given the way that reset works (relaunching the ELF app) I don't know
of a better way either. I suppose you could launch it with the RTC
offset as a command-line parameter?

>
> We could additionally persist the offset in the state file. Is this what
> you ask for? For my testing purposes I don't need it.

I don't think so. It is designed for passing driver / state
information between U-Boot phases. I suppose it should be used for
persisting state across reset too, since in principle the emulated
hardware does not change just because sandbox has reset. But in that
case we don't really need to write a file, just keep it in memory
somewhere. Or at most we could write a temporary file.

Reviewed-by: Simon Glass <sjg at chromium.org>

Regards,
Simon


More information about the U-Boot mailing list