From 4234283c3acb8c35014acc1546621fbc2621b095 Mon Sep 17 00:00:00 2001 From: lgao4 Date: Fri, 26 Aug 2011 07:46:26 +0000 Subject: Sync BaseTools Branch (version r2271) to EDKII main trunk. BaseTool Branch: https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/branches/Releases/BaseTools_r2100 Signed-off-by: lgao4 Reviewed-by: hchen30 git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@12214 6f19259b-4bc3-4df7-8a09-765794883524 --- BaseTools/Source/Python/AutoGen/AutoGen.py | 68 ++++++++++++++++++++++++++++-- BaseTools/Source/Python/AutoGen/GenC.py | 3 ++ BaseTools/Source/Python/AutoGen/GenMake.py | 3 +- 3 files changed, 70 insertions(+), 4 deletions(-) (limited to 'BaseTools/Source/Python/AutoGen') diff --git a/BaseTools/Source/Python/AutoGen/AutoGen.py b/BaseTools/Source/Python/AutoGen/AutoGen.py index 4e2b2e47d2..ff1c4fd82c 100644 --- a/BaseTools/Source/Python/AutoGen/AutoGen.py +++ b/BaseTools/Source/Python/AutoGen/AutoGen.py @@ -169,10 +169,17 @@ class WorkspaceAutoGen(AutoGen): # @param FlashDefinitionFile File of flash definition # @param Fds FD list to be generated # @param Fvs FV list to be generated + # @param Caps Capsule list to be generated # @param SkuId SKU id from command line # def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb, - BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId='', UniFlag=None): + BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None): + if Fds is None: + Fds = [] + if Fvs is None: + Fvs = [] + if Caps is None: + Caps = [] self.MetaFile = ActivePlatform.MetaFile self.WorkspaceDir = WorkspaceDir self.Platform = ActivePlatform @@ -188,6 +195,7 @@ class WorkspaceAutoGen(AutoGen): self.FdfFile = FlashDefinitionFile self.FdTargetList = Fds self.FvTargetList = Fvs + self.CapTargetList = Caps self.AutoGenObjectList = [] # there's many relative directory operations, so ... @@ -228,6 +236,11 @@ class WorkspaceAutoGen(AutoGen): # self._CheckAllPcdsTokenValueConflict() + # + # Check PCD type and definition between DSC and DEC + # + self._CheckPcdDefineAndType() + self._BuildDir = None self._FvDir = None self._MakeFileDir = None @@ -235,6 +248,56 @@ class WorkspaceAutoGen(AutoGen): return True + def _CheckPcdDefineAndType(self): + PcdTypeList = [ + "FixedAtBuild", "PatchableInModule", "FeatureFlag", + "Dynamic", #"DynamicHii", "DynamicVpd", + "DynamicEx", # "DynamicExHii", "DynamicExVpd" + ] + + # This dict store PCDs which are not used by any modules with specified arches + UnusedPcd = sdict() + for Pa in self.AutoGenObjectList: + # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid + for Pcd in Pa.Platform.Pcds: + PcdType = Pa.Platform.Pcds[Pcd].Type + + # If no PCD type, this PCD comes from FDF + if not PcdType: + continue + + # Try to remove Hii and Vpd suffix + if PcdType.startswith("DynamicEx"): + PcdType = "DynamicEx" + elif PcdType.startswith("Dynamic"): + PcdType = "Dynamic" + + for Package in Pa.PackageList: + # Key of DEC's Pcds dictionary is PcdCName, TokenSpaceGuid, PcdType + if (Pcd[0], Pcd[1], PcdType) in Package.Pcds: + break + for Type in PcdTypeList: + if (Pcd[0], Pcd[1], Type) in Package.Pcds: + EdkLogger.error( + 'build', + FORMAT_INVALID, + "Type [%s] of PCD [%s.%s] in DSC file doesn't match the type [%s] defined in DEC file." \ + % (Pa.Platform.Pcds[Pcd].Type, Pcd[1], Pcd[0], Type), + ExtraData=None + ) + return + else: + UnusedPcd.setdefault(Pcd, []).append(Pa.Arch) + + for Pcd in UnusedPcd: + EdkLogger.warn( + 'build', + "The PCD was not specified by any INF module in the platform for the given architecture.\n" + "\tPCD: [%s.%s]\n\tPlatform: [%s]\n\tArch: %s" + % (Pcd[1], Pcd[0], os.path.basename(str(self.MetaFile)), str(UnusedPcd[Pcd])), + ExtraData=None + ) + def __repr__(self): return "%s [%s]" % (self.MetaFile, ", ".join(self.ArchList)) @@ -2125,9 +2188,8 @@ class ModuleAutoGen(AutoGen): # def _GetAutoGenFileList(self): UniStringAutoGenC = True - UniStringBinBuffer = None + UniStringBinBuffer = StringIO() if self.BuildType == 'UEFI_HII': - UniStringBinBuffer = StringIO() UniStringAutoGenC = False if self._AutoGenFileList == None: self._AutoGenFileList = {} diff --git a/BaseTools/Source/Python/AutoGen/GenC.py b/BaseTools/Source/Python/AutoGen/GenC.py index e6e8847623..4430c94e0b 100644 --- a/BaseTools/Source/Python/AutoGen/GenC.py +++ b/BaseTools/Source/Python/AutoGen/GenC.py @@ -1951,6 +1951,9 @@ def CreateHeaderCode(Info, AutoGenC, AutoGenH): if Info.ModuleType in gModuleTypeHeaderFile \ and gModuleTypeHeaderFile[Info.ModuleType][0] != gBasicHeaderFile: AutoGenH.Append("#include <%s>\n" % gModuleTypeHeaderFile[Info.ModuleType][0]) + if 'PcdLib' in Info.Module.LibraryClasses: + AutoGenH.Append("#include \n") + AutoGenH.Append('\nextern GUID gEfiCallerIdGuid;\n\n') if Info.IsLibrary: diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index 6396c612ad..41a46fc69d 100644 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1253,7 +1253,7 @@ ${END}\t@cd $(BUILD_DIR) # fds: init \t-@cd $(FV_DIR) -${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -D ${macro} ${END} +${BEGIN}\tGenFds -f ${fdf_file} -o $(BUILD_DIR) -t $(TOOLCHAIN) -b $(TARGET) -p ${active_platform} -a ${build_architecture_list} ${extra_options}${END}${BEGIN} -r ${fd} ${END}${BEGIN} -i ${fv} ${END}${BEGIN} -C ${cap} ${END}${BEGIN} -D ${macro} ${END} # # run command for emulator platform only @@ -1365,6 +1365,7 @@ ${END}\t@cd $(BUILD_DIR)\n "active_platform" : str(PlatformInfo), "fd" : PlatformInfo.FdTargetList, "fv" : PlatformInfo.FvTargetList, + "cap" : PlatformInfo.CapTargetList, "extra_options" : ExtraOption, "macro" : MacroList, } -- cgit v1.2.3