summaryrefslogtreecommitdiff
path: root/arch/sandbox/cpu/start.c
diff options
context:
space:
mode:
authorPatrick Delaunay <patrick.delaunay@st.com>2020-11-20 09:48:33 +0100
committerSimon Glass <sjg@chromium.org>2021-01-05 12:24:41 -0700
commit10bb90fa30e6e4479a06982e074bb8b3b981301d (patch)
tree802c2765b93a333b850955e9b0dc16862414705e /arch/sandbox/cpu/start.c
parent941e6304f49d5f47d8802b521619d9ae481a3366 (diff)
sandbox: remove ram buffer file when U-Boot is loaded by SPL
Update management of "--rm_memory" sandbox's option and force this option when U-Boot is loaded by SPL in os_spl_to_uboot() and remove the ram file after reading in main() as described in option help message: "Remove memory file after reading". This patch avoids that the file "/tmp/u-boot.mem.XXXXXX" [created in os_jump_to_file() when U-Boot is loaded by SPL] is never deleted because state_uninit() is not called after U-Boot execution (CtrlC or with running pytest for example). This issue is reproduced by > build-sandbox_spl/spl/u-boot-spl and CtrlC in U-Bot console > make qcheck One temp file is created after each SPL and U-Boot execution (7 tims in qcheck after test_handoff.py, test_ofplatdata.py, test_spl.py execution). Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/cpu/start.c')
-rw-r--r--arch/sandbox/cpu/start.c7
1 files changed, 7 insertions, 0 deletions
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;