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.
This commit is contained in:
Alexander Boettcher 2013-06-14 10:59:52 +02:00 committed by Norman Feske
parent 1b60fd6147
commit e5eeda2ec9
5 changed files with 30 additions and 40 deletions

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}

View File

@ -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
}