Patch the BPB information in boot sector image file.\r
Patch the MBR code in MBR image file.\r
\r
-Copyright 2006 - 2010, Intel Corporation \r
-All rights reserved. This program and the accompanying materials \r
+Copyright (c) 2006 - 2016, Intel Corporation. All rights reserved.<BR>\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
#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
//\r
// Utility version information\r
//\r
-#define UTILITY_MAJOR_VERSION 0\r
-#define UTILITY_MINOR_VERSION 1\r
+#define UTILITY_MAJOR_VERSION 1\r
+#define UTILITY_MINOR_VERSION 0\r
\r
void\r
Version (\r
\r
--*/\r
{\r
- printf ("%s v%d.%d - Utility to break a file into two pieces at the specified offset.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);\r
- printf ("Copyright (c) 1999-2010 Intel Corporation. All rights reserved.\n");\r
+ printf ("%s Version %d.%d Build %s\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION, __BUILD_VERSION);\r
}\r
\r
void\r
--*/\r
{\r
Version();\r
+ printf ("Copyright (c) 1999-2016 Intel Corporation. All rights reserved.\n");\r
+ printf ("\n The BootSectImage tool prints information or patch destination file by source\n");\r
+ printf (" file for BIOS Parameter Block (BPB) or Master Boot Record (MBR).\n");\r
printf ("\nUsage: \n\\r
BootSectImage\n\\r
[-f, --force force patch even if the FAT type of SrcImage and DstImage mismatch]\n\\r
FILE *FileHandle;\r
int result;\r
\r
- FileHandle = fopen (FileName, "r+b");\r
+ FileHandle = fopen (LongFilePath (FileName), "r+b");\r
if (FileHandle == NULL) {\r
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "Open file: %s", FileName);\r
return 0;\r
FILE *FileHandle;\r
int result;\r
\r
- FileHandle = fopen (FileName, "rb");\r
+ FileHandle = fopen (LongFilePath (FileName), "rb");\r
if (FileHandle == NULL) {\r
DebugMsg (NULL, 0, DEBUG_ERROR, NULL, "ERROR: E0001: Error opening file: %s", FileName);\r
return 0;\r
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
ProcessMbr = TRUE;\r
} else if (strcmp (*argv, "-v") == 0 || strcmp (*argv, "--verbose") == 0) {\r
Verbose = TRUE;\r
+ } else if (strcmp (*argv, "--version") == 0) {\r
+ Version();\r
+ return 0;\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