/** @file\r
This file contains functions required to generate a Firmware File System file.\r
\r
-Copyright (c) 2004 - 2014, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2004 - 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
"EFI_FV_FILETYPE_SMM", // 0x0A\r
"EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE",// 0x0B\r
"EFI_FV_FILETYPE_COMBINED_SMM_DXE", // 0x0C\r
- "EFI_FV_FILETYPE_SMM_CORE" // 0x0D\r
- };\r
+ "EFI_FV_FILETYPE_SMM_CORE", // 0x0D\r
+ "EFI_FV_FILETYPE_MM_STANDALONE", // 0x0E\r
+ "EFI_FV_FILETYPE_MM_CORE_STANDALONE" // 0x0F\r
+};\r
\r
STATIC CHAR8 *mAlignName[] = {\r
"1", "2", "4", "8", "16", "32", "64", "128", "256", "512",\r
EFI_FV_FILETYPE_DRIVER, EFI_FV_FILETYPE_APPLICATION,\n\\r
EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER,\n\\r
EFI_FV_FILETYPE_SMM, EFI_FV_FILETYPE_SMM_CORE,\n\\r
+ EFI_FV_FILETYPE_MM_STANDALONE,\n\\r
+ EFI_FV_FILETYPE_MM_CORE_STANDALONE,\n\\r
EFI_FV_FILETYPE_COMBINED_SMM_DXE, \n\\r
EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE.\n");\r
fprintf (stdout, " -g FileGuid, --fileguid FileGuid\n\\r
VerboseMsg ("%s tool start.", UTILITY_NAME);\r
\r
//\r
- // Check the complete input paramters.\r
+ // Check the complete input parameters.\r
//\r
if (FfsFiletype == EFI_FV_FILETYPE_ALL) {\r
Error (NULL, 0, 1001, "Missing option", "filetype");\r
if (EFI_ERROR (Status)) {\r
goto Finish;\r
}\r
+\r
+ if (FileBuffer == NULL && FileSize != 0) {\r
+ Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");\r
+ goto Finish;\r
+ }\r
\r
//\r
// Create Ffs file header.\r
//\r
// Open output file to write ffs data.\r
//\r
- remove(OutputFileName);\r
- FfsFile = fopen (LongFilePath (OutputFileName), "wb");\r
- if (FfsFile == NULL) {\r
- Error (NULL, 0, 0001, "Error opening file", OutputFileName);\r
- goto Finish;\r
- }\r
- //\r
- // write header\r
- //\r
- fwrite (&FfsFileHeader, 1, HeaderSize, FfsFile);\r
- //\r
- // write data\r
- //\r
- fwrite (FileBuffer, 1, FileSize - HeaderSize, FfsFile);\r
+ if (OutputFileName != NULL) {\r
+ remove(OutputFileName);\r
+ FfsFile = fopen (LongFilePath (OutputFileName), "wb");\r
+ if (FfsFile == NULL) {\r
+ Error (NULL, 0, 0001, "Error opening file", OutputFileName);\r
+ goto Finish;\r
+ }\r
+ //\r
+ // write header\r
+ //\r
+ fwrite (&FfsFileHeader, 1, HeaderSize, FfsFile);\r
+ //\r
+ // write data\r
+ //\r
+ if (FileBuffer != NULL) {\r
+ fwrite (FileBuffer, 1, FileSize - HeaderSize, FfsFile);\r
+ }\r
\r
- fclose (FfsFile);\r
+ fclose (FfsFile);\r
+ }\r
\r
Finish:\r
if (InputFileName != NULL) {\r