|
61 | 61 | my @systemBinFiles = ();
|
62 | 62 | my %pnorLayout = ();
|
63 | 63 | my %PhysicalOffsets = ();
|
| 64 | +my %partitionUtilHash; |
| 65 | + |
| 66 | +# percentage utilization threshold, if crossed display warning message |
| 67 | +# that partition is almost full |
| 68 | +use constant CRITICAL_THRESHOLD => 85.00; |
64 | 69 |
|
65 | 70 | # Truncate SHA to n bytes
|
66 | 71 | use constant SHA_TRUNCATE_SIZE => 32;
|
|
409 | 414 | manipulateImages(\%pnorLayout, \%binFiles, $system_target);
|
410 | 415 | }
|
411 | 416 |
|
| 417 | +# display percentage utilization data for each eyecatch |
| 418 | +foreach my $key (keys %partitionUtilHash) { |
| 419 | + |
| 420 | + print "$key is $partitionUtilHash{$key}{pctUtilized} utilized ($partitionUtilHash{$key}{freeBytes} of $partitionUtilHash{$key}{physicalRegionSize} bytes free)\n"; |
| 421 | + |
| 422 | + # if percentage is greater than critical threshold, surface warning |
| 423 | + if ($partitionUtilHash{$key}{pctUtilized} > CRITICAL_THRESHOLD) { |
| 424 | + print "Warning: Percent utilization for $key shows that partition is almost full.\n"; |
| 425 | + } |
| 426 | +} |
| 427 | + |
412 | 428 | ################################################################################
|
413 | 429 | # Subroutines
|
414 | 430 | ################################################################################
|
@@ -452,6 +468,7 @@ sub partitionDepSort
|
452 | 468 | ################################################################################
|
453 | 469 | # manipulateImages - Perform any ECC/padding/sha/signing manipulations
|
454 | 470 | ################################################################################
|
| 471 | + |
455 | 472 | sub manipulateImages
|
456 | 473 | {
|
457 | 474 | my ($i_pnorLayoutRef, $i_binFilesRef, $system_target) = @_;
|
@@ -496,6 +513,7 @@ sub manipulateImages
|
496 | 513 | }
|
497 | 514 |
|
498 | 515 | my $eyeCatch = $sectionHash{$layoutKey}{eyeCatch};
|
| 516 | + my $physicalRegionSize = $sectionHash{$layoutKey}{physicalRegionSize}; |
499 | 517 | my %tempImages = (
|
500 | 518 | HDR_PHASE => "$bin_dir/$parallelPrefix.$eyeCatch.temp.hdr.bin",
|
501 | 519 | TEMP_SHA_IMG => "$bin_dir/$parallelPrefix.$eyeCatch.temp.sha.bin",
|
@@ -749,6 +767,22 @@ sub manipulateImages
|
749 | 767 |
|
750 | 768 | setCallerHwHdrFields(\%callerHwHdrFields, $tempImages{HDR_PHASE});
|
751 | 769 |
|
| 770 | + |
| 771 | + # store binary file size + header size in hash |
| 772 | + |
| 773 | + # If section will passed through ecc, include this in size calculation |
| 774 | + if( ($sectionHash{$layoutKey}{ecc} eq "yes") ) |
| 775 | + { |
| 776 | + $partitionUtilHash{$eyeCatch}{logicalFileSize} = %callerHwHdrFields->{totalContainerSize} * (9/8); |
| 777 | + } |
| 778 | + else |
| 779 | + { |
| 780 | + $partitionUtilHash{$eyeCatch}{logicalFileSize} = %callerHwHdrFields->{totalContainerSize}; |
| 781 | + } |
| 782 | + $partitionUtilHash{$eyeCatch}{pctUtilized} = sprintf("%.2f", $partitionUtilHash{$eyeCatch}{logicalFileSize} / $physicalRegionSize * 100); |
| 783 | + $partitionUtilHash{$eyeCatch}{freeBytes} = $physicalRegionSize - $partitionUtilHash{$eyeCatch}{logicalFileSize}; |
| 784 | + $partitionUtilHash{$eyeCatch}{physicalRegionSize} = $physicalRegionSize; |
| 785 | + |
752 | 786 | # Padding Phase
|
753 | 787 | if ($eyeCatch eq "HBI" && $testRun)
|
754 | 788 | {
|
|
0 commit comments