Name
GenFw.exe – build a UEFI image or other image.
Synopsis
GenFw.exe -r | -o <OutputFile> [-e <EfiType>] [-c | -t | -l | -u | -b | -z | -s <TimeDate> | -m | -j | --hiipackage | --hiibinpackage] [-a] [-p] <InputFile>
GenFw.exe –h
GenFw.exe --version

Description
Genfw is mainly used to process PE32 image to get the expected image data or image file. PE32 is a general-purpose image format that contains, among other information, data identifying the target environment for execution of the image. This utility can modify the standard PE32 image to create UEFI image with EFI subsystem type, PI Terse Executable image with the compact TE image header, zero its dubug data or reset its time stamp. It can also extract PE32 image data to create bin file, extract PE32 image data section to create Acpi table image, or dump PI TE image header information. It can also parse the text MicroCode definition file to create the MicroCode binary image, merge (concatenate) several MicroCode binary images into a single file by pad value and alignment requirement. This tool also supports the override the input file with the output contents.
Options
If no options are specified, tool prints usage.
Filename1 [FilenameN]
Input PE/PE32+ image, or TE image, or MicroCode Txt file, or MicroCode bin file, or hii binary pakcages.
-o FileName, --outputfile FileName
The EFI image, TeImage, AcpiImage, MicroBin, hii package lists file or other modified PE image will be created.
-e EFI_FILETYPE, --efiImage EFI_FILETYPE
Create Efi Image. EFI_FILETYPE is one of BASE, SEC, PEI_CORE, PEIM, DXE_CORE, SMM_CORE, DXE_DRIVER, UEFI_APPLICATION, DXE_SAL_DRIVER, UEFI_DRIVER, DXE_RUNTIME_DRIVER, DXE_SMM_DRIVER, SECURITY_CORE, COMBINED_PEIM_DRIVER, PIC_PEIM, RELOCATABLE_PEIM, BS_DRIVER, RT_DRIVER, APPLICATION, SAL_RT_DRIVER to support all module types.
-c, --acpi
Create Acpi table.
-t, --terse
Create Te Image.
-u, --dump
Dump TeImage Header.
-z, --zero
Zero the Debug Data Fields in the PE input image file. It also zeros the time stamp fields.
-b, --exe2bin
Convert the input EXE to the output BIN file.
-l, --stripped
Strip off the relocation information data from PE or TE image.
-s timedate, --stamp timedate
timedate format is “yyyy-mm-dd 00:00:00”. If timedata is set to “NOW”, current system time is used. The support date scope is 1970-1-1 8:0:0 ~ 2038-1-19 3:14:07.
-m, --mcifile
Convert input microcode txt definition file to microcode bin file.
-j, --join
Merge multiple microcode bin files to one file.
-a NUM, --align NUM
NUM is one HEX or DEC format alignment value, which is used to combine multiple microcode bin files.
-p NUM, --pad NUM
NUM is one HEX or DEC format padding value, which is used to combine multiple microcode bin files.
--keepexceptiontable
Don’t clear exception table.
--keepzeropending
Don’t strip zero pending of .reloc.
-r, --replace
Overwrite the input file with the output content.
-g HiiPackageListGuid, --hiiguid HiiPackageListGuid
Guid is used to specify hii package list guid.
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
--hiipackage 
Combine all input binary hii packages into a single package list as the text resource data file (RC file format).
--hiibinpackage 
Combine all input binary hii packages into a single package list as the binary resource section.
-v, --verbose
Turn on verbose output with informational messages.
-d, --debug level
	Enable debug message with specified level.
--version
Show program's version number and exit
-h, --help
Show this help message and exit
Status codes returned
STATUS_SUCCESS 	0	The action was completed as requested.	
STATUS_ERROR 		2	The action failed.	
Example
1. Generate Efi image with the input PE image, module type and the output file name.
GenFw –e PEI_CORE PeiMain.dll –o PeiMain.efi
2. Generate Te image with the input PE image and the output file name.
GenFw –t PeiMain.dll –o PeiMain.te
3. Generate acpi table image with the input PE image and the output file name.
GenFw –c Facs.dll –o Facs.acpi
4. Dump TeImage Header with the input Te Image and the output file name.
GenFw –u PeiMain.te –o PeiMain.teheader
5. Modify PeImage by zero its debug data.
GenFw –z PeiMain.dll –o Peimain.zero
6. Modify PeImage by set new timestamp and override the input image without the output file name.
GenFw –s “2007-8-16 16:06:32” PeiMain.dll –r
7. Extract bin image from PeImage.
GenFw –b PeiMain.dll –o PeiMain.bin
8. Generate the microcode binary file from the micro code txt file.
GenFw –m Mci.txt –o Mci.bin
9. Merge the multiple mci binary files to one file.
GenFw –j Mci.bin1 Mci.bin2 Mci.bin3 –a 32 –p 0xFF –o Mci.bin
10. Generate the text resource file (RC format) based on all input binary HII packages and their package list guid.
GenFw –o SampleHii.rc –g D49D2EB0-44D5-4621-9FD6-1A92C9109B99 –hiipackage SampleStr.hpk SampleVfr.hpk
11. Generate the binary resource section based on all input binary HII packages and their package list guid.
GenFw –o SampleHii.bin –g D49D2EB0-44D5-4621-9FD6-1A92C9109B99 –hiibinpackage SampleStr.hpk SampleVfr.hpk
Bugs
No known bugs.
Report bugs to edk2-buildtools-devel@lists.sourceforge.net
Files
None
See also
None
License
Copyright (c) 2007 - 2011, Intel Corporation. All rights reserved.
This program and the accompanying materials are licensed and made available 
under the terms and conditions of the BSD License which accompanies this 
distribution.  The full text of the license may be found at
http://opensource.org/licenses/bsd-license.php

THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.