## @file\r
# Generate AutoGen.h, AutoGen.c and *.depex files\r
#\r
-# Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
# which accompanies this distribution. The full text of the license may be found at\r
GlobalData.gFdfParser = Fdf\r
GlobalData.gAutoGenPhase = False\r
PcdSet = Fdf.Profile.PcdDict\r
- FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]\r
- for FdRegion in FdDict.RegionList:\r
- if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):\r
- if int(FdRegion.Offset) % 8 != 0:\r
- EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))\r
+ if Fdf.CurrentFdName and Fdf.CurrentFdName in Fdf.Profile.FdDict:\r
+ FdDict = Fdf.Profile.FdDict[Fdf.CurrentFdName]\r
+ for FdRegion in FdDict.RegionList:\r
+ if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in str(FdRegion.RegionDataList):\r
+ if int(FdRegion.Offset) % 8 != 0:\r
+ EdkLogger.error("build", FORMAT_INVALID, 'The VPD Base Address %s must be 8-byte aligned.' % (FdRegion.Offset))\r
ModuleList = Fdf.Profile.InfList\r
self.FdfProfile = Fdf.Profile\r
for fvname in self.FvTargetList:\r
Alignment = 2\r
else:\r
Alignment = 1\r
- if int(Sku.VpdOffset) % Alignment != 0:\r
- EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))\r
+ try:\r
+ VpdOffset = int(Sku.VpdOffset)\r
+ except:\r
+ try:\r
+ VpdOffset = int(Sku.VpdOffset, 16)\r
+ except:\r
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, Pcd.TokenSpaceGuidCName, Pcd.TokenCName))\r
+ if VpdOffset % Alignment != 0:\r
+ if PcdValue.startswith("{"):\r
+ EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(Pcd.TokenSpaceGuidCName, Pcd.TokenCName), File=self.MetaFile)\r
+ else:\r
+ EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (Pcd.TokenSpaceGuidCName, Pcd.TokenCName, Alignment))\r
VpdFile.Add(Pcd, Sku.VpdOffset)\r
# if the offset of a VPD is *, then it need to be fixed up by third party tool.\r
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":\r
Alignment = 2\r
else:\r
Alignment = 1\r
- if int(Sku.VpdOffset) % Alignment != 0:\r
- EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))\r
+ try:\r
+ VpdOffset = int(Sku.VpdOffset)\r
+ except:\r
+ try:\r
+ VpdOffset = int(Sku.VpdOffset, 16)\r
+ except:\r
+ EdkLogger.error("build", FORMAT_INVALID, "Invalid offset value %s for PCD %s.%s." % (Sku.VpdOffset, DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName))\r
+ if VpdOffset % Alignment != 0:\r
+ if PcdValue.startswith("{"):\r
+ EdkLogger.warn("build", "The offset value of PCD %s.%s is not 8-byte aligned!" %(DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName), File=self.MetaFile)\r
+ else:\r
+ EdkLogger.error("build", FORMAT_INVALID, 'The offset value of PCD %s.%s should be %s-byte aligned.' % (DscPcdEntry.TokenSpaceGuidCName, DscPcdEntry.TokenCName, Alignment))\r
VpdFile.Add(DscPcdEntry, Sku.VpdOffset)\r
if not NeedProcessVpdMapFile and Sku.VpdOffset == "*":\r
NeedProcessVpdMapFile = True \r
"Fail to get FLASH_DEFINITION definition in DSC file %s which is required when DSC contains VPD PCD." % str(self.Platform.MetaFile))\r
\r
if VpdFile.GetCount() != 0:\r
- DscTimeStamp = self.Platform.MetaFile.TimeStamp\r
FvPath = os.path.join(self.BuildDir, "FV")\r
if not os.path.exists(FvPath):\r
try:\r
except:\r
EdkLogger.error("build", FILE_WRITE_FAILURE, "Fail to create FV folder under %s" % self.BuildDir)\r
\r
-\r
VpdFilePath = os.path.join(FvPath, "%s.txt" % self.Platform.VpdToolGuid)\r
\r
-\r
- if not os.path.exists(VpdFilePath) or os.path.getmtime(VpdFilePath) < DscTimeStamp:\r
- VpdFile.Write(VpdFilePath)\r
-\r
+ if VpdFile.Write(VpdFilePath):\r
# retrieve BPDG tool's path from tool_def.txt according to VPD_TOOL_GUID defined in DSC file.\r
BPDGToolName = None\r
for ToolDef in self.ToolDefinition.values():\r
if F.Dir not in self.IncludePathList and self.AutoGenVersion >= 0x00010005:\r
self.IncludePathList.insert(0, F.Dir)\r
self._SourceFileList.append(F)\r
+\r
+ self._MatchBuildRuleOrder(self._SourceFileList)\r
+\r
+ for F in self._SourceFileList:\r
self._ApplyBuildRule(F, TAB_UNKNOWN_FILE)\r
return self._SourceFileList\r
\r
+ def _MatchBuildRuleOrder(self, FileList):\r
+ Order_Dict = {}\r
+ self._GetModuleBuildOption()\r
+ for SingleFile in FileList:\r
+ if self.BuildRuleOrder and SingleFile.Ext in self.BuildRuleOrder and SingleFile.Ext in self.BuildRules:\r
+ key = SingleFile.Path.split(SingleFile.Ext)[0]\r
+ if key in Order_Dict:\r
+ Order_Dict[key].append(SingleFile.Ext)\r
+ else:\r
+ Order_Dict[key] = [SingleFile.Ext]\r
+\r
+ RemoveList = []\r
+ for F in Order_Dict:\r
+ if len(Order_Dict[F]) > 1:\r
+ Order_Dict[F].sort(key=lambda i: self.BuildRuleOrder.index(i))\r
+ for Ext in Order_Dict[F][1:]:\r
+ RemoveList.append(F + Ext)\r
+ \r
+ for item in RemoveList:\r
+ FileList.remove(item)\r
+\r
+ return FileList\r
+\r
## Return the list of unicode files\r
def _GetUnicodeFileList(self):\r
if self._UnicodeFileList == None:\r