diff options
Diffstat (limited to 'arch/sandbox/cpu')
-rw-r--r-- | arch/sandbox/cpu/os.c | 5 | ||||
-rw-r--r-- | arch/sandbox/cpu/start.c | 7 | ||||
-rw-r--r-- | arch/sandbox/cpu/state.c | 4 |
3 files changed, 12 insertions, 4 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index b56fa04a34..80996a91ce 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -790,6 +790,11 @@ int os_find_u_boot(char *fname, int maxlen) int os_spl_to_uboot(const char *fname) { + struct sandbox_state *state = state_get_current(); + + printf("%s\n", __func__); + /* U-Boot will delete ram buffer after read: "--rm_memory"*/ + state->ram_buf_rm = true; return os_jump_to_file(fname); } diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index fe494aef75..8322ed7a1f 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -457,6 +457,13 @@ int main(int argc, char *argv[]) if (os_parse_args(state, argc, argv)) return 1; + /* Remove old memory file if required */ + if (state->ram_buf_rm && state->ram_buf_fname) { + os_unlink(state->ram_buf_fname); + state->write_ram_buf = false; + state->ram_buf_fname = NULL; + } + ret = sandbox_read_state(state, state->state_fname); if (ret) goto err; diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 59f37fab0b..b2901b7a8c 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -415,10 +415,6 @@ int state_uninit(void) } } - /* Remove old memory file if required */ - if (state->ram_buf_rm && state->ram_buf_fname) - os_unlink(state->ram_buf_fname); - /* Delete this at the last moment so as not to upset gdb too much */ if (state->jumped_fname) os_unlink(state->jumped_fname); |