X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=BaseTools%2FSource%2FPython%2Fbuild%2FBuildReport.py;h=f333279a5875a8cbb8f638212f4855502fcb2d72;hb=1563349a967d7e02c43492ba853babb9c660a083;hp=53d0039c51495fccd7032bafd771f8c8289dc52a;hpb=35f613d96ce43c7b23cd77aab063424ec4422e0c;p=mirror_edk2.git diff --git a/BaseTools/Source/Python/build/BuildReport.py b/BaseTools/Source/Python/build/BuildReport.py index 53d0039c51..f333279a58 100644 --- a/BaseTools/Source/Python/build/BuildReport.py +++ b/BaseTools/Source/Python/build/BuildReport.py @@ -33,7 +33,6 @@ from Common import EdkLogger from Common.Misc import SaveFileOnChange from Common.Misc import GuidStructureByteArrayToGuidString from Common.Misc import GuidStructureStringToGuidString -from Common.InfClassObject import gComponentType2ModuleType from Common.BuildToolError import FILE_WRITE_FAILURE from Common.BuildToolError import CODE_ERROR from Common.BuildToolError import COMMAND_FAILURE @@ -48,6 +47,21 @@ from Common.DataType import * import collections from Common.Expression import * +gComponentType2ModuleType = { + "LIBRARY" : "BASE", + "SECURITY_CORE" : "SEC", + "PEI_CORE" : "PEI_CORE", + "COMBINED_PEIM_DRIVER" : "PEIM", + "PIC_PEIM" : "PEIM", + "RELOCATABLE_PEIM" : "PEIM", + "PE32_PEIM" : "PEIM", + "BS_DRIVER" : "DXE_DRIVER", + "RT_DRIVER" : "DXE_RUNTIME_DRIVER", + "SAL_RT_DRIVER" : "DXE_SAL_DRIVER", + "APPLICATION" : "UEFI_APPLICATION", + "LOGO" : "BASE", +} + ## Pattern to extract contents in EDK DXS files gDxsDependencyPattern = re.compile(r"DEPENDENCY_START(.+)DEPENDENCY_END", re.DOTALL) @@ -722,7 +736,7 @@ def ReadMessage(From, To, ExitFlag): # read one line a time Line = From.readline() # empty string means "end" - if Line != None and Line != "": + if Line is not None and Line != "": To(Line.rstrip()) else: break @@ -877,10 +891,11 @@ class PcdReport(object): self.DscPcdDefault[(TokenCName, TokenSpaceGuidCName)] = DscDefaultValue def GenerateReport(self, File, ModulePcdSet): - if self.ConditionalPcds: - self.GenerateReportDetail(File, ModulePcdSet, 1) - if self.UnusedPcds: - self.GenerateReportDetail(File, ModulePcdSet, 2) + if not ModulePcdSet: + if self.ConditionalPcds: + self.GenerateReportDetail(File, ModulePcdSet, 1) + if self.UnusedPcds: + self.GenerateReportDetail(File, ModulePcdSet, 2) self.GenerateReportDetail(File, ModulePcdSet) ## @@ -904,7 +919,7 @@ class PcdReport(object): elif ReportSubType == 2: PcdDict = self.UnusedPcds - if ModulePcdSet == None: + if not ModulePcdSet: FileWrite(File, gSectionStart) if ReportSubType == 1: FileWrite(File, "Conditional Directives used by the build system") @@ -958,7 +973,7 @@ class PcdReport(object): if DscDefaultValue != DscDefaultValBak: try: DscDefaultValue = ValueExpressionEx(DscDefaultValue, Pcd.DatumType, self._GuidDict)(True) - except BadExpression, Value: + except BadExpression, DscDefaultValue: EdkLogger.error('BuildReport', FORMAT_INVALID, "PCD Value: %s, Type: %s" %(DscDefaultValue, Pcd.DatumType)) InfDefaultValue = None @@ -966,10 +981,11 @@ class PcdReport(object): PcdValue = DecDefaultValue if DscDefaultValue: PcdValue = DscDefaultValue - if ModulePcdSet != None: + if ModulePcdSet is not None: if (Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type) not in ModulePcdSet: continue InfDefault, PcdValue = ModulePcdSet[Pcd.TokenCName, Pcd.TokenSpaceGuidCName, Type] + Pcd.DefaultValue = PcdValue if InfDefault == "": InfDefault = None @@ -977,12 +993,15 @@ class PcdReport(object): if GlobalData.BuildOptionPcd: for pcd in GlobalData.BuildOptionPcd: if (Pcd.TokenSpaceGuidCName, Pcd.TokenCName) == (pcd[0], pcd[1]): - PcdValue = pcd[2] + if pcd[2]: + continue + PcdValue = pcd[3] + Pcd.DefaultValue = PcdValue BuildOptionMatch = True break if First: - if ModulePcdSet == None: + if ModulePcdSet is None: FileWrite(File, "") FileWrite(File, Key) First = False @@ -990,35 +1009,35 @@ class PcdReport(object): if Pcd.DatumType in ('UINT8', 'UINT16', 'UINT32', 'UINT64'): PcdValueNumber = int(PcdValue.strip(), 0) - if DecDefaultValue == None: + if DecDefaultValue is None: DecMatch = True else: DecDefaultValueNumber = int(DecDefaultValue.strip(), 0) DecMatch = (DecDefaultValueNumber == PcdValueNumber) - if InfDefaultValue == None: + if InfDefaultValue is None: InfMatch = True else: InfDefaultValueNumber = int(InfDefaultValue.strip(), 0) InfMatch = (InfDefaultValueNumber == PcdValueNumber) - if DscDefaultValue == None: + if DscDefaultValue is None: DscMatch = True else: DscDefaultValueNumber = int(DscDefaultValue.strip(), 0) DscMatch = (DscDefaultValueNumber == PcdValueNumber) else: - if DecDefaultValue == None: + if DecDefaultValue is None: DecMatch = True else: DecMatch = (DecDefaultValue.strip() == PcdValue.strip()) - if InfDefaultValue == None: + if InfDefaultValue is None: InfMatch = True else: InfMatch = (InfDefaultValue.strip() == PcdValue.strip()) - if DscDefaultValue == None: + if DscDefaultValue is None: DscMatch = True else: DscMatch = (DscDefaultValue.strip() == PcdValue.strip()) @@ -1032,9 +1051,42 @@ class PcdReport(object): Pcd.DatumType = Pcd.StructName if TypeName in ('DYNVPD', 'DEXVPD'): Pcd.SkuInfoList = SkuInfoList - if Pcd.SkuOverrideValues: - DscMatch = True + if Pcd.PcdFieldValueFromComm: + BuildOptionMatch = True DecMatch = False + elif Pcd.SkuOverrideValues: + DscOverride = False + if not Pcd.SkuInfoList: + OverrideValues = Pcd.SkuOverrideValues + if OverrideValues: + Keys = OverrideValues.keys() + Data = OverrideValues[Keys[0]] + Struct = Data.values()[0] + DscOverride = self.ParseStruct(Struct) + else: + SkuList = sorted(Pcd.SkuInfoList.keys()) + for Sku in SkuList: + SkuInfo = Pcd.SkuInfoList[Sku] + if TypeName in ('DYNHII', 'DEXHII'): + if SkuInfo.DefaultStoreDict: + DefaultStoreList = sorted(SkuInfo.DefaultStoreDict.keys()) + for DefaultStore in DefaultStoreList: + OverrideValues = Pcd.SkuOverrideValues[Sku] + DscOverride = self.ParseStruct(OverrideValues[DefaultStore]) + if DscOverride: + break + else: + OverrideValues = Pcd.SkuOverrideValues[Sku] + if OverrideValues: + Keys = OverrideValues.keys() + OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) + DscOverride = self.ParseStruct(OverrideFieldStruct) + if DscOverride: + break + if DscOverride: + DscMatch = True + DecMatch = False + # # Report PCD item according to their override relationship # @@ -1051,7 +1103,7 @@ class PcdReport(object): else: self.PrintPcdValue(File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValBak, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, '*M') - if ModulePcdSet == None: + if ModulePcdSet is None: if IsStructure: continue if not TypeName in ('PATCH', 'FLAG', 'FIXED'): @@ -1075,15 +1127,23 @@ class PcdReport(object): else: FileWrite(File, ' *M %-*s = %s' % (self.MaxLen + 19, ModulePath, ModuleDefault.strip())) - if ModulePcdSet == None: + if ModulePcdSet is None: FileWrite(File, gSectionEnd) else: if not ReportSubType and ModulePcdSet: FileWrite(File, gSubSectionEnd) + def ParseStruct(self, struct): + HasDscOverride = False + if struct: + for _, Values in struct.items(): + if Values[1] and Values[1].endswith('.dsc'): + HasDscOverride = True + break + return HasDscOverride def PrintPcdDefault(self, File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue): - if not DscMatch and DscDefaultValue != None: + if not DscMatch and DscDefaultValue is not None: Value = DscDefaultValue.strip() IsByteArray, ArrayList = ByteArrayForamt(Value) if IsByteArray: @@ -1092,7 +1152,7 @@ class PcdReport(object): FileWrite(File, '%s' % (Array)) else: FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DSC DEFAULT', Value)) - if not InfMatch and InfDefaultValue != None: + if not InfMatch and InfDefaultValue is not None: Value = InfDefaultValue.strip() IsByteArray, ArrayList = ByteArrayForamt(Value) if IsByteArray: @@ -1102,7 +1162,7 @@ class PcdReport(object): else: FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'INF DEFAULT', Value)) - if not DecMatch and DecDefaultValue != None: + if not DecMatch and DecDefaultValue is not None: Value = DecDefaultValue.strip() IsByteArray, ArrayList = ByteArrayForamt(Value) if IsByteArray: @@ -1113,6 +1173,8 @@ class PcdReport(object): FileWrite(File, ' %*s = %s' % (self.MaxLen + 19, 'DEC DEFAULT', Value)) if IsStructure: self.PrintStructureInfo(File, Pcd.DefaultValues) + if DecMatch and IsStructure: + self.PrintStructureInfo(File, Pcd.DefaultValues) def PrintPcdValue(self, File, Pcd, PcdTokenCName, TypeName, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue, Flag = ' '): if not Pcd.SkuInfoList: @@ -1130,7 +1192,8 @@ class PcdReport(object): Keys = OverrideValues.keys() Data = OverrideValues[Keys[0]] Struct = Data.values()[0] - self.PrintStructureInfo(File, Struct) + OverrideFieldStruct = self.OverrideFieldValue(Pcd, Struct) + self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) else: FirstPrint = True @@ -1190,8 +1253,8 @@ class PcdReport(object): FileWrite(File, '%*s: %s: %s' % (self.MaxLen + 4, SkuInfo.VariableGuid, SkuInfo.VariableName, SkuInfo.VariableOffset)) if IsStructure: OverrideValues = Pcd.SkuOverrideValues[Sku] - Struct = OverrideValues[DefaultStore] - self.PrintStructureInfo(File, Struct) + OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[DefaultStore]) + self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) else: Value = SkuInfo.DefaultValue @@ -1229,21 +1292,27 @@ class PcdReport(object): OverrideValues = Pcd.SkuOverrideValues[Sku] if OverrideValues: Keys = OverrideValues.keys() - Struct = OverrideValues[Keys[0]] - self.PrintStructureInfo(File, Struct) + OverrideFieldStruct = self.OverrideFieldValue(Pcd, OverrideValues[Keys[0]]) + self.PrintStructureInfo(File, OverrideFieldStruct) self.PrintPcdDefault(File, Pcd, IsStructure, DscMatch, DscDefaultValue, InfMatch, InfDefaultValue, DecMatch, DecDefaultValue) + def OverrideFieldValue(self, Pcd, OverrideStruct): + OverrideFieldStruct = collections.OrderedDict() + if OverrideStruct: + for Key, Values in OverrideStruct.items(): + if Values[1] and Values[1].endswith('.dsc'): + OverrideFieldStruct[Key] = Values + if Pcd.PcdFieldValueFromComm: + for Key, Values in Pcd.PcdFieldValueFromComm.items(): + OverrideFieldStruct[Key] = Values + return OverrideFieldStruct + def PrintStructureInfo(self, File, Struct): - NewInfo = collections.OrderedDict() for Key, Value in Struct.items(): - if Key not in NewInfo: - NewInfo[Key] = Value[0] + if Value[1] and 'build command options' in Value[1]: + FileWrite(File, ' *B %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0])) else: - del NewInfo[Key] - NewInfo[Key] = Value[0] - if NewInfo: - for item in NewInfo: - FileWrite(File, ' %-*s = %s' % (self.MaxLen + 4, '.' + item, NewInfo[item])) + FileWrite(File, ' %-*s = %s' % (self.MaxLen + 4, '.' + Key, Value[0])) def StrtoHex(self, value): try: @@ -1626,6 +1695,7 @@ class FdRegionReport(object): self.FvInfo = {} self._GuidsDb = {} self._FvDir = Wa.FvDir + self._WorkspaceDir = Wa.WorkspaceDir # # If the input FdRegion is not a firmware volume, @@ -1729,7 +1799,15 @@ class FdRegionReport(object): FvTotalSize = 0 FvTakenSize = 0 FvFreeSize = 0 - FvReportFileName = os.path.join(self._FvDir, FvName + ".Fv.txt") + if FvName.upper().endswith('.FV'): + FileExt = FvName + ".txt" + else: + FileExt = FvName + ".Fv.txt" + + if not os.path.isfile(FileExt): + FvReportFileName = mws.join(self._WorkspaceDir, FileExt) + if not os.path.isfile(FvReportFileName): + FvReportFileName = os.path.join(self._FvDir, FileExt) try: # # Collect size info in the firmware volume. @@ -1909,7 +1987,7 @@ class PlatformReport(object): self.PcdReport = PcdReport(Wa) self.FdReportList = [] - if "FLASH" in ReportType and Wa.FdfProfile and MaList == None: + if "FLASH" in ReportType and Wa.FdfProfile and MaList is None: for Fd in Wa.FdfProfile.FdDict: self.FdReportList.append(FdReport(Wa.FdfProfile.FdDict[Fd], Wa)) @@ -1922,7 +2000,7 @@ class PlatformReport(object): self.DepexParser = DepexParser(Wa) self.ModuleReportList = [] - if MaList != None: + if MaList is not None: self._IsModuleBuild = True for Ma in MaList: self.ModuleReportList.append(ModuleReport(Ma, ReportType)) @@ -1932,13 +2010,13 @@ class PlatformReport(object): ModuleAutoGenList = [] for ModuleKey in Pa.Platform.Modules: ModuleAutoGenList.append(Pa.Platform.Modules[ModuleKey].M) - if GlobalData.gFdfParser != None: + if GlobalData.gFdfParser is not None: if Pa.Arch in GlobalData.gFdfParser.Profile.InfDict: INFList = GlobalData.gFdfParser.Profile.InfDict[Pa.Arch] for InfName in INFList: InfClass = PathClass(NormPath(InfName), Wa.WorkspaceDir, Pa.Arch) Ma = ModuleAutoGen(Wa, InfClass, Pa.BuildTarget, Pa.ToolChain, Pa.Arch, Wa.MetaFile) - if Ma == None: + if Ma is None: continue if Ma not in ModuleAutoGenList: ModuleAutoGenList.append(Ma)