2015-01-08 21:08:48 +00:00
|
|
|
##
|
|
|
|
# Load files needed by the scenario via TFTP
|
|
|
|
#
|
|
|
|
# \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
|
2019-05-27 18:28:18 +00:00
|
|
|
# instead of only /offset_dir is used
|
|
|
|
# \param --load-tftp-copy-files avoid creating links in tftp dir by making
|
|
|
|
# copies instead
|
2015-01-08 21:08:48 +00:00
|
|
|
#
|
|
|
|
|
|
|
|
source [genode_dir]/tool/run/load.inc
|
2018-02-27 13:46:44 +00:00
|
|
|
source [genode_dir]/tool/run/load/pxe.inc
|
2015-01-08 21:08:48 +00:00
|
|
|
|
|
|
|
|
|
|
|
##
|
|
|
|
# The files are loaded implicitly via TFTP to the target machine
|
|
|
|
#
|
|
|
|
proc run_load { } {
|
|
|
|
global load_spawn_id
|
|
|
|
set load_spawn_id -1
|
|
|
|
return true
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
proc load_tftp_base_dir { } { return [get_cmd_arg --load-tftp-base-dir ""] }
|
|
|
|
|
|
|
|
|
|
|
|
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] }
|
|
|
|
|
|
|
|
|
2019-05-27 18:28:18 +00:00
|
|
|
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"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-01-08 21:08:48 +00:00
|
|
|
##
|
|
|
|
# Generate pulsar config file used for loading files from TFTP
|
|
|
|
#
|
|
|
|
proc generate_tftp_config { } {
|
|
|
|
set tftp_base_dir [load_tftp_base_dir]
|
|
|
|
set tftp_offset_dir [load_tftp_offset_dir]
|
|
|
|
|
|
|
|
if {[string length $tftp_base_dir] > 0 && [string length $tftp_offset_dir] > 0} {
|
2015-07-10 16:54:22 +00:00
|
|
|
|
|
|
|
# if the link target exists as directory this leads to bad behavior
|
|
|
|
if {[file exists $tftp_base_dir$tftp_offset_dir] &&
|
|
|
|
[string compare [file type $tftp_base_dir$tftp_offset_dir] "directory"] == 0} {
|
|
|
|
|
|
|
|
puts stderr "Error: TFTP symlink target $tftp_base_dir$tftp_offset_dir is a directory"
|
|
|
|
exit -1
|
|
|
|
}
|
2015-01-08 21:08:48 +00:00
|
|
|
exec ln -nfs "[pwd]" "$tftp_base_dir$tftp_offset_dir"
|
|
|
|
|
|
|
|
set tftp_base ""
|
|
|
|
if {[load_tftp_use_absolute]} {
|
|
|
|
set tftp_base $tftp_base_dir
|
|
|
|
}
|
|
|
|
|
|
|
|
set fh [open "$tftp_base_dir$tftp_offset_dir/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"]
|
|
|
|
puts $fh " root $tftp_base$tftp_offset_dir/[run_dir]"
|
|
|
|
puts $fh " config config-52-54-00-12-34-56"
|
|
|
|
close $fh
|
|
|
|
} else {
|
|
|
|
puts "Warning, TFTP base directory or TFTP offset directory not set."
|
|
|
|
}
|
|
|
|
}
|