Name
GenFv.exe – build one PI firmware volume image or one UEFI capsule image.
Synopsis
GenFv.exe –p –i <InputFile> [–o <OutputFile>]
GenFv.exe [-v | -q | -d] [-b <BlockSize>] [-n <NumBlock>] [-f <FfsFile>] [-s <FileTakeSize>] [-r <Address>] [-a <AddressFile>] [-m <LogFile>] [-g <Guid>] [--FvNameGuid <Guid>] [--capflag <CapFlag>] [--capheadsize <HeadSize>] [-c] –i <InputFile> –o <OutputFile>
GenFv.exe –h
GenFv.exe --version
Description
GenFv generates a PI firmware volume image or a UEFI capsule image from the PI firmware files or the binary files, which conforms to the firmware volume image format defined in PI specification or uefi capsule image format defined in UEFI specification.
This utility aggregates the Firmware File System (FFS2) files into a single FV image with FFS2 file system guid. The input files must be compliant with the PI 1.0 specification. The utility will create a FV header, append all of the FFS input files, and optionally, add the FFS pad file for those FFS files that require the specific file alignment. When adding PEI files or dxe drivers, it will relocate them to the fixed flash address or the preferred loaded memory address if necessary. Also, one symbol map file that contains the symbol information (Function and Variable) for each driver in the FV will be produced. This utility also responsible aggregates the binary files into a single UEFI capsule image with the UEFI capsule header. 
GenFv takes as input the path/filename of the Fv.inf or Cap.inf file, the output file name, the starting physical address of the FV, the boot driver base address and the runtime driver base address of the address.inf file to create the final Fv or Capsule image. This utility is usually called by GenFds tool, which parses platform.fdf file to create the internal Fv.inf or Cap.inf. The internal Fv.inf and Cap.inf information is generally not used by end users. 
 Options
If no options are specified, tool prints usage.
-o FileName, --outputfile FileName
The PI firmware volume image or Uefi Capsule image is created. This option is required.
-i FileName, --inputfile FileName
File is the input FV.inf or Cap.inf to specify how to construct FvImage or CapImage. See examples for details. File may be one capsule image when its header is dumped. This option is required.
-b BlockSize, --blocksize BlockSize
	BlockSize is one HEX or DEC format value required by FV image.
-n NumberBlock, --numberblock NumberBlock
    NumberBlock is one HEX or DEC format value. NumberBlock is one optional parameter.
-f FfsFile, --ffsfile FfsFile
	FfsFile is placed into FV image. Multiple files can be input one by one.
-s FileTakeSize, --filetakesize FileTakenSize
	Specify the size of the required space that the input file is placed in FV image. It should be specified together with the input file.
-r Address, --baseaddr Address
	Address is the rebase start address for drivers that run in Flash. It supports DEC or HEX digital format.
-a AddressFile, --addrfile AddressFile
	AddressFile is a file used to log boot driver base address and runtime driver base address. this tool will updates these two addresses afterrelocating all boot drivers and runtime drivers in this fv image to the preferred loaded memory address.
-m logfile, --map logfile
	Logfile is the output Fv map file. If this option is not given, the FvName.map will be the default fv map file name.
-g Guid, --guid Guid
    Guid is one specific capsule guid value or fv file system guid value.
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx.
--FvNameGuid Guid
    Guid is used to specify Fv Name. 
Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
--capflag CapFlag
	Specify capsule reset flag (PersistAcrossReset, PopulateSystemTable or InitiateReset or none).
--capheadsize HeadSize
	Specify head size for capsule image in the format of HEX or DEC.
-c, --capsule
	Create Uefi capsule image.
-p, --dump
	Dump a capsule image header.
-v, --verbose
	Enable verbose output with informational messages.
-q, --quiet           
    Disable all messages except key message and fatal error.
-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 BFV that contains PEI drivers in Flash with the input FV.inf, base address, and the output file name.
GenFv -i FvRecovery.inf -o FvRecovery.fv -r 0xFFFD0000
FvRecovery.inf
[options]
EFI_BLOCK_SIZE = 0x10000           #required option
EFI_NUM_BLOCKS   =  0x3
EFI_BASE_ADDRESS = 0xFFFD0000 #optional, if command line -r is not specified, this option will be used.
[attributes]
EFI_ERASE_POLARITY   =  1
EFI_WRITE_ENABLED_CAP = TRUE
EFI_READ_ENABLED_CAP = TRUE
EFI_READ_LOCK_STATUS = TRUE
EFI_WRITE_STATUS = TRUE
EFI_READ_DISABLED_CAP = TRUE
EFI_WRITE_LOCK_STATUS = TRUE
EFI_LOCK_CAP = TRUE
EFI_LOCK_STATUS = TRUE
EFI_ERASE_POLARITY = 1
EFI_MEMORY_MAPPED = TRUE
EFI_READ_LOCK_CAP = TRUE
EFI_WRITE_DISABLED_CAP = TRUE
EFI_READ_STATUS = TRUE
EFI_WRITE_LOCK_CAP = TRUE
EFI_STICKY_WRITE = TRUE
EFI_FVB2_ALIGNMENT_16 = TRUE
[files]
EFI_FILE_NAME = K:\Build\NT32\DEBUG_MYTOOLS\Fv\Ffs\52C05B14-0B98-496c-BC3B-04B50211D680PeiMain\52C05B14-0B98-496c-BC3B-04B50211D680.ffs
EFI_FILE_NAME = K:\Build\NT32\DEBUG_MYTOOLS\Fv\Ffs\9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50PcdPeim\9B3ADA4F-AE56-4c24-8DEA-F03B7558AE50.ffs
......
2. Generate FvMain that contains Dxe drivers loaded in the preferred loaded memory address with the input FV.inf, address file, the output file name, its firmware file system guid (FFS2) and its guid name.
GenFv -i FvMain.inf -o FvMain.fv -a Addr.inf –g 8c8ce578-8a3d-4f1c-9935-896185c32dd3 –FvNameGuid 6D99E806-3D38-42c2-A095-5F4300BFD7DC
Addr.inf
[options]
EFI_BOOT_DRIVER_BASE_ADDRESS = 0x1f300000
EFI_RUNTIME_DRIVER_BASE_ADDRESS = 0x1f600000
3. Generate the capsule image with the input cap.inf, and the output file name.
GenFv -i BiosUpdate.inf -o BiosUpdate.cap
BiosUpdate.inf
[options]
EFI_CAPSULE_GUID           = 25A5CD7D-A5EB-4d74-9C28-D6EF04E03B16 (Required)
EFI_CAPSULE_HEADER_SIZE  = 0x20                                                                (Optional)
EFI_CAPSULE_FLAGS              = PopulateSystemTable                                      (Optional)
[attributes]
[files]
EFI_FILE_NAME = K:\Build\NT32\DEBUG_MYTOOLS\Fv\Ffs\EDBEDF47-6EA3-4512-83C1-70F4769D4BDE-Capsule_A.fvi
4. Dump capsule image header information for the input capsule image.
GenFv -p -i BiosUpdate.cap -o Cap.info
Bugs
No known issues.
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.