From e5eeda2ec963392e73e1b85171f899facde7e775 Mon Sep 17 00:00:00 2001 From: Alexander Boettcher Date: Fri, 14 Jun 2013 10:59:52 +0200 Subject: [PATCH] run: support TFTP servers using absolute paths TFTP server requiring absolute directory names are supported (better) - specify in RUN_OPT "--tftp-absolute" to create Pulsar config with absolute path names for PXE boot. Additional a symbolic link is created from the build directory to "$PXE_TFTP_DIR_BASE$PXE_TFTP_DIR_OFFSET" automatically. This eases the use together with autopilot for x86. --- base-fiasco/run/env | 14 ++++++-------- base-foc/run/env | 14 ++++++-------- base-nova/run/env | 14 ++++++-------- base-okl4/run/env | 14 ++++++-------- base-pistachio/run/env | 14 ++++++-------- 5 files changed, 30 insertions(+), 40 deletions(-) diff --git a/base-fiasco/run/env b/base-fiasco/run/env index de957a25c..46a724d66 100644 --- a/base-fiasco/run/env +++ b/base-fiasco/run/env @@ -157,17 +157,15 @@ proc build_boot_image {binaries} { # Generate pulsar config file pointing to the config file above. # if {[info exists ::env(PXE_TFTP_DIR_BASE)] && [info exists ::env(PXE_TFTP_DIR_OFFSET)]} { - set len [string length $::env(PXE_TFTP_DIR_BASE)] - set tmp [string range [pwd] 0 $len-1] - # if PXE_TFTP_DIR_BASE is part of pwd (autopilot) we don't need DIR_OFFSET - if ([string match $tmp $::env(PXE_TFTP_DIR_BASE)]) { - set tftp_local_offset [string range [pwd] $len [string length [pwd]]] - } else { - set tftp_local_offset $::env(PXE_TFTP_DIR_OFFSET) + exec ln -nfs "[pwd]" "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)" + + set tftp_base "" + if {[get_cmd_switch --tftp-absolute]} { + set tftp_base $::env(PXE_TFTP_DIR_BASE) } set fh [open "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"] - puts $fh " root $tftp_local_offset/[run_dir]" + puts $fh " root $tftp_base$::env(PXE_TFTP_DIR_OFFSET)/[run_dir]" puts $fh " config config-52-54-00-12-34-56" close $fh } diff --git a/base-foc/run/env b/base-foc/run/env index 5b311e3b5..0c6fbad14 100644 --- a/base-foc/run/env +++ b/base-foc/run/env @@ -225,17 +225,15 @@ proc build_boot_image_x86 {binaries} { # Generate pulsar config file pointing to the config file above. # if {[info exists ::env(PXE_TFTP_DIR_BASE)] && [info exists ::env(PXE_TFTP_DIR_OFFSET)]} { - set len [string length $::env(PXE_TFTP_DIR_BASE)] - set tmp [string range [pwd] 0 $len-1] - # if PXE_TFTP_DIR_BASE is part of pwd (autopilot) we don't need DIR_OFFSET - if ([string match $tmp $::env(PXE_TFTP_DIR_BASE)]) { - set tftp_local_offset [string range [pwd] $len [string length [pwd]]] - } else { - set tftp_local_offset $::env(PXE_TFTP_DIR_OFFSET) + exec ln -nfs "[pwd]" "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)" + + set tftp_base "" + if {[get_cmd_switch --tftp-absolute]} { + set tftp_base $::env(PXE_TFTP_DIR_BASE) } set fh [open "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"] - puts $fh " root $tftp_local_offset/[run_dir]" + puts $fh " root $tftp_base$::env(PXE_TFTP_DIR_OFFSET)/[run_dir]" puts $fh " config config-52-54-00-12-34-56" close $fh } diff --git a/base-nova/run/env b/base-nova/run/env index a78beb3f1..0d1730287 100644 --- a/base-nova/run/env +++ b/base-nova/run/env @@ -101,17 +101,15 @@ proc build_boot_image {binaries} { # Generate pulsar config file pointing to the config file above. # if {[info exists ::env(PXE_TFTP_DIR_BASE)] && [info exists ::env(PXE_TFTP_DIR_OFFSET)]} { - set len [string length $::env(PXE_TFTP_DIR_BASE)] - set tmp [string range [pwd] 0 $len-1] - # if PXE_TFTP_DIR_BASE is part of pwd (autopilot) we don't need DIR_OFFSET - if ([string match $tmp $::env(PXE_TFTP_DIR_BASE)]) { - set tftp_local_offset [string range [pwd] $len [string length [pwd]]] - } else { - set tftp_local_offset $::env(PXE_TFTP_DIR_OFFSET) + exec ln -nfs "[pwd]" "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)" + + set tftp_base "" + if {[get_cmd_switch --tftp-absolute]} { + set tftp_base $::env(PXE_TFTP_DIR_BASE) } set fh [open "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"] - puts $fh " root $tftp_local_offset/[run_dir]" + puts $fh " root $tftp_base$::env(PXE_TFTP_DIR_OFFSET)/[run_dir]" puts $fh " config config-52-54-00-12-34-56" close $fh } diff --git a/base-okl4/run/env b/base-okl4/run/env index 99128319b..b3c3c4c1b 100644 --- a/base-okl4/run/env +++ b/base-okl4/run/env @@ -220,17 +220,15 @@ proc build_boot_image {binaries} { # Generate pulsar config file pointing to the config file above. # if {[info exists ::env(PXE_TFTP_DIR_BASE)] && [info exists ::env(PXE_TFTP_DIR_OFFSET)]} { - set len [string length $::env(PXE_TFTP_DIR_BASE)] - set tmp [string range [pwd] 0 $len-1] - # if PXE_TFTP_DIR_BASE is part of pwd (autopilot) we don't need DIR_OFFSET - if ([string match $tmp $::env(PXE_TFTP_DIR_BASE)]) { - set tftp_local_offset [string range [pwd] $len [string length [pwd]]] - } else { - set tftp_local_offset $::env(PXE_TFTP_DIR_OFFSET) + exec ln -nfs "[pwd]" "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)" + + set tftp_base "" + if {[get_cmd_switch --tftp-absolute]} { + set tftp_base $::env(PXE_TFTP_DIR_BASE) } set fh [open "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"] - puts $fh " root $tftp_local_offset/[run_dir]" + puts $fh " root $tftp_base$::env(PXE_TFTP_DIR_OFFSET)/[run_dir]" puts $fh " config config-52-54-00-12-34-56" close $fh } diff --git a/base-pistachio/run/env b/base-pistachio/run/env index 32ef731f4..3a23f3f80 100644 --- a/base-pistachio/run/env +++ b/base-pistachio/run/env @@ -136,17 +136,15 @@ proc build_boot_image {binaries} { # Generate pulsar config file pointing to the config file above. # if {[info exists ::env(PXE_TFTP_DIR_BASE)] && [info exists ::env(PXE_TFTP_DIR_OFFSET)]} { - set len [string length $::env(PXE_TFTP_DIR_BASE)] - set tmp [string range [pwd] 0 $len-1] - # if PXE_TFTP_DIR_BASE is part of pwd (autopilot) we don't need DIR_OFFSET - if ([string match $tmp $::env(PXE_TFTP_DIR_BASE)]) { - set tftp_local_offset [string range [pwd] $len [string length [pwd]]] - } else { - set tftp_local_offset $::env(PXE_TFTP_DIR_OFFSET) + exec ln -nfs "[pwd]" "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)" + + set tftp_base "" + if {[get_cmd_switch --tftp-absolute]} { + set tftp_base $::env(PXE_TFTP_DIR_BASE) } set fh [open "$::env(PXE_TFTP_DIR_BASE)$::env(PXE_TFTP_DIR_OFFSET)/config-00-00-00-00-00-00" "WRONLY CREAT TRUNC"] - puts $fh " root $tftp_local_offset/[run_dir]" + puts $fh " root $tftp_base$::env(PXE_TFTP_DIR_OFFSET)/[run_dir]" puts $fh " config config-52-54-00-12-34-56" close $fh }