]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/Python/GenFds/EfiSection.py
BaseTools:Make BaseTools support new rules to generate RAW FFS FILE
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / EfiSection.py
index dfb2470874e66fe1838ef31d416066fd07c16692..74f176cfef2f9833169f1c2b7994ee1c2385ff71 100644 (file)
@@ -3,13 +3,7 @@
 #\r
 #  Copyright (c) 2007 - 2018, 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
-#  which accompanies this distribution.  The full text of the license may be found at\r
-#  http://opensource.org/licenses/bsd-license.php\r
-#\r
-#  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-#  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+#  SPDX-License-Identifier: BSD-2-Clause-Patent\r
 #\r
 \r
 ##\r
@@ -99,7 +93,7 @@ class EfiSection (EfiSectionClassObject):
                 if '.depex' in SuffixMap:\r
                     FileList.append(Filename)\r
         else:\r
-            FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile)\r
+            FileList, IsSect = Section.Section.GetFileList(FfsInf, self.FileType, self.FileExtension, Dict, IsMakefile=IsMakefile, SectionType=SectionType)\r
             if IsSect :\r
                 return FileList, self.Alignment\r
 \r
@@ -223,6 +217,26 @@ class EfiSection (EfiSectionClassObject):
                                                      Ui=StringData, IsMakefile=IsMakefile)\r
                 OutputFileList.append(OutputFile)\r
 \r
+        #\r
+        # If Section Type is BINARY_FILE_TYPE_RAW\r
+        #\r
+        elif SectionType == BINARY_FILE_TYPE_RAW:\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
+                    EdkLogger.error("GenFds", GENFDS_ERROR, "Output file for %s section could not be found for %s" % (SectionType, InfFileName))\r
+\r
+            elif len(FileList) > 1:\r
+                EdkLogger.error("GenFds", GENFDS_ERROR,\r
+                                "Files suffixed with %s are not allowed to have more than one file in %s[Binaries] section" % (\r
+                                self.FileExtension, InfFileName))\r
+            else:\r
+                for File in FileList:\r
+                    File = GenFdsGlobalVariable.MacroExtend(File, Dict)\r
+                    OutputFileList.append(File)\r
 \r
         else:\r
             """If File List is empty"""\r