summaryrefslogtreecommitdiffstats
path: root/src/build/hwpf
diff options
context:
space:
mode:
authorBrian Horton <brianh@linux.ibm.com>2013-01-31 17:02:16 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-04-08 13:32:05 -0500
commita51af3d19142343cb500fbd78cd8eddebe074c91 (patch)
tree375119ee7f08aca8b5b780c50661cbb1164bab11 /src/build/hwpf
parent29ed4694a5a55efbb245acbd75d9f38eb10d232e (diff)
downloadtalos-hostboot-a51af3d19142343cb500fbd78cd8eddebe074c91.tar.gz
talos-hostboot-a51af3d19142343cb500fbd78cd8eddebe074c91.zip
add PNOR support to prcd_compile
. update prcd_server.tcl script to create PNOR files and ship them back to the client. . added option to prcd_compile.tcl for user to specifiy the fips level/build separatly from the hostboot build . add 'fipssetup' option to the hb tool, so that sandbox is created, but simics patches are processed. Change-Id: Ie720d820d61435954085395525e77d276ff5bbd0 RTC: 34097 Reviewed-on: http://gfw160.austin.ibm.com:8080/gerrit/3075 Tested-by: Jenkins Server Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build/hwpf')
-rwxr-xr-xsrc/build/hwpf/prcd_compile.tcl42
-rwxr-xr-xsrc/build/hwpf/prcd_server.tcl153
2 files changed, 149 insertions, 46 deletions
diff --git a/src/build/hwpf/prcd_compile.tcl b/src/build/hwpf/prcd_compile.tcl
index 739b789aa..0815ea46b 100755
--- a/src/build/hwpf/prcd_compile.tcl
+++ b/src/build/hwpf/prcd_compile.tcl
@@ -6,7 +6,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011,2012
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
# p1
#
@@ -263,7 +263,7 @@ proc start_patch_server_on_fsp { fspip fsppassword } {
set userid $::env(USER)
set home $::env(HOME)
set domain [exec hostname -d]
-set version "1.3"
+set version "1.4"
set files [list]
set directories [list]
@@ -282,13 +282,14 @@ foreach arg $argv {
-quit { set cmds [list quit] }
-D { set state directory }
-d { set state driverflag }
+ -f { set state fipslevelflag }
# NOT SUPPORTED -s { set state fspflag }
# NOT SUPPORTED -p { set state portflag }
-v { set verbose 1 }
-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> | -D <directory] }
+ -*h* { puts {prcd_compile.tcl [--help] [-f <fipslevel> | -d <drivername>] [-o <ouput dir> ] [-n] [ <filename> | -D <directory] }
puts {}
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 }
@@ -297,9 +298,9 @@ foreach arg $argv {
puts {The files can either be in the local current working directory, or in a local sub-directory mirroring the hostboot tree. }
puts {}
puts {examples }
- puts {> prcd_compile.tcl -d b0218a_2012_Sprint9 -o ./output fapiTestHwp.C fapiTestHwp.C sample.initfile}
- 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 {> prcd_compile.tcl -d hb0216a_1307.810 -o ./output fapiTestHwp.C fapiTestHwp.C sample.initfile}
+ puts {> prcd_compile.tcl -d hb0216a_1307.810 -o ./output/ proc_cen_framelock.C }
+ puts {> prcd_compile.tcl -f b0211a_1307.810 -o output dmi_training/proc_cen_framelock/proc_cen_framelock.H }
puts {}
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.}
@@ -338,6 +339,10 @@ foreach arg $argv {
set driver $arg
set state flag
}
+ fipslevelflag {
+ set fipslevel $arg
+ set state flag
+ }
directory {
lappend directories $arg
set directory 1
@@ -400,18 +405,13 @@ if { [info exists fspip] } {
}
-if { ![info exists driver] } {
- # default to the master for the driver
- set driver "master"
-}
-
if { ![info exists output_dir] } {
# default to PWD for output
set output_dir "./"
}
# Make the output directory
-eval {exec} "mkdir -p $output_dir"
+eval {exec} "mkdir -p $output_dir/pnor"
lappend cmds ":INFO userid $userid version $version"
@@ -419,7 +419,15 @@ if {[info exists keepsandbox]} {
lappend cmds ":INFO keepsandbox"
}
-lappend cmds ":DRIVER $driver"
+if { ![info exists driver] } {
+ set driver "default"
+}
+
+if { ![info exists fipslevel] } {
+ set fipslevel "default"
+}
+
+lappend cmds ":DRIVER $fipslevel $driver"
if {[info exists newfiles]} {
set hwp_file_cmd ":HWP_FILE_NEW"
@@ -538,6 +546,14 @@ if {[llength $cmds] > 0 } {
fcopy $sockid $fp -size $c
close $fp
fconfigure $sockid -translation auto
+ } elseif {[regexp {^:PNOR_FILE +(.+) +(.+)\n*} $line a b c] } {
+ fconfigure $sockid -translation binary
+ lappend xfer_file_list $b
+ set fp [open "$output_dir/pnor/$b" w]
+ fconfigure $fp -translation binary
+ fcopy $sockid $fp -size $c
+ close $fp
+ fconfigure $sockid -translation auto
} elseif {[regexp {.*INFO: .*} $line ->] } {
puts "$line"
} elseif {[regexp {.*ERROR:.*} $line ->] } {
diff --git a/src/build/hwpf/prcd_server.tcl b/src/build/hwpf/prcd_server.tcl
index 20ee37a26..84aa371b0 100755
--- a/src/build/hwpf/prcd_server.tcl
+++ b/src/build/hwpf/prcd_server.tcl
@@ -5,7 +5,7 @@
#
# IBM CONFIDENTIAL
#
-# COPYRIGHT International Business Machines Corp. 2011,2012
+# COPYRIGHT International Business Machines Corp. 2011,2013
#
# p1
#
@@ -29,7 +29,7 @@ exec tclsh "$0" "$@"
# Based on if_server.tcl by Doug Gilbert
-set version "1.3"
+set version "1.4"
############################################################################
# Accept is called when a new client request comes in
@@ -65,7 +65,9 @@ proc AquireData { sock } {
global running
global driver
global keepsandbox
+ global client_version
global fulldirectory
+ global fips_dir
if { [eof $sock] || [catch {gets $sock line}] } {
puts "ERROR: Client closed unexpectedly"
@@ -78,16 +80,42 @@ proc AquireData { sock } {
puts $log "$sock: hw procedure compiler server is terminating"
CloseOut $sock
set forever 0
- } elseif {[regexp {:DRIVER +(.+)} $line a b] } {
+ } elseif {[regexp {:DRIVER +(.+) +(.+)} $line a b c] } {
################################################################
# Make a unique sandbox backed to the driver specified
# Do a workon to the sandbox.
################################################################
- set driver $b
- set release ""
- puts $log "$sock: Input driver $driver"
- flush $log
+ set fipslevel $b
+ set driver $c
+ puts $log "$sock: Input: fipslevel \"$fipslevel\", driver \"$driver\""
+
+ # if either is default, determine proper.
+ if {[string compare $fipslevel "default"] == 0} {
+ if {[string compare $driver "default"] == 0} {
+ set driver master
+ }
+ } else {
+ set lvl [ string trimleft $fipslevel 'abcdefghijklmnopqrstuvwxyz0123456789_' ]
+ set lvl [ string trimleft $lvl '.' ]
+ set fips_dir "/esw/fips$lvl/Builds/$fipslevel/"
+ if {[string compare $driver "default"] == 0} {
+ # use the fips build to determine the hostboot driver
+ set fips_notes "$fips_dir/src/hbfw/releaseNotes.html"
+ if { [catch {set driver [ exec sed -n "s%<h1>Level: %%p" $fips_notes ] } ] } {
+ puts $sock "ERROR: bad FIPS level - can't find $fips_notes\n"
+ puts $log "$sock: bad FIPS level - can't find $fips_notes\n)"
+ flush $log
+ CloseOut $sock
+ return
+ } else {
+ set pos [ string last "</h1>" $driver ]
+ incr pos -1
+ set driver [ string range $driver 0 $pos ]
+ }
+ }
+ }
+ puts $log "$sock: Using: fipslevel \"$fipslevel\", driver \"$driver\""
################################################################
# create git repository
@@ -96,6 +124,7 @@ proc AquireData { sock } {
puts $sock "$sbname($sock)"
puts $log "$sock: $sbname($sock)"
+ flush $log
# Make sure sandbox dir exists
if {[catch {file mkdir "$sb_dir/$sbname($sock)"} res ] } {
@@ -109,6 +138,7 @@ proc AquireData { sock } {
ExtractSandbox $sock $git_sh($sock)
}
+
} elseif {[regexp {:HWP_FILE +(.+) +(.+)} $line a b c] } {
################################################################
@@ -317,6 +347,14 @@ proc AquireData { sock } {
puts $log "$sock: DONE"
flush $sock
}
+ if { [catch {SendPnorFiles $sock "$sb_dir/$sbname($sock)/prcd_fsp/obj/ppc/hbfw/img"} res]} {
+ puts $log "$sock: ERROR: SendPnorFiles interrupted: $res\n"
+ flush $log
+ } else {
+ puts $sock ":DONE"
+ puts $log "$sock: DONE"
+ flush $sock
+ }
} elseif {[string compare $line ":HWP_FULL_DIRECTORY"] == 0} {
puts $log "$sock: HWP_FULL_DIRECTORY"
puts $log "$sock: DONE"
@@ -329,14 +367,16 @@ proc AquireData { sock } {
puts $log "$sock: DONE"
CloseOut $sock
set line ""
- } elseif {[regexp {:INFO +(.+)} $line a b] } {
+ } elseif {[regexp {:INFO keepsandbox} $line a] } {
puts $sock ":DONE"
- puts $log "$sock: $b"
- if {[regexp {keepsandbox} $b aa] } {
- set keepsandbox 1
- } else {
- set keepsandbox 0
- }
+ puts $log "$sock: $a"
+ set keepsandbox 1
+ flush $sock
+ flush $log
+ } elseif {[regexp {:INFO userid +(.+) version +(.+)} $line a b c ] } {
+ puts $sock ":DONE"
+ puts $log "$sock: $a"
+ set client_version $c
flush $sock
flush $log
} else {
@@ -381,10 +421,8 @@ proc CloseOut { sock } {
unset socklist(addr,$sock)
if {[info exists git_sh($sock)] } {
if { $keepsandbox != 1 } {
- # Comment out next line to avoid deleting the sandbox
eval {exec} "rm -rf $sb_dir/$sbname($sock)"
}
- eval {exec} "rm -rf $sb_dir/$sbname($sock)"
unset git_sh($sock)
#unset sandbox($sbname($sock))
}
@@ -411,8 +449,8 @@ proc ExtractSandbox { sock git_sh} {
############################################################
puts $git_sh "cd $sb_dir/$sbname($sock)"
puts $git_sh {git init}
- puts $git_sh {git remote add gerrit ssh://gfw160.austin.ibm.com:29418/hostboot}
- puts $git_sh {unlog}
+ puts $git_sh {git remote add gerrit ssh://jenkins.localhost/hostboot}
+ #puts $git_sh {git remote add gerrit ssh://hostboot.gerrit/hostboot}
puts $git_sh {git fetch gerrit}
puts $git_sh {git fetch gerrit --tags}
@@ -431,13 +469,13 @@ proc ExtractSandbox { sock git_sh} {
flush $git_sh
############################################################
- ## if the git_sh is not done by 30 sec, it probably crashed
+ ## if the git_sh is not done by 60 sec, it probably crashed
## keep a list of running sandboxes
## hopefully processes timeout in the same order they were started
- ## Kick off an event that waits 30 sec then executes
+ ## Kick off an event that waits 60 sec then executes
############################################################
lappend running $sbname($sock)
- set timoutid [after 30000 {
+ set timoutid [after 60000 {
set sandbox([lindex $running 0]) crashed
lreplace $running 0 0
} ]
@@ -481,11 +519,29 @@ proc SendSandbox { sock git_sh} {
global running
global sbname
global log
+ global fips_dir
##################################################################
# Start Compile
##################################################################
- puts $git_sh "source env.bash; make -j4"
+
+ if {[string length $fips_dir ] > 0} {
+ # need to overwrite bbuild
+ puts $git_sh "echo $fips_dir > src/build/citest/etc/bbuild;"
+ }
+
+ puts $git_sh "source env.bash;\
+ make -j4;"
+
+ # hack for now. need to point to 'current' version of hb, not built, since
+ # older versions doesn't support the new fipssetup command.
+ # when this is ready merge, i'll copy the corrected 'hb' into the hostboot
+ # projects directory.
+ puts $git_sh "rm -f hb;ln -s /gsa/ausgsa/home/h/o/hortonb/hb2/src/build/tools/hb;"
+
+ puts $git_sh "export SANDBOXROOT=`pwd`; export SANDBOXNAME=prcd_fsp;\
+ echo \"./hb fipssetup && ./hb prime\" > hbdo; chmod +x hbdo;\
+ SHELL=./hbdo ./hb workon;"
##################################################################
# tell the workon shell to terminate
@@ -494,13 +550,13 @@ proc SendSandbox { sock git_sh} {
flush $git_sh
##################################################################
- ## if the git_sh is not done by 360 sec, it probably crashed
+ ## if the git_sh is not done by 600 sec, it probably crashed
## keep a list of running sandboxes
## hopefully processes timeout in the same order they were started
## Kick off an event that waits 360 sec then executes
##################################################################
lappend running $sbname($sock)
- set timoutid [after 360000 {
+ set timoutid [after 600000 {
set sandbox([lindex $running 0]) crashed
lreplace $running 0 0
} ]
@@ -555,13 +611,13 @@ proc SendSandboxNew { sock git_sh} {
flush $git_sh
##################################################################
- ## if the git_sh is not done by 360 sec, it probably crashed
+ ## if the git_sh is not done by 600 sec, it probably crashed
## keep a list of running sandboxes
## hopefully processes timeout in the same order they were started
- ## Kick off an event that waits 360 sec then executes
+ ## Kick off an event that waits 600 sec then executes
##################################################################
lappend running $sbname($sock)
- set timoutid [after 360000 {
+ set timoutid [after 600000 {
set sandbox([lindex $running 0]) crashed
lreplace $running 0 0
} ]
@@ -665,14 +721,43 @@ proc IfResult { git_sh sock sbname_sock } {
proc SendObjFiles { sock obj_dir } {
global log
- set hbi_files {}
+ set img_files {}
# Send the image files
- if {[catch {set hbi_files [glob -dir $obj_dir hbi*syms hbi*bin hbi*list hbi*modinfo *pnor *dat hbotStringFile errlparser isteplist.csv]} res]} {
+ if {[catch {set img_files [glob -dir $obj_dir hbi*syms hbi*list hbi*modinfo *pnor *dat hbotStringFile errlparser isteplist.csv]} res]} {
puts $sock "ERROR: Needed image files not found in $obj_dir"
puts $log "$sock: Needed image files not found in $obj_dir"
} else {
- SendFiles $sock $hbi_files
+ SendFiles "OBJ_FILE" $sock $img_files
+ }
+
+ flush $sock
+ flush $log
+}
+
+##################################################################
+# back to the client
+##################################################################
+proc SendPnorFiles { sock obj_dir } {
+ global log
+ global version
+ global client_version
+
+ set pnor_files {}
+
+ # Send the image files
+ if {[catch {set pnor_files [glob -dir $obj_dir hostboot.header.bin hostboot_extended.bin hostboot.stage.bin]} res]} {
+ puts $sock "ERROR: Needed image files not found in $obj_dir"
+ puts $log "$sock: Needed image files not found in $obj_dir"
+ } else {
+ if { $client_version < $version } {
+ # client can't handle PNOR_FILE type, so just send the files
+ # back and they'll get put into the <outputdir>
+ SendFiles "OBJ_FILE" $sock $pnor_files
+ } else {
+ # tell client to put these in <outputdir>/pnor
+ SendFiles "PNOR_FILE" $sock $pnor_files
+ }
}
flush $sock
@@ -682,13 +767,13 @@ proc SendObjFiles { sock obj_dir } {
##################################################################
# Send a file to the client
##################################################################
-proc SendFiles { sock files } {
+proc SendFiles { type sock files } {
global log
foreach f $files {
set size [file size $f]
- puts $sock ":OBJ_FILE [file tail $f] $size"
- puts $log "$sock: :OBJ_FILE [file tail $f] $size"
+ puts $sock ":$type [file tail $f] $size"
+ puts $log "$sock: :$type [file tail $f] $size"
fconfigure $sock -translation binary
set fp [open $f r]
fconfigure $fp -translation binary
@@ -709,7 +794,9 @@ set home_dir $::env(HOME)
set logfile "$home_dir/prcd_server.log"
set log {}
set keepsandbox 0
+set client_version 0
set fulldirectory 0
+set fips_dir ""
# Where are we running?
foreach {host site c d} [split [exec hostname] .] break
OpenPOWER on IntegriCloud