From b303ea726e1c8ed240dad2bce54821318567eab3 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Mon, 9 Nov 2009 11:47:35 +0000 Subject: Sync tool code to BuildTools project r1739. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9397 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/GenFds/DepexSection.py | 32 +++--- BaseTools/Source/Python/GenFds/Fd.py | 27 +++++ BaseTools/Source/Python/GenFds/FdfParser.py | 123 ++++++++++++++++++--- BaseTools/Source/Python/GenFds/Ffs.py | 4 +- BaseTools/Source/Python/GenFds/FfsInfStatement.py | 47 +++++++- BaseTools/Source/Python/GenFds/Fv.py | 83 ++++++++++++-- .../Source/Python/GenFds/GenFdsGlobalVariable.py | 12 +- BaseTools/Source/Python/GenFds/Section.py | 2 +- 8 files changed, 283 insertions(+), 47 deletions(-) (limited to 'BaseTools/Source/Python/GenFds') diff --git a/BaseTools/Source/Python/GenFds/DepexSection.py b/BaseTools/Source/Python/GenFds/DepexSection.py index 1c8c82a72e..a0a1905dfa 100644 --- a/BaseTools/Source/Python/GenFds/DepexSection.py +++ b/BaseTools/Source/Python/GenFds/DepexSection.py @@ -80,23 +80,27 @@ class DepexSection (DepexSectionClassObject): self.Expression = self.Expression.replace(Item, ExpGuidDict[Item]) self.Expression = self.Expression.strip() - ModuleType = (self.DepexType.startswith('PEI') and ['PEIM'] or ['DXE_DRIVER'])[0] - if self.DepexType.startswith('SMM'): - ModuleType = 'SMM_DRIVER' - InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx') - InputFile = os.path.normpath(InputFile) + if self.DepexType == 'PEI_DEPEX_EXP': + ModuleType = 'PEIM' + SecType = 'PEI_DEPEX' + elif self.DepexType == 'DXE_DEPEX_EXP': + ModuleType = 'DXE_DRIVER' + SecType = 'DXE_DEPEX' + elif self.DepexType == 'SMM_DEPEX_EXP': + ModuleType = 'DXE_SMM_DRIVER' + SecType = 'SMM_DEPEX' + else: + EdkLogger.error("GenFds", FORMAT_INVALID, + "Depex type %s is not valid for module %s" % (self.DepexType, ModuleName)) - Dpx = DependencyExpression(self.Expression, ModuleType) - Dpx.Generate(InputFile) + InputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex') + InputFile = os.path.normpath(InputFile) + Depex = DependencyExpression(self.Expression, ModuleType) + Depex.Generate(InputFile) - OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.depex') - if self.DepexType.startswith('SMM'): - OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.smm') + OutputFile = os.path.join (OutputPath, ModuleName + 'SEC' + SecNum + '.dpx') OutputFile = os.path.normpath(OutputFile) - SecType = (self.DepexType.startswith('PEI') and ['PEI_DEPEX'] or ['DXE_DEPEX'])[0] - if self.DepexType.startswith('SMM'): - SecType = 'SMM_DEPEX' - + GenFdsGlobalVariable.GenerateSection(OutputFile, [InputFile], Section.Section.SectionType.get (SecType)) FileList = [OutputFile] return FileList, self.Alignment diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py index 370008c918..26de500d9b 100644 --- a/BaseTools/Source/Python/GenFds/Fd.py +++ b/BaseTools/Source/Python/GenFds/Fd.py @@ -65,6 +65,33 @@ class FD(FDClassObject): GenFdsGlobalVariable.VerboseLogger('################### Gen VTF ####################') self.GenVtfFile() + TempFdBuffer = StringIO.StringIO('') + PreviousRegionStart = -1 + PreviousRegionSize = 1 + + for RegionObj in self.RegionList : + if RegionObj.RegionType == 'CAPSULE': + continue + if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart: + pass + elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize): + pass + elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize: + GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize))) + PadRegion = Region.Region() + PadRegion.Offset = PreviousRegionStart + PreviousRegionSize + PadRegion.Size = RegionObj.Offset - PadRegion.Offset + PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict) + PreviousRegionStart = RegionObj.Offset + PreviousRegionSize = RegionObj.Size + # + # Call each region's AddToBuffer function + # + if PreviousRegionSize > self.Size: + pass + GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function') + RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict) + FdBuffer = StringIO.StringIO('') PreviousRegionStart = -1 PreviousRegionSize = 1 diff --git a/BaseTools/Source/Python/GenFds/FdfParser.py b/BaseTools/Source/Python/GenFds/FdfParser.py index 07de92610a..24732a0d5e 100644 --- a/BaseTools/Source/Python/GenFds/FdfParser.py +++ b/BaseTools/Source/Python/GenFds/FdfParser.py @@ -1877,6 +1877,14 @@ class FdfParser: self.__GetFvNameGuid(FvObj) + FvObj.FvExtEntryTypeValue = [] + FvObj.FvExtEntryType = [] + FvObj.FvExtEntryData = [] + while True: + isFvExtEntry = self.__GetFvExtEntryStatement(FvObj) + if not isFvExtEntry: + break + self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy()) self.__GetAprioriSection(FvObj, FvObj.DefineVarDict.copy()) @@ -1970,6 +1978,79 @@ class FdfParser: return + def __GetFvExtEntryStatement(self, FvObj): + + if not self.__IsKeyword( "FV_EXT_ENTRY"): + return False + + if not self.__IsKeyword ("TYPE"): + raise Warning("expected 'TYPE'", self.FileName, self.CurrentLineNumber) + + if not self.__IsToken( "="): + raise Warning("expected '='", self.FileName, self.CurrentLineNumber) + + if not self.__GetNextHexNumber() and not self.__GetNextDecimalNumber(): + raise Warning("expected Hex FV extension entry type value At Line ", self.FileName, self.CurrentLineNumber) + + FvObj.FvExtEntryTypeValue += [self.__Token] + + if not self.__IsToken( "{"): + raise Warning("expected '{'", self.FileName, self.CurrentLineNumber) + + if not self.__IsKeyword ("FILE") and not self.__IsKeyword ("DATA"): + raise Warning("expected 'FILE' or 'DATA'", self.FileName, self.CurrentLineNumber) + + FvObj.FvExtEntryType += [self.__Token] + + if self.__Token == 'DATA': + + if not self.__IsToken( "="): + raise Warning("expected '='", self.FileName, self.CurrentLineNumber) + + if not self.__IsToken( "{"): + raise Warning("expected '{'", self.FileName, self.CurrentLineNumber) + + if not self.__GetNextHexNumber(): + raise Warning("expected Hex byte", self.FileName, self.CurrentLineNumber) + + if len(self.__Token) > 4: + raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber) + + DataString = self.__Token + DataString += "," + + while self.__IsToken(","): + if not self.__GetNextHexNumber(): + raise Warning("Invalid Hex number", self.FileName, self.CurrentLineNumber) + if len(self.__Token) > 4: + raise Warning("Hex byte(must be 2 digits) too long", self.FileName, self.CurrentLineNumber) + DataString += self.__Token + DataString += "," + + if not self.__IsToken( "}"): + raise Warning("expected '}'", self.FileName, self.CurrentLineNumber) + + if not self.__IsToken( "}"): + raise Warning("expected '}'", self.FileName, self.CurrentLineNumber) + + DataString = DataString.rstrip(",") + FvObj.FvExtEntryData += [DataString] + + if self.__Token == 'FILE': + + if not self.__IsToken( "="): + raise Warning("expected '='", self.FileName, self.CurrentLineNumber) + + if not self.__GetNextToken(): + raise Warning("expected FV Extension Entry file path At Line ", self.FileName, self.CurrentLineNumber) + + FvObj.FvExtEntryData += [self.__Token] + + if not self.__IsToken( "}"): + raise Warning("expected '}'", self.FileName, self.CurrentLineNumber) + + return True + ## __GetAprioriSection() method # # Get token statements @@ -2683,15 +2764,31 @@ class FdfParser: # @param Obj for whom token statements are got # def __GetCapsuleTokens(self, Obj): - - if not self.__IsKeyword("CAPSULE_GUID"): - raise Warning("expected 'CAPSULE_GUID'", self.FileName, self.CurrentLineNumber) - - while self.__CurrentLine().find("=") != -1: - NameValue = self.__CurrentLine().split("=") - Obj.TokensDict[NameValue[0].strip()] = NameValue[1].strip() - self.CurrentLineNumber += 1 - self.CurrentOffsetWithinLine = 0 + if not self.__GetNextToken(): + return False + while self.__Token in ("CAPSULE_GUID", "CAPSULE_HEADER_SIZE", "CAPSULE_FLAGS"): + Name = self.__Token.strip() + if not self.__IsToken("="): + raise Warning("expected '='", self.FileName, self.CurrentLineNumber) + if not self.__GetNextToken(): + raise Warning("expected value", self.FileName, self.CurrentLineNumber) + if Name == 'CAPSULE_FLAGS': + if not self.__Token in ("PersistAcrossReset", "PopulateSystemTable", "InitiateReset"): + raise Warning("expected PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber) + Value = self.__Token.strip() + while self.__IsToken(","): + Value += ',' + if not self.__GetNextToken(): + raise Warning("expected value", self.FileName, self.CurrentLineNumber) + if not self.__Token in ("PersistAcrossReset", "PopulateSystemTable", "InitiateReset"): + raise Warning("expected PersistAcrossReset, PopulateSystemTable, or InitiateReset", self.FileName, self.CurrentLineNumber) + Value += self.__Token.strip() + else: + Value = self.__Token.strip() + Obj.TokensDict[Name] = Value + if not self.__GetNextToken(): + return False + self.__UndoToken() ## __GetCapsuleData() method # @@ -2815,7 +2912,7 @@ class FdfParser: "DXE_SMM_DRIVER", "DXE_RUNTIME_DRIVER", \ "UEFI_DRIVER", "UEFI_APPLICATION", "USER_DEFINED", "DEFAULT", "BASE", \ "SECURITY_CORE", "COMBINED_PEIM_DRIVER", "PIC_PEIM", "RELOCATABLE_PEIM", \ - "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_DRIVER", "SMM_CORE"): + "PE32_PEIM", "BS_DRIVER", "RT_DRIVER", "SAL_RT_DRIVER", "APPLICATION", "ACPITABLE", "SMM_CORE"): raise Warning("Unknown Module type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) return self.__Token @@ -2859,7 +2956,7 @@ class FdfParser: Type = self.__Token.strip().upper() if Type not in ("RAW", "FREEFORM", "SEC", "PEI_CORE", "PEIM",\ - "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM_DXE_COMBO", "SMM", "SMM_CORE"): + "PEI_DXE_COMBO", "DRIVER", "DXE_CORE", "APPLICATION", "FV_IMAGE", "SMM", "SMM_CORE"): raise Warning("Unknown FV type '%s'" % self.__Token, self.FileName, self.CurrentLineNumber) if not self.__IsToken("="): @@ -3238,8 +3335,8 @@ class FdfParser: elif SectionType == "RAW": if FileType not in ("BIN", "SEC_BIN", "RAW", "ASL", "ACPI"): raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) - elif SectionType == "DXE_DEPEX": - if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX"): + elif SectionType == "DXE_DEPEX" or SectionType == "SMM_DEPEX": + if FileType not in ("DXE_DEPEX", "SEC_DXE_DEPEX", "SMM_DEPEX"): raise Warning("Incorrect section file type '%s'" % FileType, self.FileName, self.CurrentLineNumber) elif SectionType == "UI": if FileType not in ("UI", "SEC_UI"): diff --git a/BaseTools/Source/Python/GenFds/Ffs.py b/BaseTools/Source/Python/GenFds/Ffs.py index aaa791763b..438bd186dc 100644 --- a/BaseTools/Source/Python/GenFds/Ffs.py +++ b/BaseTools/Source/Python/GenFds/Ffs.py @@ -34,7 +34,6 @@ class Ffs(FDClassObject): 'DXE_RUNTIME_DRIVER': 'EFI_FV_FILETYPE_DRIVER', 'UEFI_DRIVER' : 'EFI_FV_FILETYPE_DRIVER', 'UEFI_APPLICATION' : 'EFI_FV_FILETYPE_APPLICATION', - 'SMM_DRIVER' : 'EFI_FV_FILETYPE_SMM', 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE' } @@ -50,7 +49,6 @@ class Ffs(FDClassObject): 'FV_IMAGE' : 'EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE', 'RAW' : 'EFI_FV_FILETYPE_RAW', 'PEI_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER', - 'SMM_DXE_COMBO' : 'EFI_FV_FILETYPE_COMBINED_SMM_DXE', 'SMM' : 'EFI_FV_FILETYPE_SMM', 'SMM_CORE' : 'EFI_FV_FILETYPE_SMM_CORE' } @@ -70,7 +68,7 @@ class Ffs(FDClassObject): 'COMPRESS' : '.com', 'GUIDED' : '.guided', 'PEI_DEPEX' : '.dpx', - 'SMM_DEPEX' : '.smm' + 'SMM_DEPEX' : '.dpx' } ## The constructor diff --git a/BaseTools/Source/Python/GenFds/FfsInfStatement.py b/BaseTools/Source/Python/GenFds/FfsInfStatement.py index 0dcd96da2e..ac13e4d7d9 100644 --- a/BaseTools/Source/Python/GenFds/FfsInfStatement.py +++ b/BaseTools/Source/Python/GenFds/FfsInfStatement.py @@ -47,6 +47,7 @@ class FfsInfStatement(FfsInfStatementClassObject): self.KeepRelocFromRule = None self.InDsc = True self.OptRomDefs = {} + self.PiSpecVersion = 0 ## __InfParse() method # @@ -89,6 +90,8 @@ class FfsInfStatement(FfsInfStatementClassObject): self.BaseName = Inf.BaseName self.ModuleGuid = Inf.Guid self.ModuleType = Inf.ModuleType + if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification: + self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION'] if Inf.AutoGenVersion < 0x00010005: self.ModuleType = Inf.ComponentType self.VersionString = Inf.Version @@ -102,6 +105,8 @@ class FfsInfStatement(FfsInfStatementClassObject): self.BaseName = Inf.BaseName self.ModuleGuid = Inf.Guid self.ModuleType = Inf.ModuleType + if Inf.Specification != None and 'PI_SPECIFICATION_VERSION' in Inf.Specification: + self.PiSpecVersion = Inf.Specification['PI_SPECIFICATION_VERSION'] self.VersionString = Inf.Version self.BinFileList = Inf.Binaries self.SourceFileList = Inf.Sources @@ -113,6 +118,9 @@ class FfsInfStatement(FfsInfStatementClassObject): if len(self.SourceFileList) != 0 and not self.InDsc: EdkLogger.warn("GenFds", GENFDS_ERROR, "Module %s NOT found in DSC file; Is it really a binary module?" % (self.InfFileName)) + if self.ModuleType == 'SMM_CORE' and self.PiSpecVersion < 0x0001000A: + EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "SMM_CORE module type can't be used in the module with PI_SPECIFICATION_VERSION less than 0x0001000A", File=self.InfFileName) + if Inf._Defs != None and len(Inf._Defs) > 0: self.OptRomDefs.update(Inf._Defs) @@ -153,7 +161,18 @@ class FfsInfStatement(FfsInfStatementClassObject): # Rule = self.__GetRule__() GenFdsGlobalVariable.VerboseLogger( "Packing binaries from inf file : %s" %self.InfFileName) - #FileType = Ffs.Ffs.ModuleTypeToFileType[Rule.ModuleType] + # + # Convert Fv File Type for PI1.1 SMM driver. + # + if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A: + if Rule.FvFileType == 'DRIVER': + Rule.FvFileType = 'SMM' + # + # Framework SMM Driver has no SMM FV file type + # + if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A: + if Rule.FvFileType == 'SMM' or Rule.FvFileType == 'SMM_CORE': + EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM or SMM_CORE FV file type", File=self.InfFileName) # # For the rule only has simpleFile # @@ -380,7 +399,19 @@ class FfsInfStatement(FfsInfStatementClassObject): FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension) Index = 1 - SectionType = Rule.SectionType + SectionType = Rule.SectionType + # + # Convert Fv Section Type for PI1.1 SMM driver. + # + if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A: + if SectionType == 'DXE_DEPEX': + SectionType = 'SMM_DEPEX' + # + # Framework SMM Driver has no SMM_DEPEX section type + # + if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A: + if SectionType == 'SMM_DEPEX': + EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName) NoStrip = True if self.ModuleType in ('SEC', 'PEI_CORE', 'PEIM'): if self.KeepReloc != None: @@ -517,6 +548,18 @@ class FfsInfStatement(FfsInfStatementClassObject): for Sect in Rule.SectionList: SecIndex = '%d' %Index SectList = [] + # + # Convert Fv Section Type for PI1.1 SMM driver. + # + if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion >= 0x0001000A: + if Sect.SectionType == 'DXE_DEPEX': + Sect.SectionType = 'SMM_DEPEX' + # + # Framework SMM Driver has no SMM_DEPEX section type + # + if self.ModuleType == 'DXE_SMM_DRIVER' and self.PiSpecVersion < 0x0001000A: + if Sect.SectionType == 'SMM_DEPEX': + EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName) if Rule.KeyStringList != []: SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self) else : diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py index 23ec58200b..a9ff26e597 100644 --- a/BaseTools/Source/Python/GenFds/Fv.py +++ b/BaseTools/Source/Python/GenFds/Fv.py @@ -19,6 +19,7 @@ import os import shutil import subprocess import StringIO +from struct import * import Ffs import AprioriSection @@ -70,8 +71,8 @@ class FV (FvClassObject): # If yes, return error. Doesn't support FV in Capsule image is also in FD flash region. # if self.CapsuleName != None: - for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): - FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName] + for FdName in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys(): + FdObj = GenFdsGlobalVariable.FdfParser.Profile.FdDict[FdName] for RegionObj in FdObj.RegionList: if RegionObj.RegionType == 'FV': for RegionData in RegionObj.RegionDataList: @@ -215,19 +216,81 @@ class FV (FvClassObject): self.FvAlignment.strip() + \ " = TRUE" + \ T_CHAR_LF) - - if self.FvNameGuid != None: - self.FvInfFile.writelines("EFI_FVNAME_GUID" + \ - " = %s" % self.FvNameGuid + \ - T_CHAR_LF) + # - # Add [Files] + # Generate FV extension header file # + if self.FvNameGuid == None or self.FvNameGuid == '': + if len(self.FvExtEntryType) > 0: + GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName)) + + if self.FvNameGuid <> None and self.FvNameGuid <> '': + TotalSize = 16 + 4 + Buffer = '' + for Index in range (0, len(self.FvExtEntryType)): + if self.FvExtEntryType[Index] == 'FILE': + # check if the path is absolute or relative + if os.path.isabs(self.FvExtEntryData[Index]): + FileFullPath = os.path.normpath(self.FvExtEntryData[Index]) + else: + FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index])) + # check if the file path exists or not + if not os.path.isfile(FileFullPath): + GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index])) + FvExtFile = open (FileFullPath,'rb') + FvExtFile.seek(0,2) + Size = FvExtFile.tell() + if Size >= 0x10000: + GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry file %s exceeds 0x10000." % (self.FvExtEntryData[Index])) + TotalSize += (Size + 4) + FvExtFile.seek(0) + Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16)) + Buffer += FvExtFile.read() + FvExtFile.close() + if self.FvExtEntryType[Index] == 'DATA': + ByteList = self.FvExtEntryData[Index].split(',') + Size = len (ByteList) + if Size >= 0x10000: + GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry data %s exceeds 0x10000." % (self.FvExtEntryData[Index])) + TotalSize += (Size + 4) + Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16)) + for Index1 in range (0, Size): + Buffer += pack('B', int(ByteList[Index1], 16)) + + Guid = self.FvNameGuid.split('-') + Buffer = pack('LHHBBBBBBBBL', + int(Guid[0], 16), + int(Guid[1], 16), + int(Guid[2], 16), + int(Guid[3][-4:-2], 16), + int(Guid[3][-2:], 16), + int(Guid[4][-12:-10], 16), + int(Guid[4][-10:-8], 16), + int(Guid[4][-8:-6], 16), + int(Guid[4][-6:-4], 16), + int(Guid[4][-4:-2], 16), + int(Guid[4][-2:], 16), + TotalSize + ) + Buffer + + # + # Generate FV extension header file if the total size is not zero + # + if TotalSize > 0: + FvExtHeaderFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName + '.ext') + FvExtHeaderFile = open (FvExtHeaderFileName,'wb') + FvExtHeaderFile.write(Buffer) + FvExtHeaderFile.close() + self.FvInfFile.writelines("EFI_FV_EXT_HEADER_FILE_NAME = " + \ + FvExtHeaderFileName + \ + T_CHAR_LF) + + # + # Add [Files] + # self.FvInfFile.writelines("[files]" + T_CHAR_LF) if VtfDict != None and self.UiFvName in VtfDict.keys(): self.FvInfFile.writelines("EFI_FILE_NAME = " + \ VtfDict.get(self.UiFvName) + \ T_CHAR_LF) - - diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index 77c8821a05..b54e8c88e2 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -294,10 +294,7 @@ class GenFdsGlobalVariable: @staticmethod def GenerateOptionRom(Output, EfiInput, BinaryInput, Compress=False, ClassCode=None, Revision=None, DeviceId=None, VendorId=None): -# if not GenFdsGlobalVariable.NeedsUpdate(Output, Input): -# return -# GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, Input)) - + InputList = [] Cmd = ["EfiRom"] if len(EfiInput) > 0: @@ -308,11 +305,18 @@ class GenFdsGlobalVariable: for EfiFile in EfiInput: Cmd += [EfiFile] + InputList.append (EfiFile) if len(BinaryInput) > 0: Cmd += ["-b"] for BinFile in BinaryInput: Cmd += [BinFile] + InputList.append (BinFile) + + # Check List + if not GenFdsGlobalVariable.NeedsUpdate(Output, InputList): + return + GenFdsGlobalVariable.DebugLogger(EdkLogger.DEBUG_5, "%s needs update because of newer %s" % (Output, InputList)) if ClassCode != None: Cmd += ["-l", ClassCode] diff --git a/BaseTools/Source/Python/GenFds/Section.py b/BaseTools/Source/Python/GenFds/Section.py index ffca3a11fe..1905935ebf 100644 --- a/BaseTools/Source/Python/GenFds/Section.py +++ b/BaseTools/Source/Python/GenFds/Section.py @@ -129,7 +129,7 @@ class Section (SectionClassObject): if FileType != None: for File in FfsInf.BinFileList: if File.Arch == "COMMON" or FfsInf.CurrentArch == File.Arch: - if File.Type == FileType: + if File.Type == FileType or (FfsInf.PiSpecVersion >= 0x0001000A and FileType == 'DXE_DPEX'and File.Type == 'SMM_DEPEX'): if '*' in FfsInf.TargetOverrideList or File.Target == '*' or File.Target in FfsInf.TargetOverrideList or FfsInf.TargetOverrideList == []: FileList.append(File.Path) else: -- cgit v1.2.3