From 23e3079f468fe80f361617f56774d3e07b1c46c5 Mon Sep 17 00:00:00 2001 From: Tomasz Gajewski Date: Mon, 27 May 2019 20:28:18 +0200 Subject: [PATCH] tool/run: option to copy tftp served files Fixes #3386 --- tool/run/boot_dir/foc | 6 +++--- tool/run/boot_dir/hw | 6 +++--- tool/run/boot_dir/sel4 | 6 +++--- tool/run/load/tftp | 19 ++++++++++++++++++- 4 files changed, 27 insertions(+), 10 deletions(-) diff --git a/tool/run/boot_dir/foc b/tool/run/boot_dir/foc index cbd20ea74d..bd67d9f990 100644 --- a/tool/run/boot_dir/foc +++ b/tool/run/boot_dir/foc @@ -191,15 +191,15 @@ proc run_boot_dir_arm { binaries } { puts "\nboot image: [run_dir]/image.elf\n" - # set symbolic link to image.elf file in TFTP directory for PXE boot + # install image.elf file in TFTP directory for PXE boot if {[have_include "load/tftp"]} { set tftp_base_dir [load_tftp_base_dir] set tftp_offset_dir [load_tftp_offset_dir] exec mkdir -p $tftp_base_dir$tftp_offset_dir - exec ln -sf [pwd]/[run_dir]/boot/image.elf $tftp_base_dir$tftp_offset_dir + exec {*}[load_tftp_inst_cmd] [pwd]/[run_dir]/boot/image.elf $tftp_base_dir$tftp_offset_dir if {[have_include "image/uboot"]} { - exec ln -sf [pwd]/[run_dir]/uImage $tftp_base_dir$tftp_offset_dir/uImage + exec {*}[load_tftp_inst_cmd] [pwd]/[run_dir]/uImage $tftp_base_dir$tftp_offset_dir/uImage } } } diff --git a/tool/run/boot_dir/hw b/tool/run/boot_dir/hw index 6507413ab3..01d4261ec6 100644 --- a/tool/run/boot_dir/hw +++ b/tool/run/boot_dir/hw @@ -148,12 +148,12 @@ proc run_boot_dir {binaries} { run_image [run_dir]/boot/image.elf - # set symbolic link to image.elf file in TFTP directory for PXE boot + # install image.elf file in TFTP directory for PXE boot if {[expr [have_spec arm] || [have_spec arm_64]] && [have_include "load/tftp"]} { - exec ln -sf [run_dir]/boot/image.elf [load_tftp_base_dir][load_tftp_offset_dir] + exec {*}[load_tftp_inst_cmd] [run_dir]/boot/image.elf [load_tftp_base_dir][load_tftp_offset_dir] if {[have_include "image/uboot"]} { - exec ln -sf [pwd]/[run_dir]/uImage [load_tftp_base_dir][load_tftp_offset_dir] + exec {*}[load_tftp_inst_cmd] [pwd]/[run_dir]/uImage [load_tftp_base_dir][load_tftp_offset_dir] } } diff --git a/tool/run/boot_dir/sel4 b/tool/run/boot_dir/sel4 index 42571f224d..8eb7951864 100644 --- a/tool/run/boot_dir/sel4 +++ b/tool/run/boot_dir/sel4 @@ -119,12 +119,12 @@ proc run_boot_dir {binaries} { run_image [run_dir]/boot/image.elf - # set symbolic link to image.elf file in TFTP directory for PXE boot + # install image.elf file in TFTP directory for PXE boot if {[have_spec arm] && [have_include "load/tftp"]} { - exec ln -sf [pwd]/[run_dir]/boot/image.elf [load_tftp_base_dir][load_tftp_offset_dir] + exec {*}[load_tftp_inst_cmd] [pwd]/[run_dir]/boot/image.elf [load_tftp_base_dir][load_tftp_offset_dir] if {[have_include "image/uboot"]} { - exec ln -sf [pwd]/[run_dir]/uImage [load_tftp_base_dir][load_tftp_offset_dir] + exec {*}[load_tftp_inst_cmd] [pwd]/[run_dir]/uImage [load_tftp_base_dir][load_tftp_offset_dir] } } diff --git a/tool/run/load/tftp b/tool/run/load/tftp index dc4366d520..5e18cb2013 100644 --- a/tool/run/load/tftp +++ b/tool/run/load/tftp @@ -4,7 +4,9 @@ # \param --load-tftp-base-dir base directory of TFTP # \param --load-tftp-offset-dir offset directory within TFTP # \param --load-tftp-absolute path is absolute, i.e. /base_dir/offset_dir -# instead of only /offset_dir is used +# instead of only /offset_dir is used +# \param --load-tftp-copy-files avoid creating links in tftp dir by making +# copies instead # source [genode_dir]/tool/run/load.inc @@ -30,6 +32,21 @@ proc load_tftp_offset_dir { } { return [get_cmd_arg --load-tftp-offset-dir ""] } proc load_tftp_use_absolute { } { return [get_cmd_switch --load-tftp-absolute] } +proc load_tftp_copy_files { } { return [get_cmd_switch --load-tftp-copy-files] } + + +## +# Return command used to install files in tftp directory +# +proc load_tftp_inst_cmd { } { + if {[load_tftp_copy_files]} { + return "cp --remove-destination" + } else { + return "ln -sf" + } +} + + ## # Generate pulsar config file used for loading files from TFTP #