aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrian Woods2020-01-15 14:14:54 -0800
committerStefano Stabellini2020-01-16 15:42:06 -0800
commitc1260aac1547c97f31c590bfa384d1418228c49a (patch)
tree99c6cf4fb562075ead3facf723486c804845c82f
parent779a2203bad52ab786f371f77c8d25f0cb186bca (diff)
remove tmp files when finished
Currently there are tmp files left after the script is run. This keeps track of the files and deletes them when exiting. Signed-of-by: Brian Woods <brian.woods@xilinx.com> Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
-rw-r--r--scripts/uboot-script-gen12
1 files changed, 12 insertions, 0 deletions
diff --git a/scripts/uboot-script-gen b/scripts/uboot-script-gen
index 2232f7a..bb9ee36 100644
--- a/scripts/uboot-script-gen
+++ b/scripts/uboot-script-gen
@@ -3,6 +3,15 @@
offset=$((2*1024*1024))
filesize=0
prog_req=(mkimage file)
+tmp_files=()
+
+function remove_tmp_files()
+{
+ for i in "${tmp_files[@]}"
+ do
+ rm -f "$i"
+ done
+}
function add_device_tree_kernel()
{
@@ -125,6 +134,7 @@ function check_compressed_file_type()
if test $? == 0
then
local tmp=`mktemp`
+ tmp_files+=($tmp)
cat $filename | gunzip > $tmp
filename=$tmp
fi
@@ -275,6 +285,8 @@ echo "setenv fdt_high 0xffffffffffffffff" >> $UBOOT_SOURCE
echo "booti $xen_addr - $device_tree_addr" >> $UBOOT_SOURCE
mkimage -A arm64 -T script -C none -a $uboot_addr -e $uboot_addr -d $UBOOT_SOURCE "$UBOOT_SCRIPT" &> /dev/null
+remove_tmp_files
+
memaddr=$(( $MEMORY_END - $memaddr - $offset ))
if test $memaddr -lt 0
then