]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/BootSectImage/bootsectimage.c
Sync EDKII BaseTools to BaseTools project r2093.
[mirror_edk2.git] / BaseTools / Source / C / BootSectImage / bootsectimage.c
index a907e214f45a5be6c7360239a3a8b56c4cf06d72..0d0a3cbf77e946a69a768fc6571c36daf126b6ce 100644 (file)
@@ -20,6 +20,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 #include "fat.h"\r
 #include "mbr.h"\r
 #include "EfiUtilityMsgs.h"\r
+#include "ParseInf.h"\r
 \r
 #define DEBUG_WARN  0x1\r
 #define DEBUG_ERROR 0x2\r
@@ -845,7 +846,9 @@ main (
   BOOLEAN ProcessMbr;    // -m\r
   BOOLEAN DoParse;       // -p SrcImage or -g SrcImage DstImage\r
   BOOLEAN Verbose;       // -v\r
-  \r
+  UINT64  LogLevel;\r
+  EFI_STATUS EfiStatus;\r
+\r
   SrcImage = DstImage = NULL;\r
   ForcePatch = FALSE;\r
   ProcessMbr = FALSE;\r
@@ -886,6 +889,23 @@ main (
       ProcessMbr = TRUE;\r
     } else if (strcmp (*argv, "-v") == 0 || strcmp (*argv, "--verbose") == 0) {\r
       Verbose    = TRUE;\r
+    } else if ((stricmp (*argv, "-d") == 0) || (stricmp (*argv, "--debug") == 0)) {\r
+      argc--; argv++;\r
+      if (argc < 1) {\r
+        Usage ();\r
+        return -1;\r
+      }\r
+      EfiStatus = AsciiStringToUint64 (*argv, FALSE, &LogLevel);\r
+      if (EFI_ERROR (EfiStatus)) {\r
+        Error (NULL, 0, 1003, "Invalid option value", "%s = %s", "--debug", *argv);\r
+        return 1;\r
+      }\r
+      if (LogLevel > 9) {\r
+        Error (NULL, 0, 1003, "Invalid option value", "Debug Level range is 0-9, currnt input level is %d", (int) LogLevel);\r
+        return 1;\r
+      }\r
+      SetPrintLevel (LogLevel);\r
+      DebugMsg (NULL, 0, 9, "Debug Mode Set", "Debug Output Mode Level %s is set!", *argv);\r
     } else {\r
       Usage ();\r
       return -1;\r