]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/FfsFileStatement.py
Sync BaseTools Trunk (version r2387) to EDKII main trunk.
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / FfsFileStatement.py
index ed778f3d44cad837bc894b59c266cb2a42947ade..04527fe00fee923d9e9b69e866c5dd4e94856e93 100644 (file)
@@ -1,9 +1,9 @@
 ## @file\r
 # process FFS generation from FILE statement\r
 #\r
-#  Copyright (c) 2007, Intel Corporation\r
+#  Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
 #\r
-#  All rights reserved. This program and the accompanying materials\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
 #  http://opensource.org/licenses/bsd-license.php\r
 #\r
 import Ffs\r
 import Rule\r
-from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 import os\r
 import StringIO\r
 import subprocess\r
+\r
+from GenFdsGlobalVariable import GenFdsGlobalVariable\r
 from CommonDataClass.FdfClass import FileStatementClassObject\r
 from Common import EdkLogger\r
 from Common.BuildToolError import *\r
 from Common.Misc import GuidStructureByteArrayToGuidString\r
+from GuidSection import GuidSection\r
+from FvImageSection import FvImageSection\r
 \r
 ## generate FFS from FILE\r
 #\r
@@ -36,16 +39,22 @@ class FileStatement (FileStatementClassObject) :
     #\r
     def __init__(self):\r
         FileStatementClassObject.__init__(self)\r
+        self.CurrentLineNum = None\r
+        self.CurrentLineContent = None\r
+        self.FileName = None\r
+        self.InfFileName = None\r
 \r
     ## GenFfs() method\r
     #\r
     #   Generate FFS\r
     #\r
-    #   @param  self        The object pointer\r
-    #   @param  Dict        dictionary contains macro and value pair\r
-    #   @retval string      Generated FFS file name\r
+    #   @param  self         The object pointer\r
+    #   @param  Dict         dictionary contains macro and value pair\r
+    #   @param  FvChildAddr  Array of the inside FvImage base address\r
+    #   @param  FvParentAddr Parent Fv base address\r
+    #   @retval string       Generated FFS file name\r
     #\r
-    def GenFfs(self, Dict = {}):\r
+    def GenFfs(self, Dict = {}, FvChildAddr=[], FvParentAddr=None):\r
         \r
         if self.NameGuid != None and self.NameGuid.startswith('PCD('):\r
             PcdValue = GenFdsGlobalVariable.GetPcdValue(self.NameGuid)\r
@@ -62,7 +71,7 @@ class FileStatement (FileStatementClassObject) :
         \r
         OutputDir = os.path.join(GenFdsGlobalVariable.FfsDir, self.NameGuid)\r
         if not os.path.exists(OutputDir):\r
-             os.makedirs(OutputDir)\r
+            os.makedirs(OutputDir)\r
 \r
         Dict.update(self.DefineVarDict)\r
         SectionAlignments = None\r
@@ -78,8 +87,7 @@ class FileStatement (FileStatementClassObject) :
             if self.FdName.upper() not in GenFdsGlobalVariable.FdfParser.Profile.FdDict.keys():\r
                 EdkLogger.error("GenFds", GENFDS_ERROR, "FD (%s) is NOT described in FDF file!" % (self.FdName))\r
             Fd = GenFdsGlobalVariable.FdfParser.Profile.FdDict.get(self.FdName.upper())\r
-            FvBin = {}\r
-            FileName = Fd.GenFd(FvBin)\r
+            FileName = Fd.GenFd()\r
             SectionFiles = [FileName]\r
 \r
         elif self.FileName != None:\r
@@ -93,6 +101,15 @@ class FileStatement (FileStatementClassObject) :
             for section in self.SectionList :\r
                 Index = Index + 1\r
                 SecIndex = '%d' %Index\r
+                # process the inside FvImage from FvSection or GuidSection\r
+                if FvChildAddr != []:\r
+                    if isinstance(section, FvImageSection):\r
+                        section.FvAddr = FvChildAddr.pop(0)\r
+                    elif isinstance(section, GuidSection):\r
+                        section.FvAddr = FvChildAddr\r
+                if FvParentAddr != None and isinstance(section, GuidSection):\r
+                    section.FvParentAddr = FvParentAddr\r
+\r
                 sectList, align = section.GenSection(OutputDir, self.NameGuid, SecIndex, self.KeyStringList, None, Dict)\r
                 if sectList != []:\r
                     for sect in sectList:\r