summaryrefslogtreecommitdiffstats
path: root/src/build/buildpnor/memd_creation.pl
diff options
context:
space:
mode:
authorElizabeth Liner <eliner@us.ibm.com>2017-09-12 20:24:30 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2017-09-25 16:24:05 -0400
commitbc88548f09df044cd7c8daa0b4805e31f5e51aee (patch)
tree3a91a0ebe99bd05915615c0be8324b0c8e7dc545 /src/build/buildpnor/memd_creation.pl
parent0e38c62c5d90dc6936df943b104c643673391d5f (diff)
downloadtalos-hostboot-bc88548f09df044cd7c8daa0b4805e31f5e51aee.tar.gz
talos-hostboot-bc88548f09df044cd7c8daa0b4805e31f5e51aee.zip
Removing first byte from MEMD binary
Change-Id: I8cd48e40be7e3f756daba2019e410881d563085d Reviewed-on: http://ralgit01.raleigh.ibm.com/gerrit1/46118 Tested-by: Jenkins Server <pfd-jenkins+hostboot@us.ibm.com> Reviewed-by: Stephen M. Cprek <smcprek@us.ibm.com> Reviewed-by: Christian R. Geddes <crgeddes@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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src/build/buildpnor/memd_creation.pl')
-rwxr-xr-xsrc/build/buildpnor/memd_creation.pl20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/build/buildpnor/memd_creation.pl b/src/build/buildpnor/memd_creation.pl
index aa0298988..cf549a5bf 100755
--- a/src/build/buildpnor/memd_creation.pl
+++ b/src/build/buildpnor/memd_creation.pl
@@ -101,9 +101,27 @@ print $fh $num_bin;
# Read in the MEMD binary, and concatenate to this file.
foreach my $file (@memd_files)
{
+ # Checking that first byte equals "84"
+ # The VPD spec has '84' as their first byte for a record, however it is
+ # not needed for the hostboot structure to add in into the VPD structure,
+ # so we remove it here before creating the MEMD binary
+ my $first_byte = `head -c 1 $file`;
+ die "System command failed: $?" if $?;
+
+ $first_byte =~ s/(.)/sprintf("%x",ord($1))/eg;
+ if(!($first_byte == 84))
+ {
+ die "Incorrect first byte, MEMD file is invalid";
+ }
+
+ # Removing the first byte of the MEMD binary
+ my $new_file = "edited_memd.dat";
+ run_command("tail -c +2 $file > $new_file");
+ run_command("mv $new_file $file");
+
seek($fh, $offset, 0);
print "Writing the file $file...\n";
- open(my $in_file, '<', $file) or die "Cound not open file '$file' $!";
+ open(my $in_file, '<', $file) or die "Could not open file '$file' $!";
while ( <$in_file> )
{
OpenPOWER on IntegriCloud