diff options
author | Tom Rini <trini@konsulko.com> | 2023-10-06 17:23:47 -0400 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-10-06 17:23:47 -0400 |
commit | 83aa0ed1e93e1ffac24888d98d37a5b04ed3fb07 (patch) | |
tree | fcabaf4a86164f385ede03b654bc69cbffb2a3ee /arch/sandbox/cpu/start.c | |
parent | be2abe73df58a35da9e8d5afb13fccdf1b0faa8e (diff) | |
parent | f69d3d6d10b15872a279aeb10b7c522627aff6c2 (diff) |
Merge branch '2023-10-06-spl-prepare-for-universal-payload'
To quote the author:
This series tidies up SPL a little and adds some core ofnode functions
needed to support Universal Payload. It also includes a few minor
fix-ups for sandbox.
For SPL the changes include CONFIG naming, removing various #ifdefs and
tidying up the FIT code.
One notable piece of the ofnode improvements is support for flattening a
livetree. This should be useful in future as we move FDT fixups to use
the ofnode API.
Diffstat (limited to 'arch/sandbox/cpu/start.c')
-rw-r--r-- | arch/sandbox/cpu/start.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 1026898727..2c8a72590b 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -272,17 +272,9 @@ SANDBOX_CMDLINE_OPT_SHORT(program, 'p', 1, "U-Boot program name"); static int sandbox_cmdline_cb_memory(struct sandbox_state *state, const char *arg) { - int err; - /* For now assume we always want to write it */ state->write_ram_buf = true; state->ram_buf_fname = arg; - - err = os_read_ram_buf(arg); - if (err) { - printf("Failed to read RAM buffer '%s': %d\n", arg, err); - return err; - } state->ram_buf_read = true; return 0; @@ -512,6 +504,17 @@ int sandbox_main(int argc, char *argv[]) if (os_parse_args(state, argc, argv)) return 1; + if (state->ram_buf_fname) { + ret = os_read_ram_buf(state->ram_buf_fname); + if (ret) { + printf("Failed to read RAM buffer '%s': %d\n", + state->ram_buf_fname, ret); + } else { + state->ram_buf_read = true; + log_debug("Read RAM buffer from '%s'\n", state->ram_buf_fname); + } + } + /* Remove old memory file if required */ if (state->ram_buf_rm && state->ram_buf_fname) { os_unlink(state->ram_buf_fname); @@ -519,9 +522,11 @@ int sandbox_main(int argc, char *argv[]) state->ram_buf_fname = NULL; } - ret = sandbox_read_state(state, state->state_fname); - if (ret) - goto err; + if (state->read_state && state->state_fname) { + ret = sandbox_read_state(state, state->state_fname); + if (ret) + goto err; + } if (state->handle_signals) { ret = os_setup_signal_handlers(); @@ -529,7 +534,7 @@ int sandbox_main(int argc, char *argv[]) goto err; } -#if CONFIG_VAL(SYS_MALLOC_F_LEN) +#if CONFIG_IS_ENABLED(SYS_MALLOC_F) gd->malloc_base = CFG_MALLOC_F_ADDR; #endif #if CONFIG_IS_ENABLED(LOG) |