StoreTextFile(TextFile, Section)\r
\r
\r
-## Add item to PCD dictionary.\r
-#\r
-# Add an PcdClass object to PCD dictionary. The key is generated from\r
-# PcdItemType.\r
-#\r
-# @param PcdDict PCD dictionary indexed by Pcd Item Type.\r
-# @param Arch CPU architecture: Ia32, X64, Ipf, Ebc or Common.\r
-# @param Item The Item to be added to section dictionary.\r
-#\r
-def AddToPcdsDict(PcdDict, PcdItemType, PcdCode):\r
- PcdSectionName = PcdItemType\r
- PcdSectionName = PcdSectionName.title()\r
- PcdSectionName = PcdSectionName.replace("_", "")\r
- PcdSectionName = "Pcds" + PcdSectionName\r
- PcdDict.setdefault(PcdSectionName, []).append(PcdCode)\r
-\r
## Regular expression to match an equation.\r
mReEquation = re.compile(r"\s*(\S+)\s*=\s*(\S*)\s*")\r
\r
StoreTextFile(InfFile, Section)\r
\r
\r
+## Return a Module Binary Item.\r
+#\r
+# Read the input ModuleBinaryFile class object and return one line of Binary Item.\r
+#\r
+# @param ModuleBinaryFile An input ModuleBinaryFile class object.\r
+#\r
+# @retval BinaryItem A Module Binary Item.\r
+#\r
+def GetModuleBinaryItem(ModuleBinaryFile):\r
+ Binary = []\r
+ Binary.append(ModuleBinaryFile.FileType)\r
+ Binary.append(ModuleBinaryFile.Target)\r
+ Binary.append(ModuleBinaryFile.BinaryFile)\r
+ return "|".join(Binary)\r
+\r
+\r
+## Store Binaries section.\r
+#\r
+# Write [Binaries] section to the InfFile based on Module class object.\r
+# Different CPU architectures are specified in the subsection if possible.\r
+#\r
+# @param InfFile The output INF file to store the Binaries section.\r
+# @param Module An input Module class object.\r
+#\r
+def StoreModuleBinariesSection(InfFile, Module):\r
+ Section = GetSection("Binaries", GetModuleBinaryItem, Module.Binaries)\r
+ StoreTextFile(InfFile, Section)\r
+\r
+\r
## Return a Module Library Class Item.\r
#\r
# Read the input LibraryClass class object and return one line of Library Class Item.\r
#\r
def StoreModulePpisSection(InfFile, Module):\r
Section = GetSection("Ppis", GetModuleGuidCNameItem, Module.Ppis)\r
- print Section\r
- InfFile.write(Section)\r
+ StoreTextFile(InfFile, Section)\r
\r
\r
## Store Guids section.\r
# @retval PcdItem A Module Pcd Item.\r
#\r
def GetModulePcdItem(Pcd):\r
- PcdList = [Pcd.CName, Pcd.TokenSpaceGuidCName]\r
+ PcdItem = "%s.%s" % (Pcd.TokenSpaceGuidCName, Pcd.CName)\r
if Pcd.DefaultValue != "":\r
- PcdList.append(Pcd.DefaultValue)\r
+ PcdItem = "%s|%s" % (PcdItem, Pcd.DefaultValue)\r
\r
- return "|".join(PcdList)\r
+ return PcdItem\r
\r
\r
+## DEC Pcd Section Name dictionary indexed by PCD Item Type.\r
+mInfPcdSectionNameDict = {\r
+ "FEATURE_FLAG" : "FeaturePcd",\r
+ "FIXED_AT_BUILD" : "FixedPcd",\r
+ "PATCHABLE_IN_MODULE" : "PatchPcd",\r
+ "DYNAMIC" : "Pcd",\r
+ "DYNAMIC_EX" : "PcdEx"\r
+ }\r
+ \r
## Store Pcds section.\r
#\r
-# Write [Pcds*] section to the InfFile based on Module class object.\r
+# Write [(PcdType)] section to the InfFile based on Module class object.\r
# Different CPU architectures are specified in the subsection if possible.\r
#\r
# @param InfFile The output INF file to store the Pcds section.\r
def StoreModulePcdsSection(InfFile, Module):\r
PcdsDict = {}\r
for Pcd in Module.PcdCodes:\r
- AddToPcdsDict(PcdsDict, Pcd.ItemType, Pcd)\r
+ PcdSectionName = mInfPcdSectionNameDict.get(Pcd.ItemType)\r
+ if PcdSectionName:\r
+ PcdsDict.setdefault(PcdSectionName, []).append(Pcd)\r
+ else:\r
+ EdkLogger.info("Unknow Pcd Item Type %s" % Pcd.ItemType)\r
\r
Section = ""\r
for PcdSectionName in PcdsDict:\r
StoreHeader(InfFile, Module.Header)\r
StoreModuleDefinesSection(InfFile, Module)\r
StoreModuleSourcesSection(InfFile, Module)\r
+ StoreModuleBinariesSection(InfFile, Module)\r
StoreModulePackagesSection(InfFile, Module)\r
StoreModuleLibraryClassesSection(InfFile, Module)\r
StoreModuleProtocolsSection(InfFile, Module)\r
# @retval PcdItem A Package Pcd Item.\r
#\r
def GetPackagePcdItem(Pcd):\r
- CName = Pcd.CName\r
- Token = Pcd.Token\r
- TokenSpaceGuidCName = Pcd.TokenSpaceGuidCName\r
+ PcdPair = "%s.%s" % (Pcd.TokenSpaceGuidCName, Pcd.CName)\r
DatumType = Pcd.DatumType\r
DefaultValue = Pcd.DefaultValue\r
- PcdList = [CName, Token, TokenSpaceGuidCName, DatumType, DefaultValue]\r
+ Token = Pcd.Token\r
+ PcdList = [PcdPair, DefaultValue, DatumType, Token]\r
return "|".join(PcdList)\r
\r
\r
+## DEC Pcd Section Name dictionary indexed by PCD Item Type.\r
+mDecPcdSectionNameDict = {\r
+ "FEATURE_FLAG" : "PcdsFeatureFlag",\r
+ "FIXED_AT_BUILD" : "PcdsFixedAtBuild",\r
+ "PATCHABLE_IN_MODULE" : "PcdsPatchableInModule",\r
+ "DYNAMIC" : "PcdsDynamic",\r
+ "DYNAMIC_EX" : "PcdsDynamicEx"\r
+ }\r
+\r
## Store Pcds section.\r
#\r
# Write [Pcds*] section to the DecFile based on Package class object.\r
PcdsDict = {}\r
for Pcd in Package.PcdDeclarations:\r
for PcdItemType in Pcd.ValidUsage:\r
- AddToPcdsDict(PcdsDict, PcdItemType, Pcd)\r
+ PcdSectionName = mDecPcdSectionNameDict.get(PcdItemType)\r
+ if PcdSectionName:\r
+ PcdsDict.setdefault(PcdSectionName, []).append(Pcd)\r
+ else:\r
+ EdkLogger.info("Unknow Pcd Item Type %s" % PcdItemType)\r
\r
Section = ""\r
for PcdSectionName in PcdsDict:\r