summaryrefslogtreecommitdiffstats
path: root/src/build
diff options
context:
space:
mode:
authorStephen Cprek <smcprek@us.ibm.com>2013-11-12 15:33:35 -0600
committerA. Patrick Williams III <iawillia@us.ibm.com>2013-12-12 16:15:53 -0600
commit07c9716fcf31ce5352ce412a643071ea89bd2ca1 (patch)
treecab98e95ad2fa2a34bd122e21d5ba49c49675c56 /src/build
parent1fe455d3400fd80d99176ad7f60a630ac7ce1b76 (diff)
downloadtalos-hostboot-07c9716fcf31ce5352ce412a643071ea89bd2ca1.tar.gz
talos-hostboot-07c9716fcf31ce5352ce412a643071ea89bd2ca1.zip
Handle Multiple TOCs and removed side code
Also added Hostboot Base image version header Change-Id: I0fc878a48b9449e5d4875fd14525faefe01b1ace RTC: 34764 Reviewed-on: http://gfw160.aus.stglabs.ibm.com:8080/gerrit/7276 Tested-by: Jenkins Server Reviewed-by: Brian H. Horton <brianh@linux.ibm.com> Reviewed-by: ADAM R. MUHLE <armuhle@us.ibm.com> Reviewed-by: Daniel M. Crowell <dcrowell@us.ibm.com> Reviewed-by: A. Patrick Williams III <iawillia@us.ibm.com>
Diffstat (limited to 'src/build')
-rwxr-xr-xsrc/build/buildpnor/buildpnor.pl63
-rwxr-xr-xsrc/build/mkrules/hbfw/img/makefile10
2 files changed, 45 insertions, 28 deletions
diff --git a/src/build/buildpnor/buildpnor.pl b/src/build/buildpnor/buildpnor.pl
index 4d0ee0465..a476f5d8c 100755
--- a/src/build/buildpnor/buildpnor.pl
+++ b/src/build/buildpnor/buildpnor.pl
@@ -150,17 +150,28 @@ if($rc != 0)
}
#create the PNOR image
-$rc = createPnorImage($tocVersion, $pnorBinName, \%pnorLayout);
+#two copies of TOC created at different offsets
+my $sideAOffset = $pnorLayout{metadata}{sideAOffset};
+my $sideBOffset = $pnorLayout{metadata}{sideBOffset};
+
+$rc = createPnorImage($tocVersion, $pnorBinName, \%pnorLayout, $sideAOffset);
+if($rc != 0)
+{
+ trace(0, "Error detected from call to createPnorImage() sideAOffset. Exiting");
+ exit 1;
+}
+
+$rc = createPnorImage($tocVersion, $pnorBinName, \%pnorLayout, $sideBOffset);
if($rc != 0)
{
- trace(0, "Error detected from call to createPnorImage(). Exiting");
+ trace(0, "Error detected from call to createPnorImage() sideBOffset. Exiting");
exit 1;
}
-$rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles);
+$rc = fillPnorImage($pnorBinName, \%pnorLayout, \%binFiles, $sideAOffset);
if($rc != 0)
{
- trace(0, "Error detected from call to fillPnorImage(). Exiting");
+ trace(0, "Error detected from call to fillPnorImage() sideAOffset. Exiting");
exit 1;
}
@@ -192,16 +203,19 @@ sub loadPnorLayout
my $imageSize = $metadataEl->{imageSize}[0];
my $blockSize = $metadataEl->{blockSize}[0];
my $sideAOffset = $metadataEl->{sideAOffset}[0];
+ my $sideBOffset = $metadataEl->{sideBOffset}[0];
- trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideAOffset=$sideAOffset");
+ trace(3, "$this_func: metadata: imageSize = $imageSize, blockSize=$blockSize, sideAOffset=$sideAOffset, sideBOffset=$sideBOffset");
$imageSize = getNumber($imageSize);
$blockSize = getNumber($blockSize);
$sideAOffset = getNumber($sideAOffset);
+ $sideBOffset = getNumber($sideBOffset);
$$i_pnorLayoutRef{metadata}{imageSize} = $imageSize;
$$i_pnorLayoutRef{metadata}{blockSize} = $blockSize;
$$i_pnorLayoutRef{metadata}{sideAOffset} = $sideAOffset;
+ $$i_pnorLayoutRef{metadata}{sideBOffset} = $sideBOffset;
}
#Iterate over the <section> elements.
@@ -247,12 +261,14 @@ sub loadPnorLayout
################################################################################
sub createPnorImage
{
- my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef) = @_;
+ my ($i_tocVersion, $i_pnorBinName, $i_pnorLayoutRef, $offset) = @_;
my $this_func = (caller(0))[3];
my $rc = 0;
my $key;
trace(4, "$this_func: >>Enter");
+ trace(1, "createPnorImage:: $offset");
+
#get Block size
my $blockSize = $$i_pnorLayoutRef{metadata}{blockSize};
@@ -266,14 +282,11 @@ sub createPnorImage
return $rc;
}
- #Offset of Partition Table A in PNOR
- my $sideAOffset = $$i_pnorLayoutRef{metadata}{sideAOffset};
-
#f{fs,part} --create tuleta.pnor --partition-offset 0 --size 8MiB --block 4KiB --force
if ($g_ffsCmd eq "") {
- my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --create --size $imageSize --block $blockSize --force`;
+ my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --create --size $imageSize --block $blockSize --force`;
} else {
- my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --create --size $imageSize --block $blockSize --force`;
+ my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --create --size $imageSize --block $blockSize --force`;
}
$rc = $?;
if($rc)
@@ -324,10 +337,10 @@ sub createPnorImage
#Add Partition
#f{fs,part} --add --target tuleta.pnor --partition-offset 0 --offset 0x1000 --size 0x280000 --name HBI --flags 0x0
if ($g_ffsCmd eq "") {
- trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0");
- my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`;
+ trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0");
+ my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`;
} else {
- my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`;
+ my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --add --offset $physicalOffset --size $physicalRegionSize --name $eyeCatch --flags 0x0`;
}
$rc = $?;
if($rc)
@@ -364,10 +377,10 @@ sub createPnorImage
trace(1,"userflags0 = $userflags0");
trace(1,"userflags1 = $userflags1");
if ($g_ffsCmd eq "") {
- trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --user 0 --name $eyeCatch --value $userflags0");
- my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --user 0 --name $eyeCatch --value $userflags0`;
- trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --user 1 --name $eyeCatch --value $userflags1");
- my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --user 1 --name $eyeCatch --value $userflags1`;
+ trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 0 --name $eyeCatch --value $userflags0");
+ my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 0 --name $eyeCatch --value $userflags0`;
+ trace(1, "$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 1 --name $eyeCatch --value $userflags1");
+ my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --user 1 --name $eyeCatch --value $userflags1`;
}
$rc = $?;
if($rc)
@@ -379,9 +392,9 @@ sub createPnorImage
#Trunc Partition
#f{fs,part} --target tuleta.pnor --partition-offset 0 --name HBI --trunc
if ($g_ffsCmd eq "") {
- my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset --trunc --name $eyeCatch`;
+ my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`;
} else {
- my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --trunc --name $eyeCatch`;
+ my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --trunc --name $eyeCatch`;
}
$rc = $?;
if($rc)
@@ -394,7 +407,7 @@ sub createPnorImage
#Disable usewords for now. Will get re-enabled and fixed up as
#we add support for underlying functions
-# my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $sideAOffset
+# my $Out = `$g_fpartCmd --target $i_pnorBinName --partition-offset $offset
# --user 0 --name $eyeCatch --value $actualRegionSize`;
# $rc = $?;
# if($rc)
@@ -523,12 +536,12 @@ sub checkSpaceConstraints
################################################################################
sub fillPnorImage
{
- my ($i_pnorBinName, $i_pnorLayoutRef, $i_binFiles) = @_;
+ my ($i_pnorBinName, $i_pnorLayoutRef, $i_binFiles, $offset) = @_;
my $this_func = (caller(0))[3];
my $rc = 0;
my $key;
- my $sideAOffset = $$i_pnorLayoutRef{metadata}{sideAOffset};
+ trace(1, "fillPnorImage:: $offset");
#key is the physical offset into the file, however don't need to sort
#since FFS allows populating partitions in any order
@@ -554,9 +567,9 @@ sub fillPnorImage
#fcp --target tuleta.pnor --partition-offset 0 --name HBI --write hostboot_extended.bin
if ($g_ffsCmd eq "") {
- my $Out = `$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $sideAOffset --write`;
+ my $Out = `$g_fcpCmd $inputFile $i_pnorBinName:$eyeCatch --offset $offset --write`;
} else {
- my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $sideAOffset --name $eyeCatch --write $inputFile`;
+ my $Out = `$g_ffsCmd --target $i_pnorBinName --partition-offset $offset --name $eyeCatch --write $inputFile`;
}
$rc = $?;
if($rc)
diff --git a/src/build/mkrules/hbfw/img/makefile b/src/build/mkrules/hbfw/img/makefile
index 4e6aa8179..26f3f2e8d 100755
--- a/src/build/mkrules/hbfw/img/makefile
+++ b/src/build/mkrules/hbfw/img/makefile
@@ -57,6 +57,7 @@ BASE_IMAGES = ${BASE_IMAGE} ${EXT_IMAGE} ${HBRT_IMAGE}
BASE_W_HEADER_IMAGE = hostboot.header.bin
BASE_W_HEADER_ECC_IMAGE = hostboot.header.bin.ecc
BASE_ECC_IMAGE = hostboot.bin.ecc
+BASE_SHA_IMAGE = hostboot.sha.bin
EXT_PAD_IMAGE = hostboot_extended.bin.pad
EXT_ECC_IMAGE = hostboot_extended.bin.ecc
EXT_ECC_HEADER_IMAGE = hostboot_extended.header.ecc.bin
@@ -67,7 +68,7 @@ TESTDATA_ECC = hbtestdata.bin.ecc
ALL_HB_IMAGES = ${BASE_IMAGES} \
${BASE_W_HEADER_IMAGE} \
${BASE_ECC_IMAGE} ${EXT_ECC_IMAGE} \
- ${BASE_W_HEADER_ECC_IMAGE} \
+ ${BASE_W_HEADER_ECC_IMAGE} ${BASE_SHA_IMAGE}\
${EXT_PAD_IMAGE} \
${EXT_SHA_IMAGE} ${EXT_HEADER_IMAGE} \
${EXT_ECC_HEADER_IMAGE} \
@@ -76,7 +77,10 @@ ALL_HB_IMAGES = ${BASE_IMAGES} \
cp_hbfiles: .SPECTARG
${BASE_IMAGES:@image@cp -f -u ${SRCPATH:F${image}} ${image};@}
echo "00000000001800000000000008000000000000000007EF80" | xxd -r -ps - sbe.header
- dd if=/dev/zero of=secureboot.header bs=1 count=4K
+ # add version header w/ sha hash
+ echo -en VERSION\\0 > ${BASE_SHA_IMAGE}
+ sha512sum ${BASE_IMAGE} | awk '{print $$1}' | xxd -pr -r >> ${BASE_SHA_IMAGE}
+ dd if=${BASE_SHA_IMAGE} of=secureboot.header ibs=4k conv=sync
dd if=/dev/zero of=hbb.footer bs=1 count=128K
cat sbe.header secureboot.header ${BASE_IMAGE} hbb.footer > hostboot.stage.bin
head -c 524288 hostboot.stage.bin > ${BASE_W_HEADER_IMAGE}
@@ -156,7 +160,7 @@ clobber_build_sbe_partitions:
#################################################
### SAMPLE for building a PNOR image
#################################################
-#MURANO_TARGETING = simics_MURANO_targeting.bin
+#MURANO_TARGETING = simics_MURANO_targeting.bin
#MURANO_LAYOUT = defaultPnorLayout.xml
#murano.pnor: ${MURANO_TARGETING} ${MURANO_LAYOUT} hostboot_extended.bin hostboot.bin
# ${buildpnor.pl:P} --pnorLayout ${.PATH:F${MURANO_LAYOUT}} \
OpenPOWER on IntegriCloud