]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/FfsInfStatement.py
BaseTools: Replace Binary File type strings with predefined constant
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / FfsInfStatement.py
index 9068157ba616281cc60e68e77aaa70128744fa91..728997f17d1a93a927226d67ce1fe7c56c6bde55 100644 (file)
@@ -381,7 +381,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
         #\r
         # Only patch file if FileType is PE32 or ModuleType is USER_DEFINED\r
         #  \r
-        if FileType != 'PE32' and self.ModuleType != SUP_MODULE_USER_DEFINED:\r
+        if FileType != BINARY_FILE_TYPE_PE32 and self.ModuleType != SUP_MODULE_USER_DEFINED:\r
             return EfiFile\r
 \r
         #\r
@@ -739,13 +739,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
         # Convert Fv Section Type for PI1.1 SMM driver.\r
         #\r
         if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
-            if SectionType == 'DXE_DEPEX':\r
-                SectionType = 'SMM_DEPEX'\r
+            if SectionType == BINARY_FILE_TYPE_DXE_DEPEX:\r
+                SectionType = BINARY_FILE_TYPE_SMM_DEPEX\r
         #\r
         # Framework SMM Driver has no SMM_DEPEX section type\r
         #\r
         if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:\r
-            if SectionType == 'SMM_DEPEX':\r
+            if SectionType == BINARY_FILE_TYPE_SMM_DEPEX:\r
                 EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)\r
         NoStrip = True\r
         if self.ModuleType in (SUP_MODULE_SEC, SUP_MODULE_PEI_CORE, SUP_MODULE_PEIM):\r
@@ -767,7 +767,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                 File = GenFdsGlobalVariable.MacroExtend(File, Dict, self.CurrentArch)\r
 \r
                 #Get PE Section alignment when align is set to AUTO\r
-                if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):\r
+                if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):\r
                     ImageObj = PeImageClass (File)\r
                     if ImageObj.SectionAlignment < 0x400:\r
                         self.Alignment = str (ImageObj.SectionAlignment)\r
@@ -790,7 +790,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                         )\r
                     File = StrippedFile\r
 \r
-                if SectionType == 'TE':\r
+                if SectionType == BINARY_FILE_TYPE_TE:\r
                     TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
                     GenFdsGlobalVariable.GenerateFirmwareImage(\r
                             TeFile,\r
@@ -809,7 +809,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
             GenSecInputFile = GenFdsGlobalVariable.MacroExtend(GenSecInputFile, Dict, self.CurrentArch)\r
 \r
             #Get PE Section alignment when align is set to AUTO\r
-            if self.Alignment == 'Auto' and (SectionType == 'PE32' or SectionType == 'TE'):\r
+            if self.Alignment == 'Auto' and (SectionType == BINARY_FILE_TYPE_PE32 or SectionType == BINARY_FILE_TYPE_TE):\r
                 ImageObj = PeImageClass (GenSecInputFile)\r
                 if ImageObj.SectionAlignment < 0x400:\r
                     self.Alignment = str (ImageObj.SectionAlignment)\r
@@ -833,7 +833,7 @@ class FfsInfStatement(FfsInfStatementClassObject):
                     )\r
                 GenSecInputFile = StrippedFile\r
 \r
-            if SectionType == 'TE':\r
+            if SectionType == BINARY_FILE_TYPE_TE:\r
                 TeFile = os.path.join( self.OutputPath, self.ModuleGuid + 'Te.raw')\r
                 GenFdsGlobalVariable.GenerateFirmwareImage(\r
                         TeFile,\r
@@ -942,13 +942,13 @@ class FfsInfStatement(FfsInfStatementClassObject):
             # Convert Fv Section Type for PI1.1 SMM driver.\r
             #\r
             if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) >= 0x0001000A:\r
-                if Sect.SectionType == 'DXE_DEPEX':\r
-                    Sect.SectionType = 'SMM_DEPEX'\r
+                if Sect.SectionType == BINARY_FILE_TYPE_DXE_DEPEX:\r
+                    Sect.SectionType = BINARY_FILE_TYPE_SMM_DEPEX\r
             #\r
             # Framework SMM Driver has no SMM_DEPEX section type\r
             #\r
             if self.ModuleType == SUP_MODULE_DXE_SMM_DRIVER and int(self.PiSpecVersion, 16) < 0x0001000A:\r
-                if Sect.SectionType == 'SMM_DEPEX':\r
+                if Sect.SectionType == BINARY_FILE_TYPE_SMM_DEPEX:\r
                     EdkLogger.error("GenFds", FORMAT_NOT_SUPPORTED, "Framework SMM module doesn't support SMM_DEPEX section type", File=self.InfFileName)\r
             #\r
             # process the inside FvImage from FvSection or GuidSection\r