[Skiboot] [PATCH 34/40] external/boot_tests: add arbitrary lid option -F

Stewart Smith stewart at linux.vnet.ibm.com
Mon Oct 10 19:44:15 AEDT 2016


From: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>

There are situations where we want to flash a lid that isn't neither
BOOTKERNEL nor PAYLOAD. That's the case for CAPP, to test secure and
trusted boot patches we need to flash CAPP with different secure boot
headers.

This adds the -F option for BMC targets that can be used to flash an
arbitrary lid.

Example: '-F CAPP:cappucode.bin.sec.ecc' will flash CAPP partition with
cappucode.bin.sec.ecc

The eyecatch for each partition is defined in
https://github/open-power/pnor.git

Signed-off-by: Claudio Carvalho <cclaudio at linux.vnet.ibm.com>
Signed-off-by: Stewart Smith <stewart at linux.vnet.ibm.com>
---
 external/boot-tests/bmc_support.sh | 14 +++++++++++++-
 external/boot-tests/boot_test.sh   | 16 ++++++++++++++--
 2 files changed, 27 insertions(+), 3 deletions(-)

diff --git a/external/boot-tests/bmc_support.sh b/external/boot-tests/bmc_support.sh
index f28c610..e28ce7f 100644
--- a/external/boot-tests/bmc_support.sh
+++ b/external/boot-tests/bmc_support.sh
@@ -55,7 +55,10 @@ function flash {
 	if [ "${LID[1]}" != "" ]; then
 		remotecp ${LID[1]} $target /tmp/bootkernel
 	fi
-	
+	if [ "${arbitrary_lid[1]}" != "" ]; then
+		remotecp ${arbitrary_lid[1]} $target /tmp/$(basename ${arbitrary_lid[1]})
+	fi
+
 	if [ "$?" -ne "0" ] ; then
 		error "Couldn't copy firmware image";
 	fi
@@ -94,6 +97,15 @@ function flash {
                         error "An unexpected pflash error has occurred";
                 fi
         fi
+
+	if [ ! -z "${arbitrary_lid[0]}" -a ! -z "${arbitrary_lid[1]}" ] ; then
+		msg "Flashing ${arbitrary_lid[0]} PNOR partition"
+		$SSHCMD "$PFLASH_BINARY -e -f -P ${arbitrary_lid[0]} -p /tmp/$(basename ${arbitrary_lid[1]})"
+                if [ "$?" -ne "0" ] ; then
+                        error "An unexpected pflash error has occurred";
+		fi
+	fi
+
 }
 
 function boot_firmware {
diff --git a/external/boot-tests/boot_test.sh b/external/boot-tests/boot_test.sh
index 4ad869c..88b4e69 100755
--- a/external/boot-tests/boot_test.sh
+++ b/external/boot-tests/boot_test.sh
@@ -136,6 +136,7 @@ There are three usage modes.
 
 3) boot_test.sh [-vdp] -b bmc -t target -P pnor
    boot_test.sh [-vdp] -b bmc -t target [-1 PAYLOAD] [-2 BOOTKERNEL]
+   boot_test.sh [-vdp] -b bmc -t target [-F eyecatcher:lid ]
    boot_test.sh [-vdp] -b fsp -t target [-1 lid1] [-2 lid2] [-3 lid3]
 
      Flash the given firmware before boot testing.
@@ -143,7 +144,8 @@ There are three usage modes.
      For a BMC target, -P specifies a full PNOR.
 
      For a BMC target, -1/-2 specify the PAYLOAD and BOOTKERNEL PNOR partitions
-     respectively. Only the given partitions will be flashed.
+     respectively; -e specifies the partition name for -3.
+     Only the given partitions will be flashed.
 
      For an FSP target, -1/-2/-3 specify lids. Any combination of lids is
      acceptable.
@@ -185,12 +187,14 @@ firmware_supplied=0;
 target=""
 method=""
 PNOR=""
+arbitrary_lid[0]=""
+arbitrary_lid[1]=""
 LID[0]=""
 LID[1]=""
 LID[2]=""
 keep_log_success=0
 keep_log_failure=0
-while getopts "kKhvdpB1:2:3:P:t:b:" OPT; do
+while getopts "kKhvdpB1:2:3:P:t:b:F:" OPT; do
     case "$OPT" in
 	v)
 	    V=1;
@@ -234,6 +238,14 @@ while getopts "kKhvdpB1:2:3:P:t:b:" OPT; do
 	    fi
 	    PNOR="$OPTARG"
 	    ;;
+	F)
+	    firmware_supplied=1;
+	    arbitrary_lid[0]=`echo "$OPTARG" | cut -s -f1 -d:`;
+	    arbitrary_lid[1]=`echo "$OPTARG" | cut -s -f2 -d:`;
+	    if [ -z "${arbitrary_lid[0]}" -o -z "${arbitrary_lid[1]}" ] ; then
+		error "-F must be in the format eyecatcher:lid, e.g. GARD:gard.bin";
+	    fi
+	    ;;
 	t)
 	    target=$OPTARG;
 	    ;;
-- 
2.7.4



More information about the Skiboot mailing list