[PATCH v8 4/8] sandbox: Add a -N flag to control on-host behaviour
Heinrich Schuchardt
xypron.glpk at gmx.de
Mon Oct 28 19:01:01 CET 2024
On 10/22/24 14:00, Simon Glass wrote:
> Sandbox is its own architecture, but sometimes we want to mimic the host
> architecture, e.g. when running an EFI app not built by U-Boot.
>
> Add a -N/--native flag which tells sandbox to reflect the architecture
> of the host.
>
> Signed-off-by: Simon Glass <sjg at chromium.org>
> ---
>
> Changes in v8:
> - Add new patch to control on-host behaviour
>
> arch/sandbox/cpu/start.c | 10 ++++++++++
> arch/sandbox/include/asm/state.h | 1 +
> 2 files changed, 11 insertions(+)
>
> diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
> index 81752edc9f8..2940768cd1c 100644
> --- a/arch/sandbox/cpu/start.c
> +++ b/arch/sandbox/cpu/start.c
> @@ -449,6 +449,16 @@ static void setup_ram_buf(struct sandbox_state *state)
> gd->ram_size = state->ram_size;
> }
>
> +static int sandbox_cmdline_cb_native(struct sandbox_state *state,
> + const char *arg)
> +{
> + state->native = true;
> +
> + return 0;
> +}
> +SANDBOX_CMDLINE_OPT_SHORT(native, 'N', 0,
> + "Use native mode (host-based EFI boot filename)");
We should not need an option for default behavior.
Please, turn the logic around to avoid users seeing unexpected results:
> +SANDBOX_CMDLINE_OPT_SHORT(non-compliant, 'N', 0,
> + "Non-compliant sandbox, for testing only");
Best regards
Heinrich
> +
> void state_show(struct sandbox_state *state)
> {
> char **p;
> diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
> index e7dc01759e8..dc21a623106 100644
> --- a/arch/sandbox/include/asm/state.h
> +++ b/arch/sandbox/include/asm/state.h
> @@ -101,6 +101,7 @@ struct sandbox_state {
> bool disable_eth; /* Disable Ethernet devices */
> bool disable_sf_bootdevs; /* Don't bind SPI flash bootdevs */
> bool upl; /* Enable Universal Payload (UPL) */
> + bool native; /* Adjust to reflect host arch */
>
> /* Pointer to information for each SPI bus/cs */
> struct sandbox_spi_info spi[CONFIG_SANDBOX_SPI_MAX_BUS]
More information about the U-Boot
mailing list