Name
GenSec.exe – build one PI section file.
Synopsis
GenSec.exe [options] [Filename]…
Description
GenSec is used to generate valid EFI_SECTION type files, which conforms to the firmware file section defined in PI specification, from PE32/PE32+/COFF image files or other binary files. This utility will produce a file that is the section header concatenated with the contents of the input file.  It does not validate that the contents of the input file match the section added.
PI SECTION Types referred to the Volume 3 of the PI 1.0 specification.
Mnemonic	PI Section Type	
COMPRESS	EFI_SECTION_COMPRESSION	
GUID	EFI_SECTION_GUID_DEFINED	
PE32	EFI_SECTION_PE32	
PIC	EFI_SECTION_PIC	
TE	EFI_SECTION_TE	
DXE_DEPEX	EFI_SECTION_DXE_DEPEX	
VERSION	EFI_SECTION_VERSION	
UI	EFI_SECTION_USER_INTERFACE	
COMPAT16	EFI_SECTION_COMPATIBILITY16	
FVIMAGE	EFI_SECTION_FIRMWARE_VOLUME_IMAGE	
SUBGUID	EFI_SECTION_FREEFORM_SUBTYPE_GUID	
RAW	EFI_SECTION_RAW	
PEI_DEPEX	EFI_SECTION_PEI_DEPEX	
Options
Filename1 [FilenameN]
Input PE/PE32+ image, or TE image, or other binary files.
-o FileName, --outputfile FileName
The PI section file is created. This option is required.
-s SectionType, --sectiontype SectionType
SectionType defined in PI spec is one type of EFI_SECTION_COMPRESSION, EFI_SECTION_GUID_DEFINED, EFI_SECTION_PE32, EFI_SECTION_PIC, EFI_SECTION_TE, EFI_SECTION_DXE_DEPEX, EFI_SECTION_COMPATIBILITY16, EFI_SECTION_USER_INTERFACE, EFI_SECTION_VERSION, EFI_SECTION_FIRMWARE_VOLUME_IMAGE, EFI_SECTION_RAW, EFI_SECTION_FREEFORM_SUBTYPE_GUID, EFI_SECTION_PEI_DEPEX. If sectiontype is not given, EFI_SECTION_ALL is default type to contain the input all sections to one section file.
-c [Type], --compress [Type]
Compress method type can be PI_NONE or PI_STD. If Type is not given, PI_STD is default type.
-g GuidValue, --vendor GuidValue
GuidValue is one specific vendor guid value for guided section. Its format is 00000000-0000-0000-0000-000000000000. If it is not given, the default CRC32 guided is used.
-l GuidHeaderLength, --HeaderLength GuidHeaderLength
Specify the size of header of GUID-ed data.
-r GuidAttr, --attributes GuidAttr
GuidAttr is guided section attributes, which may be PROCESSING_REQUIRED or AUTH_STATUS_VALID. If it is not given, PROCESSING_REQUIRED is the default attribute.
-n String, --name String
String is a NULL terminated string used in Ui section.
-j Number, --buildnumber Number
Number is an integer value between 0000 and 9999 used in Ver 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
Example
1. Generate PE32 section file with the input PE image, PE32 section type and the output file name.
GenSec -s EFI_SECTION_PE32 PeiMain.efi -o PeiMain.pe32 
2. Generate compression section file with the input section files, compression method and the output file name.
GenSec -s EFI_SECTION_COMPRESSION –c PI_STD PeiMain.pe32 PeiMain.ui PeiMain.ver -o PeiMain.com
3. Generate the default CRC32 guided section file with the input section files, and the output file name.
GenSec –s EFI_SECTION_GUID_DEFINED PeiMain.pe32 PeiMain.ui PeiMain.ver –o PeiMain.guided
4. Generate the vendor specific guided section file with the input vendor raw files, the vendor guid, and the output file name.
GenSec –s EFI_SECTION_GUID_DEFINED –g A31280AD-481E-41B6-95E8-127F-4C984779 –r PROCESSING_REQUIRED –r AUTH_STATUS_VALID PeiMain.raw –o PeiMain.guided
5. Generate UI section with the input string and the output file name.
Gensec -s EFI_SECTION_USER_INTERFACE –n “PeiMain” –o PeiMain.ui
6. Generate VER section with the input build number and the output file name.
GenSec -s EFI_SECTION_VERSION –j 20 –o PeiMain.ver
Bugs
No known bugs.
Report bugs to edk2-buildtools-devel@lists.sourceforge.net
Files
None
See also
None
License
Copyright (c) 2007 - 2009, 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.