# @param FlashDefinitionFile File of flash definition\r
# @param Fds FD list to be generated\r
# @param Fvs FV list to be generated\r
+ # @param Caps Capsule list to be generated\r
# @param SkuId SKU id from command line\r
#\r
def _Init(self, WorkspaceDir, ActivePlatform, Target, Toolchain, ArchList, MetaFileDb,\r
- BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=[], Fvs=[], SkuId='', UniFlag=None):\r
+ BuildConfig, ToolDefinition, FlashDefinitionFile='', Fds=None, Fvs=None, Caps=None, SkuId='', UniFlag=None):\r
+ if Fds is None:\r
+ Fds = []\r
+ if Fvs is None:\r
+ Fvs = []\r
+ if Caps is None:\r
+ Caps = []\r
self.MetaFile = ActivePlatform.MetaFile\r
self.WorkspaceDir = WorkspaceDir\r
self.Platform = ActivePlatform\r
self.FdfFile = FlashDefinitionFile\r
self.FdTargetList = Fds\r
self.FvTargetList = Fvs\r
+ self.CapTargetList = Caps\r
self.AutoGenObjectList = []\r
\r
# there's many relative directory operations, so ...\r
#\r
self._CheckAllPcdsTokenValueConflict()\r
\r
+ #\r
+ # Check PCD type and definition between DSC and DEC\r
+ #\r
+ self._CheckPcdDefineAndType()\r
+ \r
self._BuildDir = None\r
self._FvDir = None\r
self._MakeFileDir = None\r
\r
return True\r
\r
+ def _CheckPcdDefineAndType(self):\r
+ PcdTypeList = [\r
+ "FixedAtBuild", "PatchableInModule", "FeatureFlag",\r
+ "Dynamic", #"DynamicHii", "DynamicVpd",\r
+ "DynamicEx", # "DynamicExHii", "DynamicExVpd"\r
+ ]\r
+\r
+ # This dict store PCDs which are not used by any modules with specified arches\r
+ UnusedPcd = sdict()\r
+ for Pa in self.AutoGenObjectList:\r
+ # Key of DSC's Pcds dictionary is PcdCName, TokenSpaceGuid\r
+ for Pcd in Pa.Platform.Pcds:\r
+ PcdType = Pa.Platform.Pcds[Pcd].Type\r
+ \r
+ # If no PCD type, this PCD comes from FDF \r
+ if not PcdType:\r
+ continue\r
+ \r
+ # Try to remove Hii and Vpd suffix\r
+ if PcdType.startswith("DynamicEx"):\r
+ PcdType = "DynamicEx"\r
+ elif PcdType.startswith("Dynamic"):\r
+ PcdType = "Dynamic"\r
+ \r
+ for Package in Pa.PackageList:\r
+ # Key of DEC's Pcds dictionary is PcdCName, TokenSpaceGuid, PcdType\r
+ if (Pcd[0], Pcd[1], PcdType) in Package.Pcds:\r
+ break\r
+ for Type in PcdTypeList:\r
+ if (Pcd[0], Pcd[1], Type) in Package.Pcds:\r
+ EdkLogger.error(\r
+ 'build',\r
+ FORMAT_INVALID,\r
+ "Type [%s] of PCD [%s.%s] in DSC file doesn't match the type [%s] defined in DEC file." \\r
+ % (Pa.Platform.Pcds[Pcd].Type, Pcd[1], Pcd[0], Type),\r
+ ExtraData=None\r
+ )\r
+ return\r
+ else:\r
+ UnusedPcd.setdefault(Pcd, []).append(Pa.Arch)\r
+\r
+ for Pcd in UnusedPcd:\r
+ EdkLogger.warn(\r
+ 'build',\r
+ "The PCD was not specified by any INF module in the platform for the given architecture.\n"\r
+ "\tPCD: [%s.%s]\n\tPlatform: [%s]\n\tArch: %s"\r
+ % (Pcd[1], Pcd[0], os.path.basename(str(self.MetaFile)), str(UnusedPcd[Pcd])),\r
+ ExtraData=None\r
+ )\r
+\r
def __repr__(self):\r
return "%s [%s]" % (self.MetaFile, ", ".join(self.ArchList))\r
\r
#\r
def _GetAutoGenFileList(self):\r
UniStringAutoGenC = True\r
- UniStringBinBuffer = None\r
+ UniStringBinBuffer = StringIO()\r
if self.BuildType == 'UEFI_HII':\r
- UniStringBinBuffer = StringIO()\r
UniStringAutoGenC = False\r
if self._AutoGenFileList == None:\r
self._AutoGenFileList = {}\r