1. Fix the bug to support BlockSize with PCD value setting.
authorlgao4 <lgao4@c2973edb-eda0-4c78-bc6a-9341b269661f>
Wed, 24 Feb 2010 08:05:26 +0000 (08:05 +0000)
committerlgao4 <lgao4@c2973edb-eda0-4c78-bc6a-9341b269661f>
Wed, 24 Feb 2010 08:05:26 +0000 (08:05 +0000)
2. Support FD section without FdName is set when only FD image is specified in FDF file.

git-svn-id: https://edk2-buildtools.svn.sourceforge.net/svnroot/edk2-buildtools/trunk/BaseTools@1894 c2973edb-eda0-4c78-bc6a-9341b269661f

Source/Python/GenFds/FdfParser.py
Source/Python/GenFds/GenFds.py
Source/Python/GenFds/GenFdsGlobalVariable.py

index a627a9c..4ce2761 100644 (file)
@@ -40,6 +40,7 @@ import OptionRom
 import OptRomInfStatement\r
 import OptRomFileStatement\r
 \r
+from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from Common.BuildToolError import *\r
 from Common import EdkLogger\r
 \r
@@ -172,6 +173,7 @@ class FileProfile :
         self.InfList = []\r
 \r
         self.FdDict = {}\r
+        self.FdNameNotSet = False\r
         self.FvDict = {}\r
         self.CapsuleDict = {}\r
         self.VtfList = []\r
@@ -1300,7 +1302,16 @@ class FdfParser:
             raise Warning("expected [FD.]", self.FileName, self.CurrentLineNumber)\r
 \r
         FdName = self.__GetUiName()\r
+        if FdName == "":\r
+            if len (self.Profile.FdDict) == 0:\r
+                FdName = GenFdsGlobalVariable.PlatformName\r
+                self.Profile.FdNameNotSet = True\r
+            else:\r
+                raise Warning("expected FdName in [FD.] section", self.FileName, self.CurrentLineNumber)\r
         self.CurrentFdName = FdName.upper()\r
+        \r
+        if self.CurrentFdName in self.Profile.FdDict:\r
+            raise Warning("Unexpected the same FD name", self.FileName, self.CurrentLineNumber)\r
 \r
         if not self.__IsToken( "]"):\r
             raise Warning("expected ']'", self.FileName, self.CurrentLineNumber)\r
@@ -1308,6 +1319,10 @@ class FdfParser:
         FdObj = Fd.FD()\r
         FdObj.FdUiName = self.CurrentFdName\r
         self.Profile.FdDict[self.CurrentFdName] = FdObj\r
+\r
+        if len (self.Profile.FdDict) > 1 and self.Profile.FdNameNotSet:\r
+            raise Warning("expected all FDs have their name", self.FileName, self.CurrentLineNumber)\r
+\r
         Status = self.__GetCreateFile(FdObj)\r
         if not Status:\r
             raise Warning("FD name error", self.FileName, self.CurrentLineNumber)\r
@@ -1495,7 +1510,7 @@ class FdfParser:
             PcdPair = self.__GetNextPcdName()\r
             BlockSizePcd = PcdPair\r
             self.Profile.PcdDict[PcdPair] = BlockSize\r
-        BlockSize = long(self.__Token, 0)\r
+        BlockSize = long(BlockSize, 0)\r
 \r
         BlockNumber = None\r
         if self.__IsKeyword( "NumBlocks"):\r
@@ -2112,9 +2127,6 @@ class FdfParser:
             raise Warning("expected INF file path", self.FileName, self.CurrentLineNumber)\r
         ffsInf.InfFileName = self.__Token\r
 \r
-#        if ffsInf.InfFileName.find('$') >= 0:\r
-#            ffsInf.InfFileName = GenFdsGlobalVariable.GenFdsGlobalVariable.MacroExtend(ffsInf.InfFileName, MacroDict)\r
-\r
         if not ffsInf.InfFileName in self.Profile.InfList:\r
             self.Profile.InfList.append(ffsInf.InfFileName)\r
 \r
index ffb7604..1285103 100644 (file)
@@ -192,6 +192,7 @@ def main():
         
         for Arch in ArchList:
             GenFdsGlobalVariable.OutputDirFromDscDict[Arch] = NormPath(BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].OutputDirectory)
+            GenFdsGlobalVariable.PlatformName = BuildWorkSpace.BuildObject[GenFdsGlobalVariable.ActivePlatform, Arch].PlatformName
 
         if (Options.outputDir):
             OutputDirFromCommandLine = GenFdsGlobalVariable.ReplaceWorkspaceMacro(Options.outputDir)
index 96af319..cad2758 100644 (file)
@@ -54,6 +54,7 @@ class GenFdsGlobalVariable:
     FdfFile = ''
     FdfFileTimeStamp = 0
     FixedLoadAddress = False
+    PlatformName = ''
 
     SectionHeader = struct.Struct("3B 1B")