summaryrefslogtreecommitdiffstats
path: root/src/build/hwpf
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2012-10-17 15:50:20 -0500
committerA. Patrick Williams III <iawillia@us.ibm.com>2012-11-09 08:27:55 -0600
commitc5d3f875c2f5daec90556edead0d4af8c7ff5470 (patch)
treec44bb7e20b6887cb9f85ec4475d3734843d0af91 /src/build/hwpf
parente8ed2240c44d6dc2988db0c9bb4a5d9d8ce4093e (diff)
downloadtalos-hostboot-c5d3f875c2f5daec90556edead0d4af8c7ff5470.tar.gz
talos-hostboot-c5d3f875c2f5daec90556edead0d4af8c7ff5470.zip
prcd_compile: Support to take a directory as input
Enhance prcd_compile.tcl and prcd_server.tcl scripts to take a -D <dir> option and build all files (recursively) under that directory. Unknown and duplicate files will be ignored. Allows the user to point to an eKB sandbox and build a hostboot image with all hwp code in that sandbox. Change-Id: I7d99dd0ef94d4aba32db925c672cfdd71a83cfb7 RTC: 35267 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/2084 Tested-by: Jenkins Server Reviewed-by: Andrew J. Geissler <andrewg@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build/hwpf')
-rwxr-xr-xsrc/build/hwpf/prcd_compile.tcl89
-rwxr-xr-xsrc/build/hwpf/prcd_server.tcl125
2 files changed, 148 insertions, 66 deletions
diff --git a/src/build/hwpf/prcd_compile.tcl b/src/build/hwpf/prcd_compile.tcl
index c36ce64c2..739b789aa 100755
--- a/src/build/hwpf/prcd_compile.tcl
+++ b/src/build/hwpf/prcd_compile.tcl
@@ -1,26 +1,26 @@
#!/bin/sh
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/build/hwpf/prcd_compile.tcl $
+# $Source: src/build/hwpf/prcd_compile.tcl $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
# The next line is executed by /bin/sh, but not tcl \
exec tclsh "$0" "$@"
@@ -263,9 +263,10 @@ proc start_patch_server_on_fsp { fspip fsppassword } {
set userid $::env(USER)
set home $::env(HOME)
set domain [exec hostname -d]
-set version "1.2"
+set version "1.3"
set files [list]
+set directories [list]
set cmds [list]
set servers [list gfw160.austin.ibm.com]
@@ -279,6 +280,7 @@ foreach arg $argv {
flag {
switch -glob -- $arg {
-quit { set cmds [list quit] }
+ -D { set state directory }
-d { set state driverflag }
# NOT SUPPORTED -s { set state fspflag }
# NOT SUPPORTED -p { set state portflag }
@@ -286,9 +288,9 @@ foreach arg $argv {
-o { set state outputflag }
-n { set newfiles 1 }
-k { set keepsandbox 1 }
- -*h* { puts {prcd_compile.tcl [--help] [-d <drivername>] [-o <ouput dir> ] [-n] <filename> }
+ -*h* { puts {prcd_compile.tcl [--help] [-d <drivername>] [-o <ouput dir> ] [-n] [ <filename> | -D <directory] }
puts {}
- puts {Note this tool only supports *.{c,C,h,H,initfile,xml} files in the following hostboot directory trees: }
+ puts {For existing files, this only supports *.{c,C,h,H,initfile,xml} files in the following hostboot directory trees: }
puts { src/usr/hwpf/hwp }
puts { src/include/usr/hwpf/hwp }
puts {}
@@ -299,7 +301,7 @@ foreach arg $argv {
puts {> prcd_compile.tcl -d b0218a_2012_Sprint9 -o ./output/ proc_cen_framelock.C }
puts {> prcd_compile.tcl -d b0218a_2012_Sprint9 -o output dmi_training/proc_cen_framelock/proc_cen_framelock.H }
puts {}
- puts {Without the -n parameter, the file MUST be existing files in the hostboot sandbox.}
+ puts {Without the -n parameter, the file MUST be an existing files in the hostboot sandbox.}
puts {If they are not found in the sandbox, an error will be returned.}
puts {}
puts {On success, files from the img/ directory (*.bin *.syms and hbotStringFile) }
@@ -307,9 +309,14 @@ foreach arg $argv {
puts {}
puts {With the -n parameter, the files are assumed to be for a NEW HWP and will be checked to see}
puts {if they compile - no binary image files will be returned.}
- puts {examples }
+ puts {example }
puts {> prcd_compile.tcl -n mss_l3.C mss_l3.H}
puts {}
+ puts {With the -D parameter, all files in all sub-directories are built.}
+ puts {Without the -n, any files that do not exist in the hostboot sandbox are ignored.}
+ puts {example }
+ puts {> prcd_compile.tcl -D centaur/working/procedues/ -D p8/working/procedures}
+ puts {}
puts {The -d and -o parameters are optional. Default for -d is the master level of code }
puts {and default for -o is the current working directory }
puts {}
@@ -328,10 +335,14 @@ foreach arg $argv {
}
}
driverflag {
- #lappend cmds ":DRIVER $arg"
set driver $arg
set state flag
}
+ directory {
+ lappend directories $arg
+ set directory 1
+ set state flag
+ }
fspflag {
foreach {fspip fsp_port} [split $arg :] break
set state flag
@@ -411,38 +422,46 @@ if {[info exists keepsandbox]} {
lappend cmds ":DRIVER $driver"
if {[info exists newfiles]} {
+ set hwp_file_cmd ":HWP_FILE_NEW"
+} else {
+ set hwp_file_cmd ":HWP_FILE"
+}
- # NEW HWP file(s)
+if {[info exists directory]} {
+ # all valid files in directories
+ lappend cmds ":HWP_FULL_DIRECTORY"
##########################################################
# Generate command to send each input file
##########################################################
- foreach filen $files {
-
+ foreach dirn $directories {
+ set filelist [ exec find $dirn \( -name CVS -prune \) , -type f -name "*\.xml" -o -name "*\.initfile" -o -iname "*\.C" -o -iname "*\.H" ]
+ foreach filen $filelist {
set file_size [file size $filen]
set filesource($filen) $filen
- lappend cmds ":HWP_FILE_NEW $filen $file_size"
+ lappend cmds "$hwp_file_cmd $filen $file_size"
+ }
}
- ##########################################################
- # Generate compile and complete directives
- ##########################################################
- lappend cmds ":HWP_COMPILE_NEW"
- lappend cmds ":HWP_DONE"
-
} else {
- # existing file(s)
-
##########################################################
# Generate command to send each input file
##########################################################
foreach filen $files {
-
set file_size [file size $filen]
set filesource($filen) $filen
- lappend cmds ":HWP_FILE $filen $file_size"
+ lappend cmds "$hwp_file_cmd $filen $file_size"
}
+}
+
+if {[info exists newfiles]} {
+ ##########################################################
+ # Generate compile and complete directives
+ ##########################################################
+ lappend cmds ":HWP_COMPILE_NEW"
+ lappend cmds ":HWP_DONE"
+} else {
##########################################################
# Generate compile, retrieve, and complete directives
@@ -519,6 +538,8 @@ if {[llength $cmds] > 0 } {
fcopy $sockid $fp -size $c
close $fp
fconfigure $sockid -translation auto
+ } elseif {[regexp {.*INFO: .*} $line ->] } {
+ puts "$line"
} elseif {[regexp {.*ERROR:.*} $line ->] } {
puts stderr "Error in server script - $line"
set error 1
diff --git a/src/build/hwpf/prcd_server.tcl b/src/build/hwpf/prcd_server.tcl
index e717474f9..20ee37a26 100755
--- a/src/build/hwpf/prcd_server.tcl
+++ b/src/build/hwpf/prcd_server.tcl
@@ -1,25 +1,25 @@
-# IBM_PROLOG_BEGIN_TAG
-# This is an automatically generated prolog.
+# IBM_PROLOG_BEGIN_TAG
+# This is an automatically generated prolog.
#
-# $Source: src/build/hwpf/prcd_server.tcl $
+# $Source: src/build/hwpf/prcd_server.tcl $
#
-# IBM CONFIDENTIAL
+# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011-2012
+# COPYRIGHT International Business Machines Corp. 2011,2012
#
-# p1
+# p1
#
-# Object Code Only (OCO) source materials
-# Licensed Internal Code Source Materials
-# IBM HostBoot Licensed Internal Code
+# Object Code Only (OCO) source materials
+# Licensed Internal Code Source Materials
+# IBM HostBoot Licensed Internal Code
#
-# The source code for this program is not published or other-
-# wise divested of its trade secrets, irrespective of what has
-# been deposited with the U.S. Copyright Office.
+# The source code for this program is not published or otherwise
+# divested of its trade secrets, irrespective of what has been
+# deposited with the U.S. Copyright Office.
#
-# Origin: 30
+# Origin: 30
#
-# IBM_PROLOG_END_TAG
+# IBM_PROLOG_END_TAG
# the next line restarts using tclsh\
exec tclsh "$0" "$@"
@@ -29,7 +29,7 @@ exec tclsh "$0" "$@"
# Based on if_server.tcl by Doug Gilbert
-set version "1.2"
+set version "1.3"
############################################################################
# Accept is called when a new client request comes in
@@ -65,6 +65,7 @@ proc AquireData { sock } {
global running
global driver
global keepsandbox
+ global fulldirectory
if { [eof $sock] || [catch {gets $sock line}] } {
puts "ERROR: Client closed unexpectedly"
@@ -113,8 +114,8 @@ proc AquireData { sock } {
################################################################
# Open the hw procedure file in the hw procedure directory
################################################################
- puts $log "$sock: Input File $b $c"
- flush $log
+ #puts $log "$sock: Input File $b $c"
+ #flush $log
if { ![info exists sbname($sock)] } {
puts $sock "ERROR: No sandbox found"
@@ -132,30 +133,81 @@ proc AquireData { sock } {
set src_path $sb_dir/$sbname($sock)/src/usr/hwpf/hwp
set inc_path $sb_dir/$sbname($sock)/src/include/usr/hwpf/hwp
- # we can't just find -name $b because that won't find path/filename. -wholename does
- # that, but we need the $b to not have any ./ prefix if the user included that.
+ if { $fulldirectory == 1 } {
+ set filename [file tail $b]
+ } else {
+ set filename $b
+ }
+ # we can't just find -name $filename because that won't find path/filename. -wholename does
+ # that, but we need the $filename to not have any ./ prefix if the user included that.
# additionally, find usually outputs the file(s) separated by a newline. if there
# is a filename that's not unique, we need to flag that as an erorr, so we use the
# -printf to force them all onto 1 line.
- set filen [ exec find $src_path $inc_path -type f -wholename */[ string trimleft $b "./" ] -printf "%p\t" ]
+ set filen [ exec find $src_path $inc_path -type f -wholename */[ string trimleft $filename "./" ] -printf "%p\t" ]
# and then truncate the last \t. yeah, hackish..
set filen [ string trimright $filen "\t" ]
- #puts $log "$sock: find found in sandbox: \"$filen\""
+ #puts $log "$sock: find found in hostboot sandbox: \"$filen\""
# error if filen is not just 1 file
set filesfound [regexp -all {[^\t]+} $filen ]
if { $filesfound == 0 } {
- puts $sock "ERROR: Invalid Input File - $b - file not found in sandbox"
- puts $log "$sock: Invalid Input File - $b - file not found in sandbox"
+ if { $fulldirectory == 1 } {
+ # do nothing..
+ puts $log "$sock: Ignoring Input File - $filename - file not found in hostboot sandbox"
+ puts $sock "Ignoring Input File - $filename - file not found in hostboot sandbox"
+ # read the file and just throw it away
+ if {[catch {set devnull [open "/dev/null" w] } res ] } {
+ puts $sock "ERROR: Server can't open /dev/null"
+ puts $log "$sock: Server can't open /dev/null"
+ CloseOut $sock
+ } else {
+ fconfigure $devnull -translation binary
+ fconfigure $sock -translation binary
+ fcopy $sock $devnull -size $c
+ close $devnull
+ fconfigure $sock -translation auto
+ puts $sock ":DONE"
+ puts $log "$sock: DONE"
+ flush $log
+ }
+ return
+ } else {
+ puts $sock "ERROR: Invalid Input File - $filename - file not found in hostboot sandbox"
+ puts $log "$sock: Invalid Input File - $filename - file not found in hostboot sandbox"
CloseOut $sock
return
+ }
}
if { $filesfound > 1 } {
- puts $sock "ERROR: Invalid Input File - $b - filename NOT unique in sandbox"
- puts $log "$sock: Invalid Input File - $b - filename NOT unique in sandbox"
+ if { $fulldirectory == 1 } {
+ # do nothing..
+ puts $log "$sock: Ignoring Input File - $filename - file not unique in hostboot sandbox"
+ puts $sock "Ignoring Input File - $filename - file not unique in hostboot sandbox"
+ # read the file and just throw it away
+ if {[catch {set devnull [open "/dev/null" w] } res ] } {
+ puts $sock "ERROR: Server can't open /dev/null"
+ puts $log "$sock: Server can't open /dev/null"
+ CloseOut $sock
+ } else {
+ fconfigure $devnull -translation binary
+ fconfigure $sock -translation binary
+ fcopy $sock $devnull -size $c
+ close $devnull
+ fconfigure $sock -translation auto
+ puts $sock ":DONE"
+ puts $log "$sock: DONE"
+ flush $log
+ }
+ return
+ } else {
+ puts $sock "ERROR: Invalid Input File - $filename - filename NOT unique in hostboot sandbox"
+ puts $log "$sock: Invalid Input File - $filename - filename NOT unique in hostboot sandbox"
CloseOut $sock
return
+ }
}
+ puts $sock "INFO: Input File - $filename - found in hostboot sandbox"
+ puts $log "$sock: INFO: Input File - $filename - found in hostboot sandbox"
# Open with create/overwrite option
if {[catch {set hwpfile($sock) [open "$filen" w+] } res ] } {
puts $sock "ERROR: Server can't open $filen"
@@ -186,8 +238,8 @@ proc AquireData { sock } {
################################################################
# Open the hw procedure file in the hw procedure directory
################################################################
- puts $log "$sock: Input New File $b $c"
- flush $log
+ #puts $log "$sock: Input New File $b $c"
+ #flush $log
if { ![info exists sbname($sock)] } {
puts $sock "ERROR: No sandbox found"
@@ -200,13 +252,15 @@ proc AquireData { sock } {
# determine the path to the file in the git sandbox
################################################################
set newdir $sb_dir/$sbname($sock)/src/usr/hwpf/hwp/mss_new
- set filen $newdir/$b
+ set basename [file tail $b]
+ set filen $newdir/$basename
if {![file exists $newdir]} {
#puts $log "$sock: mkdir \"$newdir\""; flush $log
eval {exec} "mkdir -p $newdir"
}
- #puts $log "$sock: writing filen: \"$filen\""; flush $log
+ puts $sock "INFO: Using File - $b"
+ puts $log "$sock: INFO: Using File - $b"
# Open with create/overwrite option
if {[catch {set hwpfile($sock) [open "$filen" w+] } res ] } {
puts $sock "ERROR: Server can't open $filen"
@@ -263,6 +317,13 @@ proc AquireData { sock } {
puts $log "$sock: DONE"
flush $sock
}
+ } elseif {[string compare $line ":HWP_FULL_DIRECTORY"] == 0} {
+ puts $log "$sock: HWP_FULL_DIRECTORY"
+ puts $log "$sock: DONE"
+ puts $sock ":DONE"
+ flush $log
+ flush $sock
+ set fulldirectory 1
} elseif {[string compare $line ":HWP_DONE"] == 0} {
puts $sock ":DONE"
puts $log "$sock: DONE"
@@ -644,9 +705,11 @@ proc SendFiles { sock files } {
set forever 1
#set base_dir "./"
set base_dir "/tmp"
-set logfile "$base_dir/prcd_server.log"
+set home_dir $::env(HOME)
+set logfile "$home_dir/prcd_server.log"
set log {}
set keepsandbox 0
+set fulldirectory 0
# Where are we running?
foreach {host site c d} [split [exec hostname] .] break
@@ -665,8 +728,6 @@ array set sandbox {
array set backing {}
-puts "Logfile: $logfile"
-
if { [file exists $logfile] } {
set log [open "$logfile" a]
} else {
OpenPOWER on IntegriCloud