]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/GenFfs/GenFfs.c
BaseTools: Fixed issue in MultiThread Genfds function
[mirror_edk2.git] / BaseTools / Source / C / GenFfs / GenFfs.c
index 7a2a04c0ac9fd440624df78b463b36b713080975..fcb911f4fc34e560fd06001f91ddc1afde71273c 100644 (file)
@@ -13,6 +13,10 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
 #include <sys/stat.h>\r
 #endif\r
 \r
+#ifdef __GNUC__\r
+#include <unistd.h>\r
+#endif\r
+\r
 #include <stdio.h>\r
 #include <stdlib.h>\r
 #include <string.h>\r
@@ -154,6 +158,8 @@ Returns:
                         128K,256K,512K,1M,2M,4M,8M,16M\n");\r
   fprintf (stdout, "  -i SectionFile, --sectionfile SectionFile\n\\r
                         Section file will be contained in this FFS file.\n");\r
+  fprintf (stdout, "  -oi SectionFile, --optionalsectionfile SectionFile\n\\r
+                        If the Section file exists, it will be contained in this FFS file, otherwise, it will be ignored.\n");\r
   fprintf (stdout, "  -n SectionAlign, --sectionalign SectionAlign\n\\r
                         SectionAlign points to section alignment, which support\n\\r
                         the alignment scope 0~16M. If SectionAlign is specified\n\\r
@@ -730,7 +736,7 @@ Returns:
       continue;\r
     }\r
 \r
-    if ((stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--sectionfile") == 0)) {\r
+    if ((stricmp (argv[0], "-oi") == 0) || (stricmp (argv[0], "--optionalsectionfile") == 0) || (stricmp (argv[0], "-i") == 0) || (stricmp (argv[0], "--sectionfile") == 0)) {\r
       //\r
       // Get Input file name and its alignment\r
       //\r
@@ -738,7 +744,14 @@ Returns:
         Error (NULL, 0, 1003, "Invalid option value", "input section file is missing for -i option");\r
         goto Finish;\r
       }\r
-\r
+      if ((stricmp (argv[0], "-oi") == 0) || (stricmp (argv[0], "--optionalsectionfile") == 0) ){\r
+        if (-1 == access(argv[1] , 0)){\r
+          Warning(NULL, 0, 0001, "File is not found.", argv[1]);\r
+          argc -= 2;\r
+          argv += 2;\r
+          continue;\r
+        }\r
+      }\r
       //\r
       // Allocate Input file name buffer and its alignment buffer.\r
       //\r