/** @file\r
- This contains all code necessary to build the GenFvImage.exe utility. \r
+ This contains all code necessary to build the GenFvImage.exe utility.\r
This utility relies heavily on the GenFvImage Lib. Definitions for both\r
- can be found in the Tiano Firmware Volume Generation Utility \r
+ can be found in the Tiano Firmware Volume Generation Utility\r
Specification, review draft.\r
\r
-Copyright (c) 2007 - 2017, 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
- \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
+Copyright (c) 2007 - 2018, 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
+\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
\r
**/\r
\r
EFI_GUID mEfiFirmwareFileSystem3Guid = EFI_FIRMWARE_FILE_SYSTEM3_GUID;\r
\r
STATIC\r
-VOID \r
+VOID\r
Version (\r
VOID\r
)\r
}\r
\r
STATIC\r
-VOID \r
+VOID\r
Usage (\r
VOID\r
)\r
// Summary usage\r
//\r
fprintf (stdout, "\nUsage: %s [options]\n\n", UTILITY_NAME);\r
- \r
+\r
//\r
// Copyright declaration\r
- // \r
- fprintf (stdout, "Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.\n\n");\r
+ //\r
+ fprintf (stdout, "Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.\n\n");\r
\r
//\r
// Details Option\r
FV base address when current FV base address is set.\n");\r
fprintf (stdout, " -m logfile, --map logfile\n\\r
Logfile is the output fv map file name. if it is not\n\\r
- given, the FvName.map will be the default map file name\n"); \r
+ given, the FvName.map will be the default map file name\n");\r
fprintf (stdout, " -g Guid, --guid Guid\n\\r
GuidValue is one specific capsule guid value\n\\r
or fv file system guid value.\n\\r
Capsule OEM Flag is an integer between 0x0000 and 0xffff\n");\r
fprintf (stdout, " --capheadsize HeadSize\n\\r
HeadSize is one HEX or DEC format value\n\\r
- HeadSize is required by Capsule Image.\n"); \r
+ HeadSize is required by Capsule Image.\n");\r
fprintf (stdout, " -c, --capsule Create Capsule Image.\n");\r
fprintf (stdout, " -p, --dump Dump Capsule Image header.\n");\r
fprintf (stdout, " -v, --verbose Turn on verbose output with informational messages.\n");\r
FvInfFileName The name of an FV image description file or Capsule Image.\r
\r
Arguments come in pair in any order.\r
- -I FvInfFileName \r
+ -I FvInfFileName\r
\r
Returns:\r
\r
EFI_SUCCESS No error conditions detected.\r
EFI_INVALID_PARAMETER One or more of the input parameters is invalid.\r
- EFI_OUT_OF_RESOURCES A resource required by the utility was unavailable. \r
- Most commonly this will be memory allocation \r
+ EFI_OUT_OF_RESOURCES A resource required by the utility was unavailable.\r
+ Most commonly this will be memory allocation\r
or file creation.\r
EFI_LOAD_ERROR GenFvImage.lib could not be loaded.\r
EFI_ABORTED Error executing the GenFvImage lib.\r
Status = EFI_SUCCESS;\r
\r
SetUtilityName (UTILITY_NAME);\r
- \r
+\r
if (argc == 1) {\r
Error (NULL, 0, 1001, "Missing options", "No input options specified.");\r
Usage ();\r
// Init global data to Zero\r
//\r
memset (&mFvDataInfo, 0, sizeof (FV_INFO));\r
- memset (&mCapDataInfo, 0, sizeof (CAP_INFO)); \r
+ memset (&mCapDataInfo, 0, sizeof (CAP_INFO));\r
//\r
// Set the default FvGuid\r
//\r
memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));\r
mFvDataInfo.ForceRebase = -1;\r
- \r
+\r
//\r
// Parse command line\r
//\r
if ((stricmp (argv[0], "-h") == 0) || (stricmp (argv[0], "--help") == 0)) {\r
Version ();\r
Usage ();\r
- return STATUS_SUCCESS; \r
+ return STATUS_SUCCESS;\r
}\r
\r
if (stricmp (argv[0], "--version") == 0) {\r
Version ();\r
- return STATUS_SUCCESS; \r
+ return STATUS_SUCCESS;\r
}\r
\r
while (argc > 0) {\r
}\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-a") == 0) || (stricmp (argv[0], "--addrfile") == 0)) {\r
}\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--outputfile") == 0)) {\r
}\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-r") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {\r
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);\r
if (EFI_ERROR (Status)) {\r
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
- return STATUS_ERROR; \r
+ return STATUS_ERROR;\r
}\r
mFvDataInfo.BaseAddress = TempNumber;\r
mFvDataInfo.BaseAddressSet = TRUE;\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--blocksize") == 0)) {\r
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);\r
if (EFI_ERROR (Status)) {\r
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
- return STATUS_ERROR; \r
+ return STATUS_ERROR;\r
}\r
if (TempNumber == 0) {\r
Error (NULL, 0, 1003, "Invalid option value", "Fv block size can't be be set to zero");\r
- return STATUS_ERROR; \r
+ return STATUS_ERROR;\r
}\r
mFvDataInfo.FvBlocks[0].Length = (UINT32) TempNumber;\r
DebugMsg (NULL, 0, 9, "FV Block Size", "%s = 0x%llx", EFI_BLOCK_SIZE_STRING, (unsigned long long) TempNumber);\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-n") == 0) || (stricmp (argv[0], "--numberblock") == 0)) {\r
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);\r
if (EFI_ERROR (Status)) {\r
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
- return STATUS_ERROR; \r
+ return STATUS_ERROR;\r
}\r
if (TempNumber == 0) {\r
Error (NULL, 0, 1003, "Invalid option value", "Fv block number can't be set to zero");\r
- return STATUS_ERROR; \r
+ return STATUS_ERROR;\r
}\r
mFvDataInfo.FvBlocks[0].NumBlocks = (UINT32) TempNumber;\r
DebugMsg (NULL, 0, 9, "FV Number Block", "%s = 0x%llx", EFI_NUM_BLOCKS_STRING, (unsigned long long) TempNumber);\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {\r
argv += 2;\r
\r
if (argc > 0) {\r
- if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {\r
- if (argv[1] == NULL) {\r
- Error (NULL, 0, 1003, "Invalid option value", "Ffsfile Size can't be null");\r
- return STATUS_ERROR;\r
- }\r
- Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);\r
- if (EFI_ERROR (Status)) {\r
- Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
- return STATUS_ERROR; \r
- }\r
- mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;\r
- DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);\r
- argc -= 2;\r
- argv += 2;\r
+ if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {\r
+ if (argv[1] == NULL) {\r
+ Error (NULL, 0, 1003, "Invalid option value", "Ffsfile Size can't be null");\r
+ return STATUS_ERROR;\r
+ }\r
+ Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);\r
+ if (EFI_ERROR (Status)) {\r
+ Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
+ return STATUS_ERROR;\r
+ }\r
+ mFvDataInfo.SizeofFvFiles[Index] = (UINT32) TempNumber;\r
+ DebugMsg (NULL, 0, 9, "FV component file size", "the %uth size is %s", (unsigned) Index + 1, argv[1]);\r
+ argc -= 2;\r
+ argv += 2;\r
}\r
}\r
Index ++;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--filetakensize") == 0)) {\r
Error (NULL, 0, 1003, "Invalid option", "It must be specified together with -f option to specify the file size.");\r
- return STATUS_ERROR; \r
+ return STATUS_ERROR;\r
}\r
\r
if ((stricmp (argv[0], "-c") == 0) || (stricmp (argv[0], "--capsule") == 0)) {\r
CapsuleFlag = TRUE;\r
argc --;\r
argv ++;\r
- continue; \r
+ continue;\r
}\r
- \r
+\r
if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) {\r
if (argv[1] == NULL) {\r
Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null");\r
\r
argc -= 2;\r
argv += 2;\r
- continue; \r
- } \r
+ continue;\r
+ }\r
\r
if (stricmp (argv[0], "--capheadsize") == 0) {\r
//\r
Status = AsciiStringToUint64 (argv[1], FALSE, &TempNumber);\r
if (EFI_ERROR (Status)) {\r
Error (NULL, 0, 1003, "Invalid option value", "%s = %s", argv[0], argv[1]);\r
- return STATUS_ERROR; \r
+ return STATUS_ERROR;\r
}\r
mCapDataInfo.HeaderSize = (UINT32) TempNumber;\r
DebugMsg (NULL, 0, 9, "Capsule Header size", "%s = 0x%llx", EFI_CAPSULE_HEADER_SIZE_STRING, (unsigned long long) TempNumber);\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if (stricmp (argv[0], "--capflag") == 0) {\r
DebugMsg (NULL, 0, 9, "Capsule Flag", argv[1]);\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if (stricmp (argv[0], "--capoemflag") == 0) {\r
DebugMsg (NULL, 0, 9, "Capsule Guid", "%s = %s", EFI_CAPSULE_GUID_STRING, argv[1]);\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-g") == 0) || (stricmp (argv[0], "--guid") == 0)) {\r
DebugMsg (NULL, 0, 9, "FV Guid", "%s = %s", EFI_FV_FILESYSTEMGUID_STRING, argv[1]);\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if (stricmp (argv[0], "--FvNameGuid") == 0) {\r
DebugMsg (NULL, 0, 9, "FV Name Guid", "%s = %s", EFI_FV_NAMEGUID_STRING, argv[1]);\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-p") == 0) || (stricmp (argv[0], "--dump") == 0)) {\r
DumpCapsule = TRUE;\r
argc --;\r
argv ++;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-m") == 0) || (stricmp (argv[0], "--map") == 0)) {\r
}\r
argc -= 2;\r
argv += 2;\r
- continue; \r
+ continue;\r
}\r
\r
if ((stricmp (argv[0], "-v") == 0) || (stricmp (argv[0], "--verbose") == 0)) {\r
}\r
\r
VerboseMsg ("%s tool start.", UTILITY_NAME);\r
- \r
+\r
//\r
// check input parameter, InfFileName can be NULL\r
//\r
if (OutFileName != NULL) {\r
VerboseMsg ("the output file name is %s", OutFileName);\r
}\r
- \r
+\r
//\r
// Read the INF file image\r
//\r
return STATUS_ERROR;\r
}\r
}\r
- \r
+\r
if (DumpCapsule) {\r
VerboseMsg ("Dump the capsule header information for the input capsule image %s", InfFileName);\r
//\r
}\r
\r
Status = GenerateCapImage (\r
- InfFileImage, \r
+ InfFileImage,\r
InfFileSize,\r
OutFileName\r
);\r
if (InfFileImage != NULL) {\r
free (InfFileImage);\r
}\r
- \r
+\r
//\r
// update boot driver address and runtime driver address in address file\r
//\r
fflush (FpFile);\r
fclose (FpFile);\r
}\r
- \r
+\r
if (Status == EFI_SUCCESS) {\r
DebugMsg (NULL, 0, 9, "The Total Fv Size", "%s = 0x%x", EFI_FV_TOTAL_SIZE_STRING, (unsigned) mFvTotalSize);\r
DebugMsg (NULL, 0, 9, "The used Fv Size", "%s = 0x%x", EFI_FV_TAKEN_SIZE_STRING, (unsigned) mFvTakenSize);\r