From 09faa4a1ce356efdc393260678412d2dbd907d4b Mon Sep 17 00:00:00 2001 From: Michael D Kinney Date: Sun, 30 Mar 2025 17:55:22 -0700 Subject: BaseTools/build: Reduce special FV full to warning If an FV_SPARE_SPACE_THRESHOLD is enabled and an FV is 100% full with 0 bytes free, then this is likely a special FV that may have alignment requirements for the FFS file for both the start address and the length and the FFS file consumes all the available FV space. Reduce FV_SPARE_SPACE_THRESHOLD from an error to a warning if this FV 0 bytes free condition is detected. PR #10828 introduced the generation of these error conditions for an FV with large alignment requirements. The pad region before the aligned FFS file used to be counted as free space even though it could never be used due to the alignment requirements. There was actually no free space available. PR #10828 fixed the free space calculation to properly show it as 0 bytes free, and this change then caused build error when FV_SPARE_SPACE_THRESHOLD feature was enabled. The reduction to a warning for this condition allows the build to complete with errors and also provides a build log warning message for review. Signed-off-by: Michael D Kinney --- BaseTools/Source/Python/build/build.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'BaseTools/Source/Python') diff --git a/BaseTools/Source/Python/build/build.py b/BaseTools/Source/Python/build/build.py index 74b4242..f471aea 100755 --- a/BaseTools/Source/Python/build/build.py +++ b/BaseTools/Source/Python/build/build.py @@ -2431,9 +2431,18 @@ class Build(): if len(NameValue) == 2 and NameValue[0].strip() == 'EFI_FV_SPACE_SIZE': FreeSizeValue = int(NameValue[1].strip(), 0) if FreeSizeValue < Threshold: - EdkLogger.error("build", FV_FREESIZE_ERROR, - '%s FV free space %d is not enough to meet with the required spare space %d set by -D FV_SPARE_SPACE_THRESHOLD option.' % ( - FvName, FreeSizeValue, Threshold)) + if FreeSizeValue == 0: + # A free size of 0 means the FV is exactly 100% full which usually indicates a special + # FV for a region that contains a fixed size image with special alignment requirements + # with potentiaily a fixed address. Log a warning for review, but do not generate an + # error. + EdkLogger.warn("build", FV_FREESIZE_ERROR, + '%s FV free space %d is not enough to meet with the required spare space %d set by -D FV_SPARE_SPACE_THRESHOLD option.' % ( + FvName, FreeSizeValue, Threshold)) + else: + EdkLogger.error("build", FV_FREESIZE_ERROR, + '%s FV free space %d is not enough to meet with the required spare space %d set by -D FV_SPARE_SPACE_THRESHOLD option.' % ( + FvName, FreeSizeValue, Threshold)) break ## Generate GuidedSectionTools.txt in the FV directories. -- cgit v1.1