Skip to content

Commit

Permalink
New Optional Argument to PnorUtils.pm’s loadPnorLayout
Browse files Browse the repository at this point in the history
New Optional Argument to PnorUtils.pm’s loadPnorLayout to
declare where to place the newly created layout file.
If argument is not given, file will not be saved.
Edited scripts and makefiles that use this function.

Change-Id: I7b9ee0f7ad33ad88be58598ddf594765eabe29ea
Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/85916
Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP Build CI <op-jenkins+hostboot@us.ibm.com>
Tested-by: Jenkins OP HW <op-hw-jenkins+hostboot@us.ibm.com>
Tested-by: FSP CI Jenkins <fsp-CI-jenkins+hostboot@us.ibm.com>
Reviewed-by: Nicholas E Bofferding <bofferdn@us.ibm.com>
Reviewed-by: Christian R Geddes <crgeddes@us.ibm.com>
Reviewed-by: Michael Baiocchi <mbaiocch@us.ibm.com>
Reviewed-by: Daniel M Crowell <dcrowell@us.ibm.com>
  • Loading branch information
LF-Luis authored and dcrowell77 committed Oct 29, 2019
1 parent f41f717 commit 5dd26a0
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 21 deletions.
33 changes: 19 additions & 14 deletions src/build/buildpnor/PnorUtils.pm
Expand Up @@ -54,7 +54,8 @@ use constant PAGE_SIZE => 4096;
################################################################################
sub loadPnorLayout
{
my ($i_pnorFile, $i_pnorLayoutRef, $i_physicalOffsets, $i_testRun) = @_;
my ($i_pnorFile, $i_pnorLayoutRef, $i_physicalOffsets, $i_testRun,
$i_outputLayoutLocation) = @_;
my $this_func = (caller(0))[3];

unless(-e $i_pnorFile)
Expand Down Expand Up @@ -255,21 +256,25 @@ sub loadPnorLayout
checkForOverlap($i_pnorLayoutRef);
}

# write xml with offsets to new file
my $filename = basename($i_pnorFile, ".xml");
$filename = "${filename}WithOffsets.xml";

# writing to new file with error handling
eval
# Write xml with offsets to new file if $i_outputLayoutLocation
# argument is supplied
if (defined $i_outputLayoutLocation && $i_outputLayoutLocation ne "")
{
print XMLout($xml, RootName => "pnor", OutputFile => $filename);
1;
my $filename = basename($i_pnorFile, ".xml");
$filename = "${i_outputLayoutLocation}/${filename}WithOffsets.xml";

# writing to new file with error handling
eval
{
print XMLout($xml, RootName => "pnor", OutputFile => $filename);
1;
}
or do
{
my $err = $@;
die "ERROR: $this_func: Failed to create new XML file with corrected offsets, error = $err";
};
}
or do
{
my $err = $@;
die "ERROR: $this_func: Failed to create new XML file with corrected offsets, error = $err";
};

return 0;
}
Expand Down
9 changes: 8 additions & 1 deletion src/build/buildpnor/buildpnor.pl
Expand Up @@ -56,6 +56,7 @@
B => "B",
sideless => "sideless",
);
my $editedLayoutLocation = "";

if ($#ARGV < 0) {
usage();
Expand Down Expand Up @@ -95,6 +96,10 @@
elsif($ARGV[$i] =~ /--test/) {
$testRun = 1;
}
elsif($ARGV[$i] =~ /--editedLayoutLocation/) {
$editedLayoutLocation = $ARGV[++$i];
trace(2, "Location where the edited layout file will be placed: $editedLayoutLocation");
}
else {
traceErr("Unrecognized Input: $ARGV[$i]");
exit 1;
Expand All @@ -112,7 +117,8 @@
}

#Load PNOR Layout XML file
loadPnorLayout($pnorLayoutFile, \%pnorLayout, \%PhysicalOffsets, $testRun);
loadPnorLayout($pnorLayoutFile, \%pnorLayout, \%PhysicalOffsets, $testRun,
$editedLayoutLocation);

#Verify all the section files exist
verifyFilesExist(\%pnorLayout, \%binFiles);
Expand Down Expand Up @@ -621,6 +627,7 @@ sub usage
--fpartCmd invoke string for executing the fpart tool
--fcpCmd invoke string for executing the fcp tool
--test Output test-only sections.
--editedLayoutLocation <directory> Location to place edited layout file
Current Limitations:
--TOC Records must be 4 or 8 bytes in length
Expand Down
6 changes: 5 additions & 1 deletion src/build/buildpnor/genPnorImages.pl
Expand Up @@ -126,6 +126,7 @@
my $hwKeyHashFile = "";
my $hb_standalone="";
my $buildType="";
my $editedLayoutLocation="";

# @TODO RTC 170650: Set default to 0 after all environments provide external
# control over this policy, plus remove '!' from 'lab-security-override'
Expand All @@ -148,6 +149,7 @@
"lab-security-override!" => \$labSecurityOverride,
"emit-eccless" => \$emitEccless,
"build-type:s" => \$buildType,
"editedLayoutLocation:s" => \$editedLayoutLocation,
"help" => \$help);

if ($help)
Expand Down Expand Up @@ -391,7 +393,8 @@
}

#Load PNOR Layout XML file
loadPnorLayout($pnorLayoutFile, \%pnorLayout, \%PhysicalOffsets, $testRun);
loadPnorLayout($pnorLayoutFile, \%pnorLayout, \%PhysicalOffsets, $testRun,
$editedLayoutLocation);

# Generate final images for each system's bin files.
foreach my $binFilesCSV (@systemBinFiles)
Expand Down Expand Up @@ -1307,6 +1310,7 @@ sub usage
switch (separated with a space and not
including the single quotes). OpenPower is
the default.
--editedLayoutLocation <directory> Location to place edited layout file
Current Limitations:
- Issues with dependency on ENGD build for certain files such as SBE. This is why [--build-all | --install-all ] are used.
Expand Down
16 changes: 11 additions & 5 deletions src/build/mkrules/hbfw/img/makefile
Expand Up @@ -65,6 +65,7 @@ SBEI_OBJPATH = ${HBFW_OBJPATH:S/hbfw\/img/sbei\/sbfw\/img/g}
ENGD_WOFPATH = ${HBFW_OBJPATH:S/hbfw\/img/engd\/wofdata/g}
ENGD_MEMDPATH = ${HBFW_OBJPATH:S/hbfw\/img/engd\/memd/g}
HBFW_SIMPATH = ${HBFW_OBJPATH:S/img/simics/g}
EDITED_LAYOUT_PATH = ${DUMMY:!pwd!}
#################################################
# Copy Hostboot binary images to obj dir to be grabbed
# during build flash pass and consumption by HWSV.
Expand Down Expand Up @@ -227,12 +228,14 @@ GEN_STANDALONE_BIN_FILES = ${GEN_COMMON_BIN_FILES},TEST=EMPTY,TESTRO=EMPTY,TESTL
DEFAULT_PARAMS = --build-all --emit-eccless ${TARGET_TEST:b--test} ${HB_STANDALONE:b--hb-standalone} \
${CONFIG_SECUREBOOT:b--secureboot} --systemBinFiles ${GEN_DEFAULT_BIN_FILES} \
--pnorLayout ${PNOR_LAYOUT} ${KEY_TRANSITION_PARAMS} ${CORRUPT_PARAMS} \
--hwKeyHashFile ${IMPRINT_HW_KEY_HASH}
--hwKeyHashFile ${IMPRINT_HW_KEY_HASH} \
--editedLayoutLocation ${EDITED_LAYOUT_PATH}
.else
PNOR_LAYOUT = ${pnorLayoutFake.xml:P}
# Parameters passed into GEN_PNOR_IMAGE_SCRIPT.
GEN_DEFAULT_BIN_FILES = HBI=${HBI_IMG},HBEL=EMPTY,MVPD=${${VPO_FAKE_MVPD}:P},DJVPD=${${VPO_FAKE_DJVPD}:P},FIRDATA=EMPTY,MEMD=EMPTY
DEFAULT_PARAMS = --systemBinFiles ${GEN_DEFAULT_BIN_FILES} --pnorLayout ${PNOR_LAYOUT}
DEFAULT_PARAMS = --systemBinFiles ${GEN_DEFAULT_BIN_FILES} --pnorLayout ${PNOR_LAYOUT} \
--editedLayoutLocation ${EDITED_LAYOUT_PATH}
.endif

# rule to update hostboot image tags for custom CFM image, only enabled
Expand Down Expand Up @@ -465,7 +468,8 @@ ZZ2UGEN4_HBD_FINAL_IMG = ZZ-2U-GEN4.HBD.bin
--systemBinFiles ${GEN_ZZ2U_BIN_FILES} \
--systemBinFiles ${GEN_ZZGEN4_BIN_FILES} \
--systemBinFiles ${GEN_ZZ2UGEN4_BIN_FILES} \
--hwKeyHashFile ${IMPRINT_HW_KEY_HASH}
--hwKeyHashFile ${IMPRINT_HW_KEY_HASH} \
--editedLayoutLocation ${EDITED_LAYOUT_PATH}
.else
# Parameters passed into GEN_PNOR_IMAGE_SCRIPT.
GEN_NIMBUS_BIN_FILES = NIMBUS:HCODE=${${NIMBUS_HCODE_IMG}:P},HBD=${${NIMBUS_VPO_HBD_IMG}:P},CENHWIMG=EMPTY
Expand All @@ -476,7 +480,8 @@ ZZ2UGEN4_HBD_FINAL_IMG = ZZ-2U-GEN4.HBD.bin
--systemBinFiles ${GEN_NIMBUS_BIN_FILES} \
--systemBinFiles ${GEN_CUMULUS_BIN_FILES} \
--systemBinFiles ${GEN_AXONE_BIN_FILES} \
--systemBinFiles ${GEN_CUMULUS_CDIMM_BIN_FILES}
--systemBinFiles ${GEN_CUMULUS_CDIMM_BIN_FILES} \
--editedLayoutLocation ${EDITED_LAYOUT_PATH}
.endif

gen_system_specific_images_bypass_cache : dump-secureboot-config
Expand Down Expand Up @@ -566,7 +571,8 @@ ${IMAGE_TARGET}: ${IMAGE_LAYOUT} ${IMAGE_BINS} ${PNOR_BUILD_SCRIPT}
${FAKEPNOR} == ${IMAGE_TARGET})
${PNOR_BUILD_SCRIPT} --pnorOutBin ${IMAGE_TARGET} \
${TARGET_TEST:b--test} --pnorLayout ${IMAGE_LAYOUT} \
${IMAGE_BIN_OPTION} --fpartCmd "fpart" --fcpCmd "fcp"
${IMAGE_BIN_OPTION} --fpartCmd "fpart" --fcpCmd "fcp" \
--editedLayoutLocation ${EDITED_LAYOUT_PATH}
.endif
.endif

Expand Down

0 comments on commit 5dd26a0

Please sign in to comment.