Sync with FDF update.
authorqouyang <qouyang@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 5 Sep 2007 10:03:02 +0000 (10:03 +0000)
committerqouyang <qouyang@7335b38e-4728-0410-8992-fb3ffe349368>
Wed, 5 Sep 2007 10:03:02 +0000 (10:03 +0000)
git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@680 7335b38e-4728-0410-8992-fb3ffe349368

13 files changed:
Source/Python/CommonDataClass/FdfClassObject.py
Source/Python/GenFds/CompressSection.py
Source/Python/GenFds/DataSection.py
Source/Python/GenFds/EfiSection.py
Source/Python/GenFds/Fd.py
Source/Python/GenFds/FfsFileStatement.py
Source/Python/GenFds/FfsInfStatement.py
Source/Python/GenFds/FvImageSection.py
Source/Python/GenFds/GenFdsGlobalVariable.py
Source/Python/GenFds/GuidSection.py
Source/Python/GenFds/Section.py
Source/Python/GenFds/UiSection.py
Source/Python/GenFds/VerSection.py

index 9782729..fd79324 100644 (file)
@@ -164,7 +164,7 @@ class RuleSimpleFileClassObject(RuleClassObject) :
         RuleClassObject.__init__(self)\r
         self.FileName = None\r
         self.SectionType = ''\r
-\r
+        self.FileExtension = None\r
 class RuleFileExtensionClassObject(RuleClassObject):\r
     def __init__(self):\r
         RuleClassObject.__init__(self)\r
index 4cab90e..f22f119 100755 (executable)
@@ -53,7 +53,8 @@ class CompressSection (CompressSectionClassObject) :
         # Call GenSection\r
         #\r
         GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
-        \r
-        return OutputFile, self.Alignment\r
+        OutputFileList = []\r
+        OutputFileList.append(OutputFile)\r
+        return OutputFileList, self.Alignment\r
 \r
         \r
index 0f22ec1..b293316 100644 (file)
@@ -66,4 +66,5 @@ class DataSection (DataSectionClassObject):
         #\r
         \r
         GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
-        return OutputFile, self.Alignment\r
+        FileList = [OutputFile]\r
+        return FileList, self.Alignment\r
index 8cdde70..a8ad16f 100644 (file)
@@ -5,27 +5,24 @@ from Ffs import Ffs
 import os\r
 from CommonDataClass.FdfClassObject import EfiSectionClassObject\r
 import shutil\r
+\r
 class EfiSection (EfiSectionClassObject):\r
     \r
     def __init__(self):\r
           EfiSectionClassObject.__init__(self)\r
 \r
     def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None) :\r
-        #\r
-        # Prepare the parameter of GenSection\r
-        #\r
+        """Prepare the parameter of GenSection"""\r
         if FfsInf != None :\r
             InfFileName = FfsInf.InfFileName\r
             SectionType = FfsInf.__ExtendMarco__(self.SectionType)\r
-            #print 'File Name : %s' %self.Filename\r
-            Filename = FfsInf.__ExtendMarco__(self.Filename)\r
-            #print 'After Extend File Name: %s' %self.Filename\r
-            #print 'Buile Num: %s' %self.BuildNum\r
+            Filename = FfsInf.__ExtendMarco__(self.FileName)\r
+            """print 'Buile Num: %s' %self.BuildNum"""\r
             BuildNum = FfsInf.__ExtendMarco__(self.BuildNum)\r
-            #print 'After extend Build Num: %s' %self.BuildNum\r
-            #print 'version Num: %s' %self.VersionNum\r
+            """print 'After extend Build Num: %s' %self.BuildNum"""\r
+            """print 'version Num: %s' %self.VersionNum"""\r
             VersionNum = FfsInf.__ExtendMarco__(self.VersionNum)\r
-            #print 'After extend Version Num: %s' %self.VersionNum\r
+            """print 'After extend Version Num: %s' %self.VersionNum"""\r
             StringData = FfsInf.__ExtendMarco__(self.StringData)\r
         else:\r
             SectionType = self.SectionType\r
@@ -39,133 +36,152 @@ class EfiSection (EfiSectionClassObject):
                 GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
                 return '', None\r
             \r
-        OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get(SectionType))\r
-        #\r
-        #  If Section type is 'VERSION'\r
-        #\r
+       \r
+        \r
+        FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension)\r
+        if IsSect :\r
+            return FileList, self.Alignment\r
+\r
+        Num = SecNum\r
+        \r
+        """ If Section type is 'VERSION'"""\r
+        \r
+        OutputFileList = []\r
         if SectionType == 'VERSION':\r
-            if Filename != None:\r
-                Filename = GenFdsGlobalVariable.ReplaceWorkspaceMarco(Filename)\r
-                f = open (Filename, 'r')\r
-                VerString = f.read()\r
-                VerString = ' -n '           + \\r
-                             ' \"'           + \\r
-                             VerString       + \\r
-                             ' \"'\r
-                             \r
-            elif StringData != None:\r
-                VerString = ' -n '          + \\r
-                            '\"'            + \\r
-                            StringData      + \\r
-                            '\"'\r
+            if FileList != []:\r
+                for FileName in FileList:\r
+                    OutputFile = os.path.join( OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get(SectionType))\r
+                    Num = Num + 1\r
+                    f = open (Filename, 'r')\r
+                    VerString = f.read()\r
+                    VerString = ' -n '          + \\r
+                                ' \"'           + \\r
+                                VerString       + \\r
+                                ' \"'\r
+                    if BuildNum != None and BuildNum != '':\r
+                        BuildNumString = ' -j ' + \\r
+                                         BuildNum\r
+                    GenSectionCmd = 'GenSec -o '                + \\r
+                                     OutputFile                 + \\r
+                                     ' -s EFI_SECTION_VERSION'  + \\r
+                                     VerString                  + \\r
+                                     BuildNumString\r
+                    GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
+                    OutputFileList.append(OutputFile)\r
+                    \r
             else:\r
-                VerString = ''\r
-                             \r
-            if BuildNum != None and BuildNum != '':\r
-                BuildNumString = ' -j ' + \\r
-                                 BuildNum\r
-            else :\r
-                BuildNumString = ''\r
-            if VerString == '' and BuildNumString == '':\r
-                if self.Optional == True :\r
-                    GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
-                    return '', None\r
+                if StringData != None:\r
+                    VerString = ' -n '          + \\r
+                                '\"'            + \\r
+                                StringData      + \\r
+                                '\"'\r
                 else:\r
-                    raise Exception ("File: %s miss Version Section value" %InfFileName)\r
-            GenSectionCmd = 'GenSec -o '                + \\r
-                             OutputFile                 + \\r
-                             ' -s EFI_SECTION_VERSION'  + \\r
-                             VerString                  + \\r
-                             BuildNumString\r
-            \r
+                    VerString = ''\r
+\r
+                if BuildNum != None and BuildNum != '':\r
+                        BuildNumString = ' -j ' + \\r
+                                         BuildNum\r
+                else:\r
+                    BuildNumString = ''\r
+                    \r
+                if VerString == '' and BuildNumString == '':\r
+                    if self.Optional == True :\r
+                        GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
+                        return [], None\r
+                    else:\r
+                        raise Exception ("File: %s miss Version Section value" %InfFileName)\r
+                GenSectionCmd = 'GenSec -o '                + \\r
+                                     OutputFile                 + \\r
+                                     ' -s EFI_SECTION_VERSION'  + \\r
+                                     VerString                  + \\r
+                                     BuildNumString\r
+                GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
+                OutputFileList.append(OutputFile)\r
+\r
         #\r
         # If Section Type is 'UI'\r
         #\r
         elif SectionType == 'UI':\r
-            #if self.Filename != None :\r
-            #    f = open (self.Filename, 'r')\r
-            #    UiString = f.read ()\r
-            #    f.close()\r
-            #    UiString = ' -n '    + \\r
-            #                '\"'     + \\r
-            #                UiString + \\r
-            #                '\"'\r
-            if Filename != None:\r
-               Filename = GenFdsGlobalVariable.ReplaceWorkspaceMarco(Filename)\r
-               f = open (Filename, 'r')\r
-               UiString = f.read()\r
-               UiString = ' -n '         + \\r
-                           '\"'          + \\r
-                           UiString      + \\r
-                           '\"'\r
-                           \r
-            elif StringData != None:\r
-                UiString = ' -n '        + \\r
-                           '\"'          + \\r
-                           StringData    + \\r
-                           '\"'\r
+            if FileList != []:\r
+                for Filename in FileList:\r
+                    f = open (Filename, 'r')\r
+                    UiString = f.read()\r
+                    UiString = ' -n '         + \\r
+                                '\"'          + \\r
+                                UiString      + \\r
+                                '\"'\r
+                    GenSectionCmd = 'GenSec -o '                       + \\r
+                                 OutputFile                        + \\r
+                                 ' -s EFI_SECTION_USER_INTERFACE'  + \\r
+                                 UiString\r
+                                 \r
+                    GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
+                    OutputFileList.append(OutputFile)\r
             else:\r
-                UiString = ''\r
-\r
-            if UiString == '':\r
-                if self.Optional == True :\r
-                    GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
-                    return '', None\r
+                if StringData != None:\r
+                    UiString = ' -n '        + \\r
+                               '\"'          + \\r
+                               StringData    + \\r
+                               '\"'\r
                 else:\r
-                    raise Exception ("File: %s miss UI Section value" %InfFileName)\r
+                    UiString = ''\r
+\r
+                if UiString == '':\r
+                    if self.Optional == True :\r
+                        GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
+                        return '', None\r
+                    else:\r
+                        raise Exception ("File: %s miss UI Section value" %InfFileName)\r
+                GenSectionCmd = 'GenSec -o '                       + \\r
+                                 OutputFile                        + \\r
+                                 ' -s EFI_SECTION_USER_INTERFACE'  + \\r
+                                 UiString\r
+\r
+                GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
+                OutputFileList.append(OutputFile)\r
+\r
                 \r
-            GenSectionCmd = 'GenSec -o '                       + \\r
-                             OutputFile                        + \\r
-                             ' -s EFI_SECTION_USER_INTERFACE'  + \\r
-                             UiString\r
         else:\r
-             if Filename == None or not os.path.exists(Filename) :\r
-                 if self.Optional == True:\r
+            """If File List is empty"""\r
+            if FileList == [] :\r
+                if self.Optional == True:\r
                      GenFdsGlobalVariable.VerboseLogger( "Optional Section don't exist!")\r
-                     return '', None\r
-                 else:\r
+                     return [], None\r
+                else:\r
                      raise Exception(" %s does't exist" %Filename)\r
-             #\r
-             # For TE Section call GenFw to generate TE image\r
-             #\r
-             if SectionType == 'TE':\r
-                 TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')\r
-                 GenTeCmd = 'GenFW -t '    + \\r
-                            ' -o '         + \\r
-                             TeFile        + \\r
-                             ' '           + \\r
-                             GenFdsGlobalVariable.ExtendMarco(Filename)\r
-                 GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
-                 \r
-                 """ Copy Map file to FFS output path """\r
-                 Filename = GenFdsGlobalVariable.ExtendMarco(Filename)\r
-                 if Filename[(len(Filename)-4):] == '.efi':\r
-                     MapFile = Filename.replace('.efi', '.map')\r
-                     if os.path.exists(MapFile):\r
-                         CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')\r
-                         shutil.copyfile(MapFile, CopyMapFile)\r
-                 Filename = TeFile\r
+            \r
+            else:\r
+                """Convert the File to Section file one by one """\r
+                for Filename in FileList:\r
+                    """ Copy Map file to FFS output path """\r
+                    Filename = GenFdsGlobalVariable.ExtendMarco(Filename)\r
+                    if Filename[(len(Filename)-4):] == '.efi':\r
+                        MapFile = Filename.replace('.efi', '.map')\r
+                        if os.path.exists(MapFile):\r
+                            CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')\r
+                            shutil.copyfile(MapFile, CopyMapFile)\r
 \r
-                 \r
-             GenSectionCmd = 'GenSec -o '                                     + \\r
-                              OutputFile                                      + \\r
-                              ' -s '                                          + \\r
-                              Section.Section.SectionType.get (SectionType)   + \\r
-                              ' '                                             + \\r
-                              GenFdsGlobalVariable.ExtendMarco(Filename)\r
+                    """For TE Section call GenFw to generate TE image"""\r
 \r
-             """ Copy Map file to FFS output path """\r
-             if SectionType != 'TE':\r
-                 Filename = GenFdsGlobalVariable.ExtendMarco(Filename)\r
-                 if Filename[(len(Filename)-4):] == '.efi':\r
-                     MapFile = Filename.replace('.efi', '.map')\r
-                     if os.path.exists(MapFile):\r
-                         CopyMapFile = os.path.join(OutputPath, ModuleName + '.map')\r
-                         shutil.copyfile(MapFile, CopyMapFile)\r
+                    if SectionType == 'TE':\r
+                        TeFile = os.path.join( OutputPath, ModuleName + 'Te.raw')\r
+                        GenTeCmd = 'GenFW -t '    + \\r
+                                   ' -o '         + \\r
+                                    TeFile        + \\r
+                                    ' '           + \\r
+                                   GenFdsGlobalVariable.ExtendMarco(Filename)\r
+                        GenFdsGlobalVariable.CallExternalTool(GenTeCmd, "GenFw Failed !")\r
+                        Filename = TeFile\r
 \r
-        #\r
-        # Call GenSection\r
-        #\r
-        \r
-        GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
+                    """Call GenSection"""\r
+                    GenSectionCmd = 'GenSec -o '                                         + \\r
+                                         OutputFile                                      + \\r
+                                         ' -s '                                          + \\r
+                                         Section.Section.SectionType.get (SectionType)   + \\r
+                                         ' '                                             + \\r
+                                         GenFdsGlobalVariable.ExtendMarco(Filename)\r
+                        \r
+                    GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed !")\r
+                    OutputFileList.append(OutputFile)\r
+            \r
         return OutputFile , self.Alignment\r
index f4e6ec0..a4f8eaf 100644 (file)
@@ -48,7 +48,8 @@ class FD(FDClassObject):
         fd.write(FdBuffer.getvalue());\r
         fd.close;\r
         FdBuffer.close;\r
-        \r
+        return FdFileName\r
+    \r
     def GenVtfFile (self) :\r
         #\r
         # Get this Fd's all Fv name\r
index 2e1b51c..efbef9b 100755 (executable)
@@ -14,63 +14,70 @@ class FileStatements (FileStatementsClassObject) :
         if not os.path.exists(OutputDir):\r
              os.makedirs(OutputDir)\r
 \r
-        if self.FileName != None :\r
-            SectionFiles = ' -i ' + \\r
-                          GenFdsGlobalVariable.ReplaceWorkspaceMarco(self.FileName)\r
+        if self.FvName != None :\r
+            Buffer = StringIO.StringIO('')\r
+            Fv = GenFdsGlobalVariable.FdfParser.profile.FvDict.get(self.FvName)\r
+            FileName = Fv.AddToBuffer(Buffer)\r
+            SectionFiles = ' -i ' + FileName\r
+            \r
+        elif self.FdName != None:\r
+            Fd = GenFdsGlobalVariable.FdfParser.profile.FdDict.get(self.FdName)\r
+            FvBin = {}\r
+            FileName = Fd.GenFd(FvBin)\r
+            SectionFiles = ' -i ' + FileName\r
+            \r
         else:\r
             SectionFiles = ''\r
             Index = 0\r
             for section in self.SectionList :\r
                 Index = Index + 1\r
                 SecIndex = '%d' %Index\r
-                sect, align = section.GenSection(OutputDir, self.NameGuid, SecIndex, self.KeyStringList)\r
-                if sect != None:\r
-                    SectionFiles = SectionFiles  + \\r
-                                   ' -i '        + \\r
-                                   sect\r
-                    if align != None:\r
+                sectList, align = section.GenSection(OutputDir, self.NameGuid, SecIndex, self.KeyStringList)\r
+                if sectList != []:\r
+                    for sect in sectList:\r
                         SectionFiles = SectionFiles  + \\r
-                                       ' -n '        + \\r
-                                       align\r
+                                       ' -i '        + \\r
+                                       sect\r
+                        if align != None:\r
+                            SectionFiles = SectionFiles  + \\r
+                                           ' -n '        + \\r
+                                           align\r
                                \r
         #\r
         # Prepare the parameter\r
         #\r
-        \r
         if self.Fixed != False:\r
                 Fixed = ' -x '\r
         else :\r
                 Fixed = ''\r
-                \r
         if self.CheckSum != False :\r
                 CheckSum = ' -s '\r
         else :\r
                 CheckSum = ''\r
-                \r
         if self.Alignment != None and self.Alignment !='':\r
-                Alignment = ' -a ' + '%s' %self.Alignment\r
+            Alignment = ' -a ' + '%s' %self.Alignment\r
         else :\r
-                Alignment = ''\r
-                \r
+            Alignment = ''\r
+\r
         if not (self.FvType == None):\r
             FileType = ' -t ' + Ffs.Ffs.FvTypeToFileType.get(self.FvType)\r
         else:\r
             FileType = ''\r
 \r
         FfsFileOutput = os.path.join(OutputDir, self.NameGuid + '.ffs')\r
-                    \r
-  \r
-        GenFfsCmd = 'GenFfs' +  \\r
-                     FileType +     \\r
-                     Fixed +        \\r
-                     CheckSum +     \\r
-                     Alignment +    \\r
-                     ' -o ' +       \\r
-                     FfsFileOutput +    \\r
-                     ' -g ' +       \\r
-                     self.NameGuid +\\r
+\r
+\r
+        GenFfsCmd = 'GenFfs'       +  \\r
+                     FileType      +  \\r
+                     Fixed         +  \\r
+                     CheckSum      +  \\r
+                     Alignment     +  \\r
+                     ' -o '        +  \\r
+                     FfsFileOutput +  \\r
+                     ' -g '        +  \\r
+                     self.NameGuid +  \\r
                      SectionFiles\r
-     \r
+\r
         GenFdsGlobalVariable.CallExternalTool(GenFfsCmd,"GenFfs Failed !")\r
         return FfsFileOutput\r
         \r
index 147144a..3facd9f 100644 (file)
@@ -17,20 +17,23 @@ class FfsInfStatement(FfsInfStatementClassObject):
         FfsInfStatementClassObject.__init__(self)\r
 \r
     def __infParse__(self):\r
+        self.CurrentArch = self.__GetCurrentArch__()\r
         #\r
         # Get the InfClass object\r
         #\r
 ##        for item in GenFdsGlobalVariable.WorkSpace.InfDatabase:\r
 ##            print item\r
         self.InfFileName = NormPath(self.InfFileName)\r
-        Inf = GenFdsGlobalVariable.WorkSpace.InfDatabase[self.InfFileName]\r
+        (self.SourceDir, InfName) = os.path.split(self.InfFileName)\r
+        Inf = GenFdsGlobalVariable.WorkSpace.Build[self.CurrentArch].ModuleDatabase[self.InfFileName]\r
         #\r
         # Set Ffs BaseName, MdouleGuid, ModuleType, Version, OutputPath\r
         #\r
-        self.BaseName = Inf.Defines.DefinesDictionary['BASE_NAME'][0]\r
-        self.ModuleGuid = Inf.Defines.DefinesDictionary['FILE_GUID'][0]\r
-        self.ModuleType = Inf.Defines.DefinesDictionary['MODULE_TYPE'][0]\r
-        self.VersionString = Inf.Defines.DefinesDictionary['VERSION_STRING'][0]\r
+        self.BaseName = Inf.Header.Name\r
+        self.ModuleGuid = Inf.Header.Guid\r
+        self.ModuleType = Inf.ModuleType\r
+        self.VersionString = Inf.Header.Version\r
+        self.BinFileList = Inf.Binaries\r
         GenFdsGlobalVariable.VerboseLogger( "BaseName : %s" %self.BaseName)\r
         GenFdsGlobalVariable.VerboseLogger("ModuleGuid : %s" %self.ModuleGuid)\r
         GenFdsGlobalVariable.VerboseLogger("ModuleType : %s" %self.ModuleType)\r
@@ -46,8 +49,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
         if not os.path.exists(self.OutputPath) :\r
             os.makedirs(self.OutputPath)\r
             \r
-        self.InfOutputPath = self.__GetEFIOutPutPath__()\r
-        GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.InfOutputPath)\r
+        self.EfiOutputPath = self.__GetEFIOutPutPath__()\r
+        GenFdsGlobalVariable.VerboseLogger( "ModuelEFIPath: " + self.EfiOutputPath)\r
                              \r
     def GenFfs(self):\r
         #\r
@@ -72,8 +75,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
         # For the rule only has simpleFile\r
         #\r
         if isinstance (Rule, RuleSimpleFile.RuleSimpleFile) :\r
-            SectionOutput = self.__GenSimpleFileSection__(Rule)\r
-            FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutput)\r
+            SectionOutputList = self.__GenSimpleFileSection__(Rule)\r
+            FfsOutput = self.__GenSimpleFileFfs__(Rule, SectionOutputList)\r
             return FfsOutput\r
         #\r
         # For Rule has ComplexFile\r
@@ -87,7 +90,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 \r
     def __ExtendMarco__ (self, String):\r
         MarcoDict = {\r
-            '$(INF_OUTPUT)'  : self.InfOutputPath,\r
+            '$(INF_OUTPUT)'  : self.EfiOutputPath,\r
             '$(MODULE_NAME)' : self.BaseName,\r
             '$(BUILD_NUMBER)': self.BuildNum,\r
             '$(INF_VERSION)' : self.VersionString,\r
@@ -144,14 +147,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
             else:\r
                 return GenFdsGlobalVariable.DefaultRule\r
 \r
-    def __GetCurrentArch__(self):\r
+    def __GetPlatformArchList__(self):\r
         targetArchList = GenFdsGlobalVariable.ArchList\r
         if len(targetArchList) == 0:\r
             targetArchList = GenFdsGlobalVariable.WorkSpace.SupArchList\r
         else:\r
             targetArchList = set(GenFdsGlobalVariable.WorkSpace.SupArchList) & set(targetArchList)\r
             \r
-        #activePlatform = GenFdsGlobalVariable.WorkSpace.TargetTxt.TargetTxtDictionary.get('ACTIVE_PLATFORM')[0]\r
         dscArchList = []\r
         PlatformDataBase = GenFdsGlobalVariable.WorkSpace.Build.get('IA32').PlatformDatabase.get(GenFdsGlobalVariable.ActivePlatform)\r
         if  PlatformDataBase != None:\r
@@ -172,14 +174,8 @@ class FfsInfStatement(FfsInfStatementClassObject):
         GenFdsGlobalVariable.VerboseLogger ("Valid target architecture(s) is : " + " ".join(curArchList))\r
         return curArchList\r
     \r
-    def __GetEFIOutPutPath__(self):\r
-        Arch = ''\r
-        OutputPath = ''\r
-        (ModulePath, fileName) = os.path.split(self.InfFileName)\r
-        index = fileName.find('.')\r
-        fileName = fileName[0:index]\r
-\r
-        curArchList = self.__GetCurrentArch__()\r
+    def _GetCurrentArch__(self) :\r
+        curArchList = self.__GetPlateformArchList__()\r
         if len(curArchList) > 1 :\r
             for Key in self.KeyStringList:\r
                 Target, Tag, Arch = Key.split('_')\r
@@ -192,14 +188,22 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 raise Exception("Don't find legal Arch in Module %s !" %self.InfFileNames)\r
         elif len(curArchList) == 1 :\r
             Arch = curArchList.pop()\r
-            \r
+        return Arch\r
+    \r
+    def __GetEFIOutPutPath__(self):\r
+        Arch = ''\r
+        OutputPath = ''\r
+        (ModulePath, fileName) = os.path.split(self.InfFileName)\r
+        index = fileName.find('.')\r
+        fileName = fileName[0:index]\r
+        Arch = self._GetCurrentArch__()\r
+        \r
         OutputPath = os.path.join(GenFdsGlobalVariable.OuputDir,\r
                                   Arch ,\r
                                   ModulePath,\r
                                   fileName,\r
                                   'OUTPUT'\r
                                   )\r
-                                  \r
         OutputPath = os.path.realpath(OutputPath)\r
         return OutputPath\r
         \r
@@ -207,28 +211,53 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #\r
         # Prepare the parameter of GenSection\r
         #\r
-        GenSecInputFile = self.__ExtendMarco__(Rule.FileName)\r
+        FileList = []\r
+        OutputFileList = []\r
+        if Rule.FileName != None:\r
+            GenSecInputFile = self.__ExtendMarco__(Rule.FileName)\r
+        else:\r
+            FileList, IsSect = Section.Section.GetFileList(self, '', Rule.FileExtension)\r
 \r
+        Index = 0\r
         SectionType     = Rule.SectionType\r
+        if FileList != [] :\r
+            for File in FileList:\r
+                SecNum = '%d', Index\r
+                GenSecOutputFile= self.__ExtendMarco__(Rule.NameGuid) + \\r
+                              Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + Index\r
+                Index = Index + 1\r
+                OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
+                genSectionCmd = 'GenSec -o '                                + \\r
+                                 OutputFile                                 + \\r
+                                 ' -s '                                     + \\r
+                                 Section.Section.SectionType[SectionType]   + \\r
+                                 ' '                                        + \\r
+                                 File\r
+                #\r
+                # Call GenSection\r
+                #\r
+                GenFdsGlobalVariable.CallExternalTool(genSectionCmd, "Gensection Failed!")\r
+                OutputFileList.append(GenSecOutputFile)\r
+        else:\r
+            GenSecOutputFile= self.__ExtendMarco__(Rule.NameGuid) + \\r
+                              Ffs.Ffs.SectionSuffix[SectionType] + 'SEC' + Index\r
+            OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
+            \r
+            genSectionCmd = 'GenSec -o '                                + \\r
+                             OutputFile                                 + \\r
+                             ' -s '                                     + \\r
+                             Section.Section.SectionType[SectionType]   + \\r
+                             ' '                                        + \\r
+                             GenSecInputFile\r
+            #\r
+            # Call GenSection\r
+            #\r
+            GenFdsGlobalVariable.CallExternalTool(genSectionCmd, "Gensection Failed!")\r
+            OutputFileList.append(GenSecOutputFile)\r
 \r
-        GenSecOutputFile= self.__ExtendMarco__(Rule.NameGuid) + \\r
-                              Ffs.Ffs.SectionSuffix[SectionType]\r
-                              \r
-        OutputFile = os.path.join(self.OutputPath, GenSecOutputFile)\r
-        \r
-        genSectionCmd = 'GenSec -o '                                   + \\r
-                         OutputFile                                    + \\r
-                         ' -s '                                        + \\r
-                         Section.Section.SectionType[SectionType]      + \\r
-                         ' '                                           + \\r
-                         GenSecInputFile\r
-        #\r
-        # Call GenSection\r
-        #\r
-        GenFdsGlobalVariable.CallExternalTool(genSectionCmd, "Gensection Failed!")\r
         return OutputFile\r
     \r
-    def __GenSimpleFileFfs__(self, Rule, InputFile):\r
+    def __GenSimpleFileFfs__(self, Rule, InputFileList):\r
         #\r
         # Prepare the parameter of GenFfs\r
         #\r
@@ -240,8 +269,15 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     '.ffs'\r
 \r
         GenFdsGlobalVariable.VerboseLogger(self.__ExtendMarco__(Rule.NameGuid))\r
-        InputSection = ' -i '     + \\r
-                       InputFile\r
+        InputSection = ''\r
+        for InputFile in InputFileList:\r
+            InputSection = InputSection + \\r
+                           ' -i '       + \\r
+                           InputFile\r
+            if Alignment != '':\r
+                InputSection = InputSection  + \\r
+                               ' -n '        + \\r
+                               Alignment\r
 \r
 \r
         GenFfsCmd = 'GenFfs '  + \\r
@@ -264,14 +300,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
         SectFiles = ''\r
         Index = 0\r
         for Sect in Rule.SectionList:\r
-           Index = Index + 1\r
            SecIndex = '%d' %Index\r
-           secName = ''\r
+           SecList  = []\r
            if Rule.KeyStringList != []:\r
-               secName, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)\r
+               SecList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, Rule.KeyStringList, self)\r
            else :\r
-               secName, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self)\r
-           if secName != '':\r
+               SectList, Align = Sect.GenSection(self.OutputPath , self.ModuleGuid, SecIndex, self.KeyStringList, self)\r
+           for SecName in  SectList :\r
                SectFiles = SectFiles    + \\r
                            ' -i '       + \\r
                            secName\r
@@ -279,6 +314,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                    SectFiles = SectFiles + \\r
                                ' -n '    + \\r
                                Align\r
+               Index = Index + 1\r
         return SectFiles\r
 \r
     def __GenComplexFileFfs__(self, Rule, InputFile):\r
index f9fbaf5..21a7c53 100755 (executable)
@@ -11,11 +11,32 @@ class FvImageSection(FvImageSectionClassObject):
         FvImageSectionClassObject.__init__(self)\r
         \r
     def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None):\r
-        Buffer = StringIO.StringIO('')\r
+        OutputFileList = []\r
+        \r
+        '''If Is FvBin '''\r
+        if self.FvFileType != None:\r
+            FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FvFileType, self.FvFileExtension)\r
+            if IsSect :\r
+                return FileList, self.Alignment\r
+            \r
+            Num = SecNum\r
+            \r
+            for FileName in FileList:\r
+                OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))\r
+                GenSectionCmd = 'GenSec -o '                         + \\r
+                                OutputFile                           + \\r
+                                ' -s '                               + \\r
+                                'EFI_SECTION_FIRMWARE_VOLUME_IMAGE ' + \\r
+                                FvFileName\r
+\r
+                GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
+                OutputFileList.append(OutputFile)\r
+            return OuptuFileList, self.Alignment\r
         #\r
         # Generate Fv\r
         #\r
         if self.FvName != None:\r
+            Buffer = StringIO.StringIO('')\r
             Fv = GenFdsGlobalVariable.FdfParser.profile.FvDict.get(self.FvName)\r
             if self.Fv == None:\r
                 self.Fv = Fv\r
@@ -24,17 +45,20 @@ class FvImageSection(FvImageSectionClassObject):
                                  FvImageSection both in FvUiName and \\r
                                  FvImageArg!")\r
                                  \r
-        FvFileName = self.Fv.AddToBuffer(Buffer)\r
-        #\r
-        # Prepare the parameter of GenSection\r
-        #\r
-        OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))\r
+            FvFileName = self.Fv.AddToBuffer(Buffer)\r
+            \r
+            #\r
+            # Prepare the parameter of GenSection\r
+            #\r
+            OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))\r
                      \r
-        GenSectionCmd = 'GenSec -o '                          + \\r
-                         OutputFile                           + \\r
-                         ' -s '                               + \\r
-                         'EFI_SECTION_FIRMWARE_VOLUME_IMAGE ' + \\r
-                         FvFileName\r
+            GenSectionCmd = 'GenSec -o '                          + \\r
+                             OutputFile                           + \\r
+                             ' -s '                               + \\r
+                             'EFI_SECTION_FIRMWARE_VOLUME_IMAGE ' + \\r
+                             FvFileName\r
                          \r
-        GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
-        return OutputFile, self.Alignment\r
+            GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
+            OutputFileList.append(OutputFile)\r
+            \r
+            return OutputFileList, self.Alignment\r
index f4be8fc..28a2c45 100644 (file)
@@ -16,6 +16,7 @@ class GenFdsGlobalVariable:
     ArchList = None\r
     VtfDict = {}\r
     ActivePlatform = None\r
+\r
     def ExtendMarco (String):\r
         return String\r
     \r
index 815efd6..ec991d6 100755 (executable)
@@ -115,7 +115,9 @@ class GuidSection(GuidSectionClassObject) :
                              TempFile\r
                         \r
             GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "GenSection Failed!")\r
-            return OutputFile, self.Alignment\r
+            OutputFileList = []\r
+            OutputFileList.append(OutputFile)\r
+            return OutputFileList, self.Alignment\r
         \r
     def __FindExtendTool__(self):\r
         tool = None\r
index 0c3916a..fd98a43 100755 (executable)
@@ -14,6 +14,39 @@ class Section (SectionClassObject):
         'COMPRESS'  : 'EFI_SECTION_COMPRESSION',\r
         'UI'        : 'EFI_SECTION_USER_INTERFACE'\r
     }\r
+\r
+    BinFileType = {\r
+        'GUID'          : '.guid',\r
+        'ACPI'          : '.acpi',\r
+        'ASL'           : '.asl' ,\r
+        'UEFI_APP'      : '.app',\r
+        'LIB'           : '.lib',\r
+        'PE32'          : '.pe32',\r
+        'PIC'           : '.pic',\r
+        'PEI_DEPEX'     : '.depex',\r
+        'SEC_PEI_DEPEX' : '.depex',\r
+        'TE'            : '.te',\r
+        'UNI_VER'       : '.ver',\r
+        'VER'           : '.ver',\r
+        'UNI_UI'        : '.ui',\r
+        'UI'            : '.ui',\r
+        'BIN'           : '.bin',\r
+        'RAW'           : '.raw',\r
+        'COMPAT16'      : '.comp16',\r
+        'FV'            : '.fv'\r
+    }\r
+\r
+    SectFileType = {\r
+        'SEC_GUID'      : '.sec' ,\r
+        'SEC_PE32'      : '.sec' ,\r
+        'SEC_PIC'       : '.sec',\r
+        'SEC_TE'        : '.sec',\r
+        'SEC_VER'       : '.sec',\r
+        'SEC_UI'        : '.sec',\r
+        'SEC_COMPAT16'  : '.sec',\r
+        'SEC_BIN'       : '.sec'\r
+    }\r
+    \r
     ToolGuild = {\r
         '0xa31280ad-0x481e-0x41b6-0x95e8-0x127f-0x4c984779' : 'TianoCompress',\r
         '0xee4e5898-0x3914-0x4259-0x9d6e-0xdc7b-0xd79403cf' : 'LzmaCompress'\r
@@ -23,3 +56,29 @@ class Section (SectionClassObject):
         \r
     def GenSection(self, OutputPath, GuidName, SecNum, keyStringList, FfsInf = None):\r
         pass\r
+\r
+    def GetFileList(self, FfsInf, FileType, FileExtension):\r
+        if FileType in Section.SectFileType.getKeys() :\r
+            IsSect = True\r
+        else :\r
+            IsSect = False\r
+            \r
+        if FileExtension != None:\r
+            suffix = FileExtension\r
+        elif IsSect :\r
+            suffix = Section.SectionType(FileType)\r
+        else:\r
+            suffix = Section.BinFileType(FileType)\r
+        if FfsInf == None:\r
+            raise Exception ('Dont have Inf File!')\r
+        \r
+        FileList = []\r
+        for File in FfsInf.BinFileList :\r
+            if File.FileType == self.FileType:\r
+                FileList.append(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, FfsInf.SourceDir, File.BinaryFile))\r
+            for file in os.listdir(FfsInf.EfiOutputPath):\r
+                Name, Ext = os.path.splitext(file)\r
+                if Ext == suffix:\r
+                   FileList.append(FfsInf.EfiOutputPath, file)\r
+                   \r
+        return FileList, IsSect\r
index 8594d0d..b712f60 100644 (file)
@@ -41,4 +41,6 @@ class UiSection (UiSectionClassObject):
         # Call GenSection\r
         #\r
         GenFdsGlobalVariable.CallExternalTool(GenSectionCmd,"GenSection Failed!")\r
-        return OutputFile, self.Alignment\r
+        OutputFileList = []\r
+        OutputFileList.append(OutputFile)\r
+        return OutputFileList, self.Alignment\r
index b029d6b..2840b4f 100644 (file)
@@ -51,4 +51,6 @@ class VerSection (VerSectionClassObject):
         # Call GenSection\r
         #\r
         GenFdsGlobalVariable.CallExternalTool(GenSectionCmd, "Gensection Failed!")\r
-        return OutputFile, self.Alignment\r
+        OutputFileList = []\r
+        OutputFileList.append(OutputFile)\r
+        return OutputFileList, self.Alignment\r