summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatthew Raybuck <matthew.raybuck@ibm.com>2019-06-19 08:16:31 -0500
committerDaniel M. Crowell <dcrowell@us.ibm.com>2019-06-20 11:18:12 -0500
commit2f311fe0914db8f9e324fc4f1d37365df416cd14 (patch)
tree95a3304fd2f49736ce9737db9097697264a1ba67 /src
parent432870d9b5c4f5c68ba451d2f10f65cae64da38d (diff)
downloadtalos-hostboot-2f311fe0914db8f9e324fc4f1d37365df416cd14.tar.gz
talos-hostboot-2f311fe0914db8f9e324fc4f1d37365df416cd14.zip
Replace chomp function with platform neutral end-of-line stripping regex
There was an uncaught issue where after the BPM images were put into CMVC they would have their end-of-line characters converted to linux from windows. This commit provides a platform neutral way of stipping both line endings from the image files. Change-Id: If13565ea85c8c929c8a91029d01602f4797ab158 RTC:210367 Reviewed-on: http://rchgit01.rchland.ibm.com/gerrit1/79181 Reviewed-by: Christian R. Geddes <crgeddes@us.ibm.com> Reviewed-by: Matt Derksen <mderkse1@us.ibm.com> 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: Daniel M. Crowell <dcrowell@us.ibm.com>
Diffstat (limited to 'src')
-rwxr-xr-xsrc/build/buildpnor/buildBpmFlashImages.pl16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/build/buildpnor/buildBpmFlashImages.pl b/src/build/buildpnor/buildBpmFlashImages.pl
index ba65dab0a..a2ad7c438 100755
--- a/src/build/buildpnor/buildBpmFlashImages.pl
+++ b/src/build/buildpnor/buildBpmFlashImages.pl
@@ -146,14 +146,17 @@ sub generateFirmwareImage
# the payload is 16 bytes
use constant MAXIMUM_DATA_BYTES_FOR_PAYLOAD => 16;
- # images use carriage return which by default chomp doesn't remove so update
- # local $/ to remove that character.
- local $/ = "\r\n";
+ # Ensure that the diamond operator ( <> ) is searching for \n to determine
+ # where the end of a line is in the image file.
+ local $/ = "\n";
my $blocks = undef;
while (my $line = <$inputFileHandle>)
{
- chomp($line);
+ # Strip off the end-of-line character \n and optionally \r if it exists.
+ # Since the image files were created on a windows OS and this script
+ # runs on linux this will not be handled properly by chomp.
+ $line =~ s/\r?\n$//;
# The end of the firmware data section is marked by a 'q'
if (substr($line, 0, 1) eq "q")
@@ -239,6 +242,11 @@ sub generateFirmwareImage
print "number of blocks: $numberOfBlocks\n";
}
+ if (!defined($blocks))
+ {
+ die "Unable to process image file: $i_fileName";
+ }
+
# Write the version information to the file.
print $outputFileHandle pack("(H2)*", @version)
or die "Failed to write to output file: $imageFile";
OpenPOWER on IntegriCloud