summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/build/buildpnor/PnorUtils.pm5
-rwxr-xr-xsrc/build/buildpnor/genPnorImages.pl34
2 files changed, 37 insertions, 2 deletions
diff --git a/src/build/buildpnor/PnorUtils.pm b/src/build/buildpnor/PnorUtils.pm
index d0f5cd05f..6128c298b 100644
--- a/src/build/buildpnor/PnorUtils.pm
+++ b/src/build/buildpnor/PnorUtils.pm
@@ -409,6 +409,8 @@ sub checkSpaceConstraints
my %sectionHash = %{$$i_pnorLayoutRef{sections}};
+ print "Note: the following metrics are not a true representation of section utilization, since some sections are substantially padded before applying ECC\n";
+
for $key ( keys %{$i_binFiles})
{
my $filesize = -s $$i_binFiles{$key};
@@ -422,9 +424,8 @@ sub checkSpaceConstraints
my $eyeCatch = $sectionHash{$layoutKey}{eyeCatch};
my $physicalRegionSize = $sectionHash{$layoutKey}{physicalRegionSize};
- my $pctUtilized = sprintf("%.2f", $filesize / $physicalRegionSize * 100);
my $freeBytes = $physicalRegionSize - $filesize;
- print "$eyeCatch is $pctUtilized% utilized ($freeBytes of $physicalRegionSize bytes free)\n";
+ print "$eyeCatch section size: $physicalRegionSize, bytes used: $filesize, bytes unused: $freeBytes\n";
if($filesize > $physicalRegionSize)
{
diff --git a/src/build/buildpnor/genPnorImages.pl b/src/build/buildpnor/genPnorImages.pl
index eae4e1fe7..142fd25f5 100755
--- a/src/build/buildpnor/genPnorImages.pl
+++ b/src/build/buildpnor/genPnorImages.pl
@@ -61,6 +61,11 @@ my $programName = File::Basename::basename $0;
my @systemBinFiles = ();
my %pnorLayout = ();
my %PhysicalOffsets = ();
+my %partitionUtilHash;
+
+# percentage utilization threshold, if crossed display warning message
+# that partition is almost full
+use constant CRITICAL_THRESHOLD => 85.00;
# Truncate SHA to n bytes
use constant SHA_TRUNCATE_SIZE => 32;
@@ -409,6 +414,17 @@ foreach my $binFilesCSV (@systemBinFiles)
manipulateImages(\%pnorLayout, \%binFiles, $system_target);
}
+# display percentage utilization data for each eyecatch
+foreach my $key (keys %partitionUtilHash) {
+
+ print "$key is $partitionUtilHash{$key}{pctUtilized} utilized ($partitionUtilHash{$key}{freeBytes} of $partitionUtilHash{$key}{physicalRegionSize} bytes free)\n";
+
+ # if percentage is greater than critical threshold, surface warning
+ if ($partitionUtilHash{$key}{pctUtilized} > CRITICAL_THRESHOLD) {
+ print "Warning: Percent utilization for $key shows that partition is almost full.\n";
+ }
+}
+
################################################################################
# Subroutines
################################################################################
@@ -452,6 +468,7 @@ sub partitionDepSort
################################################################################
# manipulateImages - Perform any ECC/padding/sha/signing manipulations
################################################################################
+
sub manipulateImages
{
my ($i_pnorLayoutRef, $i_binFilesRef, $system_target) = @_;
@@ -496,6 +513,7 @@ sub manipulateImages
}
my $eyeCatch = $sectionHash{$layoutKey}{eyeCatch};
+ my $physicalRegionSize = $sectionHash{$layoutKey}{physicalRegionSize};
my %tempImages = (
HDR_PHASE => "$bin_dir/$parallelPrefix.$eyeCatch.temp.hdr.bin",
TEMP_SHA_IMG => "$bin_dir/$parallelPrefix.$eyeCatch.temp.sha.bin",
@@ -749,6 +767,22 @@ sub manipulateImages
setCallerHwHdrFields(\%callerHwHdrFields, $tempImages{HDR_PHASE});
+
+ # store binary file size + header size in hash
+
+ # If section will passed through ecc, include this in size calculation
+ if( ($sectionHash{$layoutKey}{ecc} eq "yes") )
+ {
+ $partitionUtilHash{$eyeCatch}{logicalFileSize} = %callerHwHdrFields->{totalContainerSize} * (9/8);
+ }
+ else
+ {
+ $partitionUtilHash{$eyeCatch}{logicalFileSize} = %callerHwHdrFields->{totalContainerSize};
+ }
+ $partitionUtilHash{$eyeCatch}{pctUtilized} = sprintf("%.2f", $partitionUtilHash{$eyeCatch}{logicalFileSize} / $physicalRegionSize * 100);
+ $partitionUtilHash{$eyeCatch}{freeBytes} = $physicalRegionSize - $partitionUtilHash{$eyeCatch}{logicalFileSize};
+ $partitionUtilHash{$eyeCatch}{physicalRegionSize} = $physicalRegionSize;
+
# Padding Phase
if ($eyeCatch eq "HBI" && $testRun)
{
OpenPOWER on IntegriCloud