From e921f58d44587c77b843a6332b43f171a44b76cb Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Wed, 20 Sep 2017 14:10:04 +0800 Subject: [PATCH] BaseTools: extend FFS alignment to 16M Current FFS only supports 64KiB alignment for data, Per PI 1.6 requirement, we extend FFS alignment to 16M. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/C/GenFfs/GenFfs.c | 23 ++++--- BaseTools/Source/C/GenFv/GenFvInternalLib.c | 60 +++++++++++++++---- BaseTools/Source/C/GenSec/GenSec.c | 7 ++- .../Source/C/Include/Common/PiFirmwareFile.h | 3 +- .../Source/Python/Common/FdfParserLite.py | 20 ++++--- BaseTools/Source/Python/GenFds/DataSection.py | 6 +- BaseTools/Source/Python/GenFds/EfiSection.py | 6 +- BaseTools/Source/Python/GenFds/FdfParser.py | 24 +++++--- .../Source/Python/GenFds/FfsInfStatement.py | 10 +++- BaseTools/Source/Python/GenFds/Fv.py | 9 ++- .../Source/Python/GenFds/FvImageSection.py | 20 ++++--- .../Python/GenFds/GenFdsGlobalVariable.py | 8 ++- 12 files changed, 140 insertions(+), 56 deletions(-) diff --git a/BaseTools/Source/C/GenFfs/GenFfs.c b/BaseTools/Source/C/GenFfs/GenFfs.c index eaef8a2232..cb16f385ee 100644 --- a/BaseTools/Source/C/GenFfs/GenFfs.c +++ b/BaseTools/Source/C/GenFfs/GenFfs.c @@ -50,14 +50,17 @@ STATIC CHAR8 *mFfsFileType[] = { STATIC CHAR8 *mAlignName[] = { "1", "2", "4", "8", "16", "32", "64", "128", "256", "512", - "1K", "2K", "4K", "8K", "16K", "32K", "64K" + "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", + "512K", "1M", "2M", "4M", "8M", "16M" }; STATIC CHAR8 *mFfsValidAlignName[] = { - "8", "16", "128", "512", "1K", "4K", "32K", "64K" + "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K","256K", + "512K", "1M", "2M", "4M", "8M", "16M" }; -STATIC UINT32 mFfsValidAlign[] = {0, 8, 16, 128, 512, 1024, 4096, 32768, 65536}; +STATIC UINT32 mFfsValidAlign[] = {0, 8, 16, 128, 512, 1024, 4096, 32768, 65536, 131072, 262144, + 524288, 1048576, 2097152, 4194304, 8388608, 16777216}; STATIC EFI_GUID mZeroGuid = {0}; @@ -144,12 +147,13 @@ Returns: fprintf (stdout, " -s, --checksum Indicates to calculate file checksum.\n"); fprintf (stdout, " -a FileAlign, --align FileAlign\n\ FileAlign points to file alignment, which only support\n\ - the following align: 1,2,4,8,16,128,512,1K,4K,32K,64K\n"); + the following align: 1,2,4,8,16,128,512,1K,4K,32K,64K\n\ + 128K,256K,512K,1M,2M,4M,8M,16M\n"); fprintf (stdout, " -i SectionFile, --sectionfile SectionFile\n\ Section file will be contained in this FFS file.\n"); fprintf (stdout, " -n SectionAlign, --sectionalign SectionAlign\n\ SectionAlign points to section alignment, which support\n\ - the alignment scope 1~64K. It is specified together\n\ + the alignment scope 1~16M. It is specified together\n\ with sectionfile to point its alignment in FFS file.\n"); fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n"); fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n"); @@ -168,7 +172,7 @@ StringtoAlignment ( Routine Description: - Converts Align String to align value (1~64K). + Converts Align String to align value (1~16M). Arguments: @@ -893,7 +897,12 @@ Returns: } VerboseMsg ("the size of the generated FFS file is %u bytes", (unsigned) FileSize); - FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3)); + //FfsAlign larger than 7, set FFS_ATTRIB_DATA_ALIGNMENT2 + if (FfsAlign < 8) { + FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | (FfsAlign << 3)); + } else { + FfsFileHeader.Attributes = (EFI_FFS_FILE_ATTRIBUTES) (FfsAttrib | ((FfsAlign & 0x7) << 3) | FFS_ATTRIB_DATA_ALIGNMENT2); + } // // Fill in checksums and state, these must be zero for checksumming diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c index 8072c014fa..01c862e89a 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -1,7 +1,7 @@ /** @file This file contains the internal functions required to generate a Firmware Volume. -Copyright (c) 2004 - 2016, Intel Corporation. All rights reserved.
+Copyright (c) 2004 - 2017, Intel Corporation. All rights reserved.
Portions Copyright (c) 2011 - 2013, ARM Ltd. All rights reserved.
Portions Copyright (c) 2016 HP Development Company, L.P.
This program and the accompanying materials @@ -464,57 +464,97 @@ Returns: case 0: // // 1 byte alignment + //if bit 1 have set, 128K byte alignmnet // - *Alignment = 0; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 17; + } else { + *Alignment = 0; + } break; case 1: // // 16 byte alignment + //if bit 1 have set, 256K byte alignment // - *Alignment = 4; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 18; + } else { + *Alignment = 4; + } break; case 2: // // 128 byte alignment + //if bit 1 have set, 512K byte alignment // - *Alignment = 7; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 19; + } else { + *Alignment = 7; + } break; case 3: // // 512 byte alignment + //if bit 1 have set, 1M byte alignment // - *Alignment = 9; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 20; + } else { + *Alignment = 9; + } break; case 4: // // 1K byte alignment + //if bit 1 have set, 2M byte alignment // - *Alignment = 10; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 21; + } else { + *Alignment = 10; + } break; case 5: // // 4K byte alignment + //if bit 1 have set, 4M byte alignment // - *Alignment = 12; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 22; + } else { + *Alignment = 12; + } break; case 6: // // 32K byte alignment + //if bit 1 have set , 8M byte alignment // - *Alignment = 15; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 23; + } else { + *Alignment = 15; + } break; case 7: // // 64K byte alignment + //if bit 1 have set, 16M alignment // - *Alignment = 16; + if (FfsFile->Attributes & FFS_ATTRIB_DATA_ALIGNMENT2) { + *Alignment = 24; + } else { + *Alignment = 16; + } break; default: @@ -1060,7 +1100,7 @@ Returns: // Clear the alignment bits: these have become meaningless now that we have // adjusted the padding section. // - FfsFile->Attributes &= ~FFS_ATTRIB_DATA_ALIGNMENT; + FfsFile->Attributes &= ~(FFS_ATTRIB_DATA_ALIGNMENT | FFS_ATTRIB_DATA_ALIGNMENT2); // // Recalculate the FFS header checksum. Instead of setting Header and State diff --git a/BaseTools/Source/C/GenSec/GenSec.c b/BaseTools/Source/C/GenSec/GenSec.c index c0e4de254b..d9cdc1f631 100644 --- a/BaseTools/Source/C/GenSec/GenSec.c +++ b/BaseTools/Source/C/GenSec/GenSec.c @@ -74,7 +74,8 @@ STATIC CHAR8 *mGUIDedSectionAttribue[] = { "NONE", "PROCESSING_REQUIRED", STATIC CHAR8 *mAlignName[] = { "1", "2", "4", "8", "16", "32", "64", "128", "256", "512", - "1K", "2K", "4K", "8K", "16K", "32K", "64K" + "1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", + "512K", "1M", "2M", "4M", "8M", "16M" }; // @@ -184,7 +185,7 @@ Returns: used in Ver section.\n"); fprintf (stdout, " --sectionalign SectionAlign\n\ SectionAlign points to section alignment, which support\n\ - the alignment scope 1~64K. It is specified in same\n\ + the alignment scope 1~16M. It is specified in same\n\ order that the section file is input.\n"); fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n"); fprintf (stdout, " -q, --quiet Disable all messages except key message and fatal error\n"); @@ -356,7 +357,7 @@ StringtoAlignment ( Routine Description: - Converts Align String to align value (1~64K). + Converts Align String to align value (1~16M). Arguments: diff --git a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h index 8c54021393..133c88c56e 100644 --- a/BaseTools/Source/C/Include/Common/PiFirmwareFile.h +++ b/BaseTools/Source/C/Include/Common/PiFirmwareFile.h @@ -4,7 +4,7 @@ @par Revision Reference: Version 1.4. - Copyright (c) 2006 - 2015, Intel Corporation. All rights reserved.
+ Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available under the terms and conditions of the BSD License which accompanies this @@ -65,6 +65,7 @@ typedef UINT8 EFI_FFS_FILE_STATE; // FFS File Attributes. // #define FFS_ATTRIB_LARGE_FILE 0x01 +#define FFS_ATTRIB_DATA_ALIGNMENT2 0x02 #define FFS_ATTRIB_FIXED 0x04 #define FFS_ATTRIB_DATA_ALIGNMENT 0x38 #define FFS_ATTRIB_CHECKSUM 0x40 diff --git a/BaseTools/Source/Python/Common/FdfParserLite.py b/BaseTools/Source/Python/Common/FdfParserLite.py index 8e68a67e44..7d129bfcab 100644 --- a/BaseTools/Source/Python/Common/FdfParserLite.py +++ b/BaseTools/Source/Python/Common/FdfParserLite.py @@ -1,7 +1,7 @@ ## @file # parse FDF file # -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -2340,7 +2340,8 @@ class FdfParser(object): AlignValue = None if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) AlignValue = self.__Token @@ -2608,7 +2609,8 @@ class FdfParser(object): AlignValue = None if self.__GetAlignment(): - if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) AlignValue = self.__Token @@ -2924,7 +2926,8 @@ class FdfParser(object): AlignValue = "" if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber) AlignValue = self.__Token @@ -2988,7 +2991,8 @@ class FdfParser(object): CheckSum = True if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber) if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'): raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber) @@ -3062,7 +3066,8 @@ class FdfParser(object): FvImageSectionObj.FvFileType = self.__Token if self.__GetAlignment(): - if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment At Line ", self.FileName, self.CurrentLineNumber) FvImageSectionObj.Alignment = self.__Token @@ -3129,7 +3134,8 @@ class FdfParser(object): EfiSectionObj.BuildNum = self.__Token if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'): raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber) diff --git a/BaseTools/Source/Python/GenFds/DataSection.py b/BaseTools/Source/Python/GenFds/DataSection.py index ba3677ed89..78c0af4db1 100644 --- a/BaseTools/Source/Python/GenFds/DataSection.py +++ b/BaseTools/Source/Python/GenFds/DataSection.py @@ -1,7 +1,7 @@ ## @file # process data section generation # -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -79,8 +79,10 @@ class DataSection (DataSectionClassObject): ImageObj = PeImageClass (Filename) if ImageObj.SectionAlignment < 0x400: self.Alignment = str (ImageObj.SectionAlignment) - else: + elif ImageObj.SectionAlignment < 0x100000: self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K' + else: + self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M' NoStrip = True if self.SecType in ('TE', 'PE32'): diff --git a/BaseTools/Source/Python/GenFds/EfiSection.py b/BaseTools/Source/Python/GenFds/EfiSection.py index 09fb28f32d..7da3c1e7b0 100644 --- a/BaseTools/Source/Python/GenFds/EfiSection.py +++ b/BaseTools/Source/Python/GenFds/EfiSection.py @@ -1,7 +1,7 @@ ## @file # process rule section generation # -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -231,8 +231,10 @@ class EfiSection (EfiSectionClassObject): ImageObj = PeImageClass (File) if ImageObj.SectionAlignment < 0x400: Align = str (ImageObj.SectionAlignment) - else: + elif ImageObj.SectionAlignment < 0x100000: Align = str (ImageObj.SectionAlignment / 0x400) + 'K' + else: + Align = str (ImageObj.SectionAlignment / 0x100000) + 'M' if File[(len(File)-4):] == '.efi': MapFile = File.replace('.efi', '.map') diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 8f49f9faad..499d0a6f05 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -2767,7 +2767,8 @@ class FdfParser: while True: AlignValue = None if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) #For FFS, Auto is default option same to "" if not self.__Token == "Auto": @@ -2826,7 +2827,8 @@ class FdfParser: FfsFileObj.CheckSum = True if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) #For FFS, Auto is default option same to "" if not self.__Token == "Auto": @@ -2897,7 +2899,8 @@ class FdfParser: AlignValue = None if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) AlignValue = self.__Token @@ -3186,7 +3189,8 @@ class FdfParser: AlignValue = None if self.__GetAlignment(): - if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) AlignValue = self.__Token @@ -3777,7 +3781,8 @@ class FdfParser: AlignValue = "" if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) #For FFS, Auto is default option same to "" if not self.__Token == "Auto": @@ -3826,7 +3831,8 @@ class FdfParser: SectAlignment = "" if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'): raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber) @@ -3905,7 +3911,8 @@ class FdfParser: FvImageSectionObj.FvFileType = self.__Token if self.__GetAlignment(): - if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) FvImageSectionObj.Alignment = self.__Token @@ -3972,7 +3979,8 @@ class FdfParser: EfiSectionObj.BuildNum = self.__Token if self.__GetAlignment(): - if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K"): + if self.__Token not in ("Auto", "8", "16", "32", "64", "128", "512", "1K", "4K", "32K" ,"64K", "128K", + "256K", "512K", "1M", "2M", "4M", "8M", "16M"): raise Warning("Incorrect alignment '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) if self.__Token == 'Auto' and (not SectionName == 'PE32') and (not SectionName == 'TE'): raise Warning("Auto alignment can only be used in PE32 or TE section ", self.FileName, self.CurrentLineNumber) diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index c61c227c99..958cecfad6 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -1,7 +1,7 @@ ## @file # process FFS generation from INF statement # -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# Copyright (c) 2014-2016 Hewlett-Packard Development Company, L.P.
# # This program and the accompanying materials @@ -731,8 +731,10 @@ class FfsInfStatement(FfsInfStatementClassObject): ImageObj = PeImageClass (File) if ImageObj.SectionAlignment < 0x400: self.Alignment = str (ImageObj.SectionAlignment) - else: + elif ImageObj.SectionAlignment < 0x100000: self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K' + else: + self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M' if not NoStrip: FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc') @@ -770,8 +772,10 @@ class FfsInfStatement(FfsInfStatementClassObject): ImageObj = PeImageClass (GenSecInputFile) if ImageObj.SectionAlignment < 0x400: self.Alignment = str (ImageObj.SectionAlignment) - else: + elif ImageObj.SectionAlignment < 0x100000: self.Alignment = str (ImageObj.SectionAlignment / 0x400) + 'K' + else: + self.Alignment = str (ImageObj.SectionAlignment / 0x100000) + 'M' if not NoStrip: FileBeforeStrip = os.path.join(self.OutputPath, ModuleName + '.reloc') diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index f6ccb59d77..4b03adc1c8 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -196,9 +196,12 @@ class FV (FvClassObject): FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F) # FvAlignmentValue is larger than or equal to 1K if FvAlignmentValue >= 0x400: - if FvAlignmentValue >= 0x10000: - #The max alignment supported by FFS is 64K. - self.FvAlignment = "64K" + if FvAlignmentValue >= 0x100000: + #The max alignment supported by FFS is 16M. + if FvAlignmentValue >= 0x1000000: + self.FvAlignment = "16M" + else: + self.FvAlignment = str(FvAlignmentValue / 0x100000) + "M" else: self.FvAlignment = str (FvAlignmentValue / 0x400) + "K" else: diff --git a/BaseTools/Source/Python/GenFds/FvImageSection.py b/BaseTools/Source/Python/GenFds/FvImageSection.py index 5989978a7c..68f17c31e8 100644 --- a/BaseTools/Source/Python/GenFds/FvImageSection.py +++ b/BaseTools/Source/Python/GenFds/FvImageSection.py @@ -1,7 +1,7 @@ ## @file # process FV image section generation # -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -80,9 +80,12 @@ class FvImageSection(FvImageSectionClassObject): # MaxFvAlignment is larger than or equal to 1K if MaxFvAlignment >= 0x400: - if MaxFvAlignment >= 0x10000: - #The max alignment supported by FFS is 64K. - self.Alignment = "64K" + if MaxFvAlignment >= 0x100000: + #The max alignment supported by FFS is 16M. + if MaxFvAlignment >=1000000: + self.Alignment = "16M" + else: + self.Alignment = str(MaxFvAlignment / 0x100000) + "M" else: self.Alignment = str (MaxFvAlignment / 0x400) + "K" else: @@ -117,9 +120,12 @@ class FvImageSection(FvImageSectionClassObject): FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F) # FvAlignmentValue is larger than or equal to 1K if FvAlignmentValue >= 0x400: - if FvAlignmentValue >= 0x10000: - #The max alignment supported by FFS is 64K. - self.Alignment = "64K" + if FvAlignmentValue >= 0x100000: + #The max alignment supported by FFS is 16M. + if FvAlignmentValue >= 0x1000000: + self.Alignment = "16M" + else: + self.Alignment = str(FvAlignmentValue / 0x100000) + "M" else: self.Alignment = str (FvAlignmentValue / 0x400) + "K" else: diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index d02befec11..83996beeea 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -1,7 +1,7 @@ ## @file # Global variables for GenFds # -# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License @@ -420,8 +420,10 @@ class GenFdsGlobalVariable: def GetAlignment (AlignString): if AlignString == None: return 0 - if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K"): + if AlignString in ("1K", "2K", "4K", "8K", "16K", "32K", "64K", "128K", "256K", "512K"): return int (AlignString.rstrip('K')) * 1024 + elif AlignString in ("1M", "2M", "4M", "8M", "16M"): + return int (AlignString.rstrip('M')) * 1024 * 1024 else: return int (AlignString) @@ -429,7 +431,7 @@ class GenFdsGlobalVariable: def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None, SectionAlign=None): Cmd = ["GenFfs", "-t", Type, "-g", Guid] - mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K"] + mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K", "128K", "256K", "512K", "1M", "2M", "4M", "8M", "16M"] if Fixed == True: Cmd += ["-x"] if CheckSum: -- 2.39.2