summaryrefslogtreecommitdiffstats
path: root/arch/sandbox/cpu/state.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-02-27 13:26:23 -0700
committerSimon Glass <sjg@chromium.org>2014-03-17 20:05:49 -0600
commitab839dc3e6c1d07bc926199f3eebace0804f2ecf (patch)
tree831168b1d78c5ba25177e8baa78fad1c285b4a2e /arch/sandbox/cpu/state.c
parentffb87905cb3883c84598b87ca05384c17d59dee1 (diff)
downloadtalos-obmc-uboot-ab839dc3e6c1d07bc926199f3eebace0804f2ecf.tar.gz
talos-obmc-uboot-ab839dc3e6c1d07bc926199f3eebace0804f2ecf.zip
sandbox: Add options to clean up temporary files
When jumping from one sandbox U-Boot to another in sandbox, the RAM buffer is preserved in the jump by using a temporary file. Add an option to tell the receiving U-Boot to remove this file when it is no longer needed. Similarly the old U-Boot image is left behind in this case. We cannot delete it immediately since gdb cannot then find its debug symbols. Delete it just before exiting. Together these changes ensure that temporary files are removed both for memory and U-Boot. Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/cpu/state.c')
-rw-r--r--arch/sandbox/cpu/state.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index a145808a52..59adad653c 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -365,7 +365,7 @@ int state_uninit(void)
state = &main_state;
- if (state->write_ram_buf) {
+ if (state->write_ram_buf && !state->ram_buf_rm) {
err = os_write_ram_buf(state->ram_buf_fname);
if (err) {
printf("Failed to write RAM buffer\n");
@@ -380,6 +380,10 @@ int state_uninit(void)
}
}
+ /* Delete this at the last moment so as not to upset gdb too much */
+ if (state->jumped_fname)
+ os_unlink(state->jumped_fname);
+
if (state->state_fdt)
os_free(state->state_fdt);
memset(state, '\0', sizeof(*state));
OpenPOWER on IntegriCloud