]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/FvImageSection.py
BaseTools: Fix GenSec can't found the depex file
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / FvImageSection.py
index 5989978a7c8d6c18d8d285918634fa3100eea70a..916ff919176cc00695af6b7bd6ad9c9d68a1897a 100644 (file)
@@ -1,7 +1,7 @@
 ## @file\r
 # process FV image section generation\r
 #\r
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>\r
 #\r
 #  This program and the accompanying materials\r
 #  are licensed and made available under the terms and conditions of the BSD License\r
@@ -50,7 +50,7 @@ class FvImageSection(FvImageSectionClassObject):
     #   @param  Dict        dictionary contains macro and its value\r
     #   @retval tuple       (Generated file name, section alignment)\r
     #\r
-    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}):\r
+    def GenSection(self, OutputPath, ModuleName, SecNum, KeyStringList, FfsInf = None, Dict = {}, IsMakefile = False):\r
 \r
         OutputFileList = []\r
         if self.FvFileType != None:\r
@@ -75,14 +75,17 @@ class FvImageSection(FvImageSectionClassObject):
                     MaxFvAlignment = FvAlignmentValue\r
 \r
                 OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + Num + Ffs.SectionSuffix.get("FV_IMAGE"))\r
-                GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE')\r
+                GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)\r
                 OutputFileList.append(OutputFile)\r
 \r
             # MaxFvAlignment is larger than or equal to 1K\r
             if MaxFvAlignment >= 0x400:\r
-                if MaxFvAlignment >= 0x10000:\r
-                    #The max alignment supported by FFS is 64K.\r
-                    self.Alignment = "64K"\r
+                if MaxFvAlignment >= 0x100000:\r
+                    #The max alignment supported by FFS is 16M.\r
+                    if MaxFvAlignment >=1000000:\r
+                        self.Alignment = "16M"\r
+                    else:\r
+                        self.Alignment = str(MaxFvAlignment / 0x100000) + "M"\r
                 else:\r
                     self.Alignment = str (MaxFvAlignment / 0x400) + "K"\r
             else:\r
@@ -98,7 +101,7 @@ class FvImageSection(FvImageSectionClassObject):
             Fv = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName)\r
             if Fv != None:\r
                 self.Fv = Fv\r
-                FvFileName = Fv.AddToBuffer(Buffer, self.FvAddr, MacroDict = Dict)\r
+                FvFileName = Fv.AddToBuffer(Buffer, self.FvAddr, MacroDict = Dict, Flag=IsMakefile)\r
                 if Fv.FvAlignment != None:\r
                     if self.Alignment == None:\r
                         self.Alignment = Fv.FvAlignment\r
@@ -117,9 +120,12 @@ class FvImageSection(FvImageSectionClassObject):
                         FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)\r
                         # FvAlignmentValue is larger than or equal to 1K\r
                         if FvAlignmentValue >= 0x400:\r
-                            if FvAlignmentValue >= 0x10000:\r
-                                #The max alignment supported by FFS is 64K.\r
-                                self.Alignment = "64K"\r
+                            if FvAlignmentValue >= 0x100000:\r
+                                #The max alignment supported by FFS is 16M.\r
+                                if FvAlignmentValue >= 0x1000000:\r
+                                    self.Alignment = "16M"\r
+                                else:\r
+                                    self.Alignment = str(FvAlignmentValue / 0x100000) + "M"\r
                             else:\r
                                 self.Alignment = str (FvAlignmentValue / 0x400) + "K"\r
                         else:\r
@@ -133,7 +139,7 @@ class FvImageSection(FvImageSectionClassObject):
             # Prepare the parameter of GenSection\r
             #\r
             OutputFile = os.path.join(OutputPath, ModuleName + 'SEC' + SecNum + Ffs.SectionSuffix.get("FV_IMAGE"))\r
-            GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE')\r
+            GenFdsGlobalVariable.GenerateSection(OutputFile, [FvFileName], 'EFI_SECTION_FIRMWARE_VOLUME_IMAGE', IsMakefile=IsMakefile)\r
             OutputFileList.append(OutputFile)\r
 \r
             return OutputFileList, self.Alignment\r