Home

EDK_II_Build_v1_22 - Firmware Encoding Index

image

Contents

1. Ca Code Definition Window Call Browser Output Eg Find Results 1 SQ Find Results 2 Ready Figure 26 VS2005 Call Tree View Definition of terms http msdn2 microsoft com en us library ms242753 VS 80 aspx 3 L Decompress gt Bg Targets E Decompress E By Reports E Decompresso71218 vsp 1 22 May 2010 293 BUILD 294 May 2010 1 22 Appendix J HII UEFI Compliant Unicode Strings File Format This append describes the UEFI compliant format for the input Unicode string files and strings within header files that are parsed by the StrGather parser module of the AutoGen utility The utility is versatile in that it supports multiple layouts and formats in the Unicode file This versatility allows strings to be grouped either by language or string identifier and strings may be demarcated with double quotes or by a new control character in the first column of a new line Comments may appear anywhere within the string file however processing of the line will stop at a comment that is appended to a line Blank lines terminate processing of a multi line string as does the end of file Additionally a control character default is forward slash will also terminate the end of a string UCS 2 compliant files begin with a binary character OxFEFF big endian These file may be created either by using a text editor program that will do conversions or by creating an ASCII t
2. 44 44444444444HHHHRnHHHn nennen ener nennen nn 136 7 4 1 Module AS AAA 136 7 4 2 Top level Makefile rss 142 1 9 Binary Modules ae ER ee hones 145 S MAKE Stage EATE 147 KS aA TALA 147 8 2 PreprocesShl km ders DT 148 8 3 Compile Assemblyir Arne re 148 ea Ee onl EE 149 8 5 Dynamic Aa 149 8 6 Generate ModuleImages ze output tet etes He nee 149 BiG GON Mo 149 8 7 Generate Platform Images u a en ale 149 May 2010 vii 10 11 12 viii BUILD ImageGen Stage FLASH Images eee 151 9 1 Overview of Flash Device EZA e DG 151 9 2 Parsing FDF Meta Data File cer aa ale eiae ondes 152 9 2 1 FILE Format Example esnnennnennnnnnnnnnnnnnnnnnnnnnnnnnennnnnn nn sn nn nn 153 9 3 Build Intermediate mages u ea ea o s e aoc aries kenden tes 153 deba Bibi aa AEA 153 9 32 Creating EFI Sections ae ea 153 9 3 3 Create an Apriori File irr ek TR RR POR UR 154 9 3 4 Create FFS Files from Leaf Sections 4 u4s44444 Hannes nenn 155 9 3 5 Create Encapsulation Sections rrura 156 9 4 Create the FV Image File s ur ee 157 9 5 Create the FD Image le AAE 159 9 5 1 EV Region Type rta E ar eat eese ree are RR a reren 160 9 5 2 DATA Region Type ea len 160 953 FIEE REGION Type aak in eu 161 ImageGen Stage Other Images assa 163 10 1 EFI PCI OptionROM Images cepe en tend bs 163 10 2 UEFI Applications iei oett TR te eden rs 163
3. Table 15 ImageGen Final Output File Extensions Input Extensions fv mcb fd efi pe32 Output Extension Description Firmware Device Images UEFI PCI OptionROM Images rom For UEFI compliant PCI Option ROMs the EfiRom tool is used to process efi or pe32 files into the rom file For UEFI applications the efi file generated at the end of the MAKE stage can be used directly or if the application will be included as part of a flash device image all of the shell applications the efi file is processed using the standard steps for including a driver in an image 4 7 Getting Started While the EDK II User s Manual provides more detailed instructions in developing EDK II code this section provides an overview to the steps needed to obtain code and perform a build of an emulation environment 4 7 1 Workstation Setup A workstation running one of the supported operating systems should be setup on a network and the compile tools installed An OS specific version of a Subversion SVN client must be installed May 2010 73 BUILD Note TortoiseSVN works well for Microsoft OS based workstations while a command line SVN client can be used on UNIX based systems Setup of the subversion client is beyond the scope of this document refer to the EDK II website for more information on SVN 4 7 2 Downloading Code Using an SVN client developers should checkout the edk2 source tree at
4. 255 Appendix D OU BE ADE AAA 259 Appendix E build exe command u a ee 269 SBOV LGA 269 E 2 Makefile actions tere rr rh naeh polaren 269 E 3 Build Targets and elea e 269 EA Ea EAE 270 Appendix F NT32 Platform Emulation Envoronment nnn ennee eneen eenen ennenenn 273 Appendix G Firmware Volume INE 275 G 1 Firmware Volume INF Description rss 275 G 2 Attributes GOGO 275 ERIS bilean EEn 277 G 4 Options SECTION EEA 278 Appendix H HII EFI Compliant Unicode Strings File Format 281 HI Control Character eie tenait certo an len 281 PZ Eang age Definitions s ts elle 281 HZ String Definitions n ame ieh 281 H 3 String Control Sequences x tosta oath toot detegit Atelier onte 282 Appendix I VS2005 Team Suite Performance Profile sssss 285 1 1 Step 1 Create a new project rss 285 I 2 Step 2 Update the project AAA 285 1 2 1 To pass an argument in to the console application nnen 287 1 2 2 Step 3 Run the Performance Wizard ss 289 Appendix J 1 22 May 2010 ix BUILD HII UEFI Compliant Unicode Strings File Format 295 Appendix K Mod le AA ALEA 299 x May 2010 1 22 Tables Table 1 EDK Build Infrastructure Support Matrix sa 1 Table 2 EFI Section Types He 18 Tables Defined FV File Types Ld ec a ee esu asd gaiago 20 Table 4 Basic EFI SECTION Type Codes nnn anseenseneneneensnne
5. FE EE HE HE FE FE HE HE HE HE FE HE HE HE FE FE FE HE HE FE FE FE FE E HE FE FE FE HE E FE FE FE HE HE FE FE FE HE HE HE HE FE FE HE HE FE FE FE E HE FE FE FE FE E FE FE FE FE HE FE FE FE FE EE HE FE HE HE HE ERE FE HE HE HE HE FE E I HE ASL FAMILY MSFT _ _ ASL PATH C ASL asl exe God ito E FE FE AE RH KOA KOA KOA HH HH HEHE FE FE HE FE FE FE FE FE FE FE E FE FE E FE FE EA FE E FE FE FE Eda BE _ _EBC_PP_PATH EHEHE HEHE HEHE HE HE HE HE HE FE FE Ago EE FE FE HE HE HE FE FE RE HE HE FE FE E E AA FE FE E E d FE FE HE HE FE FE dA HE HE FE FE FE EER FE FE E HE EE FE FE HE HE FE FE E HE HHH Microsoft Visual Studio NET 2003 IA 32 only with Link Time Code Generation And Intel ACPI Compiler FEFE EE FE HE ERE EE FE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE E HE E HE E HE HE HE HE HE HE HE HE HE HE HE HE FE HE IE E HE HE E E FE HE HE HE HE HE E FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE E BE HE VS2003 Microsoft Visual Studio NET 2003 and Intel ACPI Source Language Compiler iasl exe VS2003 FAMILY MSFT May 2010 1 22 bed zg Aiz dd izo ASL definitions Ld ERE ER EHE HE BE HE VS2003 ASL PATH VS2003 ASL FLAGS VS2003 ASL OUTFLAGS VS2003 ASLCC FLAGS VS2003 ASLPP FLAGS VS2003 ASLDLINK FLAGS bed zg Ard d HE E HEHH IA32 definitions bed zg Az dd izo VS2003 IA32 DLL VS2003 IA32 MAKE P
6. Table 22 C Compiler s Preprocessor Options Microsoft Intel GCC Description nologo nologo Do not display compiler version information E E E Preprocess only do not compile assemble or link TC TC x assembler with cpp Compile as c files FIAutoGen h FIAutoGen h include AutoGen h Always include AutoGen h file Table 23 C Compiler s Preprocessor Options for VFR files ONLY 1 22 Microsoft nologo JE TC D VFRCOMPILE FI MOD NAME StrDefs h Intel nologo E TC D VFRCOMPILE GCC E XC DVFRCOMPILE P Description Do not display compiler version information Preprocess only do not compile assemble or link Compile as c files Used only for Preprocessing VFR files Used only for Preprocessing VFR files do not generate line directives Force include of the module s StrDefs h file Table 24 Pre compiled Header PCH Creation Flags Microsoft Intel nologo nologo c c W4 W4 GCC Wall Do not display compiler version information Compile C files to object obj files only do not link Warning level 4 print errors warnings and remarks or enable most warning messages May 2010 Description 101 Build Environment WX WX Werror Force warnings to be reported as errors Gy Gy Separate functions for linker GS GS Disable security checks O1 O1 Optimize for Maximum Speed Oi Oi Enable Intrins
7. lt EXECPATH gt lt Command gt lt EOL gt lt D11Path gt Family lt Guid gt lt UserDefined gt DLL DPATH lt EXECPATH gt lt EOL gt May 2010 81 82 BUILD lt EXECPATH gt lt Definition gt lt Environ gt lt AbsolutePath gt lt Command gt lt Word gt lt Ext gt lt Definition gt DEF MACRO Sep lt Path gt Family FAMILY lt SupFamily gt lt EOL gt lt SupFamily gt MSFT INTEL GCC ACPICA lt Guid gt GUID lt RegistryFormatGuid gt lt EOL gt lt UserDefined gt Word lt UserDefinedValues gt lt EOL gt lt FlagAttr gt FLAG lt FlagValues gt lt EOL gt Parameters Note that no space characters are permitted on the left side of the expression before the equal sign All of the keywords that make up the left side of the expression must be alphanumeric only no special characters are permitted Target A keyword that uniquely identifies the build target the first field where fields are separated by the underscore character Two values DEBUG and RELEASE have been pre defined This keyword is used to bind command flags to individual commands Users may want to add other definitions such as PERF SIZE or SPEED and define their own set of FLAGS to use with these tags The wildcard character is permitted after it has been defined one time for a tool chain TagNa
8. DEF VS2005x86_BINX64 cl exe DEF VS2005x86_BINX64 cl exe DEF VS2005x86_BINX64 cl exe DEF VS2005x86_BINX64 cl exe DEF VS2005x86_BINX64 m164 exe DEF VS2005x86_BINX64 lib exe DEF VS2005x86_BINX64 link exe DEF VS2005x86_BINX64 cl exe DEF VS2005x86_BINX64 cl exe DEF VS2005x86_BINX64 link exe nologo c WX GS X w4 Gs8192 D UNICODE Olib2s GL Gy FIAutoGen h EHs c GR GF Zi Gm RELEASE VS2005x86 X64 CC FLAGS nologo c WX GS X w4 Gs8192 D UNICODE Olib2s GL Gy FlAutoGen h EHs c GR GF DEBUG VS2005x86 X64 ASM FLAGS RELEASE VS2005x86 X64 ASM FLAGS nologo c WX W3 Cx Zd Zi nologo c WX W3 Cx Zd DEBUG VS2005x86 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT DEBUG SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER RELEASE VS2005x86 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG May 2010 1 22 DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text Ld FE HE FE HE FE HE FE HE HE HEHE HEHE HHH IPF definitions HEEE HEHE HEHE HE HE HE HEHE HEHE H H HH VS2005x86 IPF DLL DEF VS2005x86 DLL VS2005x86 IPF PP PATH DEF VS2005x86_BIN64 cl exe V
9. EFI GUIDED SECTION AUTH STATUS VALID Set to 1 if the section contains authentication data that is reported through the AuthenticationStatus parameter returned from the GUIDed Section Extraction Protocol Ifthe EFI GUIDED SECTION AUTH STATUS VALID bitis clear the AuthenticationStatus parameter is not used Example typedef struct EFI GUID DEFINED SECTION UINT32 CRC32 SECTION HEADER GuidSectionHeader CRC32Checksum May 2010 53 BUILD EFI_FFS_FILE_HEADER The header of an FFS file typedef struct 54 EFI_GUID Name EFI FFS INTEGRITY CHECK IntegrityCheck EFI FV FILETYPE Type EFI FFS FILE ATTRIBUTES Attributes UINT8 S126 3 EFI FFS FILE STATE State EFI FFS FILE HEADER typedef struct EFI GUID Name EFI FFS INTEGRITY CHECK IntegrityCheck EFI FV FILETYPE Type EFI FFS FILE ATTRIBUTES Attributes UINT8 Size 3 EFI FFS FILE STATE State UNIT32 ExtendedSize EFI FFS FILE HEADER2 Parameters Name Type This GUID is the file name It is used to uniquely identify the file There may be only one instance of a file with the file name GUID of Name in any given firmware volume IntegrityCheck Used to verify the integrity of the file Type EFI FFS INTEGRITY CHECK is defined in Related Definitions below Identifies the type of file Type EFI FV FILETYPE is defined as a UINTS following the coding values Defined FV File Types table above Attributes Size D
10. s_base i ASM FoS dst ASM FLAGS I s path INC d path s_base iii lt Command GCC Command RVCT gt S PP PP_FLAGS INC src gt d_path s_base i Trim source code o d_path s_base iii d path s_base i For RVCTCYGWIN ASM FLAGS must be first to work around pathing issues ASM ASM FLAGS o dst INC d path s base iii Assembly Code File COMMON IPF lt InputFile gt as lt ExtraDependency gt MAKE FILE lt OutputFile gt OUTPUT DIR s dir s_base obj lt Command MSFT Command INTEL gt S PP S PP FLAGS S INC src gt d path s_base i Trim source code o d_ path s base iii d path s base i For RVCTCYGWIN ASM FLAGS must be first to work around pathing issues S ASM S ASM FLAGS o dst d_path s_base iii 262 May 2010 1 22 visual Form Representation File lt InputFile gt 2 NEE SVET VFR lt ExtraDependency gt MAKE FILE lt OutputFile gt DEBUG DIR s dir s_base c lt Command gt MD OUTPUT DIR s dir gt NUL 2 gt amp 1 S VFRPP S VFRPP FLAGS INC src gt OUTPUT DIR s dir s base i MD d path gt NUL 2 gt s1 TS VFR VER FLAGS output directory d path OUTPUT DIR 4 s dir s base i Object File lt InputFile gt OD TO lt OutputFile gt OUTPUT DIR MODULE NA
11. 152 GenFds get the flash image organization information from the FDF file which is specified in command line with the f option Files that comprise the flash image are described by INF and FILE statements in FV sections of an FDF file These files contain file name file type and other useful information that let GenFds know which rule specified in FDF file should be used to generate the FFS file The location of the output directory containing the image files created by GenFw or provided as binary images from MAKE stage is described in the DSC file which is specified in command line using the p option As more than one architecture might be supported by the platform the a option clarifies outputs for the different architectures INF files are listed in a FV in the FDF file following the format in the example INF LakeportX64Pkg SecCore SecCore inf INF MdeModulePkg Core Pei PeiMain inf INF MdeModulePkg Universal PCD Pei Pcd inf INF IntelFrameworkModulePkg Universal StatusCode Pei PeiStatusCode inf INF IntelFrameworkModulePkg Universal VariablePei VariablePei inf All the paths in the above example are relative to the Workspace directory The information in the INF files determine how an FFS will be generated If you want to customize the FFS you can specify an override by adding an override in the INF May 2010 1 22 ImageGen Stage FLASH Images INF RuleOverride PICOMPRESSED Ich7Pkg UhciPei Ich7Uhci inf INF RuleOver
12. DEBUG DIR lt Path gt s_dir lt NameVars gt s base MODULE_NAME lt CommandCodes gt lt FileFlags gt lt EOL gt lt CmdVar gt lt Executable gt Code Code FLAGS Word String iNC flag flag attr lt op gt lt File gt gt gt gt NUL 2 gt amp 1 filename lt Extension gt A keyword that uniquely identifies a specific command the fourth field of the Conf tools_def txt record Several Code keywords have been predefined refer to the CommandCode descriptions in the tools_def txt section Executable A specific command without extension that is in a directory that is in the user s PATH system environment variable flag A flag that is specific to a command single command such as o an output flag used by some commands flag attr A required attribute for a specific flag filename A reserved variable or set of variables appended using the directory separator character string Table 18 lists the reserved variables that are available and their definition of how they are interpreted May 2010 1 22 1 22 MetaData File Specifications Table 18 Reserved Variable Strings src s_path s_dir s_name s_base s_ext dst d_path d_name d_base d_ext Table 19 lists the Variable St
13. HEHEHE HE HE HEHE IEEE HEHE H HH ASL definitions THERE HE HE HEHE HE HE HE HEHE HEHE EE HH ELFGCC ASL PATH DEF UNIX IASL BIN ELFGCC ASL FLAGS ELFGCC ASL OUTFLAGS DEF IASL OUTFLAGS ELFGCC ASLPP FLAGS x c E P ELFGCC_ ASLCC_FLAGS xc ELFGCC ASLDLINK FLAGS DEF UNIXGCC DLINK FLAGS COMMON entry _ReferenceAcpiTable FEE FE FE AE FE RT THE HE HE HEH IA32 definitions FEE FE FE E FE HE HE FE RHE HE HE HEH HE ELFGCC IA32 CC PATH DEF ELFGCC BIN gcc ELFGCC IA32 SLINK PATH ELFGCC IA32 DLINK PATH ELFGCC IA32 ASM PATH ELFGCC IA32 PP PATH ELFGCC IA32 VFRPP PATH ELFGCC32 IA32 ASLCC PATH ELFGCC32 IA32 ASLPP PATH DEF ELFGCC BIN gcc ELFGCC32 IA32 ASLDLINK PATH DEF ELFGCC_BIN 1d ELFGCC_IA32_RC_PATH DEF ELFGCC_BIN objcopy DEF ELFGCC_BIN ar DEF ELFGCC_BIN 1d DEF ELFGCC_BIN gee DEF ELFGCC_BIN gcc DEF ELFGCC_BIN gee DEF ELFGCC_BIN gee ELFGCC IA32 CC FLAGS m32 g fshort wchar fno strict aliasing Wall malign double c include DEST DIR DEBUG AutoGen h DSTRING ARRAY NAME BASE_NAME Strings ELFGCC IA32 SLINK FLAGS 224 May 2010 1 22 ELFGCC IA32 DLINK FLAGS melf i386 nostdlib shared entry IMAGE ENTRY POINT u IMAGE ENTRY POINT ELFGCC IA32 DLINK FLAGS melf 1386 nostdlib n q Ttext 0x220 entry IMAGE ENTRY POINT u IMAGE ENTRY POINT ELFGCC IA32 ASM FLAGS c x assembler imacros DEST
14. IA32 definitions FEE FE FE AE FE HE HE FE FE HE HE HE HE HEHE HE UNIXGCC IA32 CC PATH DEF UNIXGCC IA32 PETOOLS PREFIX gcc UNIXGCC IA32 SLINK PATH UNIXGCC IA32 DLINK PATH DEF UNIXGCC IA32 PETOOLS PREFIX ar DEF UNIXGCC IA32 PETOOLS PREFIX ld UNIXGCC IA32 ASM PATH DEF UNIXGCC IA32 PETOOLS PREFIX gcc UNIXGCC IA32 PP PATH DEF UNIXGCC IA32 PETOOLS PREFIX gcc UNIXGCC IA32 VFRPP PATH DEF UNIXGCC IA32 PETOOLS PREFIX gcc UNIXGCC IA32 CC FLAGS Os fshort wchar fno strict aliasing Wall Werror Wno missing braces c include AutoGen h FEFE EE FE HRS HEHE RE RE X64 definitions FEFE EE FE HE ERE ER FE HE HE RE HEHE HEHE May 2010 85 BUILD UNIXGCC X64 CC PATH DEF UNIXGCC X64 PETOOLS PREFIX gcc UNIXGCC X64 SLINK PATH DEF UNIXGCC X64 PETOOLS PREFIX ar UNIXGCC X64 DLINK PATH DEF UNIXGCC X64 PETOOLS PREFIX 1d UNIXGCC X64 ASM PATH DEF UNIXGCC X64 PETOOLS PREFIX gcc UNIXGCC X64 PP PATH DEF UNIXGCC X64 PETOOLS PREFIX gcc UNIXGCC X64 VFRPP PATH DEF UNIXGCC X64 PETOOLS PREFIX gcc UNIXGCC X64 CC FLAGS Os fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno address Wno array bounds c include AutoGen h D EFI P64 Note In the above example all entries must be on a single line The use of the backslash character is used here for readability however it cannot be used in the file 5 3 target txt File 86 This file is used to filter the build so everything does
15. MODULE NAME StrDefs h ARCHASM FLAGS g DEBUG XCODE32 ARM CC FLAGS ARCHCC FLAGS PLATFORM FLAGS mthumb interwork g Oz mabi aapcs mapcs fno short enums save temps combine fshort wchar fno strict aliasing Wall Werror Wno missing braces fomit frame pointer c include AutoGen h mdynamic no pic fno stack protector RELEASE XCODE32 ARM CC FLAGS ARCHCC FLAGS PLATFORM FLAGS mthumb interwork Oz mabi aapcs mapcs fno short enums save temps combine fshort wchar fno strict aliasing Wall Werror Wno missing braces fomit frame pointer c include AutoGen h mdynamic no pic fno stack protector THREE EIE IEEE AE FE AE FE EE EIE EE EIE EE EIE IEEE E FE FE FE FE FE E FE FE FE FE FE EE HEHE HEHE FE FE FE FE FE FE FE FE E FE FE FE FE FE FE FE E FE FE FE FE FE FE FE BE ARM Tools FEFE EE FE HE FE FE FE FE FE FE HE FE HE FE dg FE HE FE HE FE HE FE HE FE HE THREE RE HE HE HE HH HHH HH AAA FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE HE FH HH HE RVCT31 Tools from ARM RVCT31 FAMILY RVCT Li Use default values or override in DSC file Li RVCT31 ARM ARCHCC FLAGS thumb cpu ARM1176JZF S RVCT31 ARM ARCHASM FLAGS RVCT31 ARM ARCHDLINK FLAGS RVCT31 ARM PLATFORM FLAGS RVCT31 ARM INTRINSIC FLAGS cpu ARM1176JZF S CompilerIntrinsicsLib lib DEBUG RVCT31 ARM DLINK FLAGS ARCHDLINK FLAGS entry IMAGE ENTRY POINT ro base 0 no scanlib reloc n
16. The conditional statements may appear anywhere within the file Conditional directive sections can be nested All conditional directives must evaluate to either True or False Directive statements are in fix expressions that are evaluated left to right with items within parenthesis evaluated before the outer expressions are evaluated Use of parenthesis is encouraged to remove ambiguity May 2010 1 22 MetaData File Specifications Prototype lt Conditional gt lt IfStatement gt lt EOL gt Conditional Statements i ElseIfConditional Conditional lt ElseConditional gt 0 1 lt Conditional gt tendif lt EOL gt lt IfStatement gt lif Expression Statements Sections lt SubSections gt lt SectionStatements gt lt ElseIfConditional gt ltelseif Expression lt EOL gt Statements lt ElseConditional gt lelse lt EOL gt Statements Expression lt VariableOrTest gt lt OP gt lt VariableOrTest gt lt VariableOrTest gt Symbol lt AritmeticTest gt Symbol a zA Z a zA Zz0 9 IE lt ArithmeticTest gt lt Variable gt lt ArithmeticOp gt Argument LA lt Arugment gt Ox a fA F0 9 1 j 0 9 0 lt LogicalOp gt AND OR XOR NOT lt Aritmeticop gt Iz gt Parameters Sta
17. 288 UINT64 INT64 UINT32 INT32 UINT16 CHAR16 INT16 BOOLEAN UINT8 CHAR8 May 2010 1 22 Process File Status UefiDecompressGetInfo Buffer FileInfo nFileSizeLow amp DestinationSize amp ScratchSize if Status O Destination Malloc DestinationSize Scratch Malloc ScratchSize if Scratch NULL amp amp Destination NULL Status UefiTianoDecompress Buffer Destination Scratch 2 if Status 0 printf Decompress Failed I 2 2 Step 3 Run the Performance Wizard 1 2 3 Ui Tools Performance Tools Performance Wizard Make sure your project is selected and hit Next When you are asked what method of profiling would like to use select Instrumentation a The default is Sampling so you must change this Then type Finish A Performance Explorer pain should show up Right click on you project name and select Launch a This should rebuild your application with performance infrastructure b Under Reports you should see a Project Name date vsp file that contains the info Make sure you profile in the Release build and not the Debug build for best results May 2010 289 BUILD The following is an example of the output you should see 290 May 2010 1 22 1 22 May 2010 291 292 Zehten Decormrant 2 projets gt oenspmes E 8 Mander ries ID dik U berar Fine Performance Report Summary Most Called Functions Decoder
18. 7 4 1 2 7 clean cleanall cleanlib Targets used to delete part or all files generated during build clean if exist OUTPUT_DIR rmdir s q OUTPUT DIR cleanall if exist DEBUG_DIR rmdir s q DEBUG_DIR if exist OUTPUT_DIR rmdir s q OUTPUT DIR del f q pdb idb gt NUL 2 gt amp 1 cleanlib cd BUILD_DIR IPF MdePkg Library DxePcdLib DxePcdLib amp amp MAKE MAKE FLAGS cleanall cd BUILD_DIR IPF MdePkg Library BaseLib BaseLib amp amp MAKE MAKE FLAGS cleanall cd BUILD_DIR IPF CsiCpuUncorePkg Library ItcTimerLib ItcTimerLib amp amp MAKE MAKE FLAGS cleanall cd MODULE BUILD DIR 7 4 2 Top level Makefile The top level makefile is composed by following macro and target definitions 7 4 2 1 Macro Definitions Platform information macros come from Defines section in the DSC file 142 May 2010 1 22 AutoGen Stage PLATFORM NAME NT32 PLATFORM GUID EB216561 961F 47EE 9EF9 CA426EF547C2 PLATFORM VERSION 0 3 PLATFORM DIR WORKSPACE Nt32Pkg PLATFORM OUTPUT DIR Build NT32 Build configuration macros come from WORKSPACE Conf target txt command line options and or Defines section in the DSC file TOOLCHAIN TAG MYTOOLS TARGET DEBUG Build directories are determined by the build tools BUILD_DIR WORKSPACE Build NT32 DEBUG MYTOOLS FV DIR WORKSPACE Build NT32 DEBUG MYTOOLS FV 7 4 2 2 Build Target Definitions 7 4 2 2 1 a
19. EFI_STATUS EFIAPI lt DESTRUCTOR gt VOID If MODULE TYPE PEI CORE MODULE TYPE PEIM include statement AutoGen c EFI STATUS EFIAPI lt DESTRUCTOR gt IN EFI PEI FILE HANDLE FileHandle IN EFI PEI SERVICES PeiServices UK If MODULE TYPE DXE CORE MODULE TYPE DXE_DRIVER MODULE TYPE DXE SMM DRIVER MODULE TYPE DXE_RUNTIME DRIVER II MODULE_TYPE DXE SAL DRIVER MOODULE TYPE UEFI_DRIVER MODULE TYPE UEFI APPLICATION include statement AutoGen c EFI STATUS EFIAPI lt DESTRUCTOR gt IN EFI_HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable End DESTRUCTOR defined in INF If MODULE TYPE BASE include statement AutoGen c VOID EFIAPI ProcessLibraryDestructorList VOID 124 May 2010 BUILD 1 22 AutoGen Stage If MODULE TYPE PEI CORE MODULE TYPE PEIM include statement AutoGen c VOID EFIAPI ProcessLibraryDestructorList IN EFI PEI FILE HANDLE FileHandle IN EFI PEI SERVICES PeiServices If MODULE TYPE DXE CORE MODULE TYPE DXE DRIVER MODULE TYPE DXE SMM DRIVER MODULE TYPE DXE RUNTIME DRIVER MODULE TYPE DXE SAL DRIVER MOODULE TYPE UEFI DRIVER MODULE TYPE UEFI APPLICATION include statement AutoGen c VOID EFIAPI ProcessLibraryDestructorList IN EFI PEI FILE HANDLE Im
20. Expanding the call tree view can be very useful May 2010 1 22 View Project Buld Ga ZIA Debug Data Tools Test Window Community Help DUI Be E K Release gt Wina2 Le Solution Decompress 2 projects ReadFile RtlallocateHeap E UefiTianoDecompress void const void void unsigned int Ei Decode struct SCRATCH DATA E DecodeC struct SCRATCH DATA FilBuf struct SCRATCH DATA unsigned short E ReadCLen struct SCRATCH DATA Fillbuf struct SCRATCH DATA unsigned short EB MakeTable struct SCRATCH DATA unsigned short ut E ReadPTLen struct SCRATCH DATA unsigned short unsic FilBuf struct SCRATCH DATA unsigned short 8 MakeTable struct SCRATCH DATA unsigned short ut E DecodeP struct SCRATCH DATA Fillguf struct SCRATCH DATA unsigned short SZ ed InterlockedCompareExchange 1 252935 0 029978 0 083073 20 222962 9 230592 8 530086 0 211189 0 115465 1 900173 0 034768 0 018475 0 295897 0 244457 0 000172 0 006236 0 000036 5 f Decompress 0 000021 E Eg Header Files GetCurrentProcessId 0 000048 jn stdafx h GetCurrentThreadid 0 000030 Gi Resource Files GetsystemTimeasFieTime 0 000210 E Ep Source Files GetTickCount 0 000036 Gi Decompress cpp Gadea QueryPerformanceCounter 0 000000 E Readme txt Ej tmainCRTStartup 0 000683 e Gites _SEH_prolog4 0 000090 E y Header Files E wmain 0 001759 ih stdafx h CloseHandle 0 000000 i Resource Files Ge
21. IA32 MdeModulePkg Application HelloWorld HelloWorld OUTPUT DIR MODULE BUILD DIR OUTPUT DEBUG DIR MODULE BUILD DIR DEBUG DEST DIR OUTPUT OUTPUT DIR DEST DIR DEBUG DEBUG DIR 7 4 1 1 5 Tools flags 138 These are used to concatenate the flags from different places in the predefined order The order makes sure that the flags defined DSC file can override flags in INF file and default ones Note that in the code example below the tools will expand the values into a single line TOOLS DEF LZMA FLAGS does not appear in the Makefile only the flag values appear May 2010 1 22 AutoGen Stage LZMA FLAGS TOOLS DEF LZMA FLAGS INF LZMA FLAGS DSC LZMA FLAGS DSC INF LZMA FLAGS PP FLAGS TOOLS DEF PP FLAGS INF PP FLAGS DSC PP FLAGS DSC INF PP FLAGS SLINK FLAGS TOOLS DEF SLINK FLAGS INF SLINK FLAGS V DSC SLINK FLAGS DSC INF SLINK FLAGS CC FLAGS TOOLS DEF CC FLAGS INF CC FLAGS V DSC CC FLAGS DSC INF CC FLAGS APP FLAGS TOOLS DEF APP FLAGS INF APP FLAGS DSC APP FLAGS DSC INF APP FLAGS VFRPP FLAGS TOOLS DEF VFRPP FLAGS INF VFRPP FLAGS DSC VFRPP FLAGS DSC INF VFRPP FLAGS DLINK FLAGS TOOLS DEF DLINK FLAGS INF DLINK FLAGS V DSC DLINK FLAGS DSC INF DLINK FLAGS ASM FLAGS TOOLS DEF ASM FLAGS INF ASM FLAGS V DSC ASM FLAGS DSC INF ASM FLAGS TIANO FLAGS TOOLS DEF TIANO FLAGS INF TIANO FLAGS V
22. ICCx86xASL X64 CC PATH DEF ICC BINX64x86 icl exe ICCx86xASL X64 SLINK PATH DEF ICC BINX64x86 xilib exe 4 xilib exe needs lib exe from Visual Studio ICCx86xASL X64 SLINK DLL DEF VS2005x86 BIN ICCx86xASL X64 DLINK PATH DEF ICC BINX64x86 xilink exe ICCx86xASL X64 PP PATH ICCx86xASL X64 VFRPP PATH ICCx86xASL X64 APP PATH ICCx86xASL X64 ASM PATH ICCx86xASL X64 ASM DLL ICCx86xASL X64 ASLCC PATH ICCx86xASL X64 ASLPP PATH DEF ICC_BINX64x86 icl exe DEF ICC_BINX64x86 icl exe DEF ICC_BINX64x86 icl exe DEF WINDDK_BINX64 m164 exe DEF VS2005x86_DLL DEF ICC_BINX64x86 icl exe DEF ICC_BINX64x86 icl exe ICCx86xASL X64 ASLDLINK PATH DEF ICC_BINX64x86 xilink exe DEBUG ICCx86xASL X64 CC FLAGS nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FIS DEST DIR DEBUG AutoGen h Zi Gm EHs c GF RELEASE ICCx86xASL X64 CC FLAGS nologo c WX GS X WA Gs8192 D UNICODE Olib2s GL Gy FI DEST DIR DEBUG AutoGen h EHs c GF DEBUG ICCx86xASL X64 ASM FLAGS nologo c WX W3 Cx Zd Zi RELEASE ICCx86xASL X64 ASM FLAGS nologo c WX W3 Cx Zd DEBUG ICCx86xASL X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICCx86xASL X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 40
23. In addition to creating images that initialize a complete platform the build process also May 2010 1 22 Firm ware Image Files Design Discussion supports creation of stand alone UEFI applications including OS Loaders and Option ROM images containing driver code Figure 2 below shows the reference implementation tools and creation processes for both of these image types UEFI efi Application Firm ware Filesystem File EFI Section Files Firm ware Image Files oo GenFw dn Header Modifications PE32 PE32 Files PE32 PE32 Files Figure 2 EFI PCI Expansion OptionROM and UEFI Application Creation The final feature that is supported by the EDK II build process is the creation of Binary Modules that can be packaged and distributed for use by other organizations Binary modules do not require distribution of the source code This will permit vendors to distribute UEFI images without having to release proprietary source code This packaging process permits creation of an archive file containing one or more binary files that are either Firmware Image files or higher EFI Section files Firmware Filesystem files etc The build process will permit inserting these binary files into the appropriate level in the build stages 2 4 Boot Sequence PI compliant system firmware must support the six phases security SEC pre efi initialization PEI driver execution environment DXE boot device selecti
24. Module PE32 image size Build time stamp The time stamp in module PE32 image Driver Type The driver file type UEFI Specification Version The UEFI specification version the module conform to PI Specification Version The PI specification version the module conform to Dispatch Order The predicted dispatch order of this module Image Address The predicted image loading address Entry Point Address The predicted entry point address The items marked with exist when PREDICTION or ALL is specified in Y option May 2010 175 BUILD Example SS Boah gt DB m mb a ne Module Summary Module Name SmbiosDxe Module INF Path c edk2 MdeModule Universal SmbiosDxe SmbiosDxe inf File GUID F9D88642 0737 49BC 81B5 6889CD57D9EA Size OxlE2C 7 54K Time Stamp 2009 12 08 13 30 00 0 Driver Type 0x7 DRIVER UEFI Specification Version 2 1 PI Specification Version 1 0 Dispatch Order 11 DXE Dispatcher Image Address TOM 0xf8a000 Entry Point Address TOM 0xf89a60 Module Section Details for SmbiosDxe 6 SS M M Example2 b Module Summary Module Name EbcDxe Module INF Path c edk2 MdeModule Universal EbcDxe EbcDxe inf File GUID 13AC6DD0 73D0 11D4 B06B 00AAO00BD6DE7 Size 0x35B8 13 43K Time Stamp 2009 12 08 13 30 00 0 Driver Type 0x7 DRIVER UEFI Specification Version 2 1 Module Section Details for EbcDxe Sm ggg EEE EEE EEE De g
25. NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER bed ize Aiz AERE ERE dde A zg gd Mde d dr A zd JG ab A eg JG IE AERE AERE EHE gd Ad Habe d gg Ag EHH GCC Common HEHEHE HE HE HE FE HE HE HE HE HE FE FE Ago EE FE HE HE HE HE FE FE E FE HE HE AA FE FE E HE HE FE FE FE FE HE HE FE FE FE FE HE HE FE FE FE FE E HE HE GO RE FE FE HE HE FE FE E HE GH OBJCOPY PATH echo OBJCOPY FLAGS objcopy not needed for SYMRENAME PATH echo SYMRENAME FLAGS Symbol renaming not needed for DEFINE GCC ALL CC FLAGS Os fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno array bounds c include AutoGen h DEFINE GCC IA32 CC FLAGS DEF GCC ALL CC FLAGS m32 malign double freorder blocks freorder blocks and partition 02 DEFINE GCC X64 CC FLAGS DEF GCC ALL CC FLAGS mno red zone Wno address DEFINE GCC IPF CC FLAGS DEF GCC ALL CC FLAGS minline int divide min latency DEFINE GCC IA32 X64 DLINK COMMON nostdlib s pie gc sections DEFINE GCC IA32 X64 ASLDLINK FLAGS DEF GCC IA32 X64 DLINK COMMON entry _ReferenceAcpiTable u IMAGE ENTRY POINT DEFINE GCC IA32 X64 DLINK FLAGS DEF GCC IA32 X64 DLINK COMMON entry _ IMAGE ENTRY POINT file alignment 0x20 section alignment 0x20 Map DEST DIR DEBUG BASE_NAME map DEFINE GCC IPF DLINK FLAGS nostdlib 02 gc sections dll static entry IMAGE ENTRY POINT
26. SizeOfBuffer Buffer Else include statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt Value LibPcdSetEx lt DatumSize gt amp lt TokenSpaceGuidCName gt _gPcd BinaryPatch lt TokenCName gt Value 7 3 3 5 3 HII string pack definitions These are generated only if uni files are found For details please refer to section 7 3 2 include statement AutoGen h Unicode String ID define LANGUAGE_NAME 0x0000 not referenced define PRINTABLE LANGUAGE NAME 0x0001 not referenced define STR_MISC_BASE BOARD MANUFACTURER 0x0002 define STR MISC BASE BOARD PRODUCT NAME 0x0003 define STR MISC BASE BOARD VERSION 0x0004 P4 d LE a Lf zu extern unsigned char MiscSubclassStrings define STRING ARRAY NAME MiscSubclassStrings ys 7 3 4 AutoGen c file The code generated in AutoGen c includes 1 22 May 2010 119 BUILD e Calling of constructor and destructor of library instances against which the module will ink e The module load and unload entry points e Global variables for GUID Protocol PPIs value used global variables and database for P CDs used e Unicode string pack definition AutoGen c file is only generated for EDK II non library modules The following sections identify what lines of information are included in the file as well as pseudo code to references on to how a variable lt var_name gt might be
27. nologo E TC DVFRCOMPILE TEE HERE HERE EH EHE HEB E HE ASL definitions TEE ERE HERE EH EHE RE RE HE DDK3790 ASL PATH DDK3790 ASL FLAGS DDK3790 ASL OUTFLAGS DEF WIN IASL BIN DEF IASL OUTFLAGS 210 May 2010 1 22 1 22 DDK3790 ASLCC FLAGS DDK3790 ASLPP FLAGS DDK3790 ASLDLINK FLAGS FEFE EE HER ERE ER EHE RE RE HE IA32 definitions Ld UHR DDK3790 IA32 CC PATH DDK3790 IA32 SLINK PATH DDK3790 IA32 DLINK PATH DDK3790 IA32 ASMLINK PATH DDK3790 IA32 PP PATH DDK3790 IA32 VFRPP PATH DDK3790 IA32 APP PATH E DDK3790 IA32 ASM PATH DDK3790 IA32 ASLCC PATH DDK3790 IA32 ASLPP PATH DDK3790 IA32 ASLDLINK PATH DEBUG DDK3790 IA32 CC FLAGS GL FIAutoGen h EHs c GR RELEASE DDK3790 IA32 CC FLAGS GL FIAutoGen h EHs c GR DEBUG DDK3790 IA32 ASM FLAGS RELEASE DDK3790 IA32 ASM FLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT ASLDLINK FLAGS DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 lib exe DEF WINDDK_BIN32 link exe DEF WINDDK_BIN16 link16 exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 ml exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 link exe nologo c WX W4 Gy Gs8192 D UNICODE 01ib2 GF Zi Gm nologo c WX W4 Gy Gs8192 D UNICODE 01ib2 GF nologo c WX W3 coff Cx Zd Zi nologo c WX W3 co
28. 0x00 offset to string LANGUAGE_NAME 0x0000 0x96 0x02 0x00 0x00 offset to string SPRINTABLE LANGUAGE NAME 0x0001 string SLANGUAGE NAME offset 0x0000028E 0x66 0x00 0x72 0x00 0x61 0x00 0x00 0x00 string SPRINTABLE LANGUAGE NAME offset 0x00000296 0x46 0x00 0x72 0x00 0x61 0x00 Ox6E 0x00 OxE7 0x00 0x61 0x00 0x69 0x00 0x73 0x00 0x00 0x00 strings terminator pack 0x00 0x00 0x00 0x00 0x02 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 7 3 3 AutoGen h file The code generated in AutoGen h includes Prototypes of constructor and destructor from the library instances the module will link against Prototypes of entry and unload image entry points Global variable definitions for GUID Protocol PPI values used Global variable definitions and the database of PCDs used Unicode string database definitions The file will contain 7 3 3 1 Header prologue The macro name is composed with GUID value of INF file 1 22 May 2010 113 BUILD include statement AutoGen h ifndef AUTOGENH 6987936E ED34 44db AE97 1FASE4ED2116 define AUTOGENH 6987936E ED34 44db AE97_1FA5E4ED2116 m s 7 3 3 2 Global macro definitions If they are defined in INF file Un defining them first is for backward compatibility with R8 module build because these macros are not defined in INF file of R8 modules but passed via compiler option i
29. 2010 189 BUILD HAE FEAE HEHE HE HE HE HEHE FE AE FE aE aE aE aE FE AE EHE FE AE FE FE E EE HERE E FE FE E FE FE AE FE FE E FE EEE EE EE AE FE FE EE HE HE EBC FAMILY INTEL C Program Files Intel EBC Bin iec exe C Program Files Intel EBC Bin iec exe C Program Files Intel EBC Bin link exe EBC CC PATH EBC SLINK PATH EBC SLINK FLAGS lib NOLOGO MACHINE EBC EBC PP FLAGS nologo E TC FIS DEST DIR DEBUG AutoGen h EBC CC FLAGS nologo FAcs c W3 WX FI DEST DIR DEBUG AutoGen h EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib NOLOGO MACHINE EBC OPT REF NODEFAULTLIB ENTRY IMAGE ENTRY POINT 7 SUBSYSTEM EFI BOOT SERVICE DRIVER God ipad EIE IHE EIE EE TH KOA KOA IEEE E FE FE FE FE HE FE FE FE FE FE E A FE FE HEHE KAIA FE FE FE FE E FE HEHE FE FE FE FE EA BE Eda BE Intel ACPI Source Language Compiler Template FE EE HE HE HE FE HE HE HE HE FE HE HE HE FE FE FE HE E FE FE FE FE HE HE FE FE FE HE HEHE FE FE HE HE HE FE FE HE HE HE HE FE FE HE FE FE FE FE E E FE FE FE FE E FE FE FE FE HE FE FE FE FE HE HE E FE HE HE HE HE FE FE HE HE HE HE FE HHHH HE _ ASL FAMILY INTEL _ _ ASL PATH C ASL iasl exe RR FE E FE HE E FE FE AE FE KOA E FE TEE FE E FE FE FE FE FE E FE FE FE ARGA FE FE FE E FE FE FE FE FE E HE FE FE E FE FE FE FE FE E FE E FE FE E FE FE FE FE FE FE FE E FE FE FE FE FE FE FE FE BE Microsoft ACPI Source Language Compiler Template
30. CP S dst S OUTPUT DIR CP dst BIN DIR CP DEBUG DIR map OUTPUT DIR Dependency Expression File InputFile Tagus Gaza dS lt OutputFile gt OUTPUT DIR MODULE NAME depex lt Command gt S PP CC FLAGS S APP FLAGS INC src gt OUTPUT DIR 4 s dir 4 s base i Trim source code o OUTPUT DIR s dir s base iii OUTPUT DIR s_dir s_base i GenDepex t MODULE TYPE o dst OUTPUT_DIR s_dir s_base iii Acpi Source Language File lt InputFile gt asl A SI ASL lt OutputFile gt OUTPUT DIR s dir s base aml lt ExtraDependency gt MAKE FILE lt Command MSFT Command INTEL gt Trim asl file o S OUTPUT DIR s dir s base i src S ASLPP S ASLPP FLAGS INC I s path OUTPUT DIR s dir s base i gt S OUTPUT DIR s dir s_base iii S ASL S ASL FLAGS ASL OUTFLAGS S dst OUTPUT DIR s_dir s_base iii lt Command GCC gt Trim asl file o OUTPUT_DIR s_dir s_base i src TS ASLPP S ASLPP FLAGS INC I s_path OUTPUT_DIR s_dir s_base i gt OUTPUT_DIR s_dir s_base iii S ASL S ASL FLAGS ASL_OUTFLAGS dst S OUTPUT DIR s_dir s_base iii C Code File AcpiTable lt InputFile gt EN lt OutputFile gt OUTPUT DIR s_dir s_b
31. EFI SECTION TE 0x12 EFI SECTION VERSION 0x14 EFI SECTION USER INTERFACE 0x15 EFI SECTION COMPATIBILITY16 0x16 ENT EFI SECTION FIRMWARE VOLUME IMAGE 0x17 EE EFI SECTION FREEFORM SUBTYPE GUID Ox18 EFI SECTION RAW t 0x9 The size for these standard sections is defined as a 24 bit unsigned integer that contains the total size of the section in bytes including the EFI COMMON SECTION HEADER For example a zero length section has a Size of 4 bytes Except for the SE sECTION VERSION and the EFI SECTION USER INTERFACE the format of each section is the EFI_ COMMON SECTION HEADER prefixed to a file containing data Refer to the definitions in Section 3 for EFI SECTION VERSION and EFI SECTION USER INTERFACE May 2010 27 BUILD 2 7 5 Generating Encapsulation EFI SECTION Files This section provides the overview for generating the two Encapsulation EFI SECTION files The SE sEcTIoN header must be present along with additional header information The encapsulation EFI Section header will be prefixed to the file or data section There are three encapsulation EFI_sEcTIon types The first two types listed have extended header information Table 5 Encapsulation EFI SECTION Type Codes Section Type Value EFI SECTION COMPRESSION 0x01 EFI SECTION GUID DEFINED 0x02 EFI SECTION DISPOSABLE 0x03 A compression section uses the SE sECTION COMPRESSION header while the GUID defined
32. Functions With Most Individual Work Nare Tees rem Decode 14 730501 reas Docodec Functions Taking Longest fiere hoe cupa from Performance ZUK LEE E Te ze AES FEM ey casse rcm S en i citi onion Profiler exited Starting analyete for C Work Decomprece Deccuprescd 71210 vep Pymbel Engine Loading symbols tor module co Mock Deccapressice lenselPeconprass ane Sabol Beyine Loading ryubolr for module C VIWDOWS eyeceu22 k erta122 dL1 Prabol Engine Failed to Load pdb for module at C AMIMDUMEL yst em ST Werna132 dll Syabol Regine Loading ryubolz tor module C VIMDOWS Winds x06 Microrofr UCQD CAT lfcqbJbOalelOe2b 2 0 50727 762 x wv b120700 M4S7CIQ0 AIL Etzi Engine Filed to Load pdb for module at C XWIMDUMELVLnS AIRES Hacroso fe EEE CIT Jtcb3baleltalb 3 0 50727 762 x wv GIZE7DOMIEUCHO d1 Syabol Beine Loading zyubolr for module C XWINDOUS erpe di Byabol Engine Failed to Load pdb for module at C AWIMDUMEL ys6 emST nt dll d Completed Analyeie for C MorkiDeccupree Decomprecs 091210 vep GO Profiling Complete Caci iz Werden fica Brower i tent E et Eate Reedy Figure 25 V82005 Performance Summary D D Pete E errezeta BUILD From the summary it appears that Decode must have a very hot loop in it DecodeC and FillBuf are very simple but they are called so many times a very small improvement will be multiplied by 100 000
33. How a file will be handled is defined in WORKSPACE Con build rule txt and converted into actions and targets in makefile How a file will be processes is defined in the file specified by the BUILD RULE CONF statement in target txt or the default file WORKSPACE Conf build rule txt In the previous step those rules were used to generate makefiles 8 1 Overview From a platform point of view what will be done in MAKE stage includes building library modules building non library modules and finally generating flash image s Build Library Modules Build Non Library Modules Generate Flash Image Figure 20 EDK II Build Process Platform Point of View PoV From a module point of view things done in MAKE stage includes preprocessing compiling or assembling static dynamic linking and module image generation 1 22 May 2010 147 BUILD Preprocess Trim Com pile Assemble Static Dynamic Link Generate Module Im ages Figure 21 EDK Il Build Process Module PoV 8 2 Preprocess Trim Preprocessing is an intrinsic behavior of C compiler and will be always done automatically without explicitly calling A separate preprocessing step is needed by those non C files which have no preprocessing supported in their compiler or assembler For example in order to use macros defined in C header files include directives can be used in an assembly file A separated preprocessing step will be used to complete
34. Iasm Code File Masm16 Code File Microcode Binary File Microcode File Object File Static Library File Unicode Text File Visual Form Representation File lt UserDefined gt lt Word gt lt InputFile lt InFamilyOpt gt gt lt EOL gt lt InputFileSpec gt lt OutputFile lt OutFamilyOpt gt gt lt EOL gt lt OutputFileSpec gt lt ExtraDependency gt lt PATH gt lt filename gt lt Macro gt lt Command lt CmdFamilyOpt gt gt lt EOL gt lt CommandSpec gt lt Family gt InputFile lt Family gt lt Family gt OutputFile lt Family gt TI Family Command lt Family gt MSFT INTC GCC ACPICA lt FileType gt lt FileSpec gt lt EOL gt lt LineList gt lt CommaList gt lt SemiList gt lt WildCard gt lt Extension gt lt EOL gt May 2010 89 lt CommaList gt lt SemiList gt lt WildCard gt lt Extension gt lt OutputFileSpec gt lt OutDirectory gt lt Path gt lt NameVars gt lt CommandSpec gt lt CommandCodes gt lt CmdVar gt lt Executable gt lt FileFlags gt Op File Parameters Code BUILD lt WildCard gt Extension lt CommaList gt lt WildCard gt Extension lt SemiList gt m 9 a zA Z a zA Z0 9 lt OutDirectory gt Extension lt EOL gt OUTPUT DIR
35. KORE ROET U 163 Build Changes and Customizations aa 165 111 Building Tor Debug se E a ge E E NZ Ake 165 11 3 1 Debugging Files area tedere ei 165 11 1 2 Salesiar 166 11 1 3 Advanced Debugging u A aa en Bene 166 11 2 Adding Custom Compression Tools rss 166 11 3 Using Custom Build Tools ter eee Eee hern eer pn eR eren 167 11 4 Customizing Compilation for a Component essa 167 11 5 Changing Files in a Library EDK Only rrura 167 Reports raue ag CE LEE 169 12 1 Build Report Generation BRG Tool rss 169 12 2 Sample Launch Steps NT32 platform ra 169 12 3 Output AAA 169 bea BEZALA 170 12 3 2 Section and Sub section Format a 170 124 Platforn SUMMA a 171 12 5 Global PCD Seton EKE 172 12 5 1 Required lire c e as ec p dn ee E C e ede dg 172 12 5 2 Optional lines see er eee err entren tea tee nee na kk sa er rete NEKE dia 172 12 6 FD SECU OM eec EE 173 120 1 FD Seco Header AAE 173 12 6 2 FD Region Sub section AE 174 May 2010 1 22 12 7 Module SS8CcllOni z aka ee araia iatera dazat det DNA 175 12 7 1 Module Section Summary eur 175 12 7 2 Library Sub section i oe Reha 176 127 9 POD S b Section cepta cera tote te patienter dg 178 12 7 4 DEPEX Sub section ss 179 12 7 5 Build Flags SUb seCctiOni ee 179 12 7 6 Notification Sub section sa 180 Appendix A MANN ADIOS m a EE 181 Appendix B TOOIS Lo qu R 185 Appendix C Target T
36. SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICCxASL X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D May 2010 231 232 BUILD Machine AMD64 LTCG DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text ICCxASL X64 SLINK FLAGS nologo LTCG FEFE EE FE HE FE HE FE HE FE HE HE HEHE HEHE HEH IPF definitions HEHEHE HE HE HE HE HE HE HE HEHE HEHE H NE ICCxASL IPF CC PATH DEF ICC_BIN64 icl exe icl exe needs cl exe from Visual Studio ICCxASL IPF CC DLL DEF MS VS BIN ICCxASL IPF SLINK PATH DEF ICC_BIN64 xilib exe xilib exe needs lib exe from Visual Studio ICCxASL IPF SLINK DLL DEF MS VS BIN DEF MS VS DLL ICCxASL IPF DLINK PATH DEF ICC BIN64 xilink exe ICCxASL IPF PP PATH ICCxASL IPF VFRPP PATH ICCxASL IPF APP PATH ICCxASL IPF ASM PATH ICCxASL IPF ASLCC PATH ICCxASL IPF ASLPP PATH DEF ICC_BIN64 icl exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 ias exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 icl exe ICCxASL IPF ASLDLINK PATH DEF ICC BIN64 xilink exe DEBUG ICCxASL IPF CC FLAGS nologo c WX W4 GX Gy Od FI DEST DIR DEBUG AutoGen h QIA64 fr32 GF Zi RELEASE ICCxASL IPF CC FLAGS nologo c WX W4 GX Gy od FI DEST DIR DEBUG AutoGen h QIA64 fr32 GF DEBUG ICCxASL IPF ASM F
37. Select preferences In the configurations window select All Configurations In the left hand pain select Configuration Properties gt Debugging Under Command Arguments type in the command line In my example the input file is compress and the output file is decompress out In this example compress is the EDK II NT32 FV 2 5MB compressed to 707K So decompress out should be 2 5MB NT32 FV May 2010 287 EDK II Property Pages Configuration active Debug DI Platform factve win3z j Configuration Manager Debugger to launch Loca Windows Debugger v C C E Linker Manifest Tool SZ XML Document Generator e Browse Information zi Buid Events Custom Build Step Code Analysis Web Deployment Applicaton Verifier BUILD AES S TargetPath Cox I ce e Figure 24 VS2005 Property Page This example required the EDK II Decompress Lib be ported into this environment as follows 1 Add EDK II EFI type definitions to get the EFI code to compile Map EFI types typedef unsigned typedef _ int64 typedef unsigned typedef _ int32 typedef unsigned typedef unsigned typedef short typedef unsigned typedef unsigned typedef char __int64 int32 short short char char define UINT8 MAX Oxff 2 Convert EFI STATUS RETURN STATUS to int and removed defines for return values to make it easier for the code to compile 3 Glue in the EFI code into tmain
38. TRUE EFI FVB2 ALIGNMENT 16 TRUE TRUE TRUE TRUE files EFI FILE NAME C Combo R9 LakeportX64Dev Build LakeportX64Pkg DEBUG_MYTOOLS FV Ffs EDBEDF47 6EA3 4512 83C1 70F4769DABDENEDBEDF47 6EA3 4512 83C1 70F4769DABDE ffs 9 5 Create the FD image file s 1 22 The whole FD image is described by a list of Regions which correspond to the locations of different areas within the hardware flash device Currently most flash devices have a variable number of blocks all of identical size When burning an image into one of these devices only whole blocks can be burned into the device at any one time This puts a constraint that all layout regions of the FD image must start on a block boundary To accommodate future flash parts that have variable block sizes the layout is described by the offset from the BaseAddress and the size of the section that is being described Since completely filling a block is not probable part of the last block of a region can be left empty To ensure that no extraneous information is left in a partial block the block should be erased prior to burning it into the device Multiple devices with non volatile memory are treated as a single device with contiguous memory space Regions must be defined in ascending order and may not overlap Each layout region starts with a eight digit hex offset leading ox required followed by the pipe character followed by the size of the region also in hex with the l
39. WX W4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR L INTEL FIAutoGen h EHs c GF nologo nologo c WX W3 Zd Zi nologo c WX W3 Zd NOLOGO NODEFAULTLIB IGNORE 4086 xdata D SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICCx86 IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 May 2010 1 22 1 22 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text ICCx86 IA32 ASMLINK FLAGS nologo tiny TEE HERE FE HE FE HE FE HE HE HEHE HEHE HEH X64 definitions FEFE HE FE HE ERE ER FE HE HE HEHE HEHE HEH ICCx86 X64 CC PATH DEF ICC_BINX64x86 icl exe ICCx86 X64 SLINK PATH DEF ICC BINX64x86 xilib exe 4 xilib exe needs lib exe from Visual Studio ICCx86 X64 SLINK DLL DEF VS2005x86 BIN ICCx86 X64 DLINK PATH DEF ICC BINX64x86 xilink exe ICCx86 X64 PP PATH ICCx86 X64 VFRPP PATH ICCx86 X64 APP PATH ICCx86 X64 ASM PATH ICCx86 X64 ASM DLL ICCx86 X64 ASLCC PATH ICCx86 X64 ASLPP PATH DEF ICC_BINX64x86 icl exe DEF ICC BINX64x86 icl exe DEF ICC_BINX64x86 icl exe DEF WINDDK_BINX64 m164 exe DEF VS2005x86 DLL DEF ICC BINX64x86 icl exe DEF ICC_BINX64x86 icl exe ICCx86 X64 ASLDLINK PATH DEF
40. and as such each block entry would have the May 2010 1 22 Design Discussion BlockMap index NumBlocks 1 while the BlockMap index BlockLength would vary according to the size of the FFS file plus any padding value needed to align the next block on a natural boundary If the extended header is not included then the ExtHeaderOffset is set to zero If an extended header is present it is followed by zero or more variable length extension EFI FIRMWARE VOLUME EXT ENTRY entries volume Top File VTF FFS File N Additional FFS Files FFS File 1 Optional Extended Fv Header Extended Header Address Base Address Figure 15 Firmware Volume Layout Prior to adding the last FFS file as specified in the FDF file the FFS file must be modified to comply with the Volume Top File specification After the last FFS file has been added so that the FvLength is complete the Checksum field is set to zero and a checksum is calculated on the header so that a valid header will sum to zero and placed into the Checksum field 2 7 11 Implementing Compression As stated in earlier sections images that are executed from ROM may not be compressed Images that contain reloc sections or that are executed post PEI phase may be compressed to save space in ROM For best space savings and performance an entire FV containing all post PEI phase code should be compressed rather than compressing individual drivers Decompression routi
41. double byte encoding for the character mapping however recommendations have been given for these characters see Table 29 below May 2010 297 298 Table 29 HII Double Byte Encoding Map wordspace bariyoosan String Double Byte Encoding String Double Byte Encoding bold OxF620 endbold OxF621 Nitalic OxF622 Venditalic OxF623 underline OxF624 Vendunderline OxF625 dblunder OxF62A enddblunder OxF62B5 emboss OxF6265 endemboss OxF6275 shadow OxF6285 endshadow OxF6295 n newline 0x2028 f formfeed 0x000C r carriage 0x000D p paragraph 0x2029 return separator ospace 0x1680 enquad 0x2000 ogham space mark emquad 0x2001 ensp en space 0x2002 emsp 0x2003 em3sp three 0x2004 per em space em4sp 0x2005 em6sp 0x2006 usp 0x2008 tsp thin space 0x2009 punctuation space hsp hair 0x200A msp medium Ox205F space math space bsp no 0x00A0 Mnbsp narrow 0x0202F break space no break space zsp zero 0x200B ah Armenian 0x058A width space hyphen hy hyphen 0x2010 df figure dash 0x2012 den en 0x2013 dem em dash 0x2014 dash bh non 0x2011 MO Tibetan mark OxOFOB breaking intersyllabic hyphen tsheg Vosp Ethiopic 0x1361 k Khmer sign 0x17D5 May 2010 BUILD 1 22 Appendix K Module Types Table 30 EDK I Module Types MODULE TYPE Supported Description Architec
42. i ASM o OUTPUT_DIR s_dir s_base obj S ASM FLAGS INC d_path s_base iii S SLINK S SLINK FLAGS OUTPUT DIR s_ dir s_base slib OUTPUT DIR s_dir s_base obj otool t OUTPUT DIR s dir s base slib hex2bin py dst Microcode File lt InputFile gt Tebas TIKI OTXE Zea lt OutputFile gt OUTPUT DIR s base mcb lt Command gt GenFw o dst m src Microcode Binary File lt InputFile gt meh lt OutputFile gt OUTPUT DIR MODULE NAME bin lt Command gt GenFw o dst j MICROCODE BINARY FILES S CP dst BIN_DIR EFI Image File lt InputFile gt PT efi T Efi EFI lt OutputFile gt lt Command gt Unicode Text File lt InputFile gt kunt Untz UNI lt OutputFile gt DEBUG DIR AutoGen c DEBUG DIR MODULE NAME StrDefs h lt Command gt Efi Image UEFI OPTIONROM lt InputFile gt efi EFI Efi lt OutputFile gt BIN_DIR MODULE NAME rom lt Command gt OPTROM i PCI_DEVICE_ID f PCI_VENDOR_ID 1 PCI_CLASS CODE r S PCI REVISION o dst OPTROM FLAGS src 1 22 May 2010 267 268 BUILD Unicode Text File UEFI_HII lt InputFile gt nt Uni TUNI lt OutputFile gt OUTPUT DIR MODULE NAME StrDefs hpk DEBUG DIR MODULE NAME StrDefs h lt Command gt Visual Form Represent
43. i e arguments Note Due to management and file size considerations only the first occurrence of the reference on each page is an active link Subsequent references on the same page will not be actively linked to the definition and will use the standard nonunderlined BOLD Monospace typeface Find the first instance of the name in the underlined BOLD Monospace typeface on the page and click on the word to jump to the function or type definition The following typographic conventions are used in this document to illustrate the Extended Backus Naur Form item item item range range item itemt item nr item tn itemm Square brackets denote the enclosed item is optional Curly braces denote a choice or selection item only one of which may occur on a given line Angle brackets denote a name for an item Parenthesis with characters and dash characters denote ranges of values for example a zA Z0 9 indicates a single alphanumeric character while 0 9 indicates a single digit Characters within quotation marks are the exact content of an item as they must appear in the output text file The question mark denotes zero or one occurrences of an item The star character denotes zero or more occurrences of an item The plus character denotes one or more occurrences of an item A superscript number n is the number occurrences of the item that must be used Example 0 9 8 indicates that there
44. undefined IMAGE ENTRY POINT Map DEST DIR DEBUG BASE NAME map DEFINE GCC IPF OBJCOPY FLAGS I elf64 ia64 little O efi bsdrv ia64 DEFINE GCC IPF SYMRENAME FLAGS redefine sym memcpy CopyMem DEFINE GCC ASM FLAGS c x assembler imacros DEST DIR DEBUG AutoGen h DEFINE GCC PP FLAGS DEST DIR DEBUG AutoGen h E x assembler with cpp include 1 22 May 2010 217 BUILD DEFINE GCC_VFRPP_FLAGS x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h FEFE AE HE FE EHE FE AE FE FE FE HE FE AEE FE AE FE ERE ERE ERE EHE IE EHE IEEE IEEE FE AE HE FE EE EE HE FE AE EE BE FE E BE BE EE EHE EE HEHHE HE G Unix GCC And Intel Linux ACPI Compiler FEE EAE AEE IE FEE HE E HE E FE E HE IER E AE E FE E EE AE FE AE FE AE IER FE FE FE FE FE IER FE FE E FE AE FE AE FE AE FE IE FE FE FE AE FE FE FE FE HE E FE E FE FE FE FE FE FE FE FE FE FE HE IBI HE _UNIXGCC UNIX GCC ASL Intel Linux ACPI Source Language Compiler iasl UNIXGCC FAMILY GCC UNIXGCC MAKE PATH make DEFINE UNIXGCC DLINK FLAGS COMMON nostdlib s pie UNIXGCC PP FLAGS E x assembler with cpp include DEST DIR DEBUG AutoGen h UNIXGCC DLINK FLAGS DEF UNIXGCC DLINK FLAGS COMMON entry _ IMAGE ENTRY POINT file alignment 0x20 section alignment 0x20 Map DEST DIR DEBUG BASE NAME map UNIXGCC ASM FLAGS c x assembler imacros DEST DIR DEBUG AutoGen h UNIXGCC VFRPP FLA
45. while messages that are displayed as part of the menu system or are stored for display later are written in UNICODE UCS 2 encoded format The UEFI PI specifications define the structure for Human Interface Infrastructure HII as well as Visual Forms Representation VFR Also supported but not defined within the reference build and the UEFI PI specifications is the user defined Vital Product Data VPD areas 2 6 4 Special Files VTF amp BSF The Volume Top File VTF is a file that must be located such that the last byte of the file is also the last byte of the firmware volume Regardless of the actual file type a VTF file must have the file name GUID of EFI FFS VOLUME TOP FILE GUID The file name is a GUID andEFI EES VOLUME TOP FILE GUID is the C define that is used by code and the build system in place of the GUID value The build system must be aware of this GUID and insert a pad file if necessary to guarantee the VTF is located correctly at the top of the firmware volume This is also required for update and write operations The Bootstrap file is firmware file that is aligned to the top of the 32 bit address space It is responsible for encapsulating the reset vector for the Itanium processor family and IA 32 It also contains fixed information such as the PEIM return link for IA 32 and the entry point to the PEI core Also of interest it contains the base of the boot FV to enable successive module discovery in PEI 2 6 5 EFI
46. 2 6 2 Firmware ESS 18 2 6 3 Firmware Volumes rss 20 2 6 4 Special Files VTF amp Se C 22 2 6 5 EFI FM FILETYPE SECURITY Notes entente nn Re rcu xen ha 22 2 6 6 EFI FV FIEETYPE PEI CORE Notes u a een 22 2 6 7 EFI EN FILETYPE PEIM Notes sssmRRRRRHRRRHHHeHeHHHHHHHHnnn 23 2 6 8 EFI FV FILETYPE COMBINED PEIM DRIVER Notes nn 23 2 6 9 DXE BDS TLS and AE hau era 23 gd Sic gek ag 24 2 17 1 Compiling OOB ETT aAA iG ei einna na 24 2 7 2 Creating a Terse Image c 24 2 7 3 Removing reloc sections AE 25 2 7 4 Generating LEAF EFI SECTION ESS nnen aa 26 2 7 5 Generating Encapsulation EFI SECTION ESS 28 2 7 6 Generating DEPEX EFI SECTION Fil S nn nae ananas nennen eennnnsnensenens 28 2 7 7 Generating Visual Forms IFR HII Files sarro 29 2 7 8 Generating EFI FFS Files a dak RE 30 May 2010 V vi BUILD 2 1 9 APRIORI Fil8s tend roti rise an 31 2 7 10 Generating EFI Firmware Volume FV Files rss 31 2 7 11 Implementing Compression rss 33 2 7 12 Implementing Encryption or Signing rra a 34 2 7 13 Generating an FD image file nnen ansneenerenen renners enne nennenennnnnnreevennn 34 2 7 14 Generating Applications rss 35 2 7 15 Generating an Option ROM essan 35 2 7 16 Generating Capsule Update ESS 37 UEFI and PI Image Specification eee 39 Reference Build Process Overview eeeeeeeeeeeeeeeeennnnnn 63 4 1 Supported Development Enviro
47. 4 Else a Find all files defined by the INF file whose file type is FileType and add each one to the FFS with a section type of SectionType b Add files defined in sources followed by files defined in binaries If more than 1 u1 section in the final FFS file then error If more than 1 ver section in the final FFS file then error If more than 1 DxE_DEPEX section in final the FFS file then error If more than 1 Per DEPEX section in the final FFS file then error If more than 1 sm DEPEX section in the final FFS file then error aan 9 3 5 Create Encapsulation Sections There are two types of encapsulation sections a coMPRESSION section and the GUIDED section A coMPRESSION section uses standard UEFI compression decompression mechanisms Other compression schemes must use the curzpEp form of encapsulation section The compress encapsulation section uses the following format SECTION COMPRESS type SECTION EFI SECTION TYPE SECTION EFI SECTION TYPE FILENAME string The type argument is optional only EFI_STANDARD_COMPRESSION is supported by the PI specification The current EDK enumerations for compression are a violation of the PI specification and SECTION GUIDED should be used instead The EFI_SECTION TYPE and FILENAME are required sub elements within the compression encapsulation section for most sections however both the VERSION EFI SECTION VERSION and UI EFI SECTION USER INTEFACE may specify a string
48. 6 amp 7 are reserved and must be set to the ERASE POLARITY defined in the EFI FIRMWARE VOLUME HEADER Related Definitions dad EFI FFS INTEGRITY CHECK LT typedef union struct UINT8 Header UINT8 File Checksum UINT16 Checksum16 EFI_FFS_INTEGRITY_CHECK GO EFI_FV_FILETYPE LI typedef UINT8 EFI_FV_FILETYPE GO EFI_FFS_ATTRIBUTES Eda typedef UINTS EFI_FFS FILE ATTRIBUTES May 2010 55 BUILD EFI_FIRMWARE_VOLUME_HEADER The header of an FV file typedef struct UINT8 EFI_GUID UINT64 UINT32 EFI FVB ATTRIBUTES 2 UINT16 UINT16 UINT16 UINT8 UINT8 EFI_FV_BLOCK_MAP ZeroVector 16 FileSystemGuid FvLength Signature Attributes HeaderLength Checksum ExtHeaderOffset Reserved 1 Revision BlockMapl EFI FIRMWARE VOLUME HEADER Parameters ZeroVector The first 16 bytes are reserved to allow for the reset vector of processors whose reset vector is at address 0 FileSystemGuid Declares the file system with which the firmware volume is formatted Type EFI GUID is defined in InstallProtocolInterface in the Unified Extensible Firmware Interface Specification version 2 0 UEFI 2 0 specification FvLength Length in bytes of the complete firmware volume including the header Signature Set to _ F V H Attributes Declares capabilities and power on defaults for the firmware volume Current state is determined using the GetAttributes function and
49. APRIORI Files At most here can be at most one APRIORI file in a given firmware volume The PEI file named by GUID of PEI APRIORI FILE NAME GUID Will specify the order of invocation of PEIMs by the PEI foundation This is a special file of the type EFI FV FILETYPE FREEFORM With a single EFI_sECTION RAW and has the format typedef struct EFI GUID FileNamesWithinVolume NumberOfModulesInVolume PEI APRIORI FILE CONTENTS The DXE file named by GUID of DxE_APRIORI FILE NAME GUID Will specify the dispatch order of drivers by the DXE foundation This is a special file of the type EFI FV FILETYPE FREEFORM With a single EFI_SECTION_RAW and has the same format as the PEI APRIORI FILE CONTENTS 2 7 10 Generating EFI Firmware Volume FV Files This section provides the overview for generating an FV file which contains an FV header and a sequence of FFS files FVs are usually implemented so that the SEC and PEI Foundation are not compressed while most PEIMs are executed from ROM see above As a result these images are typically placed in a separate FV with post PEI phase modules placed in one or more FVs that are compressed Reference Section 2 7 11 below May 2010 31 BUILD The FV files are combinations of FFS files For SEC PEI Foundation and most PEIMs that execute directly from ROM will need to have the BaseAddress re based to the location of the driver in ROM There are three different types of rebase actions The firs
50. ASLDLINK FLAGS bed zg Az dd E HH IA32 definitions Ld UHR CYGGCCxASL IA32 CC PATH DEF CYGWIN BINIA32 gcc CYGGCCxASL IA3 2 SLINK PATH DEF CYGWIN BINIA32 ar CYGGCCxASL IA3 2 DLINK PATH DEF CYGWIN BINIA32 ld CYGGCCxASL IA32 ASM PATH DEF CYGWIN BINIA32 gcc CYGGCCxASL IA32 PP PATH DEF CYGWIN BINIA32 gcc CYGGCCxASL IA32 APP PATH DEF CYGWIN BINIA32 gcc CYGGCCxASL IA32 VFRPP PATH DEF CYGWIN BINIA32 gcc CYGGCCxASL IA32 ASLCC PATH DEF CYGWIN BINIA32 gcc CYGGCCxASL IA32 ASLPP PATH DEF CYGWIN BINIA32 gcc CYGGCCxASL IA32 ASLDLINK PATH DEF CYGWIN_BINIA32 1d CYGGCCxASL_IA32_RC_PATH DEF CYGWIN BINIA32 windres CYGGCCxASL IA32 CC FLAGS Os fshort wchar fno strict aliasing Wall Werror c include AutoGen h CYGGCCxASL IA32 RC FLAGS J rc O coff 222 May 2010 1 22 bed zg Aiz dd izo X64 definitions HEHEHE HE HE HEHE HE HE HE HEHE HEHE BE CYGGCCxASL X64 CC PATH CYGGCCxASL X64 SLINK PATH CYGGCCxASL X64 DLINK PATH CYGGCCxASL X64 ASM PATH CYGGCCxASL X64 PP PATH CYGGCCxASL X64 APP PATH CYGGCCxASL X64 VFRPP PATH CYGGCCxASL X64 ASLCC PATH CYGGCCxASL X64 ASLPP PATH CYGGCCxASL X64 ASLDLINK PATH CYGGCCxASL X64 RC PATH CYGGCCxASL X64 CC FLAGS red zone Wall Werror c include Aut CYGGCCxASL X64 RC FLAGS E bed zg Ard HE E HEHH IPF definitions bed zg Az dd E IG E CYGGCCxASL IPF CC PATH CYGGCCxASL IPF SLINK PATH CYGGCCxASL IPF DLINK PATH CYGGC
51. After the header is created then the rest of the original image all header information stripped is appended to the TE header Figure 10 shows the relationship of original image to the TE image data Section rdata Section data Section rdata Section text Section text Section Terse Im age Standard PE32 COFF Im age Figure 12 Standard Image to Terse Image Comparison 2 7 3 Removing reloc sections Removing the relocation section of either a PE or TE image can only be done if the reloc section is at the end of the file While most reloc sections are fairly small in comparison to the other sections of the files removing all of the reloc sections in combination with using Terse images for the PEI foundation and PEIMs that do not register for shadow see UEFI PI specs can shrink a platform image by several hundred bytes 1 22 May 2010 25 BUILD For a TE image the file size strippedsize is adjusted by subtracting the length of the reloc section The DataDirectory 0 VirtualAddress is set to O as is the size parameter Removing the relocation section of a PE image is slightly more complicated The PE32 image header which contains both the EFI_IMAGE DOS SIGNATURE OX5A4D and an EFI IMAGE NT SIGNATURE 0x00004545 will be modified by setting the EFI IMAGE FILE HEADER Characteristics EFI IMAGE FILE RELOCS STRIPPED bit The IPF header uses a similar data structure to IA32 X64 and EBC data s
52. BUILD LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text VS2005x86xASL IA32 ASMLINK FLAGS nologo tiny HEHEHE HE HE HEHE HE HE HE HE HE HEHE GG X64 definitions THERE HE HE HEHE HE HE HE HEHE HEHE EE HH VS2005x86xASL X64 DLL DEF VS2005x86 DLL VS2005x86xASL X64 CC PATH DEF VS2005x86_BINX64 cl exe VS2005x86xASL X64 PP PATH DEF VS2005x86_BINX64 cl exe VS2005x86xASL X64 APP PATH DEF VS2005x86_BINX64 cl exe VS2005x86xASL X64 VFRPP PATH VS2005x86xASL X64 ASM PATH VS2005x86xASL X64 SLINK PATH VS2005x86xASL X64 DLINK PATH VS2005x86xASL X64 ASLCC PATH DEF VS2005x86_BINX64 cl exe VS2005x86xASL X64 ASLPP PATH DEF VS2005x86_BINX64 cl exe VS2005x86xASL X64 ASLDLINK PATH DEF VS2005x86_BINX64 link exe DEF VS2005x86_BINX64 cl exe DEF VS2005x86_BINX64 m164 exe DEF VS2005x86_BINX64 lib exe DEF VS2005x86_BINX64 link exe DEBUG VS2005x86xASL X64 CC FLAGS nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FIAutoGen h EHs c GR GF Zi Gm RELEASE VS2005x86xASL X64 CC FLAGS nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FIAutoGen h EHs c GR GF DEBUG VS2005x86xASL X64 ASM FLAGS nologo c WX W3 Cx Zd Zi RELEASE VS2005x86xASL X64 ASM FLAGS nologo c WX W3 Cx Zd DEBUG VS2 005x8 6xASL X6 4 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10
53. DEBUG VS2005x86xASL IPF ASM FLAGS N us X explicit M ilp64 N so W4 d debug RELEASE VS2005x86xASL IPF ASM FLAGS N us X explicit M ilp64 N so W4 DEBUG VS2005x86xASL IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEBUG DIR BASE NAME map PDB DEBUG_DIR BASE_NAME pdb DEBUG RELEASE VS2005x86xASL IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER 1 22 May 2010 209 BUILD SAFESEH NO BASE 0 DRIVER MAP DEBUG DIR S BASE NAME map PDB DEBUG DIR BASE NAME pdb TEE HERE ERE ER EHE HEB HE EBC definitions Ld HE FE HE FE HE FE HEHE HEHE HEHE HEH VS2005x86xASL EBC FAMILY INTEL VS2005x86xASL EBC MAKE PATH DEF VS2005x86 BIN nmake exe VS2005x86xASL EBC PP PATH VS2005x86xASL EBC VFRPP PATH VS2005x86xASL EBC CC PATH VS2005x86xASL EBC SLINK PATH DEF EBC_BINx86 iec exe DEF EBC_BINx86 iec exe DEF EBC_BINx86 iec exe DEF EBC_BINx8 6 link exe VS2005x86xASL EBC DLINK PATH DEF EBC_BINx86 link exe VS2005x86xASL EBC MAKE FLAGS nologo VS2005x86xASL EBC PP FLAGS nologo E TC FIAutoGen h VS2005x86xASL E
54. DRIVER DEBUG RELEASE VS2003xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 May 2010 193 BUILD LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text VS2003xASL IA32 ASMLINK FLAGS nologo tiny HEEE HE HE HEHE HE HE HE HEHE HEHE SG EBC definitions THERE HE HE HEHE HE HE HE HEHE HEHE H H HH VS2003xASL EBC FAMILY INTEL VS2003xASL EBC MAKE PATH DEF VS2003_BIN nmake exe VS2003xASL EBC PP PATH VS2003xASL EBC VFRPP PATH VS2003xASL EBC CC PATH VS2003xASL EBC SLINK PATH VS2003xASL EBC DLINK PATH DEF EBC_BIN iec exe DEF EBC_BIN iec exe DEF EBC_BIN iec exe DEF EBC_BIN link exe DEF EBC_BIN link exe VS2003xASL EBC RC PATH DEF VS2003_BIN rc exe VS2003xASL EBC MAKE FLAGS nologo VS2003xASL EBC PP FLAGS nologo E TC FIAutoGen h VS2003xASL EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT VS2003xASL EBC VFRPP FLAGS nologo E TC DVFRCOMPILE FI MODULE NAME StrDefs h VS2003xASL EBC SLINK FLAGS lib NOLOGO MACHINE EBC VS2003xASL EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP THEE HERE ERE EE FE FE HE FE HE FE
55. DSC TIANO FLAGS DSC INF TIANO FLAGS MAKE FLAGS TOOLS DEF MAKE FLAGS INF MAKE FLAGS V DSC MAKE FLAGS DSC INF MAKE FLAGS ASMLINK FLAGS TOOLS DEF ASMLINK FLAGS INF ASMLINK FLAGS DSC ASMLINK FLAGS DSC INF ASMLINK FLAGS ASL FLAGS TOOLS DEF ASL FLAGS INF ASL FLAGS V DSC ASL FLAGS DSC INF ASL FLAGS 7 4 1 1 6 Tools path These come from the file specified by TOOL CHAIN CONF definition in WORKSPACE Conf target txt LZMA H dev AllPackagesDev IntelRestrictedTools Bin Win32 LzmaCompress exe PP C Program Files Microsoft Visual Studio 8 Vc bin cl exe SLINK C Program Files Microsoft Visual Studio 8 Vc bin lib exe CC C Program Files Microsoft Visual Studio 8 Vc bin cl exe APP C Program Files Microsoft Visual Studio 8 Vc bin cl exe VFRPP C Program Files Microsoft Visual Studio 8 Vc bin cl exe DLINK C Program Files Microsoft Visual Studio 8 Vc bin link exe ASM C Program Files Microsoft Visual Studio 8 Vc bin ml exe TIANO TianoCompress exe MAKE C Program Files Microsoft Visual Studio 8 Vc bin nmake exe ASMLINK C WINDDK 3790 1830 bin bin16 link exe ASL C ASL iasl exe a nai 7 4 1 1 7 Shell commands These are used to make sure that the file operations for both nmake and GNU make system become as the same as possible 1 22 May 2010 139 BUILD shell commands for nmake RD rmdir s q RM del f q MD mkdir CP copy y MV move y shel
56. EFI PCI OptionROM image e If the input file s are legacy OptROM binary image fill in EFI PCI OptROM header in the output EFI PCI OptionROM image then copy the input file content to the output EFI PCI OptionROM image to create the EFI PCI OptionROM image The final image is placed in the FV folder of the build directory 10 2 UEFI Applications If a developer wants to generate only UEFI applications verify that no FDF file is specified in the DSC file This prevents the GenFds tool from being called after all of the modules have been built by the MAKE stage The UEFI application files efi files built from application modules are put in the following directory OUTPUT_DIRECTORY PLATFORM_NAME lt BuildTarget gt _ lt ToolChainTag gt ARCH 10 3 Capsules This section describes the processing of the EFI files generated by the MAKE Stage into Update Capsules Capsule images contain a Fv Image or a FFS file to be updated The capsule section in FDF file is parsed to get e Capsule Header information including Capsule guid flags and header size e Capsule content may be either a Fv Image or a FFS file A Fv Image may be specified using any FV section described in this FDF file It will be generated same using the process described in Section 9 4 Additionally an existing FV file created as part May 2010 163 164 BUILD of an FD image may be used These FV files can be directly integrated into a Cap
57. EFI SECTION USER INTERFACE 1 22 May 2010 49 BUILD EFI_FREEFORM_SUBTYPE_GUID_SECTION This is the entire EFI_FREEFORM_SUBTYPE_GUID_SECTION where the GUID is the only content typedef struct EFI COMMON SECTION HEADER CommonHeader EFI GUID SubTypeGuid EFI FREEFORM SUBTYPE GUID SECTION typedef struct EFI COMMON SECTION HEADER2 CommonHeader EFI GUID SubTypeGuid EFI FREEFORM SUBTYPE GUID SECTION2 Parameters SubTypeGuid This GUID is defined by the creator of the file It is a vendor defined file type Type EFI GUID is defined in InstallProtocolInterface in the UEFI Specification 2 0 CommonHeader Common section header CommonHeader Type EFI SECTION GUID DEFINED 50 May 2010 1 22 UEFI and PI Image Specification EFI COMPRESSION SECTION The header of an EFI_COMPRESSION SECTION A compression section is an encapsulation section in which the section data is compressed To process the contents and extract the enclosed section stream the section data must be decompressed using the decompressor indicated by the CompressionType parameter The decompressed image is then interpreted as a section stream EFI COMPRESSION SECTION2 is used if the section is 16MB or larger typedef struct EFI COMMON SECTION HEADER CommonHeader UINT32 UncompressedLength UINT8 CompressionType EFI_COMPRESSION SECTION typedef struct EFI COMMON SECTION HEADER2 CommonHeader UINT32 UncompressedLength UINT8 Compressi
58. EFT FIRMWARE FILE SYSTEM2 GUID that identifies it as a PI compliant Firmware Volume The signature is set to rva and the reserved byte is set to zero The PI Specification defined Revision is set to 0x02 As FFS files are added to the FV the length of the FFS is added to the FvLength field such that the final FvLength is complete length of the firmware volume including the header and extended header information Also as an FFS file is added to the FV if the driver executes from ROM the base address of the driver will be adjusted rebased within the FFS file to the physical location in ROM BaseAddress offset Attributes defined in the FDF file are set that define the capabilities and power on defaults of this FV These come from the FvAttributes of the FV INFO data structure The HeaderLength is set to size of header including the size of the 0 0 terminated BlockMap data array The B1ockMap data array is a mapping of the FFS files giving the length in blocks and block size for each FFS file in the FV starting with the first FFS file This is an index of the blocks and does not specify each FFS by name If an extended header is required it should be placed immediately following the BlockMap data array The ExtHeaderOffset is set to the location of the extended header Each block will be aligned on the largest value specified by the SE rvB2 ALIGNMENT attribute Note that it is permissible to use variable block length devices
59. Envoronment The NT32Pkg provides a platform emulation environment that executes on windows platform The reference build program is used to start the emulation environment after it has been built Prior to building the platform Nt32Pkg Nt32Pkg dsc the user may want to modify PCD settings in the file The following PCDs control the mappings of your system environment to the emulation environment PedWinNtSerialPort L COM1 COM2 VOID 18 This maps the serial port to COM1 or COM2 if COM1 is not available PcdWinNtFileSystem Lv t EdkShel1BinPkg bin ia32 Apps VOID 106 This shows the location of the shell applications PcdWinNtGop L UGA Window 1 UGA Window 2 VOID 50 This defines label for the two windows that are started PcdWinNtConsole L Bus Driver Console Window VOID 50 This defines label for the windows that are started PcdWinNtVirtualDisk L FW 40960 512 VOID 24 This defines the max and block sizes for the virtual disk drive that is created PcdWinNtMemorySize L 64 64 VOID 10 This defines the memory available for the emulator in MBytes PcdWinNtPhysicalDisk A L a RW 2880 512 d RO 307200 2048 3j RW 262144 512 VOID 100 This defines the available storage devices that should be present at startup A D and J you may want to change the drive letters to match the development environment note that you should not use the C drive as you could inadvertently wipe it out PcdWinNtUga L UGA Window 1 UGA W
60. FV FILETYPE SECURITY Notes The security section is always executed from ROM For size optimization the relocation reloc section of security executables may be stripped The reference build does this by default Security drivers run directly from flash need to have the BaseAddress re based to the location the driver occupies in ROM prior to putting the driver into a Firmware Volume FV 2 6 6 EFI EN FILETYPE PEI CORE Notes 22 The last step of the security section was to hand off execution to the PEI foundation which is typically executed in three phases pre memory during memory detection and after memory is available For size optimization it is recommended to have the pre memory and memory detection PEI core modules ROM resident to have the PE32 image converted to a terse image and to have the reloc section stripped After memory is present the PEI Core modules should be shadowed in memory to speed up execution These modules can also contain signing decryption and or decompression routines to handle verification uncompressing or decrypting algorithms for GUIDED encapsulation sections or for compressed PEIMs and any remaining FVs that contain the DXE Foundation and all drivers and applications that are used in the DXE phase or later The decompression should always occur after memory is available The PEI Foundation modules that run directly from flash need to have the BaseAddress re based to the location it occupies in ROM
61. Flags e Fora text section the Flags value is a bit wise OR of EFI IMAGE SCN CNT CODE EFI IMAGE SCN MEM EXECUTE and EFI IMGE SCN MEM READ 0x60000020 e Fora data section the Flags value is a bit wise OR of EFI IMAGE SCN CNT INITIALIZED DATA EFI IMAGE SCN MEM WRITE and EFI IMAGE SCN MEM READ 0xC0000040 e For a reloc section the Flags value is a bit wise OR of EFI IMAGE SCN CNT INITIALIZED DATA EFI IMAGE SCN MEM DISCARDABLE and EFI IMAGE SCN MEM READ 0x42000040 e Fora debug section the Flags value is a bit wise OR of EFI IMAGE SCN CNT INITIALIZED DATA EFI IMAGE SCN MEM DISCARDABLE and EFI IMAGE SCN MEM READ 0x42000040 Once these have been modified the EFr_COMMON SECTION HEADER Will be prefixed to the file Each EFI COMMON SECTION HEADER type field defines the data that follows Table 4 lists May 2010 1 22 1 22 Design Discussion the section type value All EFI section files start with the EFI COMMON SECTION HEADER reloc Section data Section rdata Section text Section Standard PE32 COFF Im age data Section rdata Section text Section Terse Im age Figure 13 EFI Image Files Table 4 Basic EFI SECTION Type Codes Section Type Value EFI SECTION PE32 i 0x10 B EFI SECTION PIC 0x11
62. HERE FE HE FE HE FE HE HE HEHE HEHE HEH ASLCC FLAGS ASLDLINK FLAGS SUBSYSTEM CONSOLE ASLPP FLAGS ASL FLAGS FEAE AE HE HE HEHE FEAE HEHEHEHE E I I GE LzmaCompress tool definitions FEAE AE HE HE HEHE HEHE IE E I HH LZMA PATH LZMA GUID HH TianoCompress tool definitions HH TIANO PATH TIANO GUID VfrCompile 1 n EfiRom e GL X TC Dmain ReferenceAcpiTable NODEFAULTLIB ENTRY ReferenceAcpiTable nologo EP C LzmaCompress EE4E5898 3914 4259 9D6E DC7BD79403CF TianoCompress A31280AD 481E 41B6 95E8 127F4C984779 May 2010 253 BUILD 254 May 2010 1 22 Appendix C target txt The following is the default version of the target txt file Note that the lines wrap in this document however no line wrapping is permitted in the target txt file May 2010 255 BUILD Copyright c 2006 2007 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 Filename target template ALL Paths are Relative to WORKSPACE Separate multip
63. ICCxASL IA32 ASMLINK FLAGS HEHEHE HE HE HEHE HE AGG X64 definitions THEE HE HE HEHE HE HE HE HE HE HEHE EE HH ICCxASL X64 CC PATH ICCxASL X64 SLINK PATH nologo 4 xilib exe needs lib exe from Visual Studio DEF MS VS BIN DEF ICC BINX64 xilink exe ICCxASL X64 SLINK DLL ICCxASL X64 DLINK PATH ICCxASL X64 PP PATH ICCxASL X64 VFRPP PATH ICCxASL X64 APP PATH ICCxASL X64 ASM PATH ICCxASL X64 ASM DLL ICCxASL X64 ASLCC PATH ICCxASL X64 ASLPP PATH ICCxASL X64 ASLDLINK PATH DEBUG ICCxASL X64 CC FLAGS tiny DEF ICC_BINX64 icl exe DEF ICC_BINX64 xilib exe DEF ICC_BINX64 icl exe DEF ICC_BINX64 icl exe DEF ICC_BINX64 icl exe DEF WINDDK_BINX64 unl64 exe DEF MS_VS_DLL DEF ICC_BINX64 icl exe DEF ICC_BINX64 icl exe DEF ICC_BINX64 xilink exe nologo D UNICODE Olib2s GL Gy FIS DEST DIR DEBUG AutoGen RELEASE ICCxASL X64 CC FLAGS nologo D UNICODE Olib2s GL Gy FIS DEST DIR DEBUG AutoGen DEBUG ICCxASL X64 ASM FLAGS RELEASE ICCxASL X64 ASM FLAGS DEBUG ICCxASL X64 DLINK FLAGS OPT REF OPT ICF 10 MAP ALIGN 32 SECTION nologo nologo NOLOGO c WX GS X W4 Gs8192 h Zi Gm EHs c GF c WX GS X W4 Gs8192 h EHs c GF c WX W3 Cx Zd Zi c WX W3 Cx Zd NODEFAULTLIB IGNORE 4086 xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE
64. L lt NewCtrlChar gt lt EOL gt lt Token gt lt CtrlChar gt L language lt LangCode gt lt String gt L security L lt CFormatGUID gt L lt EOL gt L Ox lt HexDigitu gt L Ox HexDigitu L Ox lt HexDigitu gt 4 L Ox HexDigitu L Ox HexDigitU L Ox HexDigitu L Ox HexDigitU L Ox HexDigitu L Ox HexDigitU L Ox HexDigitu L Ox HexDigitU n jj ua uf uA uF u0 u9 lt CtrlChar gt L string uA uZ uA uZ u0 u9 u_ 9 lt ISO639part1 gt lt ISO639part2 gt lt RFC3066 gt ua uz uAa uz ua uz uA uz 3 ua uz uA uz 2 8 1 ua uz uA uZ u0 u9 2 83 L L lt Word gt L L LdWord L NonWhitespaceChar NonWhitespaceChar lt Text gt lt Attributes gt lt CtrlCode gt lt EOL gt lt String gt lt EOL gt lt StartAttribute gt lt String gt lt StopAttribute gt lt AttrCtrlChar gt lt FontAttr gt May 2010 1 22 lt AttrCtrlChar gt lt StopAttribute gt lt FontAttr gt lt SimpleAttrs gt lt StandardAttrs gt lt CtrlCode gt lt EscChar gt Definitions LanguageCodes EINE lt AttrCtrlChar gt L end lt FontAttr gt lt SimpleAttrs gt lt StandardAttrs gt L narrow gt lt L wide gt L normal L bold gt lt L italic gt lt L emboss gt L shad
65. MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE VS2005x8 6xASL X6 4 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG May 2010 1 22 DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text TEE HERE HERE E EHE HE RE HE IPF definitions HEHEHE HE HE HEHE HE HE HE HE HE HEHE SG VS2005x86xASL IPF DLL DEF VS2005x86 DLL VS2005x86xASL IPF PP PATH DEF VS2005x86_BIN64 cl exe VS2005x86xASL IPF APP PATH DEF VS2005x86_BIN64 cl exe VS2005x86xASL IPF VFRPP PATH VS2005x86xASL IPF CC PATH VS2005x86xASL IPF ASM PATH VS2005x86xASL IPF SLINK PATH VS2005x86xASL IPF DLINK PATH VS2005x86xASL IPF ASLCC PATH DEF VS2005x86_BIN64 cl exe VS2005x86xASL IPF ASLPP PATH DEF VS2005x86_BIN64 cl exe VS2005x86xASL IPF ASLDLINK PATH DEF VS2005x86 BIN64 link exe DEF VS2005x86_BIN64 cl exe DEF VS2005x86_BIN64 cl exe DEF VS2005x86 BIN64 ias exe DEF VS2005x86 BIN64 lib exe DEF VS2005x86 BIN64 Mlink exe DEBUG VS2005x86xASL IPF CC FLAGS Os GL FIAutoGen h QIPF fr32 Zi RELEASE VS2005x86xASL IPF CC FLAGS Os GL FIAutoGen h QIPF fr32 nologo c WX GS X WA EHs c GR Gy nologo c WX GS X W4 EHs c GR Gy
66. Microsoft Intel and GCC must be supported All provided source code should be Posix compliant If assembly source code is used both GCC GAS and Microsoft MASM style files should be provided See the EDK II C Coding Standard for additional information 2 2 1 Reference Implementation Build process restrictions The build process for all configurations must be identical with the caveat that only applicable EDK II Packages need compile for any given operating system An additional restriction on the workstation is the architecture of the workstation only IA32 and X64 based workstations are supported The EDK II BaseTools package which provides the reference build system can be built with binaries for Win32 Win64 X64 not IPF Linux32 Linux64 only X64 Mac32 and Mac64 X64 Some native versions of X64 operating systems may not be available 2 3 UEFI PI Firmware Images UEFI and PI specifications define the standardized format for EFI firmware storage devices FLASH or other non volatile storage which are abstracted into Firmware Volumes A Firmware Volume FV is a file level interface to firmware storage Multiple FVs may be present in a single FLASH device or a single FV may span multiple FLASH devices An FV may be produced to support some other type of storage entirely such as a disk partition or network device For more information consult the Platform Initialization Specification Volume 3 In all cases an FV is formatted
67. NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP THE HERE EE EE FE FE HE FE HE FE dg EHE EHE EHE HE E HE EERE RE RE TH THERE AA FE FE FE FE FE FE FE FE FE IHE IHE IHE IH EIN E HE Li Li Microsoft Visual Studio 2005 Li VS2005 Microsoft Visual Studio 2005 All Edition including Standard Professional Express TeamSuite ASL Microsoft ACPI Source Language Compiler asl exe HEEE HE HE HE HE HE HE HE HE HE FE FE HH E FE HE HE FE FE E E HE FE FE FE E HE E FE FE FE HE HE HE FE FE FE FE HE HE FE FE FE FE FE HE HE FE FE E E E FE FE FE FE HE HE FE FE E FH HE VS2005xASL Microsoft Visual Studio 2005 ALL Edition including Standard Professional Express TeamSuite VS2005xASL FAMILY MSFT VS2005xASL MAKE PATH DEF VS2005 BIN nmake exe VS2005xASL MAKE FLAG nologo VS2005xASL RC PATH DEF VS2005 BIN rc exe VS2005xASL SLINK FLAGS NOLOGO LTCG VS2005xASL APP FLAGS nologo E TC VS2005xASL PP FLAGS nologo E TC FIAutoGen h VS2005xASL VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h FEFE EE FE HE FE FE FE HE FE HE HE HEHE HEHE HEH ASL definitions TEHETHER ER E FE HE HE HEHE HEHE HEH VS2 O05xASL ASL PATH DEF WIN ASL BIN VS2005xASL ASL FLAGS e 198 May 2010 1 22 1 22 VS2005xASL ASL OUTFLAGS VS2005xASL ASLCC FLAGS VS2005xASL ASLPP FLAGS VS2005xASL ASLDLI
68. PATH DEF EBC_BIN link exe VS2005xASL EBC MAKE FLAGS nologo VS2005xASL EBC PP FLAGS nologo E TC FIAutoGen h VS2005xASL EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT VS2005xASL EBC VFRPP FLAGS nologo E TC DVFRCOMPILE FI MODULE NAME StrDefs h VS2005xASL EBC SLINK FLAGS lib NOLOGO MACHINE EBC VS2005xASL EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP FEFE EE HERE EE E HE FE FE HE FE HE FE dg FE HE FE HE FE HE ETERS THE THE HE E HE HE HE HE HE HE HE HE THERE A AERE FE FE AERE FE FE FE FE FE FE FE FE FE FE HE IHE NE HE Microsoft Visual Studio 2005 x86 VS2005 Microsoft Visual Studio 2005 All Edition including Standard Professional Express TeamSuite ASL Intel ACPI Source Language Compiler HEEE HE HE HEHE HE HE HE HE HE FE FE Ago EE FE HE HE HE HE FE FE AA HE HE FE FE E E AA FE FE E E RE FE FE HE HE FE FE dA HE HE FE FE FE ERE AA FE FE FE E EE FE FE HE HE FE HE EE IE HE VS2005x86 Microsoft Visual Studio 2005 ALL Edition including Standard Professional Express TeamSuite VS2005x86 FAMILY MSFT VS2005x86 MAKE PATH DEF VS2005x86 BIN nmake exe VS2005x86 MAKE FLAGS nologo VS2005x86 RC PATH DEF VS2005x86 BIN rc exe VS2005x86 SLINK FLAGS NOLOGO LTCG VS2
69. PATH DEF RVCT31 TOOLS PATH armlink RVCT31 ARM ASM PATH DEF RVCT31 TOOLS PATH armasm RVCT31 ARM PP PATH DEF RVCT31 TOOLS PATH armcc RVCT31 ARM VFRPP PATH DEF RVCT31 TOOLS PATH armcc RVCT31 ARM FROMELF PATH DEF RVCT31 TOOLS PATH fromelf God ipad IEEE AE FE KOA EE EIE KOA HH A FE E FE FE BH HEHE HH HEHE E FE FE HH Ea FE FE FE FE AB HE ARM Tools amp Cygwin FEFE EE FE HE EE EE FE FE HE FE HE FE dg EHE FE HE FE HE THE HE E HE E HE HE HE HE HE E HE HE HE HE HE HH HH HH HH HH AAA FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FH HHHH HE ARMCYGWIN Tools from ARM in a Cygwin environment RVCT31CYGWIN FAMILY RVCT RVCT31CYGWIN BUILDRULEFAMILY RVCTCYGWIN RVCT31CYGWIN ARM CCPATH FLAG DEF RVCT31CYGWIN TOOLS PATH armcc RVCT31CYGWIN ARM SLINKPATH FLAG RVCT31CYGWIN ARM DLINKPATH FLAG RVCT31CYGWIN ARM ASMPATH FLAG RVCT31CYGWIN ARM PPPATH FLAG RVCT31CYGWIN ARM VFRPPPATH FLAG DEF RVCT31CYGWIN TOOLS PATH armlink DEF RVCT31CYGWIN TOOLS PATH armlink DEF RVCT31CYGWIN TOOLS PATH armasm DEF RVCT31CYGWIN TOOLS PATH armcc DEF RVCT31CYGWIN TOOLS PATH armcc RVCT31CYGWIN ARM FROMELFPATH FLAG DEF RVCT31CYGWIN TOOLS PATH fromelf Use default values or override in DSC file RVCT31CYGWIN ARM ARCHCC FLAGS RVCT31CYGWIN ARM ARCHASM FLAGS RVCT31CYGWIN ARM ARCHDLINK FLAGS thumb cpu ARM1176JZF S cpu ARM1176JZF S 1 22 May 2010 249 250
70. Refer to the EDK II INF Specification EDK II DSC Specification EDK II DEC Specification and EDK II Flash Description File Specification to see the format of these files Note More than one INF file may exist in a module directory but the basename and GUID for these INF files must be different The parse stage creates individual module and library autogen c autogen h andmakefiles as well as a single top level makefile Since EDK II supports Microsoft Intel and GCC complier tool chains the Microsoft Build Tool NMAKE Makefile is for Windows developer Workstations using Microsoft or Intel tool chains on a Microsoft Windows operating system development workstation For UNIX based development workstations the GCC build tool GMAKE GNUmakefile is used Parse the target txt and tools_def txt files to build a list of compiler tools that will be used in makefiles as well as to determine what modules will be built All third party tools and flags for those tools get expanded in the generated makefiles The following is an example of makefile statements that support this mode PP C Program Files Microsoft Visual Studio NET 2003 Vc7 bin cl exe CC C Program Files Microsoft Visual Studio NET 2003 Vc7 bin cl exe APP C Program Files Microsoft Visual Studio NET 2003 Vc7 bin cl exe VFRPP C Program Files Microsoft Visual Studio NET 2003 Vc7 bin cl exe DLINK C Program Files Microsoft Visual Studio NET 2003 Vc7 bin link exe PCH C P
71. TAG MYTOOLS MULTIPLE_THREAD FLAG Optional MULTIPLE THREAD Enable the parsing of an DSC file restricting the build output target s The Build Target ARCH is determined by a logical AND of TARGET_ARCH values Defines SUPPORTED_ARCHITECTURES tag a ARCH option If not specified then all valid architectures specified in the DSC file for which tools are available will be built Specify the name of the filename to use for specifying the tools to use for the build If not specified the file WORKSPACE Conf tools def txt will be used for the build This file MUST be located in the WORKSPACE Conf directory Specify the name s of the tools def txt TagName to use If not specified all applicable Tool Chain Tag name tools will be used for the build The list uses space character separation Flag to enable multi thread build If not specified default is Disable If your computer is multi core or has multiple CPUs enabling this feature will bring a performance benefit This feature is only available for spawn build mode and only for PLATFORM builds The clean cleanall or stand alone module build is still single threaded MAX CONCURRENT THREAD NUMBER NUMBER Optional The number of concurrent te tE db db MAX CONCURRENT THREAD NUMBER 2 BUILD RULE CONF Filename Optional 8 8 1 22 threads Default is 2 Recommend setting this value to one more than the nu
72. TRUE True true FALSE False false 0 TV end of line May 2010 BUILD 1 22 Example attributes EFI READ DISABLED CAP EFI READ ENABLED CAP EFI READ STATUS EFI WRITE DISABLED CAP EFI WRITE ENABLED CAP EFI WRITE STATUS EFI LOCK CAP EFI LOCK STATUS EFI STICKY WRITE EFI MEMORY MAPPED EFI ERASE POLARITY EFI ALIGNMENT CAP EFI ALIGNMENT 2 EFI ALIGNMENT 4 EFI ALIGNMENT 8 EFI ALIGNMENT 16 EFI ALIGNMENT 32 EFI ALIGNMENT 64 EFI ALIGNMENT 128 EFI ALIGNMENT 256 EFI ALIGNMENT 512 EFI ALIGNMENT 1K EFI ALIGNMENT 2K EFI ALIGNMENT 4K EFI ALIGNMENT 8K EFI ALIGNMENT 16K EFI ALIGNMENT 32K EFI ALIGNMENT 64K G 3 Files Section 1 22 Summary Defines the iies tag is found only in Firmware Volume INF files This file is created by the build utility and is an input to the GenFvImage utility Prototype files expression Filename COMPONENT TYPE PATH TRUE TRUE TRUE TRUE TRUE TRUE TRUE FALSE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE files lt EOL gt lt expression gt lt Filename gt lt COMPONENT TYPE lt FVS gt lt FFSEXT gt PROCESSOR lt arch gt lt APRORI gt lt EFN gt lt EOL gt lt PATH gt lt Word gt lt Extension gt Refer to Table Component module Types 5509413 lt Word gt 77 0 013 Ma
73. The following values are set for UEFI images EFI IMAGE MACHINE IA320x014C EFI IMAGE MACHINE IA640x0200 EFI IMAGE MACHINE x640x8664 EFI IMAGE MACHINE EBCOxOEBC 4 6 3 ImageGen File Extensions Table 14 and Table 15 describe intermediate file extensions and final file extensions in the ImageGen stage of the build for a platform The ImageGen stage takes the output of the MAKE stage typically the efi files and converts the files into EFI section files using the GenSec tool The next step combines the section files into FFS files using the GenFfs tool Once the Ffs files have been generated they are combined into an FV 72 May 2010 1 22 Reference Build Process Overview image file using the GenFv tool FV image files are combined into FD image files by the GenFds tool which also controls all of the other steps in this stage Table 14 GenFds Image Generation Intermediate File Extensions Input Output Extension Description Extension efi pe32 EFI SECTION PE32 pe32 ui ver com EFI SECTION COMPRESSION ui ui EFI SECTION USER INTERFACE depex dpx EFI SECTION PEI DEPEX or EFI SECTION DXE DEPEX tmp sec guided EFI SECTION GUID DEFINED ver ver EFI SECTION VERSION acpi aml bin Faw EFI SECTION RAW bmp com dpx ffs FFS file images guided pe32 ui ver ffs JD Firmware Volume Image files fv sec txt mcb Microcode Binary File generated from the Microcode text files
74. This is intended to get over the long command line limitation CP copy command MV move command RM delete command MD create dir command RD remove dir command Reserved File Type Don t change following names of file types and their associated files which are also used in tools code C Code File C Header File Dynamic Library File Static Library File Visual Form Representation File Unicode Text File C Code File lt InputFile gt SEE 2c Ge UC Cpp Cpp CBP VV 0 o pk 8 lt ExtraDependency gt MAKE FILE 1 22 May 2010 261 BUILD lt OutputFile gt OUTPUT DIR s dir s_base obj lt Command MSFT Command INTEL gt CC Fo dst CC FLAGS INC src lt Command GCC Command RVCT gt For RVCTCYGWIN CC_FLAGS must be first to work around pathing issues CC S CC_FLAGS o dst INC src SYMRENAME SYMRENAME FLAGS dst C Header File lt InputFile gt ede H lt OutputFile gt lt Command gt Assembly Code File COMMON COMMON lt InputFile MSFT InputFile INTEL InputFile RVCT gt asm Asm ASM InputFile GCC S OV 25 lt ExtraDependency gt MAKE FILE lt OutputFile gt OUTPUT DIR s dir s base obj lt Command MSFT Command INTEL gt S PP PP FLAGS INC src gt d path S s base i Trim source code convert hex o d path s base iii d_path
75. UefiRuntimeServicesLibConstructor c edk2 MdePkg Library BaseloLibIntrinsic BaseloLibIntrinsic inf IoLib c edk2 MdePkg Library BasePciCf8Lib BasePciCf8Lib inf PciCf8Lib c edk2 MdePkg Library BasePciLibCf8 BasePciLibCf8 inf PciLib c edk2 MdePkg Library BasePrintLib BasePrintLib inf PrintLib c edk2 Ich9Pkg Library IntelIchAcpiTimerLib IntelIchAcpiTimerLib inf TimerLib C IntelAcpiTimerLibConstructor c edk2 MdePkg Library UefiLib UefiLib inf UefiLib c edk2 MdePkg Library BaseSynchronizationLib BaseSynchronizationLib inf SynchronizationLib c edk2 MdePkg Library DxeHobLib DxeHobLib inf HobLib C DxeHobLibConstructor c edk2 MdePkg Library UefiDriverEntryPoint UefiDriverEntryPoint inf UefiDriverEntryPoint c edk2 MdePkg Library UefiRuntimeLib UefiRuntimeLib inf UefiRuntimeLib C UefiRuntimeLibConstructor D UefiRuntimeLibDestructor May 2010 177 BUILD Example2 edk2 R8BearLakePkg Guid GuidLib inf edk2 EdkCompatibilityPkg Foundation Guid EdkGuidLib inf edk2 EdkCompatibilityPkg Foundation Protocol EdkProtocolLib inf edk2 EdkCompatibilityPkg Foundation Library RuntimeDxe EfiRuntimeLib EfiRunti meLib inf c edk2 EdkCompatibilityPkg Foundation Core Dxe ArchProtocol ArchProtocolLib inf c edk2 EdkCompatibilityPkg Foundation Library CompilerStub CompilerStubLib inf c edk2 EdkCompatibilityPkg Foundation Guid EdkGuidLib inf c edk2 EdkCompatibilityPkg Foundation Framework Protoco
76. Volume and the entire FV can be compressed The modules after the DXE Foundation has been given control may have other dependent drivers Similar to the EFI_SECTION_PEI_DEPEX Section a dependency EFI SECTION DXE DEPEX Section may be required These files are used by the DXE May 2010 23 BUILD foundation to ensure required drivers are available when needed Another feature of some of these modules the BDS is particular has to do with the Human Interface Infrastructure HII The HII uses internal forms representation IFR coded files 2 7 Creating EFI Images 2 7 1 Compiling Code EDK II modules include both libraries drivers and applications Library modules are compiled and linked as static libraries Drivers and applications are compiled to object files then linked with the static libraries they require After the static image has been created the resulting image is run through the dynamic linker to generate the relocate able binary images DLL All EFI images must be formatted PE32 PE32 COFF Note ELF images created by GCC on Linux systems need additional processing to simulate the PE32 COFF format Since UEFI PI images are not standard executables these dynamically linked DLL files must be processed to become UEFI PI compliant images This processing involves replacing the standard header with an EFI header that reflects the EFI SECTION type Prior to creating the EFI section files PEI Foundation and PEIM ima
77. Zi RELEASE VS2005xASL IPF CC FLAGS Os GL FIAutoGen h QIPF fr32 DEBUG VS2005xASL IPF ASM FLAGS RELEASE VS2005xASL IPF ASM FLAGS DEBUG VS2005xASL IPF DLINK FLAGS IGNORE 4086 MAP ALIGN 32 SECTION DRIVER MAP DEBUG DIR BASE NAME RELEASE VS2005xASL IPF DLINK FLAGS IGNORE 4086 MAP ALIGN 32 SECTION nologo c WX GS X W4 nologo c WX GS X W4 N us X explicit M ilp64 N us X explicit M ilp64 EHs c GR Gy EHs c GR Gy N so W4 d debug N so W4 NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 map PDB DEBUG_DIR BASE_NAME pdb DEBUG NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF xdata D SECTION pdata D MACHINE IA64 May 2010 201 BUILD ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEBUG DIR BASE_NAME map PDB DEBUG DIR BASE NAME pdb FEFE EE FE HE FE FE FE FE FE HE HE HEHE HEHE HEH EBC definitions TEE FE HE ERE ER FE HE HE HEHE HEHE HEH VS2005xASL EBC FAMILY INTEL VS2005xASL EBC MAKE PATH DEF VS2005_BIN nmake exe VS2005xASL EBC PP PATH VS2005xASL EBC VFRPP PATH VS2005xASL EBC CC PATH VS2005xASL EBC SLINK PATH DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN link exe VS2005xASL EBC DLINK
78. an FD file at the location specified by the FD section of the FDF file 4 4 4 EFI PCI Expansion Option ROM Images There are two methods for creating an option ROM image when the EDE file is specified ane when an EDE file is not present To build from source and no FDF file is present if the module s INF file contains the keywords PCI DEVICE ID PCI VENDOR ID and PCI CLASS CODE the build will terminate after creating EFI files there will be no call to the GenFds tool These key words alsol force the creation of an option ROM image after the EFI files have been created using the EfiRom program to create the EFI PCI Expansion ROM image If an FDF is present then the build tools will parse the FDF file looking for an OptionRom section and create the option ROM based on the contents of this section Note that the FDF specification permits adding binary images such as the legacy option rom binary as well as support for multiple architecture driver images to the option ROM image Option ROM images are always created in the output FV directory 4 4 5 UEFI Applications When building only UEFI applications no FDF file is specified in the DSC file the build would normal terminate after creating EFI files there would be no call to the GenFds tool Using an option on the build tool command line to specify building a UEFI Application forces the parsing stage to generate the top level makefile with an alternate path This path will force the c
79. and different meta data files The following provides the rules required to assign a value to a PCD Highes t Command line D flags FDF file SET statements within a section FDF file grammar describing assignment of PCD values FDF file SET statement in the defines section DSC file Component INF lt Pcd gt section statements DSC file SET statements following the global Pcd sections DSC file global Pcd sections DSC file SET statements in the defines sections INF file PCD sections Default Values DEC file PCD sections Default Values Lowest 6 3 Third Party Tool Flags The tools def txt file provides various flags for third party tools The following tables provide a summary of these Best Known options May 2010 99 Build Environment Note A reserved keyword MDEPKG_NDEBUG can be used for codesize reduction purposes Table 20 Standard C File Compiler Options Microsoft Intel GCC Description nologo nologo Do not display compiler version information C C C Compile C files to object obj files only do not link WX WX Werror Force warnings to be reported as errors GS GS Disable security checks W4 W4 Wall Warning level 4 print errors warnings and remarks or enable most warning messages Gs8192 Control stack 8192 bytes checking calls Gy Gy Separate functions for linker O1ib2 O1 Optimize for minimum space enable intrinsic functions enable in line expan
80. claimed as the property of others Copyright 2008 2010 Intel Corporation All rights reserved ii May 2010 1 22 Revision History Revision Revision History Date 1 0 Initial release February 2008 1 1 Update based on errata August 2008 1 2 Updates based on enhancement requests June 2009 1 21 Updates based on errata and enhancement requests January 2010 Definitions in DSC file defines section are now global to both DSC and FDF files Added language filters RFC LANGUAGES and ISO LANGUAGES Rule processing for file type lists is alphabetical i e files are added in alphabetical order Added warning for VFR file naming convention cannot use a name that is also used for a C file Use of the IDENTIFIER statement in tools def txt is optional Whitespace characters are permitted in the meta data files so tools must handle them use of token based processing is recommended Tools must support any number of FV EXT ENTRY TYPE statements in an FDF file The build tools must auto compute the ExtHeaderOffset in the FV Header The build tools must auto compute the ExtHeaderSize in the FV Ext Header based on the size of the FV Ext Header and all the FV Ext Header Entries The build tools must auto compute the ExtEntrySize field in the FV Ext Header Entry structure based on the size of the file specified by the FILE statement or the number of bytes in the byte array of the DATA statement If the
81. d IPF Assembly include files ATE Visual Forms Representation files uni Unicode UCS 2 files dxs Dependency Expression files depreciated asl C formatted ACPI code files these files are processed independent from the C code files asi ACPI Header Files asic C formatted ACPI table files these files are processed independent from the C code files txt Microcode text files bin Microcode binary files bmp Logo files used in the ImageGen stage ui Unicode User Interface files ver Unicode Version files 4 6 2 File Extensions for UEFI image files This section details the intermediate file extensions that generated by the MAKE stage of the build process This stage involves processing source files and generating dynamic objects which are further processed by the GenFw tool to create efi files Table 12 MAKE Stage Intermediate Output File Extensions Extension Description obj Object files generated by MAKE stage lib Static Linked files generated by MAKE stage dll Dynamically Linked files generated by MAKE stage aml ACPI code files generated by MAKE stage a iii Trim and C Pre Processor output files bin Microcode files 1 22 May 2010 71 Table 13 MAKE Stage Output File Extensions Extension efi acpi depex mcb Description Non UEFI Applications DXE Drivers DXE Runtime Drivers DXE SAL Drivers have the Subsystem type field of the DOS TE header
82. flash image and applications that execute from the EFI Shell These statically linked applications cannot make use of OS standard libraries or headers Applications that are executed within the flash image must be stored in an FFS file along with the optional version and user interface sections These applications are installed as part of the standard shell commands The only way to execute a command that is executed within the flash image is to install it along with the shell commands Otherwise they cannot be executed Applications that execute from the EFI shell are PE32 COFF applications that have a modified header and do not need to be placed within an FFS file The efi file generated by the MAKE stage is capable of being executed from the shell command prompt 2 7 15 Generating an Option ROM file This section provides the overview for generating an external PCI OptionROM where the driver is on a PCI add in card PCI devices that are laid down on a platform board rather than on an add in card Ethernet Video Audio etc devices will most likely have the driver resident in an FFS FV FD with the device vendor providing the driver code to the board vendor A PCI Option ROM is typically discovered during system initialization and the driver will be dispatched by the DXE Foundation PCI Option ROM drivers are constructed from either EFI files or Binary files or a combination of both Most EFI implementations of PCI Option ROMs ca
83. genSec For each module assemble the section files into an FFS file For each FV listed in the FDF file creat the FV file Assembles the existing FV files and other content into the ROM FD image Generates a Capsule Image Generates an OptionRom E 4 Usage Usage build exe options target 270 May 2010 1 22 1 22 Copyright c 2007 Intel Corporation All rights reserved Options version h help show program s version number and exit show this help message and exit a TARGETARCH arch TARGETARCH p PLATFORMFILE ARCHS is one of list IA32 X64 IPF or EBC which overrides target txt s TARGET_ARCH definition To specify more archs please repeat this option platform PLATFORMFILE Build the platform specified by the DSC file name argument overrides target txt s ACTIVE_PLATFORM definition m MODULEFILE module MODULEFILE b BUILDTARGET Build the module specified by the INF file name argument buildtarget BUILDTARGET BuildTarget is one of list DEBUG RELEASE which overrides target txt s TARGET definition To specify more TARGET please repeat this option t TOOLCHAIN tagname TOOLCHAIN s spawn n THREADNUMBER Using the Tool Chain Tagname to build the platform overrides target txt s TOOL CHAIN TAG definition If this flag is specified as soon as a module can be built the build will start without waiting for AutoGen to complete remaining mod
84. gt EFI WRITE STATUS TrueFalse lt EOL gt EFI LOCK CAP lt TrueFalse gt lt EOL gt EFI LOCK STATUS lt TrueFalse gt lt EOL gt EFI ERASE POLARITY lt ZeroOne gt lt EOL gt EFI STICK WRITE lt TrueFalse gt lt EOL gt EFI MEMORY MAPPED lt TrueFalse gt lt EOL gt EFI ALIGNMENT CAP lt TrueFalse gt lt EOL gt EFI ALIGNMENT 2 lt TrueFalse gt lt EOL gt EFI ALIGNMENT 4 lt TrueFalse gt lt EOL gt EFI ALIGNMENT 8 lt TrueFalse gt lt EOL gt EFI ALIGNMENT 16 lt TrueFalse gt lt EOL gt May 2010 275 276 lt TrueFalse gt lt TF gt lt True gt lt False gt lt ZeroOne gt lt EOL gt EFI_ALIGNMENT 32 lt TrueFalse gt lt EOL gt EFI_ALIGNMENT 64 lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt EFI ALIGNMENT 128 EFI ALIGNMENT 256 EFI ALIGNMENT 512 EFI ALIGNMENT 1K EFI ALIGNMENT 2K EFI ALIGNMENT 4K EFI ALIGNMENT 8K EFI ALIGNMENT 16K EFI ALIGNMENT 32K EFI ALIGNMENT 64K lt ZeroOne gt TF True False nl nl lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt lt TrueFalse gt lt EOL gt
85. gt _gPed FixedAtBuild lt TokenCName gt If PCD type PATCHABLE IN MODULE If DatumType VOID amp amp PcdValue array include statement AutoGen h define PCD PATCHABLE lt TokenCName gt SIZE lt MaxDatumSize gt AAK include statement AutoGen h define PCD VALUE lt TokenCName gt lt PcdValue gt extern lt DatumType gt gPcd BinaryPatch lt TokenCName gt define PCD GET MODE lt DatumSize gt lt TokenCName gt VN _gPed BinaryPatch TokenCName NK If DatumType VOID amp amp PcdValue array include statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt SizeOfBuffer Buffer LibPatchPcdSetPtr gPcd BinaryPatch lt TokenCName gt UINTN PCD PATCHABLE lt TokenCName gt SIZE SizeOfBuffer Buffer Else include statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt Value gPed BinaryPatch lt TokenCName gt Value 115 1 22 May 2010 BUILD If PCD_type DYNAMIC include statement AutoGen h define PCD GET MODE lt DatumSize gt lt TokenCName gt VN LibPcdGet DatumSize PCD TOKEN lt PcdTokenCName gt If DatumType VOID include _ statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt SizeOfBuffer Buffer LibPcdSet lt DatumSize gt _gPcd_BinaryPatch lt TokenCName gt SizeOfBuffer B
86. http edk2svn sourceforge net svnroot trunk edk2 Win32 binaries of the EDK II build tools are included in the BaseTools Bin Win32 sub directory of the edk2 source tree UNIX based workstations will need to build the EDK II BaseTools by using subversion to checkout the BaseTools sub project buildtools tianocore org The SVN client is used to checkout this sub project located https buildtools tianocore org svn buildtools trunk BaseTools Unix developers should refer to the follow UNIX specific Pre build Setup instructions below for more information 4 7 3 Path and Target Verification Prior to attempting the build the developer may need to modify the configuration file Conf target txt or Conf tools_def txt that were created by the edksetup script The default configuration for edk2 builds uses Microsoft Visual Studio 2005 for IA32 and X64 target builds and the Microsoft Windows DDK WINDDK version 3790 1830 for IPF target builds that have been installed in standard known locations The default Tool Chain Tag MYTOOLS uses these tools Ifthe tool chains are installed in non standard locations the Conf tools_def txt file should be modified to point to path where the tools are installed If different versions of the tools Visual Studio NET 2003 for example are installed then a different tool chain tag name can be used The TOOL_CHAIN_TAG setting in Conf target txt is used to control the name The default tools_def txt file c
87. image is not an exact 512 byte multiple padding bytes are added to ensure the image is an exact multiple of 512 bytes If this occurs a new checksum is calculated and replaces an existing checksum value 2 7 16 Generating Capsule Update Files This section provides the overview for generating Capsule files Capsules are formatted variable length data structures that are passed from runtime back to the preboot phases PEI DXE BDS They are intended to be the major vehicle for delivering firmware volume changes Capsules are constructed with a capsule header and the capsule volume Content within the capsule volume usually includes a Firmware Volume as well as a Configuration Results CR file The CR file is a string of Internal Forms Representation IFR name value pairs as defined by the Human Interface Infrastructure HII After identifying and creating the Firmware Volume that will be included in the capsule the capsule header will be constructed The header is constructed as follows The capsuleGuid defines the format of the capsule data including any optional header information The format for a capsule is shown in Figure 15 1 22 May 2010 37 BUILD 31 16 15 Capsule D ata u Capsule Header Figure 17 EFI Capsule Layout 2 7 16 1 Reference Implementation Capsule generation and content The reference build tool provides functionality to generate capsules The capsule data content is defined in the FDF file fo
88. integrator The reference design Nt32 Platform emulation environment contains a virtual flash device The content within this virtual FD is laid out per Figure 4 0200290000 Ox0029FFFF 0x0028E000 Ox0028FFFF NY Store Event Log 0x0028C00 0x0028D FFF 0x00280000 0 0028BFFF FYMAIN_ Compact 0 x00000000 0x0027FFF Figure 4 NT32 Flash Device Layout Figure 5 represents a typical IA32 X64 FD layout where SEC and PEI code is located in the FV Recovery section and the remaining drivers are located in a GUIDED encapsulation compressed section designated as FVMAIN Compact May 2010 1 22 EN Recovery OxFFFDOOOO OxFFFCOOOO OxFFFBEOQOO NV Store Event Log OxFFFBCOOO OxFFFBADOO OxFFFBOOOO EMAIN Compact OsFFFOOOOO Figure 5 Typical IA32 X64 Flash Device Layout Figure 6 represents a typical IPF FD layout May 2010 Design Discussion BUILD FY Recovery Uncompressed SEC amp PEI Foundation Modules OxFFCEOOOO OxFFBEOOOO OxFFBCODOD NY Store Event Log OxFFBAODI0 OxFFBADODO OxFFAEOOOO FYMAIN Compact Compressed FY containing After Memory PEI Foundation Modules PEIMs DXE Drivers UEFI Drivers and UEFI Applications 0xFF800000 Figure 6 Typical IPF FD Layout All of these layouts assume only one flash device with the virtual memory addresses listed for each section within the FD Note More than one flash device may be present within a platform so the images may be split ov
89. izo IPF definitions bed zg Aiz dd izo ICC IPF CC PATH nologo LTCG DEF ICC_BIN64 icl exe icl exe needs cl exe from Visual Studio ICC IPF CC DLL ICC IPF SLINK PATH xilib exe needs lib exe from Visual ICC IPF SLINK DLL ICC IPF DLINK PATH ICC IPF PP PATH ICC IPF VFRPP PATH ICC IPF APP PATH ICC IPF ASM PATH ICC IPF ASLCC PATH ICC IPF ASLPP PATH ICC IPF ASLDLINK PATH DEBUG ICC IPF CC FLAGS DEF MS VS BIN DEF ICC_BIN64 xilib exe Studio DEF MS VS BIN DEF MS VS DLL DEF ICC_BIN64 xilink exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 ias exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 icl exe DEF ICC_BIN64 xilink exe nologo c WX W4 GX Gy FIS DEST DIR DEBUG AutoGen h QIA64 fr32 GF Zi RELEASE ICC IPF CC FLAGS nologo c WX W4 GX Gy FIS DEST DIR DEBUG AutoGen h QIA64 fr32 GF DEBUG ICC IPF ASM FLAGS debug F COFF32 RELEASE ICC IPF ASM FLAGS COFF32 DEBUG ICC IPF DLINK FLAGS N us X explicit M ilp64 N us X explicit M ilp64 od od N so N so NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG S BASE NAME map 74 PDB DEST DIR DEBUG BASE NAME pdb DEBUG NOLOGO NODEFAU
90. kenne rd he 79 5 9 VAT QU Fig erraten 86 HA dose IUIUS 88 May 2010 1 22 Build Environment 20 00 00 00 ann ann nn nan man nnnnnnnannan ann ann ann ann ann ann ann rana nn 95 6 1 Environment Variables rss 95 6 1 1 Required Environment Variables rss 95 6 1 2 Optional Environment Variables nnen oenen mmm 96 EEEa bizizale zen ses ee 96 6 2 1 The precedence of what platform or module gets built 97 6 2 2 The precedence of the TARGET value seen 97 6 2 3 The precedence of the TARGET ARCH values esses 97 6 2 4 Third Party tools using t TOOL CHAIN TAO 98 6 2 5 Precedence of FLAGS values rss 98 6 2 6 Precedence of Macro Definitions rss 98 6 2 7 Precedence of PCD Values ss 99 6 3 Third Party Tool Flags tre ee 99 AuloGen St ge cc 105 INEO UIDI 105 7 2 Auto generation PTOCBSS occa nahen 106 7 2 1 Determine What to Build rrura 106 7 2 2 Parse file pointed to by TOOL CHAIN CONF rrura 109 7 2 3 Parse build rule txt specified by BUILD RULE CONF and ADD BUILD RULE 109 1 2 4 Parse DSG EDE INF DEC TGS ae ra dataren 110 T2 5 POSLPrOCESSING ae oco cocta re 110 7 3 AUIO generaled Code ennen aren leer ah ur 111 7 3 1 Dependency expression file rss 111 T3 2 e Sting Pack isn ee ee ae bre e a Ebor aste 111 T22 AutoGen h AAE 113 7 3 4 AutoGenic flle scr d a EET EE d E o ETAn 119 7 4 Auto generated Makefiles
91. less than 0x01000000 16MB The F sFileHeader IntegrityCheck Checksum Header is set to 0 as are the Checksum File and FileHeader State prior to calculating and setting the checksum of the header If the FFs_ATTRIB_CHECKSUM bit is set in the F sFileHeader Attributes then the checksum for the remainder of the Ffs content must be generated and placed in the Checksum File part of the F sFileHead IntegrityCheck structure The r sFileHeader State is zeroed the EFI FILE HEADER CONSTRUCTION EFI FILE HEADER VALID and EFI FILE DATA VALID bits are set 2 7 8 1 Reference Implementation FDF file The reference build uses the FDF file to specify construction of the FD FVs and FFS files as well as how to construct the different EFI Sections what content is put into each section Flags for attributes and alignment values are specified in the FDF file These values are used to set the bits in FFS Header As an example if multiple sections are specified with different alignment values only the maximum value of the alignment is used and all sections are aligned to that value Additionally the sections are placed into the FFS in the order they appear in the FDF or specified by the Rules section of the FDF configuration file Each driver is put into an FFS of its own Also EDK II expects the ordering of PEIM and DXE ffs files to start with a optional dependency section followed by the PE32 user interface and finally the version sections 2 7 9
92. must be compiled before they can run This should be relatively easy if the machine has the standard compiler tools In the best case the developer should just be able to type the following command GenFv help And then run the make command suggested by the output of the command Being able successfully run the BaseTools does not mean that your build environment is fully set up If you want to use a GCC based compiler for UEFI PI development you should refer to the GCC section of this document for instructions on how to build the UEFI PI GCC cross compiler It is also likely that you will need to modify the Conf tools def txt and Conf target txt files 4 7 5 Building Nt32 Emulation Environment On a Windows development workstation once these tag names and paths have been checked the developer only needs to type build to build the Nt32 emulation platform In order to run the emulation environment type build run after the build successfully completes If the developer experiences problems with the build the most typical issues are related to the paths and tool chain tag name used by the build The following are most common May 2010 75 BUILD 1 Forgetting to use the nt32 switch on edksetup bat To resolve this issue a Rerun edksetup bat nt32 b Retry the build 2 Compiler tools not found To resolve this issue a Either the wrong tool chain tag was used or the location of the tools for the tool chain tag were not fou
93. must be exactly eight digits so 01234567 is valid while 1234567 is not valid A superscript number n within curly braces followed by a comma indicates the minimum number of occurrences of the item with no maximum number of occurrences A superscript number n within curly braches preceded by a comma indicates a maximum number of occurrences of the item un A super script number n followed by a comma and a number m indicates that the number of occurrences can be from n to m occurrences of the item inclusive 1 22 May 2010 7 BUILD May 2010 1 22 Design Discussion 2 Design Discussion This section of the document provides an overview to the build process for UEFI and PI compliant modules This includes existing EDK components and new EDK II modules Note Path and Filename elements within the EDK Il Meta Data files and command line arguments are case sensitive in order to support building on UNIX style operating systems 2 1 Reference Implementation UEFI amp PI formats EDK II Build Tools follow both the UEFI and PI specifications for file formats In some cases the tools have been extended to follow the Intel Innovation Framework for 2 2 Development Environments The EDK II build environment must support development workstations running Microsoft Windows operating systems or Linux operating systems or Apple Mac OS X operating systems In addition multiple compiler tools chains from
94. nologo E TC DVFRCOMPILE exe w4 Gs8192 Gy D w4 Gs8192 Gy D nologo c WX W3 coff Cx Zd Zi nologo c WX W3 coff Cx Zd NOLOGO NODEFAULTLIB IGNORE 4086 xdata D SECTION pdata D MACHINE 1386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG PDB DEBUG DIR BASE NAME pdb NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 RELEASE MYTOOLS IA32 DLINK FLAGS May 2010 1 22 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text PDB DEBUG DIR BASE NAME pdb MYTOOLS IA32 ASMLINK FLAGS nologo tiny THER HE HE HEHE HE HE HE HE HE NG x64 definitions HEHEHE HE HE HEHE HE HE HE HE HE HEHE H H HH MYTOOLS X64 DLL DEF VS2005 DLL MYTOOLS X64 MAKE PATH DEF VS2005 BIN Wnmake exe MYTOOLS X64 CC PATH MYTOOLS X64 SLINK PATH MYTOOLS X64 DLINK PATH MYTOOLS X64 PP PATH MYTOOLS X64 VFRPP PATH MYTOOLS X64 APP PATH MYTOOLS X64 ASM PATH MYTOOLS X64 ASLCC PATH MYTOOLS X64 ASLPP PATH MYTOOLS X64 ASLDLINK PATH DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 lib exe DEF VS2005_BINX64 link exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 m164 exe DEF VS2005 BINX64 cl exe DEF VS2005 BINX64 cl exe D
95. not always get built It also provides pointers to the tools def txt file and the active build rule txt files All file names are relative to the system environment variable worksPacE No wildcard characters are permitted in this file All entries in this file are case sensitive While the values in this file filter what will be built the TARGET TARGET ARCH and TOOL CHAIN TAG values may also be overridden on the build tool s command line May 2010 1 22 1 22 MetaData File Specifications Prototype lt ToolsDef gt lt Platform gt lt Target gt lt TargetArch gt lt ToolsDef gt lt ToolTagName gt lt ThreadEnable gt lt BldRuleConf gt lt MoreBldRules gt lt Platform gt ACTIVE PLATFORM PlatformFile lt EOL gt lt Target gt TARGET TargetVal lt EOL gt lt TargetArch gt TARGET ARCH Arch lt EOL gt lt ToolsDef gt TOOL CHAIN CONF ToolDefs lt EOL gt lt ToolTagName gt TOOL CHAIN TAG TagName lt EOL gt lt ThreadEnable gt MAX CONCURRENT THREAD NUMBER lt NumThrds gt lt EOL gt lt NumThrds gt 1 9 0 9 lt BldRuleConf gt BUILD_RULE_CONF BuildRules lt EOL gt lt MoreBldRules gt ADD BUILD RULE MoreBuildRules lt EOL gt Parameters PlatformFile Specify the WORKSPACE relative Path and Filename of the platform DSC file that will be used for the build This line is required only i
96. of the GenFw tool are discussed in Section 9 1 and Section 9 2 8 7 Generate Platform Images The final images generated by building a platform are always FVs or FDs if an FDF file is declared in platform s DSC file The GenFds tool is used for this purpose This is the final step of building a platform which is called in top level makefile For details regarding GenFds please refer to Section 9 1 Section 9 2 and Section 9 3 May 2010 149 BUILD 150 May 2010 1 22 ImageGen Stage FLASH Images 9 ImageGen Stage FLASH Images This chapter describes the processing of the EFI files generated by the MAKE Stage into FLASH binary images Some of the PCDs defined or used in conditional directives in the FDF are set in the platform s DSC file The tools must make at least one pass over the DSC file to get PCD values for conditional directives and other PCD entries used in the FDF file If a Feature Flag PCD value used in a conditional directive cannot be determined the build should break 9 1 Overview of Flash Device Layout The GenFds tool is typically called as the last step of a platform build s MAKE Stage The build exe command will setup the call to GenFds and let the Make utility call the program The GenFds program can also be executed by the developer from the command line In order to execute from the command line the tool needs to have it s environment setup The following is an example of executing GenFds a
97. prior to putting the driver into an FV By default the reference build system will strip the reloc section of all modules May 2010 1 22 Design Discussion 2 6 7 EFI FV FILETYPE PEIM Notes There are three types of PEIMs e XIP must execute from ROM e PEIMs that must be executed from memory and e PEIMs that will execute in from memory if memory is available If no memory is available then the PEIMs can execute from ROM Some PEIMs are executed from ROM some PEIMs are executed only from memory and some PEIMs may be executed from memory only if memory is present For PEIMs executed only from ROM the image should be converted to a terse image the reloc section stripped for size optimization and module cannot be compressed the images must be re based to the location in ROM PEIMs that execute from memory should never have the reloc section stripped but may be converted to terse images and may be compressed PEIMs that are coded to register for shadow i e they may be run from memory if memory is present should not have the reloc section stripped The reference build implementation uses a keyword SHADOW in the module s INF file to indicate this mode setting SHADOW TRUE By default the reference build implementation will strip the reloc section of PEIMs PEIMs must specify the sHapow TRUE in the module s INF file to prevent this Additional flags in the FDF file RELOCS_RETAINED and RELOCS STRIPPED are provided to
98. size is greater than 16 bits the build should break Specified parsing priority rules for definitions and values Added report generator syntax as part of the build Add support for Auto alignment for PE32 and TE images Add support for specifying block information for capsules FeatureFlagExpression processing should allow C style expression syntax and follow C rules for processing 1 22 Grammatical and formatting changes Added Module types May 2010 appendix Version 1 2 May 2010 Build iv May 2010 1 22 Contents DOVER CUO EAE 1 AE GUAL 1 1 2 Target Audience m Pr EEA 1 1 3 Related Information rrura 1 AE Bla 2 1 5 Conventions Used in this Document sa 5 1 5 1 Data Structure Descriptions rss 5 1 5 2 Pseudo Code Conventions rss 6 1 5 3 Typographic Conventions un ae 6 Design DISCUSSION an ee nn 9 2 1 Reference Implementation UEFI amp PI formats ss 9 2 2 Development Environments rrura 9 2 2 1 Reference Implementation Build process restrictions eneen ennn 9 2 3 UEFI PI Firmware bala AAE 9 2 4 Boot Sequence 11 Ee egie ai ebei ga KAE 12 24 2 Pre EFI Initialization PEl usw ae 12 2 4 3 Drive Execution Environment DXE sua 13 24 4 Boot Device Selection BDS san eot une npn xxu dinner 13 2 4 5 Transient System Load TLS and Runtime URTA rss 13 2 4 6 Aller Life IAL 13 2 9 Typical Flash Part EA eU nee 13 2 6 Generic Build Process rrura 16 2 0 1 EFLSEGTION RII cem 17
99. space gEfiNt32PkgTokenSpaceGuid gEfiMdeModulePkgTokenSpaceGuid Each global PCD item contains one or more lines 12 5 1 Required line The first line is required P F lt PcdCName gt lt PcdType gt lt DatumType gt PcdValue e P means the Pcd s value is override in DSC file e F means the PCD s value is override in FDF file e If no P or F mean the PCD s value comes from DEC file Example P PcdWinNtFirmwareVolume FIXED VOID L Fv Nt32 f d 12 5 2 Optional lines 12 5 2 1 First optional line e if lt PcdType gt is DYN HII lt VariableGuid gt lt VariableName gt lt Offset gt Example P PcdGMchDvmtTotalSize DYN HII UINT8 0 gSysConfigGuid L Setup OxAA e if PcdType is DYN VPD 172 December 2007 1 22 Reports lt Offset relative to VPD base address Example F PcdVpdSample DYN VPD UINT32 1 0x0001FFF 12 5 2 2 Second optional line The second optional line is present if the value from the DEC was overridden It is formatted as follows DEC DEFAULT lt Value in DEC gt Example P PcdWinNtFirmwareFdSize FIXED UINT32 DEC DEFAULT 0x2a0000 0x0 12 5 2 3 Additional optional lines Additional lines are optional and show module level overrides Each module with an override is listed with the value of the override e M means the PCD s value is module level override Each line is formatted as follows M Inf Filename Example P Pc
100. the C code files the Makefiles then generates the object files for libraries Generates the C code files the Makefiles generates the object files for libraries generates the object files for the modules then links them then calls genfw for each of the intermediate final objects to create efi files Generates the C code files the Makefiles generates the object files for libraries generates the object files for the modules links them calls genfw for each of the intermediate final objects to create efi files generates SECTION files generates FFS files generates FV files and finally generates FD files Target makefiles genlibs and skip autogen genmodules and skip autogen genefi and skip autogen gensections and skip autogen genffs and skip autogen genfvs and skip autogen genfd and skip autogen gencapsule and skip autogen genOptionRom and skip autogen Description Generates only the Makefiles assumes that genc has completed and all C code files exist Will only generate the object files for libraries Generates the object files for the modules then links them with library object files that must already exist into intermediate object files Processes the intermediate PE32 PE32 object files that must already exist modifying the header to match EFI IMAGE FILE HEADER with output files having a efi extension For each efi file will call the
101. the comment character Examples this is a comment line Unicode Text File This is also a valid comment Unicode Text File This is not valid The last example is not valid as the section header data element format is text with the square brackets included as part ofthe data element 5 1 3 Valid Entries All entries must appear on a single line with entries terminated by either a new line or 1 22 May 2010 77 BUILD a comment Comments must be scripting style using the hash character See previous section above for details 5 1 4 Macro statements tools_def txt only The use of MACRO statements is limited in EDK II tools_def txt meta data file to be local to the meta data file The format and usage for the macro statements is DEFINE MACRO Path MACRO filename foo Any defined MACRO will be expanded by tools when they encounter the entry in the section Three environment variables WORKSPACE EDK SOURCE and EDK_TOOLS_PATH are never expanded when data is emitted to Makefiles The macro statements are positional in that only statements following a macro definition are permitted a macro cannot be used before it has been defined MACRO statements are permitted in DSC and FDF files to reference PATH statements assign values to PCDs and to provide a minimum level of directive statements refer to the corresponding specification for additional details 5 1 5 Conditional Directive Statements 78
102. there are CONSTRUCTORSs defined in Defines section in INF file of the library instances that are being linked to If CONSTRUCTOR defined in INF If MODULE TYPE BASE include statement AutoGen c EFI STATUS EFIAPI lt CONSTRUCTOR gt VOID I If MODULE TYPE PEI CORE MODULE TYPE PEIM include statement AutoGen c EFI STATUS EFIAPI lt CONSTRUCTOR gt IN EFI PEI FILE HANDLE EileHandle IN EFI PEI SERVICES PeiServices If MODULE TYPE DXE CORE MODULE TYPE DXE DRIVER MODULE TYPE DXE SMM DRIVER MODULE TYPE DXE RUNTIME DRIVER MODULE TYPE DXE SAL DRIVER MOODULE TYPE UEFI DRIVER MODULE TYPE UEFI APPLICATION 1 22 May 2010 121 BUILD include statement AutoGen c EFI_STATUS EFIAPI lt CONSTRUCTOR gt IN EFI_HANDLE ImageHandle IN EFI_SYSTEM TABLE SystemTable E wi End CONSTRUCTOR defined in INF If MODULE TYPE BASE include statement AutoGen c VOID EFIAPI ProcessLibraryConstructorList VOID E If MODULE TYPE PEI CORE MODULE TYPE PEIM include statement AutoGen c VOID EFIAPI ProcessLibraryConstructorList IN EFI PEI FILE HANDLE FileHandle IN EFI PEI SERVICES PeiServices If MODULE TYPE DXE CORE MODULE TYPE DXE DRIVER MODULE TYPE DXE SMM DRIVER MODULE TYPE DXE RUNTIME DRIVER MODULE TYPE DXE SA
103. when its entry point exits UEFI Driver A driver that follows the UEFI specification UEFI Specification Version 2 3 Current version of the EFI specification released by the Unified EFI Forum UEFI Platform Initialization Specification 1 2 Current version of the PI specification released by the Unified EFI Forum This specification builds on the Intel Platform Innovation Framework for EFI specifications and transfers ownership of most of these specifications from Intel to a non profit industry trade organization Unified EFI Forum A non profit collaborative trade organization formed to promote and manage the UEFI standard For more information see www uefi org VFR Visual Forms Representation 1 5 Conventions Used in this Document This document uses typographic and illustrative conventions described below 1 5 1 Data Structure Descriptions Intel processors based on 32 bit Intel architecture IA 32 are little endian machines This distinction means that the low order byte of a multibyte data item in memory is at the lowest address while the high order byte is at the highest address Processors of the Intel Itanium processor family may be configured for both little endian and big endian operation All implementations designed to conform to this specification will use little endian operation In some memory layout descriptions certain fields are marked reserved Software must initialize such fields to zero and ignor
104. 0 IPF CC FLAGS nologo c WX GS X W4 EHs c GR Gy Os GL FIAutoGen h QIPF fr32 DEBUG DDK3790 IPF ASM FLAGS N us X explicit M ilp64 N so W4 d debug RELEASE DDK3790 IPF ASM FLAGS N us X explicit M ilp64 N so W4 DEBUG DDK3790 IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEST DIR DEBUG BASE NAME pdb DEBUG RELEASE DDK3790 IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 May 2010 213 BUILD DRIVER MAP DEST DIR DEBUG BASE_NAME map PDB DEST DIR DEBUG BASE_NAME pdb Ld HE FE HE FE HE FE HE HE HEHE HEHE HEH EBC definitions FEFE HE FE EE ERE E FE HE HE HEHE HEHE HHH DDK3790 EBC FAMILY INTEL DDK3790 EBC PP PATH DEF EBC_BIN iec exe DDK3790 EBC CC PATH DDK3790 EBC DLINK PATH DDK3790 EBC SLINK PATH DEF EBC_BIN iec exe DEF EBC_BIN link exe DEF EBC_BIN link exe DDK3790 EBC VFRPP PATH DEF EBC_BIN iec exe DDK3790 EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT DDK3790 EBC SLINK FLAGS lib
105. 005x86 APP FLAGS nologo E TC VS2005x86 PP FLAGS nologo E TC FIAutoGen h VS2005x86 VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h Ld EE FE FE FE FE FE HE HE HEHE HEHE HEH ASL definitions TEHETHER ER E FE HE HE HEHE HEHE HEH VS2005x86 ASL PATH DEF WIN IASL BIN VS2005x86 ASL FLAGS 202 May 2010 1 22 1 22 VS2005x86 ASL OUTFLAGS VS2005x86 ASLCC FLAGS VS2005x86 ASLPP FLAGS VS2005x86 ASLDLINK FLAGS TEE HERE ERE HER EHE HE RE HE IA32 definitions bed zg Aiz HE E HEHH VS2005x86 IA32 DLL VS2005x86 IA32 MAKE PATH VS2005x86 IA32 CC PATH VS2005x86 IA32 VFRPP PATH VS2005x86 IA32 SLINK PATH VS2005x86 IA32 DLINK PATH VS2005x86 IA32 ASMLINK PATH VS2005x86 IA32 APP PATH VS2005x86 IA32 PP PATH VS2005x86 IA32 ASM PATH VS2005x86 IA32 ASLCC PATH VS2005x86 IA32 ASLPP PATH VS2005x86 IA32 ASLDLINK PATH VS2005x86 IA32 MAKE FLAG DEBUG VS2005x86 IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c RELEASE VS2005x86 IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c DEBUG_VS2005x86 IA32 ASM FLAGS RELEASE VS2005x86 IA32 ASM FLAGS DEBUG VS2005x86 IA32 DLINK FLA DEF IASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT ASLDLINK FLAGS DEF VS2005x86 DLL DEF VS2005x86 BIN nmake exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN lib exe DEF VS2005x86 BIN link exe DEF WINDDK_
106. 0x05 EFI FV FILETYPE PEIM PEI Module PEIM 0x06 EFI FV FILETYPE DRIVER DXE driver 0x07 EFI FV FILETYPE COMBINED PEIM DRIVER Combined PEIM DXE driver 0x08 EFI FV FILETYPE APPLICATION Application 0x09 EFI FV FILETYPE SMM Contains a PE32 image 0x0A that will be loaded into SMRAM EFI FV FILETYPE FIRMWARE VOLUME IMAGE An embedded Firmware OxOB Volume Image EFI FV FILETYPE COMBINED SMM DXE Contains PE32 image that OxOC will be dispatched by the DXE Dispatcher and will also be loaded into SMRAM EFI FV FILETYPE SMM CORE SMM Foundation OxOD EFI FV FILETYPE OEM OEM File Types OxCO OxDF EFI FV FILETYPE DEBUG Debug Test File Types OxEO OxEF EFI FV FILETYPE FFS Firmware File System OxFO OxFF Specific File Types EFI FV FILETYPE PAD Pad file for FFS OxFO 2 6 3 Firmware Volumes One or more FFS files are combined into a Firmware Volume FV The format for a an FV is a header followed by an optional extended header followed by zero or more FFS files Figure 11 illustrates the layout of the FV 20 May 2010 1 22 Design Discussion 16 15 N number of FFS Files N Extended Entry Type GE EE ES El HEA Optional FV Extended Header Figure 11 General FV Layout Multiple FV files each of which is just a logical firmware device can be combined into a single FD image 1 22 May 2010 21 BUILD Within the context of modules error messages within the code are written in plain text English ASCII
107. 1 22 1 22 HEHEHE HE HE HEHE HE HE HE HE HE HEHE H H HH X64 definitions FEFE EE FE HE ER E FE HE HE HEHE RE HEH UNIXGCC X64 CC PATH UNIXGCC X64 ASLCC PATH UNIXGCC X64 SLINK PATH UNIXGCC X64 DLINK PATH UNIXGCC X64 ASLDLINK PATH UNIXGCC X64 ASM PATH UNIXGCC X64 PP PATH UNIXGCC X64 ASLPP PATH UNIXGCC X64 VFRPP PATH UNIXGCC X64 RC PATH DEF UNIXGCC X64 PETOOLS PREFIX gcc DEF UNIXGCC X64 PETOOLS PREFIX gcc DEF UNIXGCC X64 PETOOLS PREFIX ar DEF UNIXGCC X64 PETOOLS PREFIX 1d DEF UNIXGCC_X64_PETOOLS PREFIX 1d DEF UNIXGCC X64 PETOOLS PREFIX gcc DEF UNIXGCC X64 PETOOLS PREFIX gcc DEF UNIXGCC X64 PETOOLS PREFIX gcc DEF UNIXGCC X64 PETOOLS PREFIX gcc DEF UNIXGCC X64 PETOOLS PREFIX windres UNIXGCC X64 CC FLAGS fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno array bounds c include AutoGen h mno red zone Wno address UNIXGCC X64 RC FLAGS J re 0 coff bed zg Aiz dd izo IPF definitions bed zg Aiz HE E HHHH UNIXGCC IPF CC PATH UNIXGCC IPF ASLCC PATH UNIXGCC IPF SLINK PATH UNIXGCC IPF DLINK PATH UNIXGCC IPF ASLDLINK PATH UNIXGCC IPF ASM PATH UNIXGCC IPF PP PATH UNIXGCC IPF ASLPP PATH UNIXGCC IPF VFRPP PATH UNIXGCC IPF OBJCOPY PATH UNIXGCC IPF SYMRENAME PATH UNIXGCC IPF RC PATH DEF UNIXGCC IPF PETOOLS PREFIX gcc DEF UNIXGCC IPF PETOOLS PREFIX gcc DEF UNIXGCC IPF PETOOLS PREFIX ar DEF UNIXGCC IPF PETOOLS PREFIX ld DEF UNIXGCC IPF PE
108. 3 234 ICCx86 ASL FLAGS ICCx86 ASL OUTFLAGS ICCx86 ASLCC FLAGS ICCx86 ASLPP FLAGS ICCx86 ASLDLINK FLAGS TEE HER ERE E EHE HEB E HE IA32 definitions bed zg Az d HE E E E HH ICCx86 IA32 CC PATH ICCx86 IA32 SLINK PATH ICCx86 IA32 SLINK DLL ICCx86 IA32 DLINK PATH ICCx86 IA32 ASMLINK PATH ICCx86 IA32 PP PATH ICCx86 IA32 VFRPP PATH ICCx86 IA32 APP PATH ICCx86 IA32 ASM PATH ICCx86 IA32 ASM DLL ICCx86 IA32 ASLCC PATH ICCx86 IA32 ASLPP PATH ICCx86 IA32 ASLDLINK PATH DEBUG ICCx86 IA32 CC FLAGS RELEASE ICCx86 IA32 CC FLAGS DEBUG ICCx86 IA32 ASM FLAGS RELEASE ICCx86 IA32 ASM FLAGS ICCx86 IA32 SLINK FLAGS DEBUG ICCx86 IA32 DLINK FLAGS OPT REF OPT ICF 10 MAP ALIGN 32 SECTION DEF IASL OUTFLAGS DEF ICC WIN ASLCC FLAGS DEF ICC WIN ASLPP FLAGS DEF ICC WIN ASLDLINK FLAGS DEF ICC_BIN32x86 icl BUILD exe DEF ICC_BIN32x86 xilib exe xilib exe needs lib exe from Visual Studio DEF VS2005x86 BIN DEF ICC_BIN32x86 xilink exe DEF WINDDK_BIN16 link16 exe DEF ICC_BIN32x86 icl DEF ICC_BIN32x86 icl DEF ICC_BIN32x86 icl DEF VS2005x86 BIN ml DEF VS2005x86 DLL DEF ICC_BIN32x86 icl DEF ICC_BIN32x86 icl exe exe exe exe exe exe DEF ICC BIN32x86 xilink exe nologo c WX w4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR L INTEL FIAutoGen h EHs c GF Zi Gm nologo c
109. 32 FAMILY GCC XCODE32 BUILDRULEFAMILY XCODE XCODE32 ASL PATH usr bin iasl XCODE32 MAKE PATH make This tool needs to be installed seperatly from Xcode 3 2 XCODE32 MTOC PATH Developer usr bin mtoc XCODE32 DSYMUTIL PATH usr bin dsymutil DEBUG XCODE32 MTOC FLAGS RELEASE XCODE32 MTOC FLAGS align 0x20 d DEBUG DIR MODULE NAME dll align 0x20 HEHEHE HE HE HEHE HE AGG IA32 definitions FEFE EE FE HE ERE E FE HE HE HEHE HEHE HEH 1 22 May 2010 245 246 BUILD XCODE32 IA32 CC PATH gcc XCODE32 IA32 SLINK PATH libtool XCODE32 IA32 DLINK PATH ld XCODE32 IA32 ASM PATH as XCODE32 IA32 PP PATH gee XCODE32 IA32 VFRPP PATH gcc XCODE32 IA32 ASL PATH iasl XCODE32 IA32 ASLCC PATH gcc XCODE32 IA32 ASLPP PATH gcc XCODE32 IA32 ASLDLINK PATH ld DEBUG XCODE32 IA32 DLINK FLAGS arch i386 u IMAGE ENTRY POINT e _ IMAGE ENTRY POINT preload segalign 0x20 slow stubs pie all load dead strip segladdr 0x240 read only relocs suppress map DEST DIR DEBUG BASE NAME map RELEASE XCODE32 IA32 DLINK FLAGS arch i386 u IMAGE ENTRY POINT e _ IMAGE ENTRY POINT preload segalign 0x20 slow stubs pie all load dead strip segladdr 0x220 read only relocs suppress map DEST DIR DEBUG BASE NAME map XCODE32 IA32 SLINK FLAGS static o DEBUG XCODE32 IA32 ASM FLAGS arch i386 g RELEASE XCODE32 IA32 ASM FLAGS arch i
110. 386 XCODE32 IA32 PP FLAGS arch i386 E x assembler with cpp include DEST DIR DEBUG AutoGen h XCODE32 IA32 VFRPP FLAGS arch i386 x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h DEBUG XCODE32 IA32 CC FLAGS arch i386 save temps g O0 combine mms bitfields fshort wchar fno strict aliasing Wall Werror Wno missing braces c include AutoGen h mdynamic no pic fno stack protector RELEASE XCODE32 IA32 CC FLAGS arch i386 Oz combine mms bitfields fshort wchar fno strict aliasing Wall Werror Wno missing braces fomit frame pointer c include AutoGen h mdynamic no pic fno stack protector XCODE32 IA32 ASLCC FLAGS arch i386 x c save temps g O0 mms bitfields fshort wchar fno strict aliasing Wall Werror Wno missing braces c include AutoGen h mdynamic no pic XCODE32 IA32 ASLDLINK FLAGS arch i386 e main preload segalign 0x20 slow stubs pie segladdr 0x220 read only relocs suppress map DEST DIR DEBUG BASE NAME map XCODE32 IA32 ASLPP FLAGS XCODE32 IA32 ASL FLAGS arch i386 x c E HH X64 definitions still a work in progress This tool chain does not produce the correct ABI it is just used to compile the code HH XCODE32 X64 CC PATH gcc 4 2 XCODE32 X64 SLINK PATH libtool XCODE32 X64 DLINK PATH ld XCODE32 X64 ASM PATH as XCODE32 X64 PP PATH gcc 4 2 XCODE32 X64 VFRPP PATH gcc 4 2 XCODE32 X64 ASL
111. 5 Express Standard and Pro ICCx86 win64 Intel C Compiler V9 1 x86 Intel EBC Intel ASL VS2005x86xASL win64 Microsoft Visual Studio 2005 Team Suite Edition x86 Intel EBC Microsoft ASL also compatible with VS 2005 Express Standard and Pro ICCx86xASL win64 Intel C Compiler V9 1 x86 Intel EBC Microsoft ASL CYGGCCx86 win64 CygWin GCC x86 Intel EBC x86 Intel ASL CYGGCCx86xASL win64 CygWin GCC x86 Intel EBC x86 Microsoft ASL Commented out All versions of VS2005 use the same standard install directory AEAEE FEE FEE IE HERE E HE E FE IEEE E FE EA AE FE FE FE FE IER FE FE FE FE FE HH HH FE FE FEAE HH FE AE FEE FE HEHE FE dik HH FE FE FE FE FE AE HE FEFE EE FE HE EE EE FE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE HE HE E HE E HE E HE E HE E HE HE HE HE HE HE FE HE HE E FE HE E HE FE HE HE E FE HE E FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE HE IH E HE Supported Tool Chain Family MSFT Microsoft GCC GNU GCC INTEL INTEL FEFE EE FE HE EE EE FE FE HE FE HE FE HE FE HE FE HE FE HE FE HE ETERS HE E HE E HE E HE HE HE HE HE HE HE HE HE HE AA FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE HE IN E HE FEFE HE FE HE EE EE FE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE HE HE E HE E HE E HE HE HE E HE E HE HE HE A FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE HE HE HH HE Intel EFI Byte Code Compiler Template May
112. 6 rename section data hii TEE HERE ER E EHE HEHE HEHE HE IPF definitions bed zg Ard dd E IG E ELFGCC IPF CC PATH DEF ELFGCC BIN gcc ELFGCC IPF ASLCC PATH DEF ELFGCC BIN gcc ELFGCC IPF SLINK PATH DEF ELFGCC BIN ar ELFGCC IPF DLINK PATH DEF ELFGCC_BIN 1d ELFGCC I PF ASLDLINK PATH DEF ELFGCC BIN ld ELFGCC IPF ASM PATH DEF ELFGCC_ BIN gcc ELFGCC IPF PP PATH DEF ELFGCC_ BIN gcc ELFGCC IPF ASLPP PATH DEF ELFGCC_ BIN gcc ELFGCC IPF VFRPP PATH DEF ELFGCC BIN gcc ELFGCC IPF RC PATH DEF ELFGCC BIN objcopy 1 22 May 2010 225 BUILD ELFGCC IPF CC FLAGS Os fshort wchar Wall Werror c include AutoGen h D EFI P64 ELFGCC IPF DLINK FLAGS nostdlib shared entry IMAGE ENTRY POINT u IMAGE ENTRY POINT ELFGCC IPF SLINK FLAGS ELFGCC IPF ASM FLAGS c x assembler imacros DEST DIR DEBUG AutoGen h ELFGCC IPF PP FLAGS DEST DIR DEBUG AutoGen h E x assembler with cpp include ELFGCC IPF VFRPP FLAGS x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h ELFGCC IPF RC FLAGS I binary O elf64 ia64 little B ia64 rename section data hii FEFE AE HE HE EHE FE AE FEFE FE HE FE AE E FE AE FE HE EHE EA EA EAO IE FE AE FE FE E HE FE AE FE FE E FE FE AE HE FE AE FE FE EA EA EA E FE FE E BEE AE HEHE EE A E AG Intel R C Compiler Version 9 1 IPF Intel R C Compiler for Itanium R Version 9 1 Build 20060928 Pac
113. 6 IPF ASM PATH ICCx86 IPF ASLCC PATH ICCx86 IPF ASLPP PATH ICCx86 IPF ASLDLINK PATH DEBUG ICCx86 IPF CC FLAGS DEF VS2005x86 BIN DEF VS2005x86 DLL DEF ICC_BIN64x86 xilink exe DEF ICC_BIN64x86 icl exe DEF ICC_BIN64x86 icl exe DEF ICC_BIN64x86 icl exe DEF ICC_BIN64x86 ias exe DEF ICC_BIN64x86 icl exe DEF ICC_BIN64x86 icl exe DEF ICC_BIN64x86 xilink exe nologo c WX W4 GX Gy Od FIS DEST DIR DEBUG AutoGen h QIA64 fr32 GF Zi RELEASE ICCx86 IPF CC FLAGS nologo c WX WA GX Gy Od FIS DEST DIR DEBUG AutoGen h QIA64 fr32 GF DEBUG ICCx86 IPF ASM FLAGS d debug F COFF32 RELEASE ICCx86 IPF ASM FLAGS F COFF32 DEBUG ICCx86 IPF DLINK FLAGS N us X explicit M ilp64 N so W3 N us X explicit M ilp64 N so W3 NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG S BASE NAME map PDB DEST DIR DEBUG S BASE NAME pdb DEBUG RELEASE ICCx86 IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER May 2010 1 22 SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEST DI
114. 7 4 1 1 2 Module information These come from Defines section in the INF file and Components section in DSC file 1 22 May 2010 137 BUILD Foreach InfFile include statement MODULE BUILD DIR MMakefile MODULE NAME getValue BASE N InfFile MODULE GUID getValue FILE GUID InfFIle MODULE VERSION getValue VERSION STRING InfFile MODULE TYPE getValue MODULE TYPE InfFile MODULE FILE BASE NAME getValue BASE NAME InfFile BASE NAME MODULE NAME MODULE RELATIVE DIR getDirPart InfFile MODULE DIR WORKSPACE getDirPart InfFile ME Example MODULE NAME HelloWorld MODULE GUID 6987936E ED34 44db AE97 1FASE4ED2116 MODULE VERSION 1 0 MODULE TYPE UEFI APPLICATION MODULE FILE BASE NAME HelloWorld BASE NAME MODULE NAME MODULE RELATIVE DIR MdeModulePkg Application HelloWorld MODULE DIR WORKSPACE MdeModulePkg Application HelloWorld 7 4 1 1 3 Build configuration These come from WORKSPACE Conf target txt command line options or Defines section in DSC file ARCH IA32 TOOLCHAIN TAG MYTOOLS TARGET DEBUG 7 4 1 1 4 Build directories These are determined by build tools Macro DEST_DIR_OUTPUT and DEST_DIR_DEBUG are generated for backward compatibility PLATFORM BUILD DIR WORKSPACE Build NT32 BUILD DIR WORKSPACE Build NT32 DEBUG_MYTOOLS BIN DIR BUILD_DIR IA32 LIB DIR BIN_DIR MODULE BUILD DIR BUILD DIR
115. 86 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D May 2010 239 240 BUILD Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rd ICCx86xASL X64 SLINK FLAGS TEE HERE ERE E EHE REE BE IPF definitions HEEE HE HE HEHE HE HE HE HEHE HEHE H H HH ICCx86xASL IPF CC PATH E icl exe needs cl exe from Visual Studio ICCx86xASL IPF CC DLL ICCx86xASL IPF SLINK PATH xilib exe needs lib exe from Visual Studio ICCx86xASL IPF SLINK DLL ICCx86xASL IPF DLINK PATH ICCx86xASL IPF PP PATH ICCx86xASL IPF VFRPP PATH ICCx86xASL IPF APP PATH ICCx86xASL IPF ASM PATH ICCx86xASL IPF ASLCC PATH ICCx86xASL IPF ASLPP PATH ICCx86xASL IPF ASLDLINK PATH DEBUG ICCx86xASL IPF CC FLAGS FI DEST DIR DEBUG AutoGen h QIA64 fr32 GF RELEASE ICCx86xASL IPF CC FLAGS FI DEST DIR DEBUG AutoGen h QIA64 fr32 GF DEBUG ICCx86xASL IPF ASM FLAGS W3 d debug F COFF32 RELEASE ICCx86xASL IPF ASM FLAGS W3 F COFF32 DEBUG ICCx86xASL IPF DLINK FLAGS OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER ata text nologo LTCG DEF ICC_BIN64x86 icl DEF VS2005x86 BIN DEF ICC_BIN64x86 xilib exe exe DEF VS2005x86 BIN DEF VS2005x86_ DLL DEF ICC_BIN64x86 xilink exe exe exe exe exe e
116. 86xASL IA32 ASLCC PATH VS2005x86xASL IA32 ASLPP PATH VS2005x86xASL IA32 ASLDLINK PATH VS2005x86xASL IA32 MAKE FLAG DEBUG VS2005x86xASL IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR RELEASE VS2005x86xASL IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR DEBUG VS2005x86xASL IA32 ASM FLAGS RELEASE VS2005x86xASL IA32 ASM FLAGS DEF MS ASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT ASLDLINK FLAGS DEF VS2005x86 DLL DEF VS2005x86 BIN nmake exe DEF VS2005x86_BIN cl exe DEF VS2005x86_ BIN cl exe DEF VS2005x86_BIN lib exe DEF VS2005x86_BIN link exe DEF WINDDK_BIN16 link16 exe DEF VS2005x86 BIN cl exe DEF VS2005x86_BIN cl exe DEF VS2005x86 BIN ml exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN link exe S nologo nologo c WX GS W4 Gs8192 D UNICODE Gy Zi Gm nologo c WX GS W4 Gs8192 D UNICODE GF GF nologo c WX W3 Cx coff Zd Zi nologo c WX W3 Cx coff Zd DEBUG VS2005x86xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION DLL ENTRY IMAGE ENTRY POINT SUB DEBUG RELEASE VS2005x86xASL IA32 DLINK FLA OPT REF OPT ICF 10 MAP ALIGN 32 S xdata D SECTION pdata D MACHINE I386 LTCG SYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER GS NOLOGO NODEFAULTLIB IGNORE 4086 ECTION xdata D SECTION pdata D MACHINE 1386 May 2010 207 208
117. A ER H ARMGCC ARM version of the GCC cross compiler ARMGCC FAMILY GCC ARMGCC MAKE PATH make FE HE HE HE FE FE HE HE EHH HE HE EERE ASL definitions FE EE HE ERE HH HE HE HE HEHE HE HE HEHE HH ARMGCC ASL PATH ARMGCCC ASL FLAGS ARMGCC ASL OUTFLAGS ARMGCC ASLPP FLAGS ARMGCC ASLCC FLAGS ARMGCC ASLDLINK FLAGS _ReferenceAcpiTable bed zg HERH dd izo ARM definitions bed zg Aiz d dd izo ARMGCC ARM ASLCC PATH ARMGCC ARM ASLDLINK PATH ARMGCC ARM ASLPP PATH ARMGCC ARM CC PATH ARMGCC ARM SLINK PATH ARMGCC ARM DLINK PATH DEF UNIX IASL BIN DEF IASL OUTFLAGS x E P X C DEF UNIXGCC_DLINK_FLAGS_COMMON entry DEF ARMGCC_BIN arm elf gcc DEF ARMGCC_BIN arm elf 1d DEF ARMGCC_BIN arm elf gcc DEF ARMGCC BIN arm elf gcc DEF ARMGCC BIN arm elf ar DEF ARMGCC_BIN arm elf 1d May 2010 251 252 BUILD ARMGCC ARM ASM PATH ARMGCC ARM PP PATH ARMGCC ARM VFRPP PATH DEF ARMGCC BIN arm elf as DEF ARMGCC BIN arm elf gcc DEF ARMGCC BIN arm elf gce Use default values or override in DSC file ARMGCC ARM ARCHCC FLAGS ARMGCC ARM ARCHASM FLAGS ARMGCC ARM ARCHDLINK FLAGS ARMGCC ARM PLATFORM FLAGS ARMGCC ARM INTRINSIC FLAGS CompilerIntrinsicsLib lib DEBUG ARMGCC ARM ASM FLAGS RELEASE ARMGCC ARM ASM FLAGS ARCHASM FLAGS mlittle endian g ARCHASM FLAGS mlittle endian ARMGCC ARM PP FLAGS A
118. A2 4b69 BA40B 72ABD6DD8708 DxeCore efi SECTION VERSION 1 2 3 INF VERSION 1 NT32 Dxe WinNtThunk Cpu Cpu inf FILE FV IMAGE EF41A0E1 40B1 481f 958E 6FBA4D9B12E76 SECTION GUIDED 3EA022A4 1439 4ff2 B4E4 A6F65A13A9AB SECTION FV IMAGE Dxe APRIORI DXE INF a a a inf INF a c c inf INF a b b inf INF a d d inf In the example above there are three FFS files in the Fv Root and one Encapsulated FV image The build tools will create an APRIORI file that will dispatch the DxE_core first then the CPU module second In the FV image named by the GUID Er41aoe there will be at least five FFS files the APRronr file named Dxe listing the GUID names of modules a inf c inf and b inf which will be dispatched in this order Once complete the d inf module may be dispatched 9 3 4 Create FFS Files from Leaf Sections Section 9 2 shows the INF and FILE statements in an FDF to describe FFS files that will be placed into FV The FILE statement is straight forward letting you know how an FFS file is organized as it contains section information within its scope INF statement on the other hand will use a particular RULE that is determined by the module type in the INF and specified build architecture The Ruie section of the FDF file is used to define custom rules Custom rules may also be applied to a given INF file listed in an rv section The Rule section is also used to define rules for module types that p
119. ADER The following data structure is for an EFI Capsule Header A capsule is simply a contiguous set of data that starts with an EFI CAPSULE HEADER The CapsuleGuid field in the header defines the format of the capsule The capsule contents are designed to be communicated from an OS present environment to the system firmware To allow capsules to persist across system reset a level of indirection is required for the description of a capsule since the OS primarily uses virtual memory and the firmware at boot time uses physical memory typedef struct EFI GUID CapsuleGuid UINT32 HeaderSize UINT32 Flags UINT32 CapsulelmageSize EFI CAPSULE HEADER Parameters Note 62 CapusuleGuid A GUID that defines the content of a capsule HeaderSize The size of the header may be larger than the size of the EFI CAPSULE HEADER as the GUID may imply extended header entries Flags A bit encode field describing the capsule s attributes All undefined bits must be set to zero Currently only bits 16 17 and 18 are defined Flags values 0x0000 OxFFFF are defined by the CapsuleGuid Values 0x00010000 OxFFFFOOOO are defined by in the UEFI specification 0x00010000 CAPSULE FLAGS PERSIST ACROSS RESET 0x00020000 CAPSULE FLAGS POPULATE SYSTEM TABLE 0x00040000 CAPSULE FLAGS INITIATE RESET Note A capsule which has the CAPSULE FLAGS INITIATE RESET Flag must have CAPSULE FLAGS PERSIST ACROSS RESET set in its header as well Firmwa
120. AEE AE EIE E FE FE FE FE FE E FE EIER AE FE FE FE EE FE FE EE AB EA BE ICCx86xASL Intel C Compiler V9 1 ICCx86xASL FAMILY INTEL ICCx86xASL MAKE PATH ICCx86xASL RC PATH DEF VS2005x86 BIN nmake exe DEF VS2005x86_BIN rc exe ICCx86xASL MAKE FLAGS ICCx86xASL VFRPP FLAGS FI MODULE NAME StrDefs h ICCx86xASL APP FLAGS ICCx86xASL PP FLAGS nologo nologo E TC DVFRCOMPILE nologo E TC nologo E TC FIAutoGen h THE HERE HERE E EHE NR ASL definitions TEHET HER FE HE FE HE FE HE HE HEHE HEHE HEH ICCx86xASL ASL PATH DEF WIN ASL BIN 1 22 May 2010 237 238 BUILD ICCx86xASL ASL FLAGS ICCx86xASL ASL OUTFLAGS ICCx86xASL ASLCC FLAGS ICCx86xASL ASLPP FLAGS ICCx86xASL ASLDLINK FLAGS DEF MS ASL OUTFLAGS DEF ICC WIN ASLCC FLAGS DEF ICC WIN ASLPP FLAGS DEF ICC WIN ASLDLINK FLAGS TEE HERE ERE ER EHE RE RE BE IA32 definitions HEEE HE HE HEHE HE IGA ICCx86xASL IA32 CC PATH DEF ICC BIN32x86 icl exe ICCx86xASL IA32 SLINK PATH DEF ICC_BIN32x86 xilib exe xilib exe needs lib exe from Visual Studio ICCx86xASL IA32 SLINK DLL DEF VS2005x86 BIN ICCx86xASL IA32 DLINK PATH DEF ICC BIN32x86 xilink exe ICCx86xASL IA32 ASMLINK PATH ICCx86xASL IA32 PP PATH ICCx86xASL IA32 VFRPP PATH ICCx86xASL IA32 APP PATH ICCx86xASL IA32 ASM PATH ICCx86xASL IA32 ASM DLL ICCx86xASL IA32 ASLCC PATH ICCx86xASL
121. AGES is a semi colon separated doubled quoted string of RFC 4646 May 2010 111 BUILD language codes while the ISO_LANGUAGES is a non separated double quoted string of three character ISO 639 2 language codes e Search all source files in the include path of the module to find out which string IDs are used e Macros will be generated in AutoGen h for the string IDs used Those string IDs not used will be generated but commented out They is just for debug purposes For example include statement AutoGen h Unicode String ID define LANGUAGE NAME 0x0000 not referenced define PRINTABLE LANGUAGE NAME 0x0001 not referenced define STR BOOT FAILED 0x0002 define STR BOOT SUCCEEDED 0x0003 define STR PERFORM MEM TEST 0x0004 define STR INTERNAL EFI SHELL 0x009E not referenced define STR LEGACY BOOT A 0x009F not referenced define STR PROCESSED ALL BOOT OPTIONS 0x00A0 not referenced yg e The HII string package data will be generated in AutoGen c in the form of a data array with array name lt ModuleBaseName gt Strings For example May 2010 1 22 AutoGen Stage include statement AutoGen c Unicode String Pack Definition unsigned char PlatformBdsDxeStrings Start of string definitions for fra 0x20 Ox1A 0x00 0x00 0x02 0x00 Ox8E 0x02 0x00 0x00 0x96 0x02 0x00 0x00 Ox9E 0x00 0x00 0x00 0x00 0x00 0x00 0x00 offset 0x16 Ox8E 0x02 0x00
122. AGS C Program Files Intel EBC Lib EbcLib 1lib NOLOGO May 2010 83 84 Table 17 Predefined Attributes Attribute Description DLL The path to the Compiler required DLLs required for some tools to get generate debug files DPATH Deprecated use DLL The path to the Compiler required DLLs required for some tools to get generate debug files FAMILY A flag to the build command that will be used to ensure the correct commands and flags are used in the generated Makefile or GNUMakefile as well as to use the correct options for independent tools such as the ACPI compiler FLAGS The arguments for individual CommandCode tools GUID This defines the Registry Format GUID 8 4 4 4 12 OUTPUT This specifies an output flag for the Assembler ASM command PATH This is the full path and executable name for a command code Example DEFINE VSNET2003 BIN C Program Files Microsoft Visual Studio NET 2003 Vc7 bin DEFINE VSNET2003 DLL C Program Files Microsoft Visual Studio NET 2003 Common7 IDE DEFINE ACPI_BIN DEFINE PEGCC_BIN32 DEFINE PEGCC_BINX64 God ipad E FE HE FE HE HE FE FE FE FE HE EE FE FE RE FE FE OA IHE EIE FE E TH od HH HH FE FE FE FE FE FE FE HH HH HR RH c ASL opt tiano i386 tiano pe i386 tiano pe bin opt tiano x86 64 pc mingw64 x86 64 pc mingw64 bin VS2003 Microsoft Visual Studio NET 2003 VS2003 FAMILY MSFT Ld EE FE HE FE HE FE HE FE HEHE HEHE HEHE HEH IA32 definition
123. AGS DEF ICC WIN ASLDLINK FLAGS 1 22 May 2010 241 242 MYTOOLS MAKE FLAGS MYTOOLS VFRPP FLAGS FI MODULE NAME StrDefs h MYTOOLS APP FLAGS MYTOOLS PP FLAGS MYTOOLS SLINK FLAGS bed zg Aiz HE E HEHH IA32 definitions bed zg Aiz dd izo MYTOOLS IA32 DLL MYTOOLS IA32 MAKE PATH MYTOOLS IA32 CC PATH MYTOOLS IA32 SLINK PATH MYTOOLS IA32 DLINK PATH MYTOOLS IA32 ASMLINK PATH MYTOOLS IA32 PP PATH MYTOOLS IA32 VFRPP PATH MYTOOLS IA32 APP PATH MYTOOLS IA32 ASM PATH MYTOOLS IA32 ASLCC PATH MYTOOLS IA32 ASLPP PATH MYTOOLS IA32 ASLDLINK PATH MYTOOLS IA32 RC PATH DEBUG MYTOOLS IA32 CC FLAGS RELEASE MYTOOLS IA32 CC FLAGS nologo DEF VS2005 DLL DEF VS2005_ BIN cl DEF VS2005_ BIN cl DEF VS2005_ BIN cl DEF VS2005 BIN ml DEF VS2005_ BIN cl DEF VS2005 BIN cl nologo c WX GS UNICODE Olib2 GL FIAutoGen h EHs c GR GF Zi Gm nologo c WX GS UNICODE Olib2 GL FlAutoGen h EHs c GR GF DEBUG MYTOOLS IA32 ASM FLAGS RELEASE MYTOOLS IA32 ASM FLAGS DEBUG MYTOOLS IA32 DLINK FLAGS OPT REF OPT ICF 10 MAP ALIGN 32 SECTION nologo E TC nologo E TC FIAutoGen h nologo LTCG DEF VS2005_BIN nmake exe DEF VS2005_BIN cl DEF VS2005_BIN lib exe DEF VS2005_BIN link exe DEF WINDDK_BIN16 link16 exe exe exe exe exe exe DEF VS2005_BIN link exe DEF VS2005 BIN rc exe exe BUILD
124. AL gt lt Value gt lt String gt lt VAL gt lt Filename gt Example options EFI_BASE ADDRESS OxFFD80000 EFI FILE NAME FvRecovery fv EFI NUM BLOCKS 0x28 EFI_BLOCK SIZE 0x10000 1 22 May 2010 279 BUILD 280 May 2010 1 22 Appendix H HII EFI Compliant Unicode Strings File Format This appendix describes the EFI compliant format for the input Unicode string files that are parsed by the StrGather parser module of the AutoGen utility The utility is versatile in that it supports multiple layouts and formats in the Unicode file This versatility allows strings to be grouped either by language or string identifier and strings may be demarcated with double quotes or by a new control character in the first column of a new line The token name following the string token must be in uppercase characters H 1 Control Character The default control character is a forward slash with a double slash indicating a comment to end of line The control character can be changed at any time in the script using the set control character control sequence For example to use a hash instead of a slash H 1 1 Language Definition Before any strings for a particular language can be defined the language must be defined using the langdef directive For example if strings for English and Spanish are to be defined in the Unicode string file then the following statements must be present before any string
125. ARCH directory Links needed gcc ar amp ld DEFINE UNIXGCC_IA32_PETOOLS_PREFIX DEFINE UNIXGCC X64 PETOOLS PREFIX Option 5 Install programs under user s home directory DEFINE UNIXGCC IA32 PETOOLS PREFIX ENV HOME programs gcc ia32 bin i686 pc mingw32 DEFINE UNIXGCC X64 PETOOLS PREFIX ENV HOME programs gcc x64 bin x86 64 pc mingw32 opt tiano ia64 pc elf ia64 pc elf bin ENV WORKSPACE BaseTools Bin gcc Ia32 ENV WORKSPACE BaseTools Bin gcc X64 DEFINE CYGWIN BIN DEFINE CYGWIN BINIA32 bin c cygwin bin c cygwin opt tiano i386 tiano pe i386 tiano pe 1 22 May 2010 187 BUILD DEFINE CYGWIN_BINX64 c cygwin opt tiano x86 64 pc mingw64 x86 64 pc mingw64 bin DEFINE CYGWIN BINIPF c i cygwin opt tiano gcc ipf bin ia64 pc elf DEFINE UNIX IASL BIN usr bin iasl DEFINE UNIX IASL BIN HOME programs iasl DEFINE WIN ASL BIN DIR C ASL DEFINE WIN IASL BIN DEF WIN ASL BIN DIR iasl exe DEFINE WIN ASL BIN DEF WIN ASL BIN DIR asl exe DEFINE IASL OUTFLAGS p DEFINE MS ASL OUTFLAGS Fo DEFINE MSFT ASLPP FLAGS nologo EP C DEFINE DEFINE MSFT ASLCC FLAGS MSFT ASLDLINK FLAGS GL Y TC Dmain ReferenceAcpiTable NODEFAULTLIB ENTRY ReferenceAcpiTable SUBSYSTEM CONSOLE DEFINE DEFINE DEFINE ICC WIN ASLPP FLAGS nologo EP C ICC WIN ASLCC FLAGS X TC WX Od Dmain ReferenceAcpiTable ICC WIN ASLDLINK FLAGS NODEFAULTLIB ENTRY ReferenceAcpiTa
126. ATH VS2003 IA32 CC PATH VS2003 IA32 VFRPP PATH VS2003 IA32 SLINK PATH VS2003 IA32 DLINK PATH VS2003 IA32 ASMLINK PATH VS2003 IA32 APP PATH VS2003 IA32 PP PATH VS2003 IA32 ASM PATH VS2003 IA32 ASLCC PATH VS2003 IA32 ASLPP PATH VS2003 IA32 ASLDLINK PATH VS2003 IA32 RC PATH VS2003 IA32 MAKE FLAGS VS2003 IA32 APP FLAGS VS2003 IA32 PP FLAGS VS2003 IA32 VFRPP FLAGS ETS MODULE NAME StrDefs h DEBUG VS2003 IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR RELEASE VS2003 IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR DEBUG VS2003 IA32 ASM FLAGS RELEASE VS2003 IA32 ASM FLAGS VS2003 IA32 SLINK FLAGS DEBUG VS2003 IA32 DLINK FLAGS OPT ICF 10 MAP ALIGN 32 SECTION DEBUG RELEASE VS2003 IA32 DLINK FLAGS GF GX Zi DEF WIN IASL BIN DEF IASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT ASLDLINK FLAGS DEF VS2003 DLL DEF VS2003_BIN nmake exe DEF VS2003_ BIN cl exe DEF VS2003_BIN cl exe DEF VS2003_ BIN lib exe DEF VS2003 BIN link exe DEF WINDDK_BIN16 link16 exe DEF VS2003_ BIN cl exe DEF VS2003_ BIN cl exe DEF VS2003_ BIN ml exe DEF VS2003_ BIN cl exe DEF VS2003_ BIN cl exe DEF VS2003 BIN link exe DEF VS2003_ BIN rc exe nologo nologo nologo nologo E E E LTE TC TC FIAutoGen h DVFRCOMPILE WX Gm WX nologo c WA Gs8192 Gy D UNICODE nologo c WA Gs8192 Gy D UNICODE
127. AULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEBUG DIR BASE NAME map PDB DEBUG DIR BASE NAME pdb DEBUG RELEASE VS2005 IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 May 2010 197 BUILD ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEBUG DIR BASE_NAME map PDB DEBUG DIR BASE NAME pdb TEE HERE HERE E EHE REE HE EBC definitions TEE HERE FE HE FE HE FE HE HE HEHE HEHE HEH VS2005 EBC FAMILY INTEL VS2005 EBC MAKE PATH DEF VS2005 BIN nmake exe VS2005 EBC PP PATH VS2005 EBC VFRPP PATH VS2005 EBC CC PATH VS2005 EBC SLINK PATH DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN link exe VS2005 EBC DLINK PATH DEF EBC BIN link exe VS2005 EBC MAKE FLAGS nologo VS2005 EBC PP FLAGS nologo E TC FIAutoGen h VS2005 EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT VS2005 EBC VFRPP FLAGS nologo E TC DVFRCOMPILE FI MODULE NAME StrDefs h VS2005 EBC SLINK FLAGS lib NOLOGO MACHINE EBC VS2005 EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib
128. BC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT VS2005x86xASL EBC VFRPP FLAGS nologo E TC DVFRCOMPILE FI MODULE NAME StrDefs h VS2005x86xASL EBC SLINK FLAGS lib NOLOGO MACHINE EBC VS2005x86xASL EBC DLINK FLAGS C Program Files x86 Intel EBC Lib EbcLib 1lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI_BOOT_SERVICE DRIVER MAP FE EE HE HE FE FE HE HE HE HE FE HE HE HE FE FE FE HE HE FE FE aR HE HE FE FE FE E HE FE FE FE UR FE HE HE HE AU FE HE FE FE FE AA HE FE FE FE FE E AA FE FE HE E FE FE EH HE HE ERE FE HE HE HE RR E I HE Microsoft Device Driver Kit 3790 1830 IA 32 X64 Itanium with Link Time Code Generation And Intel ACPI Compiler FEFE EE HE HE EE EE FE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE E HE HE HE E HE E HE E HE E HE E HE HE HE HE HE HE HE HE RE HE FE E FE E HE E FE E HE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE HH HHHH E DDK3790 Microsoft Windows DDK 3790 1830 ASL Intel ACPI Source Language Compiler iasl exe DDK3790 FAMILY MSFT DDK3790 MAKE PATH DEF WINDDK_BIN32 nmake exe DDK3790 MAKE FLAGS nologo DDK3790 RC PATH DEF WINDDK_BIN32 rc exe DDK3790 PP FLAGS DDK3790 APP FLAGS DDK3790 SLINK FLAGS DDK3790 VFRPP FLAGS FI MODULE NAME StrDefs h nologo E TC FIAutoGen h nologo E TC nologo LTCG
129. BIN16 link16 exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN ml exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN cl exe DEF VS2005x86 BIN link exe S nologo GR GF Gy Zi Gm nologo c WX GS W4 Gs8192 D UNICODE nologo c WX GS w4 Gs8192 D UNICODE GR GF nologo c WX W3 Cx coff Zd Zi nologo c WX W3 Cx coff Zd GS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE VS2005x86 IA32 DLINK FLA GS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 LTCG May 2010 203 204 DLL ENTRY IMAGE ENTRY POINT BUILD SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text VS2005x86 IA32 ASMLINK FLAGS nologo tiny HEEE HE HE HEHE HE HE HE HEHE HEHE GG X64 definitions HEEE HE HE HEHE HE HE HE HE HE HEHE EE HH VS2005x86 X64 DLL VS2005x86 X64 CC PATH VS2005x86 X64 PP PATH VS2005x86 X64 APP PATH VS2005x86 X64 VFRPP PATH VS2005x86 X64 ASM PATH VS2005x86 X64 SLINK PATH VS2005x86 X64 DLINK PATH VS2005x86 X64 ASLCC PATH VS2005x86 X64 ASLPP PATH VS2005x86 X64 ASLDLINK PATH DEBUG VS2005x86 X64 CC FLAGS DEF VS2005x86 DLL
130. BUILD RVCT31CYGWIN ARM PLATFORM FLAGS RVCT31CYGWIN ARM INTRINSIC FLAGS CompilerIntrinsicsLib lib DEBUG RVCT31CYGWIN ARM DLINK FLAGS DLINKPATH FLAG ARCHDLINK_FLAGS entry IMAGE ENTRY POINT ro base 0 no scanlib reloc no exceptions datacompressor off strict symbols map list cygpath m DEST DIR DEBUG BASE NAME map ENV EDK TOOLS PATH Bin CYGWIN_NT 5 1 i686 ARM DEBUG RVCT31CYGWIN INTRINSIC FLAGS RELEASE RVCT31CYGWIN ARM DLINK FLAGS DLINKPATH FLAG ARCHDLINK_FLAGS entry IMAGE ENTRY POINT ro base 0 no scanlib reloc no exceptions datacompressor off strict symbols map list cygpath m DEST DIR DEBUG BASE NAME map ENV EDK TOOLS PATH Bin CYGWIN NT 5 1 1686 ARM DEBUG RVCT31CYGWIN INTRINSIC FLAGS RVCT31CYGWIN ARM ASM FLAGS ASMPATH FLAG ARCHASM FLAGS apcs interwork RVCT31CYGWIN ARM PP FLAGS CCPATH FLAG ARCHCC FLAGS PLATFORM FLAGS E RVCT31CYGWIN ARM VFRPP FLAGS CCPATH FLAG ARCHCC FLAGS S PLATFORM FLAGS E DVFRCOMPILE preinclude cygpath m DEST DIR DEBUG MODULE NAME StrDefs h RVCT31CYGWIN ARM MAKE PATH make RVCT31CYGWIN ARM SLINK FLAGS SLINKPATH FLAG partial o DEBUG RVCT31CYGWIN ARM CC FLAGS CCPATH FLAG ARCHCC FLAGS S PLATFORM FLAGS c90 c g 02 no autoinline asm gnu apcs interwork signed chars no unaligned access split sectio
131. Both of these are files that contains a binary FV as defined by the PI 1 2 specification The format for the rv RegionType is one of the following FV UiFvName Or FV Filename Where Filename is a filename defined by the rv section s CREATE FILE Filename statement The following is an example of FV region type 0x000000 0x0C0000 gEfiMyTokenSpaceGuid PcdFlashFvMainBaseAddress gEfiMyTokenSpaceGuid PcdFlashFvMa inSize FV FvMain 9 5 2 DATA Region Type 160 The DATA RegionType is a region that contains is a hex value or an array of hex values This data that will be loaded into the flash device starting at the first location pointed to by the Offset value The format of the DATA RegionType iS DATA Hex Byte Data Structure The following is an example of a DATA region type Ox0CA000 0x002000 gEfiMyTokenSpaceGuid PcdFlashNvStorageBase gEfiMyTokenSpaceGuid PcdFlashNvStorag eSize DATA 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 Ox8D Ox2B OxF1 OxFF 0x96 0x76 Ox8B 0x4C This data may need to be modified based on content of the region In order for EFI modules to access these regions a customized region header may be required Tools May 2010 1 22 ImageGen Stage FLASH Images for creating custom header information is beyond the scope of the standard build 9 5 3 FILE Region Type The FILE RegionType is a pointer to a binary file that will be loaded into the flash device startin
132. C X64 ASM PATH ICC X64 ASM DLL ICC X64 ASLCC PATH ICC X64 ASLPP PATH ICC X64 ASLDLINK PATH DEBUG_ICC_X64_CC_FLAGS UNICODE Olib2s GL Gy FIS DEST DIR DEBUG AutoGen h Zi Gm RELEASE ICC X64 CC FLAGS UNICODE Olib2s GL Gy FI DEST_ DIR DEBUG AutoGen h EHs c DEBUG ICC X64 ASM FLAGS RELEASE ICC X64 ASM FLAGS DEBUG ICC X64 DLINK FLAGS nologo tiny DEF ICC_BINX64 icl exe DEF ICC_BINX64 xilib exe Studio DEF MS_VS_BIN DEF ICC_BINX64 xilink exe DEF ICC_BINX64 icl exe DEF ICC_BINX64 icl exe DEF ICC_BINX64 icl exe DEF WINDDK_BINX64 m164 DEF MS VS DLL DEF ICC_BINX64 icl exe DEF ICC_BINX64 icl exe DEF ICC_BINX64 xilink exe exe nologo c WX GS X WA Gs8192 D EHs c GF X WA Gs8192 D GF nologo c WX W3 Cx Zd Zi nologo c WX W3 Cx Zd NOLOGO NODEFAULTLIB IGNORE 4086 nologo c WX GS OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D 1 22 May 2010 227 228 BUILD Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICC X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text ICC X64 SLINK FLAGS bed zg Ard dd
133. CTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER RELEASE VS2005xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 LTCG May 2010 199 200 DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text VS2005xASL IA32 ASMLINK FLAGS nologo tiny HEHEHE HE HE HEHE HE HE HE HEHE HEHE NG X64 definitions HEEE HE HE HEHE HE HE HE HEHE HEHE H H HH VS2005xASL X64 DLL VS2005xASL X64 CC PATH VS2005xASL X64 PP PATH VS2005xASL X64 APP PATH VS2005xASL X64 VFRPP PATH VS2005xASL X64 ASM PATH VS2005xASL X64 SLINK PATH VS2005xASL X64 DLINK PATH VS2005xASL X64 ASLCC PATH VS2005xASL X64 ASLPP PATH VS2005xASL X64 ASLDLINK PATH DEBUG VS2005xASL X64 CC FLAGS RELEASE VS2005xASL X64 CC FLAGS DEBUG VS2005xASL X64 DLINK FLAGS OPT ICF 10 MAP ALIGN 32 SECTION DEBUG RELEASE VS2005xASL X64 DLINK FLAGS DEF VS2005 DLL DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 m164 exe DEF VS2005_BINX64 lib exe DEF VS2005_BINX64 link exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 link exe BUILD nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy F
134. CxASL IPF ASLDLINK PATH CYGGCCxASL IPF ASM PATH CYGGCCxASL IPF PP PATH CYGGCCxASL IPF VFRPP PATH CYGGCCxASL IPF ASLCC PATH CYGGCCxASL IPF ASLPP PATH CYGGCCxASL IPF OBJCOPY PATH CYGGCCxASL IPF SYMRENAME PATH E CYGGCCxASL IPF RC PATH CYGGCCxASL IPF CC FLAGS divide min latency CYGGCCxASL IPF DLINK FLAGS entry IMAGE ENTRY POINT undefine DEST DIR DEBUG BASE NAME map CYGGCCxASL IPF OBJCOPY FLAGS CYGGCCxASL IPF SYMRENAME FLAGS CYGGCCxASL IPF RC FLAGS data hii bed zg Aiz dd izo EBC definitions bed zg Ard dd izo CYGGCCxASL EBC FAMILY INTEL DEF CYGWIN BINX64 gcc DEF CYGWIN BINX64 ar DEF CYGWIN BINX64 1d DEF CYGWIN BINX64 gcc DEF CYGWIN BINX64 gcc DEF CYGWIN BINX64 gcc DEF CYGWIN BINX64 gcc DEF CYGWIN BINX64 gcc DEF CYGWIN BINX64 gcc DEF CYGWIN_BINX64 1d DEF CYGWIN BINX64 windres Os fshort wchar fno strict aliasing mno oGen h D_EFI_P64 J rc O coff DEF CYGWIN BINIPF gcc DEF CYGWIN BINIPF ar DEF CYGWIN_BINIPF 1d DEF CYGWIN_BINIPF 1d DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF objcopy DEF CYGWIN_BINIPF objcopy DEF CYGWIN_BINIPF objcopy Os fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno array bounds c include AutoGen h minline int d CYGGCCxASL EBC PP PATH DEF EBC_BIN iec exe CYGGCCxASL EBC CC PATH DEF
135. D UNICODE Olib2s GL Gy FlAutoGen h EHs c GR GF DEBUG DDK3790 X64 ASM FLAGS nologo c WX W3 Cx Zd Zi RELEASE DDK3790 X64 ASM FLAGS nologo c WX W3 Cx Zd DEBUG DDK3790 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE DDK3790 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG 212 May 2010 1 22 1 22 DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text Ld HER EHE REE HE IPF definitions TEE HERE HERE ER EHE HEB HHH DDK3790 IPF CC PATH DEF WINDDK_BIN64 cl exe DDK3790 IPF SLINK PATH DEF WINDDK_BIN64 lib exe DDK3790 IPF DLINK PATH DEF WINDDK_BIN64 link exe DDK3790 IPF PP PATH DEF WINDDK_BIN64 cl exe DDK3790 IPF VFRPP PATH DEF WINDDK_BIN64 cl exe DDK3790 IPF APP PATH DEF WINDDK_BIN64 cl exe DDK3790 IPF ASM PATH DEF WINDDK_BIN64 ias exe DDK3790 IPF ASLCC PATH DEF WINDDK_BIN64 cl exe DDK3790 IPF ASLPP PATH DEF WINDDK_BIN64 cl exe DDK3790 IPF ASLDLINK PATH DEF WINDDK BIN64 Mlink exe DEBUG DDK3790 IPF CC FLAGS nologo c WX GS X W4 EHs c GR Gy Os GL FIAutoGen h QIPF fr32 Zi RELEASE DDK379
136. DATA DIRECTORY EFI IMAGE DOS HEADER 1 22 This is the DOS header of a PE 32 exe or dll file typedef struct UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT32 e magic e colp e Up e ric e cparhdr e minalloc e maxalloc e ss e Sp e csum e 1p e CS e lrarle e ovno e res 4 e oemid e oeminfo e res2 10 e lfanew EFI IMAGE DOS HEADER Parameters e magic The Magic number e cblp e cp Bytes on the last page of file pages in file e orig Relocations e cparhdr Size of header in paragraphs e minalloc Minimum extra paragraphs needed e maxalloc Maximum extra paragraphs needed May 2010 UEFI and PI Image Specification 41 42 Initial relative SS value e sp E Initial SP value e csum i Checksum e ip E Initial IP value Initial relative CS Value e lfarlc i File address of relocation table e ovno Overlay number e res Reserved words e oemid u OEM identifier for e_oeminfo e oeminfo i OEM Information e oemid specific e resZ Reserved words e lfanew i File address of new exe header May 2010 BUILD 1 22 1 22 UEFI and PI Image Specification Related Definitions union EFI IMAGE OPTIONAL HEADER32 EFI IMAGE OPTIONAL HEADER64 EFI IMAGE OPTIONAL HEADER typedef struct Common structure UIN
137. DIR DEBUG AutoGen h ELFGCC IA32 PP FLAGS DEST DIR DEBUG AutoGen h m32 E x assembler with cpp include ELFGCC IA32 VFRPP FLAGS x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h ELFGCC IA32 RC FLAGS I binary O elf32 1386 B i386 rename section data hii FEFE HE FE HE ER E EHE HE BENE X64 definitions FEFE EE FE HE HERE E EHE HE BE HE ELFGCC X64 CC PATH DEF ELFGCC BIN gcc ELFGCC X64 ASLCC PATH DEF ELFGCC BIN gcc ELFGCC X64 SLINK PATH DEF ELFGCC BIN ar ELFGCC X64 DLINK PATH DEF ELFGCC_BIN 1d ELFGCC X64 ASLDLINK PATH DEF ELFGCC_BIN 1d ELFGCC X64 ASM PATH DEF ELFGCC BIN gcc ELFGCC X64 PP PATH DEF ELFGCC BIN gcc ELFGCC X64 ASLPP PATH DEF ELFGCC BIN gcc ELFGCC X64 VFRPP PATH DEF ELFGCC BIN gcc ELFGCC X64 RC PATH DEF ELFGCC BIN objcopy ELFGCC X64 CC FLAGS Os fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno address Wno array bounds c include AutoGen h D EFI P64 ELFGCC X64 DLINK FLAGS nostdlib shared entry IMAGE ENTRY POINT u IMAGE ENTRY POINT ELFGCC X64 SLINK FLAGS ELFGCC X64 ASM FLAGS c x assembler imacros DEST DIR DEBUG AutoGen h ELFGCC X64 PP FLAGS DEST DIR DEBUG AutoGen h E x assembler with cpp include ELFGCC X64 VFRPP FLAGS x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h ELFGCC X64 RC FLAGS I binary O elf64 x86 64 B i38
138. DK II firmware components to a firmware volume on a given platform Specification Conformance The EDK II Build infrastructure supports building UEFI 2 3 and PI 1 2 compliant platforms Existing EDK components may need to be updated to align with these specifications Table 1 EDK Build Infrastructure Support Matrix EDK EDK II EDK FDF EDK II EDK INF EDK II DSC DSC FDF INF EDK Build Tools YES NO YES NO YES NO EDK II Build Tools NO YES NO YES YES YES 1 2 Target Audience This document is intended for persons performing EFI development and support for different platforms 1 3 Related Information The following publications and sources of information may be useful to you or are 1 22 May 2010 1 BUILD referred to by this specification e Extensible Firmware Interface Specification Intel 2001 http developer intel com technology efi Note See the glossary sections in the EFI 1 10 Specification for additional required or recommended definitions of terms abbreviations documents and specifications Note See the master Framework glossary in the Framework Interoperability and Component Specifications help system for additional required or recommended definitions of terms abbreviations documents and specifications http www intel com technology framework spec htm e Unified Extensible Firmware Interface Specification Version 2 3 Unified EFI Inc 2006 http www uefi org e Platform Initialization Spec
139. DSC Inf BuildOptions 6 2 6 Precedence of Macro Definitions 98 Additional build scoping can be implemented using the DSC and FDF directive statements in combination with command line options for the build tool Note that all command line options for the build tool are passed to the GenFds tool after the make portion of the build completes Directive statements defined in the DSC and FDF specifications include ifdef ifndef if else elseif and endif These control statements are used to either include or exclude lines as the parsing tool processes these files The build and GenFds tools use the y define command line options with an argument formatted MACRO N yalue Ifthe value is omitted the May 2010 1 22 MACRO_NAME is assigned a value of TRUE Macro values Highest values must be defined prior to using them in directive statements or for PCD The following provides the rules for obtaining macro values Command line D flags left most has higher priority FDF file DEFINE statements FDF file DEFINE statements in the defines section DSC file Component INF DEFINE statements embedded in subsections DSC file DEFINE statements in sections following the defines sections DSC file DEFINE statements in the defines section tools def txt file flags Lowest 6 2 7 Precedence of PCD Values The va lues that are assigned to individual PCDs required by a build may come from different locations
140. DYN VPD UINT32 1 0x0001FFF 3 The third line is the optional line if lt PcdValue gt in DSC file is not equal to the value in DEC files DEC DEFAULT lt Value in DEC gt For example P PcdWinNtFirmwareFdSize FIXED UINT32 0x2a0000 DEC DEFAULT 0x0 Note This sub section presents when PCD or ALL is specified in Y option 12 7 4 DEPEX Sub section This sub section holds module dependency expression DEPEX information The sub section header holds the module finial dependency expression If the module is an EDKII style module and it inherits dependency from one of its library instance it lists the inherited library dependency expression in the sub section contents Example1 Dependency Expression DEPEX from INF gEfiFirmwareVolumeBlockProtocolGuid AND gEfiPcdProtocolGuid Module gEfiFirmwareVolumeBlockProtocolGuid From Lib gEfiPcdProtocolGuid c edk2 MdePkg Library DxePcdLib DxePcdLib inf lt rr rr rr rr rr rr rr gt Example2 gt added lt Dependency Expression DEPEX from DXS EFI PCI ROOT BRIDGE IO PROTOCOL GUID AND EFI VARIABLE ARCH PROTOCOL GUID AND EFI VARIABLE WRITE ARCH PROTOCOL GUID AND EFI METRONOME ARCH PROTOCOL GUID AND EFI RUNTIME ARCH PROTOCOL GUID AND EFI PCI ROOT BRIDGE IO PROTOCOL GUID AND EFI HII DATABASE PROTOCOL GUID Note This sub section presents when DEPEX or ALL is specified in Y option 12 7 5 Build Flags Su
141. Device FD FD Name Nt32 Base Address 0 Size 0x2a0000 2688KB FD Region Type FV Base Address 0 Size 0x280000 2560K FV Name FvRecovery Occupied Size 0x221F60 2183K Free Size 0x5E0A0 376K List of other FD region sub section 2S l gez m Eee The following sections describe these reports and sub sections in detail 12 4 Platform Summary Platform summary displays at the beginning of the output report including the following items e Platform Name Platform UI name PLATFORM NAME in DSC Defines section e Platform DSC Path Path of platform DSC file e Architectures List string of all architectures used in build e Tool Chain Tool chain string e Target Target String e Build Environment Environment string reported by Python e Build Duration Build duration time string e Report Content List of flags the control the report content 1 22 May 2010 171 BUILD Example Platform Name Nt32 Platform DSC Path c edk2 Nt32Pkg Nt32Pkg dsc Architectures IA32 Tool Chain MYTOOLS Target DEBUG Build Environment Windows XP 5 1 2600 Build Duration 05 12 Report Contents LIBRARY FLASH PREDICTION Note Platform Summary always presents and appears at the beginning of report 12 5 Global PCD Section This section contains the information for all PCDs whose values are the same for all modules in a platform The content of global PCD sub section is grouped by token
142. E CYGGCCxASL EBC DLINK PATH CYGGCCxASL EBC SLINK PATH DEF E BC BIN iec exe DEF EBC BIN link exe BC BIN link exe 1 22 May 2010 I elf64 ia64 little O efi bsdrv ia64 redefine sym memcpy CopyMem I binary O elf64 ia64 rename section nostdlib 02 gc sections dll static IMAGE ENTRY POINT Map 223 BUILD CYGGCCxASL EBC VFRPP PATH CYGGCCxASL EBC RC PATH DEF EBC BIN iec exe DEF MS VS BIN rc exe CYGGCCxASL EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT CYGGCCxASL EBC SLINK FLAGS lib NOLOGO MACHINE EBC CYGGCCxASL EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER FE EE HE HE FE FE HE HE HE HE FE HE HE HE FE FE EAE AERE FE FE FE HE HE FE FE FE HE HE FE FE FE UR ERE ERE AU FE HE FE FE FE AU HE FE FE FE FE E A FE FE HE FE AR HE HE HE FE HE HE HE HE FE FE HE HE HE HE FE HHHH HE Elf GCC This configuration is used to compile on Linux boxes to produce elf binaries God ipad E FE FE AE KOA KOA KOA HH HEHE HEHE FE FE E FE FE ARKA FE FE FE E AE FE FE FE Eda Eda IH ELFGCC Linux ELF GCC ELFGCC FAMILY ELFGCC MAKE PATH GCC make ELFGCC PP FLAGS E x assembler with cpp include AutoGen h ELFGCC VFRPP FLAGS x c E P DVFRCOMPILE include MODULE NAME StrDefs h
143. E HE FE FE FE E HE FE FE FE UR FE HE HE HE AU FE HE FE FE FE AA HE FE FE FE FE E AA FE FE FE FE FE FE FE FH FE E FE HE dog RR REE Cygwin GCC And Microsoft ACPI Compiler FE EE HE HE FE FE HE HE HE E FE HE HE HE FE FE FE HE HE FE FE FE FE HE HE FE FE FE E E FE FE FE HE HE FE FE FE HE HE HE FE FE FE HE FE FE FE FE HE HE FE FE FE FE E AA FE FE HE FE FE FE FE FH E HE FE HE HE HE ERE FE HE HE HE FE E I HE CYGGCCXASL CygWin GCC ASL Microsoft ACPI Source Language Compiler asl exe CYGGCCxASL FAMILY GCC CYGGCCxASL DLL CYGGCCxASL MAKE PATH DEF CYGWIN BIN DEF MS_VS_BIN nmake exe CYGGCCxASL MAKE FLAGS nologo CYGGCCxASL PP FLAGS E x assembler with cpp include AutoGen h CYGGCCxASL DLINK FLAGS nostdlib 02 gc sections dll export all symbols entry _ IMAGE ENTRY POINT file alignment 0x20 section alignment 0x20 CYGGCCxASL ASM FLAGS c x assembler imacros AutoGen h CYGGCCxASL APP FLAGS E x assembler CYGGCCxASL VFRPP FLAGS x c E P DVFRCOMPILE include MODULE NAME StrDefs h TEHETHER FE HE FE HE FE HE HE HEHE HEHE HEH ASL definitions TEHET FE EE ERE ER FE HE HE HEHE HEHE HEH CYGGCCxASL ASL PATH CYGGCCxASL ASL FLAGS CYGGCCxASL ASL OUTFLAGS CYGGCCxASL ASLCC FLAGS CYGGCCxASL ASLPP FLAGS CYGGCCxASL ASLDLINK FLAGS DEF WIN ASL BIN DEF MS ASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT
144. E HEHE AE AE FE FE HE EHE EA EA EA FE E FE FE AE FE FE E FE FE AE FE FE E FE FE E FE AE AE FE FE FE FE FE AE FE FE AE FE FE E HE FE AE FE HE HE HE HHE HE May 2010 1 22 THEE AERE FE FE HE EE EE EE EE ERE ERE EHE IE EHE IEEE IEEE FE AE HE FE EE EE EE AE FE FE E FE FE E HE FE AE FE FE E FE FE EE IE EE IE EE IE E E G Li Li Supported Tool Chains VS2003 win32 Microsoft Visual Studio NET 2003 Intel EBC Intel ASL VS2005 win32 Microsoft Visual Studio 2005 Team Suite Edition Intel EBC Intel ASL also compatible with VS 2005 Express Standard and Pro DDK3790 win32 Microsoft Windows DDK 3790 1830 Intel EBC Intel ASL UNIXGCC UNIX GCC No EBC Intel ASL ELFGCC Linux ELF GCC No EBC Intel ASL _CYGGCC win32 CygWin GCC Intel EBC Intel ASL ICE win32 Intel C Compiler V9 1 Intel EBC Intel ASL MYTOOLS win32 VS2005 for IA32 X64 WINDDK 3790 1830 for IPF Intel EBC Intel ASL VS2003xASL win32 Microsoft Visual Studio NET 2003 Intel EBC Microsoft ASL VS2005xASL win32 Microsoft Visual Studio 2005 Team Suite Edition Intel EBC Microsoft ASL DDK3790xASL win32 Microsoft Windows DDK 3790 1830 Intel EBC Microsoft ASL CYGGCCxASL win32 CygWin GCC Intel EBC Microsoft ASL ICCxASL win32 Intel C Compiler V9 1 Intel EBC Microsoft ASL VS2005x86 win64 Microsoft Visual Studio 2005 Team Suite Edition x86 Intel EBC Intel ASL also compatible with VS 200
145. E REE BE ASL definitions TEE HERE ERE E EHE REE HE CYGGCC ASL PATH CYGGCC ASL FLAGS CYGGCC ASL OUTFLAGS CYGGCC ASLPP FLAGS CYGGCC ASLCC FLAGS CYGGCC ASLDLINK FLAGS TEE ERE HERE EH EHE RE RE HE IA32 definitions TEE HERE FE HE FE HE FE HE HE HEHE HEHE HHH _CYGGCC_IA32_CC_PATH CYGGCC IA32 SLINK PATH CYGGCC IA32 DLINK PATH CYGGCC IA32 ASM PATH CYGGCC IA32 PP PATH CYGGCC IA32 APP PATH CYGGCC IA32 VFRPP PATH CYGGCC IA32 ASLCC PATH CYGGCC IA32 ASLPP PATH CYGGCC IA32 ASLDLINK PATH CYGGCC IA32 RC PATH CYGGCC IA32 CC FLAGS Werror c include AutoGen h CYGGCC IA32 RC FLAGS bed zg Aiz dd izo X64 definitions bed zg Az HE E HHHH CYGGCC X64 CC PATH CYGGCC X64 SLINK PATH CYGGCC X64 DLINK PATH CYGGCC X64 ASM PATH CYGGCC X64 PP PATH CYGGCC X64 APP PATH 220 GCC DEF CYGWIN BIN DEF MS_VS_BIN nmake exe nologo BUILD E x assembler with cpp include AutoGen h nostdlib 02 gc sections dll export all symbols entry _ IMAGE ENTRY POINT file alignment 0x20 section alignment c x assembler imacros AutoGen h E x assembler x c E P DVFRCOMPILE include DEF WIN IASL BIN DEF IASL OUTFLAGS mg E P X C nostdlib s pie gc sections entry _ReferenceAcpiTable u IMAGE ENTRY POINT DEF CYGWIN_BINIA32 gcc DEF CYGWIN_BINIA32 ar DEF CYGWIN_BINIA32 1d DEF CYGWIN_BINIA32 gcc DE
146. E32 ARM PLATFORM FLAGS XCODE32 ARM INTRINSIC FLAGS CompilerIntrinsicsLib lib XCODE32 ARM CC PATH DEF IPHONE TOOLS usr bin gcc XCODE32 ARM SLINK PATH DEF IPHONE TOOLS usr bin libtool XCODE32 ARM DLINK PATH DEF IPHONE TOOLS usr bin ld XCODE32 ARM ASM PATH DEF IPHONE TOOLS usr bin as XCODE32 ARM PP PATH DEF IPHONE TOOLS usr bin gcc XCODE32 ARM VFRPP PATH DEF IPHONE TOOLS usr bin gcc DEBUG XCODE32 ARM DLINK FLAGS ARCHDLINK FLAGS u _ IMAGE ENTRY POINT e S IMAGE ENTRY POINT preload segalign 0x20 slow stubs pie all load dead strip segladdr 0x220 read only relocs suppress map DEST DIR DEBUG BASE NAME map ENV EDK TOOLS PATH Bin Darwin i386 ARM DEBUG XCODE32 INTRINSIC_FLAGS RELEASE XCODE32 ARM DLINK FLAGS ARCHDLINK FLAGS u IMAGE ENTRY POINT e S IMAGE ENTRY POINT preload segalign 0x20 slow stubs pie all load dead strip segladdr 0x220 read only relocs suppress map DEST DIR DEBUG 1 22 May 2010 247 BUILD BASE NAME map ENV EDK TOOLS PATH Bin Darwin i386 ARM RELEASE XCODE32 INTRINSIC FLAGS XCODE32 ARM SLINK FLAGS static o DEBUG XCODE32 ARM ASM FLAGS RELEASE XCODE32 ARM ASM FLAGS ARCHASM FLAGS XCODE32 ARM PP FLAGS ARCHCC FLAGS PLATFORM FLAGS E x assembler with cpp include DEST DIR DEBUG AutoGen h XCODE32 ARM VFRPP FLAGS ARCHCC FLAGS PLATFORM FLAGS x c E P DVFRCOMPILE include DEST DIR DEBUG
147. EDK Build Specification May 2010 Revision 1 22 Build Acknowledgements THIS SPECIFICATION IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER INCLUDING ANY WARRANTY OF MERCHANTABILITY NONINFRINGEMENT FITNESS FOR ANY PARTICULAR PURPOSE OR ANY WARRANTY OTHERWISE ARISING OUT OF ANY PROPOSAL SPECIFICATION OR SAMPLE Intel products are not intended for use in medical life saving or life sustaining applications Intel may make changes to specifications and product descriptions at any time without notice Designers must not rely on the absence or characteristics of any features or instructions marked reserved or undefined Intel reserves these for future definition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them A license is hereby granted to copy and reproduce this specification for internal use only No other license express or implied by estoppel or otherwise to any other intellectual property rights is granted herein Intel disclaims all liability including liability for infringement of any proprietary rights relating to use of information in this specification No license express or implied by estoppel or otherwise to any intellectual property rights is granted herein This specification is an intermediate draft for comment only and is subject to change without notice Readers should not design products based on this document Other names and brands may be
148. EF VS2005 BINX64 link exe MYTOOLS X64 RC PATH DEF VS2005 BIN rc exe DEBUG MYTOOLS X64 CC FLAGS nologo c WX GS W4 Gs8192 Gy D UNICODE Olib2 GL FlAutoGen h EHs c GR GF Zi Gm RELEASE MYTOOLS X64 CC FLAGS nologo c WX GS W4 Gs8192 Gy D UNICODE Olib2 GL FIAutoGen h EHs c GR GF DEBUG MYTOOLS X64 ASM FLAGS nologo c WX W3 Cx Zd Zi RELEASE MYTOOLS X64 ASM FLAGS nologo c WX W3 Cx Zd DEBUG MYTOOLS X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE MYTOOLS X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D 1 22 May 2010 243 244 BUILD Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text THEE HERE HERE ER EHE NR IPF definitions Ld FE HE FE HE FE HE HE HEHE HEHE HEH MYTOOLS IPF MAKE PATH DEF WINDDK_BIN32 nmake exe MYTOOLS IPF CC PATH DEF WINDDK_BIN64 cl exe MYTOOLS IPF SLINK PATH DEF WINDDK_BIN64 lib exe MYTOOLS IPF DLINK PATH DEF WINDDK_BIN64 link exe MYTOOLS IPF PP PATH DEF WINDDK_BIN64 cl exe MYTOOLS IPF VFRPP PATH DEF WINDDK BIN64 cl exe MYTOOLS IPF APP PATH DEF WINDDK_BIN64 cl exe M
149. EFIAPI ProcessModuleEntryPointList IN EFI HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable if SetJump amp mJumpContext 0 AutoGen Stage ExitDriver ENTRY POINT1 ImageHandle SystemTable ASSERT FALSE if SetJump amp mJumpContext 0 ExitDriver lt ENTRY_POINT2 gt ImageHandle SystemTable ASSERT FALSE return mDriverEntryPointStatus static BASE LIBRARY JUMP BUFFER mJumpContext static EFI STATUS mDriverEntryPointStatus EFI LOAD ERROR VOID EFIAPI ExitDriver IN EFI STATUS Status May 2010 131 BUILD if EFI ERROR Status EFI ERROR mDriverEntryPointStatus mDriverEntryPointStatus Status LongJump amp mJumpContext UINTN 1 ASSERT FALSE MK 7 3 4 6 Module Unload Image Statements The following algorithm is used to process potential UNLOAD_IMAGE statements that might be defined in the Defines section in the INF file 132 May 2010 1 22 AutoGen Stage If Number of UNLOAD IMAGE in INF 0 include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED const UINT8 _gDriverUnloadImageCount 0 EFI_STATUS EFIAPI ProcessModuleUnloadList IN EFI_HANDLE ImageHandle return EFI_SUCCESS ir I Number of UNLOAD_IMAGE in INF 1 include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED const UINT8 _gDriverUnloadImageCount 1 EFI_STATUS lt UNLOAD IMAGE IN EFI HANDLE ImageHand
150. ER DEFINED lt InputFile gt Lab lt ExtraDependency gt MAKE FILE lt OutputFile gt DEBUG DIR MODULE NAME lt Command MSFT Command INTEL gt S DLINK S DLINK FLAGS S DLINK SPATH ES STATIC LIBRARY FILES LIST lt Command GCC gt TS DLINK DLINK_FLAGS DLINK_SPATH S STATIC LIBRARY FILES LIST S DLINK2 FLAGS lt Command RVCT gt S DLINK DLINK FLAGS o dst DLINK_SPATH via S STATIC LIBRARY FILES LIST S DLINK2 FLAGS lt Command RVCTCYGWIN gt STATIC LIBRARY FILES LIST has the wrong paths for cygwin NS DLINK DLINK_FLAGS o dst DLINK_SPATH STATIC LIBRARY FILES S DLINK2 FLAGS lt Command XCODE gt S DLINK o Sidst DLINK FLAGS DLINK_SPATH filelist S STATIC LIBRARY FILES LIST S DLINK2 FLAGS Dynamic Library File lt InputFile gt 7 01 1 lt OutputFile gt DEBUG DIR MODULE NAME efi lt Command MSFT Command INTEL Command GCC Command RVCT gt GenFw e MODULE TYPE o dst src S CP dst OUTPUT DIR S CP dst BIN_DIR CE DEBUG DIR map OUTPUT DIR lt Command XCODE gt tool to convert Mach O to PE COFF S MTOC subsystem S MODULE TYPE MTOC FLAGS Sisre 264 May 2010 1 22 DEBUG DIR MODULE NAME pecoff create symbol file for GDB debug DSYMUTIL src GenFw e MODULE TYPE o dst DEBUG_DIR MODULE NAME pecoff
151. F CYGWIN_BINIA32 gcc DEF CYGWIN_BINIA32 gcc DEF CYGWIN_BINIA32 gcc DEF CYGWIN_BINIA32 gcc DEF CYGWIN_BINIA32 gcc DEF CYGWIN BINIA32 1d DEF CYGWIN_BINIA32 windres Os fshort wchar fno strict aliasing Wall J rc O coff DEF CYGWIN_BINX64 gcc DEF CYGWIN_BINX64 ar DEF CYGWIN BINX64 1d DEF CYGWIN_BINX64 gcc DEF CYGWIN_BINX64 gcc DEF CYGWIN_BINX64 gcc May 2010 1 22 _CYGGCC_X64_VFRPP_PATH DEF CYGWIN BINX64 gcc CYGGCC X64 ASLCC PATH DEF CYGWIN BINX64 gcc CYGGCC X64 ASLPP PATH DEF CYGWIN BINX64 gcc CYGGCC X64 ASLDLINK PATH DEF CYGWIN_BINX64 1d CYGGCC X64 RC PATH DEF CYGWIN BINX64 windres CYGGCC X64 CC FLAGS Os fshort wchar fno strict aliasing mno red zone Wall Werror c include AutoGen h D EFI P64 CYGGCC X64 RC FLAGS J re O coff THE HE HE HEHE HE HE HE HEHE HEHE H NE IPF definitions HEEE HE HE HEHE HE HE HE HEHE HEHE H H HHH CYGGCC IPF CC PATH DEF CYGWIN BINIPF gcc CYGGCC IPF SLINK PATH CYGGCC IPF DLINK PATH CYGGCC IPF ASLDLINK PATH CYGGCC IPF ASM PATH CYGGCC IPF PP PATH CYGGCC IPF VFRPP PATH CYGGCC IPF ASLCC PATH CYGGCC IPF ASLPP PATH DEF CYGWIN BINIPF ar DEF CYGWIN_BINIPF 1d DEF CYGWIN_BINIPF 1d DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc DEF CYGWIN_BINIPF gcc CYGGCC IPF OBJCOPY PATH DEF CYGWIN BINIPF objcopy CYGGCC IPF SYMRENAME PATH DEF CYGWIN BINIPF
152. FDF file and some parts of the DSC file to create the final binary image files This stage processes the individual EFI files formatting them into leaf EFI SECTION types and combining them using implied rules or custom rules into different firmware files FFS firmware volumes FVs and the final FLASH images FDs The construction of these images is based on the content of the FDF file with a very limited amount of data being obtained from the DSC file The default build rules specify removal of reloc sections of the PE32 PE32 file for all SEC PEI CORE and PEIM modules and components To prevent removal of the reloc section a module developer will need to specify a keyword SHADOW in the INF file Assuming that all FD and FV images are going to be generated based on the default value of the top level build command for each FV image specified the following must occur 1 The FDF file is parsed to create a directed graph structure for each FV image so that all leaf EFI SECTIONS are created first May 2010 1 22 Reference Build Process Overview 2 These leaf sections are either put into encapsulated sections or put directly into an BE file following the implied rules or user defined rules defined later in this ocument 3 As each FFS File is created the file is either encapsulated into another FFS file or appended to an FV image 4 Once all of the FFS files have been placed into an FV image file the FV file is put into
153. File lt InputFile gt h H lt OutputFile gt OUTPUT DIR MODULE NAME gch OUTPUT DIR s dir s_base obj lt Command gt Visual Form Representation File lt InputFile gt vfr Vfr VFR lt OutputFile gt DEBUG DIR s_dir s_base c lt Command gt PP VFRPP_FLAGS INC src gt OUTPUT DIR s dir s base i Trim vfr file o OUTPUT_DIR s_dir s_base iii OUTPUT_DIR s dir s base i mkdir d path gt NUL 2 gt amp 1 VfrCompile od d path OUTPUT DIR s dir s base iii 1 22 May 2010 93 94 May 2010 BUILD 1 22 6 Build Environment This chapter details the supported build environments developer workstations for EDK II development It also covers the tool configuration files that describe the developer s tool environments Note that the term development platform s referenced throughout this document means the workstation a developer using to write code and build a target binary The architecture for the target binary does not have to match the same architecture as the developer s workstation Note Path and Filename elements within the Build Meta Data files and command line arguments are case sensitive in order to support building on UNIX style operating systems All builds are performed within a WORKSPACE which is defined as a contiguous directory structure on a development workstation Sinc
154. GF GX c WX c WX LTCG NODEFAULTLIB IGNORE 4086 OPT REF W3 coff Cx Zd Zi W3 coff Cx Zd nologo nologo nologo NOLOGO xdata D SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 LTCG 1 22 May 2010 191 BUILD DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text VS2003 IA32 ASMLINK FLAGS nologo tiny HEHEHE HE HE HEHE HE HE HE HEHE HEHE N EBC definitions THE HEHE HEHE HE HE HE HEHE HEHE EE HH VS2003 EBC FAMILY INTEL VS2003 EBC MAKE PATH DEF VS2003_BIN nmake exe VS2003 EBC PP PATH VS2003 EBC VFRPP PATH VS2003 EBC CC PATH VS2003 EBC SLINK PATH VS2003 EBC DLINK PATH DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN link exe DEF EBC BIN link exe VS2003 EBC RC PATH DEF VS2003_BIN rc exe VS2003 EBC MAKE FLAGS nologo VS2003 EBC PP FLAGS nologo E TC FlAutoGen h VS2003 EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT VS2003 EBC VFRPP FLAGS nologo E TC DVFRCOMPILE FIS MODULE_NAME StrDefs h VS2003 EBC SLINK FLAGS lib NOLOGO MACHINE EBC VS2003 EBC DLINK FLAGS C Program Fil
155. GS x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h HEHEHE HE HE HEHE HE HE HE HE HE HEHE SG ASL definitions THE HE HE HEHE HE HE HE HEHE HEHE EE HH UNIXGCC ASL PATH DEF UNIX IASL BIN UNIXGCC ASL FLAGS UNIXGCC ASL OUTFLAGS DEF IASL OUTFLAGS UNIXGCC ASLPP FLAGS x c E P UNIXGCC ASLCC FLAGS X c UNIXGCC ASLDLINK FLAGS DEF UNIXGCC DLINK FLAGS COMMON entry _ReferenceAcpiTable FEE FE FE AE FE HE RET H FE HE HE HE RH IA32 definitions FEE FE FE AE FE HE HE FE FE E HE HE HE HE HE UNIXGCC IA32 PP PATH DEF UNIXGCC IA32 PETOOLS PREFIX gcc UNIXGCC IA32 CC PATH UNIXGCC IA32 SLINK PATH UNIXGCC IA32 DLINK PATH UNIXGCC IA32 ASLPP PATH UNIXGCC IA32 ASLCC PATH UNIXGCC IA32 ASLDLINK PATH DEF UNIXGCC IA32 PETOOLS PREFIX gcc DEF UNIXGCC IA32 PETOOLS PREFIX ar DEF UNIXGCC_IA32_PETOOLS PREFIX ld DEF UNIXGCC_IA32_PETOOLS PREFIX gcc DEF UNIXGCC_IA32_PETOOLS PREFIX gcc DEF UNIXGCC_IA32_PETOOLS PREFIX ld UNIXGCC_IA32_ASM PATH DEF UNIXGCC_IA32_PETOOLS PREFIX gcc UNIXGCC_IA32_VFRPP_PATH DEF UNIXGCC_IA32_PETOOLS PREFIX gcc UNIXGCC IA32 RC PATH DEF UNIXGCC IA32 PETOOLS PREFIX windres UNIXGCC IA32 CC FLAGS fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno array bounds c include AutoGen h m32 malign double freorder blocks freorder blocks and partition UNIXGCC IA32 RC FLAGS J re O coff 218 May 2010
156. Gen h ICCx86xASL EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT ICCx86xASL EBC VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h ICCx86xASL EBC SLINK FLAGS lib NOLOGO MACHINE EBC ICCx86xASL EBC DLINK FLAGS C Program Files x86 Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP God ipad IEEE IHE KOA EE FE FE IHE EIE IEEE E FE FE FE EE TEE IHE EIE KAIA KAIA FE FE FE FE E FE FE FE FE E FE FE FE FE FE FE FE E FE FE FE Eda Eda MYTOOLS IA32 Microsoft Visual Studio NET 2003 and Microsoft Windows DDK 3790 1830 for 16 bit linker X64 Microsoft Windows DDK 3790 1830 IPF Microsoft Windows DDK 3790 1830 EBC Intel EFI Byte Code Compiler FEE FE FE E FE HE E FE FE AE FE E FE KOA EE FE FE FE FE FE E FE FE FE FE FE FE FE FE FE FE E FE FE FE FE FE E FE FE FE FE FE E FE FE FE FE AE FE FE AE FE FE E FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE HH HE FE MYTOOLS Settings compatible with previous versions of tools_def template MYTOOLS FAMILY MSFT bed zg zd dd izo ASL definitions bed zg zd dd izo MYTOOLS ASL PATH DEF WIN IASL BIN MYTOOLS ASL FLAGS MYTOOLS ASL OUTFLAGS DEF IASL OUTFLAGS MYTOOLS ASLCC FLAGS DEF ICC WIN ASLCC FLAGS MYTOOLS ASLPP FLAGS DEF ICC WIN ASLPP FLAGS MYTOOLS ASLDLINK FL
157. HE EBC definitions TEHET HER FE HE FE HE FE HE HE HEHE HEHE HEH MYTOOLS EBC FAMILY INTEL MYTOOLS EBC MAKE PATH DEF VS2005 BIN nmake exe MYTOOLS EBC PP PATH MYTOOLS EBC VFRPP PATH MYTOOLS EBC CC PATH MYTOOLS EBC SLINK PATH MYTOOLS EBC DLINK PATH DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN link exe DEF EBC BIN link exe MYTOOLS EBC RC PATH DEF VS2005_ BIN rc exe MYTOOLS EBC MAKE FLAGS nologo MYTOOLS EBC PP FLAGS nologo E TC FIAutoGen h MYTOOLS EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT MYTOOLS EBC VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h MYTOOLS EBC SLINK FLAGS lib NOLOGO MACHINE EBC MYTOOLS EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib 1lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP God ipad IEEE IHE KOA EE EIE EE EIE IEEE IHE FE FE FE FE FE FE FE FE EIE HEHE HEHE HH E FE E FE HH HH FE FE E FE FE FE FE FE FE FE FE HH HE FE Xcode Support for building on Mac OS X Snow Leopard FE EE HE HE FE FE HE HE HE E FE HE HE HE FE FE FE HE HE FE FE FE FE HE HE FE FE FE HEHE FE FE HE HE HE FE FE HE HE HE HE FE FE HE FE HE FE FE HE HE FE FE FE FE A FE a FE FE FE FE HE HE FE HE HE HE HE FE FE HE HE HE HE HE E I HE XCODE32 Xcode 3 2 Tools Snow Leopard XCODE
158. I Sections or a Framework File System and a description file specific to linking and binary editing of features and attributes specified in a Platform Configuration Database PCD mixed modules with both binary and source modules Multiple modules can be combined into a package and multiple packages can be combined into a single package Protocol An API named by a GUID PCD Platform Configuration Database PEI Pre EFI Initialization Phase PPI A PEIM to PEIM Interface that is named by a GUID Runtime Services Interfaces that provide access to underlying platform specific hardware that might be useful during OS runtime such as time and date services These services become active during the boot process but also persist after the OS loader terminates boot services May 2010 1 22 Introduction SAL System Abstraction Layer A firmware interface specification used on Intel Itanium Processor based systems SEC Security Phase is the code in the Framework that contains the processor reset vector and launches PEI This phase is separate from PEI because some security schemes require ownership of the reset vector SKU Stock Keeping Unit UEFI Application An application that follows the UEFI specification The only difference between a UEFI application and a UEFI driver is that an application is unloaded from memory when it exits regardless of return status while a driver that returns a successful return status is not unloaded
159. IA32 ASLPP PATH DEF WINDDK_BIN1 6 link16 exe DEF ICC_BIN32x86 icl exe DEF ICC_BIN32x86 icl exe DEF ICC_BIN32x86 icl exe DEF VS2005x86 BIN ml exe DEF VS2005x86 DLL DEF ICC_BIN32x86 icl exe DEF ICC_BIN32x86 icl exe ICCx86xASL IA32 ASLDLINK PATH DEF ICC BIN32x86 xilink exe DEBUG ICCx86xASL IA32 CC FLAGS nologo c WX W4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR L INTEL FIAutoGen h EHs c GF Zi Gm RELEASE ICCx86xASL IA32 CC FLAGS nologo c WX W4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR L INTEL FIAutoGen h EHs c GF DEBUG ICCx86xASL IA32 ASM FLAGS nologo c WX W3 Zd Zi RELEASE ICCx86xASL IA32 ASM FLAGS nologo c WX W3 Zd ICCx86xASL IA32 SLINK FLAGS nologo DEBUG ICCx86xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICCx86xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D May 2010 1 22 1 22 MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text ICCx86xASL IA32 ASMLINK FLAGS nologo tiny TEE HERE ERE ER EHE HEB E BE X64 definitions FEFE HE HER ER E EHE RE RE BE
160. IAutoGen h EHs c GR GF Zi Gm nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FIAutoGen h EHs c GR GF DEBUG VS2005xASL X64 ASM FLAGS RELEASE VS2005xASL X64 ASM FLAGS nologo c WX W3 Cx Zd Zi nologo c WX W3 Cx Zd NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG May 2010 1 22 1 22 DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text TEE HERE HERE ERE FE HE HE NR IPF definitions HEEE HE HE HEHE HE GGA VS2005xASL IPF DLL VS2005xASL IPF PP PATH VS2005xASL IPF APP PATH VS2005xASL IPF VFRPP PATH VS2005xASL IPF CC PATH VS2005xASL IPF ASM PATH VS2005xASL IPF SLINK PATH VS2005xASL IPF DLINK PATH VS2005xASL IPF ASLCC PATH VS2005xASL IPF ASLPP PATH VS2005xASL IPF ASLDLINK PATH DEBUG VS2005xASL IPF CC FLAGS DEF VS2005 DLL DEF VS2005 BIN64 Ncl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 ias exe DEF VS2005_BIN64 lib exe DEF VS2005_BIN64 link exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 link exe Os GL FIAutoGen h QIPF fr32
161. ICC_BINX64x86 xilink exe DEBUG ICCx86 X64 CC FLAGS nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FI DEST DIR DEBUG AutoGen h Zi Gm EHs c GF RELEASE ICCx86 X64 CC FLAGS nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FIS DEST DIR DEBUG AutoGen h EHs c GF DEBUG ICCx86 X64 ASM FLAGS nologo c WX W3 Cx Zd Zi RELEASE ICCx86 X64 ASM FLAGS nologo c WX W3 Cx Zd DEBUG ICCx86 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICCx86 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D May 2010 235 236 BUILD Machine AMD64 LTCG DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text ICCx86 X64 SLINK FLAGS FEFE EE FE HE ERE ER EHE NR IPF definitions bed zg Aiz dd izo ICCx86 IPF CC PATH icl exe needs cl exe from Visual Studio ICCx86 IPF CC DLL ICCx86 IPF SLINK PATH nologo LTCG DEF ICC_BIN64x86 icl exe DEF VS2005x86 BIN DEF ICC_BIN64x86 xilib exe xilib exe needs lib exe from Visual Studio ICCx86 IPF SLINK DLL ICCx86 IPF DLINK PATH ICCx86 IPF PP PATH ICCx86 IPF VFRPP PATH ICCx86 IPF APP PATH ICCx8
162. IN ASL BIN DEF MS ASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT ASLDLINK FLAGS FEFE AE HE HE EHE FEAE HEHEHHE I E I HH 214 May 2010 1 22 IA32 definitions FEFE EE FE HE FE HE FE HE FE HE HE HEHE HEHE HEH DDK3790xASL IA32 CC PATH DEF WINDDK_BIN32 cl exe DDK3790xASL IA32 SLINK PATH DDK3790xASL IA32 DLINK PATH DDK3790xASL IA32 ASMLINK PATH DEF WINDDK_BIN32 lib exe DEF WINDDK_BIN32 link exe DEF WINDDK_BIN16 link16 exe DDK3790xASL IA32 PP PATH DDK3790xASL IA32 VFRPP PATH DDK3790xASL IA32 APP PATH DDK3790xASL IA32 ASM PATH DDK3790xASL IA32 ASLCC PATH DDK3790xASL IA32 ASLPP PATH DDK3790xASL IA32 ASLDLINK PATH DEBUG DDK3790xASL IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR RELEASE DDK3790xASL IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR DEBUG DDK3790xASL IA32 ASM FLAGS RELEASE DDK3790xASL IA32 ASM FLAGS DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 ml exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 cl exe DEF WINDDK_BIN32 link exe nologo c WX W4 Gy Gs8192 D UNICODE GF Zi Gm nologo c WX W4 Gy Gs8192 D UNICODE GF nologo c WX W3 coff Cx Zd Zi nologo c WX W3 coff Cx Zd DEBUG DDK3790xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 L
163. INE I386 LTCG May 2010 195 196 DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text VS2005 IA32 ASMLINK FLAGS nologo tiny HEHEHE HE HE HEHE HE HE HE HEHE HEHE EE HH X64 definitions THEE HE HE HEHE HE HE HE HEHE HEHE H H HH VS2005 X64 DLL VS2005 X64 CC PATH VS2005 X64 PP PATH VS2005 X64 APP PATH VS2005 X64 VFRPP PATH VS2005 X64 ASM PATH VS2005 X64 SLINK PATH VS2005 X64 DLINK PATH VS2005 X64 ASLCC PATH VS2005 X64 ASLPP PATH VS2005 X64 ASLDLINK PATH DEBUG VS2005 X64 CC FLAGS RELEASE VS2005 X64 CC FLAGS DEBUG VS2005 X64 ASM FLAGS RELEASE VS2005 X64 ASM FLAGS DEF VS2005 DLL DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 cl exe DEF VS2005_BINX64 ml64 exe DEF VS2005_BINX64 lib exe DEF VS2005_BINX64 link exe DEF VS2005_BINX64 cl exe DEF VS2005 BINX64 cl exe DEF VS2005_BINX64 link exe BUILD nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FIAutoGen h EHs c GR GF Zi Gm nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FIAutoGen h EHs c GR GF nologo c WX W3 Cx Zd Zi nologo c WX W3 Cx Zd DEBUG VS2005 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL ENTRY IMAGE EN
164. ION IA32 Bin DEFINE ICC ASM32x86 C Program Files x86 Intel Compiler C DEF ICC VERSION IA32 Bin DEF INE ICC BINX64 C Program Files Intel Compiler C DEF ICC VERSION EM64T Bin DEF INE ICC ASMX64 C Program Files Intel Compiler C DEF ICC VERSION EM64T Bin DEFINE ICC BINX64x86 C Program Files x86 Intel Compiler C DEF ICC VERSION EM64T Bin DEFINE ICC ASMX64x86 C Program Files x86 Intel Compiler C DEF ICC VERSION EM64T Bin DEFINE ICC BIN64 C Program Files Intel Compiler C DEF ICC VERSION Itanium Bin DEFINE ICC_BIN64x86 C Program Files x86 Intel Compiler C DEF ICC VERSION Itanium Bin DEFINE EBC BIN DEFINE EBC BINx86 C Program Files Intel EBC Bin C Program Files x86 Intel EBC Bin DEFINE ELFGCC BIN usr bin Option 1 Hard coded full path to compiler suite DEFINE UNIXGCC IA32 PETOOLS PREFIX opt tiano i386 tiano pe i386 tiano pe bin DEFINE UNIXGCC X64 PETOOLS PREFIX opt tiano x86 64 pc mingw64 x86 64 pc mingw64 bin DEFINE UNIXGCC IPF PETOOLS PREFIX Option 2 Use an environment variable DEFINE UNIXGCC IA32 PETOOLS PREFIX ENV IA32 PETOOLS PREFIX DEFINE UNIXGCC X64 PETOOLS PREFIX ENV X64 PETOOLS PREFIX Option 3 Install the compiler suite into your default paths DEFINE UNIXGCC IA32 PETOOLS PREFIX i386 pc mingw32 DEFINE UNIXGCC X64 PETOOLS PREFIX x86 64 pc mingw32 Option 4 Create links under the BaseTools Bin gcc
165. ION STRING INF VERSION Optional BUILD NUM BUILD NUMBER The above rule stipulates that for file type PEIM in all build architectures the generated FFS may contain at most one optional PEI_DEPEX section must contain one TE section and may contain at most one UI section with the UI string set to the INF file s module name and at most one VERSION section 9 3 3 Create an Apriori File Some firmware volumes may require an APRIORI file to be created An APRIORI file is a text file containing a GUID named list of two or more modules in the firmware volume The modules will be invoked or dispatched in the order they appear in the APRIORI file Only one of each PEI and DXE Apriori file is permitted within a single Firmware Volume Nested Firmware Volumes are permitted so Apriori files are limited to specifying the files and not FVs that are within the scope of the FV image in which it is located It is permissible for nested FV images to have one PEI and one DXE Apriori file per FV Scoping is accomplished using the curly 4 braces The following example demonstrates an example of multiple APRronz files 154 May 2010 1 22 ImageGen Stage FLASH Images Fv Root DEFINE NT32 WORKSPACE EdkNt32Pkg DEFINE BuildDir OUTPUT DIRECTORY PLATFORM NAME TARGET _ TOOL CHAIN TAG APRIORI DXE FILE DXE CORE B5596C75 37A2 4b69 B40B 72ABD6DD8708 SECTION COMPRESS SECTION PE32 BuildDir X Y Z B5596C75 37
166. K together with other static library files generated from dependent library modules into dll file Object files generated from ASLC files will be linked DLINK to dll file directly without static link step Object files generated from real mode assembly files are linked to com files by real mode linker ASMLINK 8 6 Generate Module Images The final images generated by building a module are files which can be recognized by EFI Framework protocols The types of those files supported by default are EFI executable image file efi ACPI machine language file aml ACPI table file acpi real mode executable file com and macrocode binary file bin The efi file will be generated for non library modules which have C files declared It s converted from dll file created during the dynamic link step by the GenFw tool Also e aml file is generated from asl file in Compile Assembly step e acpi file is converted from dll file by the GenFw tool e com file is generated in the Dynamic Link step by real mode linker ASMLINK e bin file is converted from txt file by GenFw tool 8 6 1 GenFw This tool is used to generate UEFI Firmware Image files based on Component or Module types listed in the INF files from the PE PE32 COFF images generated by the third party tool chains This takes dll files created during the compile portion of the MAKE stage converting the header and creating the efi files Additional functions
167. L DRIVER MOODULE TYPE UEFI DRIVER MODULE TYPE UEFI APPLICATION include statement AutoGen c VOID EFIAPI ProcessLibraryConstructorList IN EFI PEI FILE HANDLE ImageHandle IN EFI PEI SERVICES SystemTable ys 122 May 2010 1 22 AutoGen Stage include statement AutoGen c N33 If CONSTRUCTOR defined in INF If MODULE TYPE BASE include statement AutoGen c EFI STATUS Status Status lt CONSTRUCTOR gt ASSERT_EFI_ERROR Status If MODULE TYPE PEI CORE MODULE TYPE PEIM include statement AutoGen c EFI STATUS Status Status lt CONSTRUCTOR gt FileHandle PeiServices ASSERT EFI ERROR Status ys If MODULE TYPE DXE CORE MODULE TYPE DXE_DRIVER MODULE TYPE DXE SMM DRIVER MODULE TYPE DXE RUNTIME DRIVER MODULE TYPE DXE SAL DRIVER MOODULE TYPE UEFI_DRIVER MODULE TYPE UEFI APPLICATION include statement AutoGen c EFI STATUS Status Status lt CONSTRUCTOR gt ImageHandle SystemTable ASSERT_EFI_ERROR Status ys include statement AutoGen c NS 7 3 4 4 Library Destructor Statements Contained if there are DESTRUCTORSs defined in Defines section in INF file of the library instances that are being linked to 1 22 May 2010 123 If DESTRUCTOR defined in INF I MODULE_TYPE BASE include statement AutoGen c
168. LAGS N us X explicit M ilp64 N so W3 d debug F COFF32 RELEASE ICCxASL IPF ASM FLAGS N us X explicit M ilp64 N so W3 F COFF32 DEBUG ICCxASL IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG S BASE NAME map PDB DEST DIR DEBUG BASE NAME pdb DEBUG RELEASE ICCxASL IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER May 2010 1 22 SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEST DIR DEBUG BASE NAME pdb ICCxASL IPF SLINK FLAGS nologo HEEE HEHE HEHE HEHE HEHEHE HEHE HEHE HH EBC definitions HEEE HEHE HEHE HEHE HEHEHE HEHE RHE ICCxASL EBC FAMILY INTEL ICCxASL EBC MAKE PATH DEF MS VS BIN nmake exe ICCxASL EBC PP PATH DEF EBC BIN iec exe ICCxASL EBC VFRPP PATH DEF EBC_BIN iec exe ICCxASL EBC CC PATH DEF EBC_BIN iec exe ICCxASL EBC SLINK PATH DEF EBC_BIN link exe ICCxASL EBC DLINK PATH DEF EBC_BIN link exe ICCxASL EBC MAKE FLAGS nologo ICCxASL EBC PP FLAGS nologo E TC FIAutoGen h ICCxASL EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTR
169. LINK PATH VS2005 IA32 ASMLINK PATH VS2005 IA32 APP PATH VS2005 IA32 PP PATH VS2005 IA32 ASM PATH VS2005 IA32 ASLCC PATH VS2005 IA32 ASLPP PATH VS2005 IA32 ASLDLINK PATH VS2005 IA32 MAKE FLAGS DEBUG VS2005 IA32 CC FLAGS GL FIAutoGen h EHs c GR GF RELEASE VS2005 IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR DEBUG VS2005 IA32 ASM FLAGS RELEASE VS2005 IA32 ASM FLAGS DEBUG VS2005 IA32 DLINK FLAGS OPT ICF 10 MAP ALIGN 32 SECTION DEF WIN IASL BIN DEF IASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT ASLDLINK FLAGS DEF VS2005 DLL DEF VS2005_BIN nmake exe DEF VS2005_BIN cl exe DEF VS2005 BIN cl exe DEF VS2005_BIN lib exe DEF VS2005_BIN link exe DEF WINDDK_BIN16 link16 exe DEF VS2005 BIN cl exe DEF VS2005 BIN cl exe DEF VS2005 BIN ml exe DEF VS2005 BIN cl exe DEF VS2005 BIN cl exe DEF VS2005 BIN link exe nologo nologo c WX GS W4 Gs8192 D UNICODE 01ib2 Gy Zi Gm nologo c WX GS W4 Gs8192 D UNICODE GF nologo nologo NOLOGO xdata D c WX w3 Cx coff Zd Zi c WX W3 Cx coff Zd NODEFAULTLIB IGNORE 4086 OPT REF SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE VS2005 IA32 DLINK FLAGS OPT ICF 10 MAP ALIGN 32 SECTION NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF xdata D SECTION pdata D MACH
170. LTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER RELEASE ICC IPF DLINK FLAGS May 2010 W3 d W3 F NNN SNN 1 22 SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEST DIR DEBUG BASE NAME pdb ICC IPF SLINK FLAGS nologo TEE HERE ERE EH EHE RE RE BE EBC definitions FEFE EE FE HE HER E EHE HEB EH BE ICC EBC FAMILY INTEL ICC EBC MAKE PATH ICC EBC PP PATH ICC EBC VFRPP PATH ICC EBC CC PATH ICC EBC SLINK PATH ICC EBC DLINK PATH DEF MS VS BIN nmake exe DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN link exe DEF EBC BIN link exe ICC EBC MAKE FLAGS nologo ICC EBC PP FLAGS nologo E TC FIAutoGen h ICC EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT ICC EBC VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h ICC EBC SLINK FLAGS lib NOLOGO MACHINE EBC ICC EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP FEFE AE HE HE EHE HE AE FE FE FE EE ERE EE ERE ERE ERE EHE E EHE IEEE EE E HE FE AE HE EE EE HE FE AE EA EA EALO FE AE FE FE E FE EE FE FE HEHE EE ER H Intel R C Compiler Ve
171. M FLAGS N us X explicit M ilp64 N so W4 d debug RELEASE DDK3790xASL IPF ASM FLAGS N us X explicit M ilp64 N so W4 DEBUG DDK3790xASL IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEST DIR DEBUG BASE NAME pdb DEBUG RELEASE DDK3790xASL IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 May 2010 1 22 DRIVER MAP DEST DIR DEBUG BASE_NAME map PDB DEST DIR DEBUG BASE NAME pdb FEFE EE FE EE HERE ERE EHE REE HE EBC definitions TEE ERE ERE ER EHE RE RE HE DDK3790xASL EBC FAMILY INTEL DDK3790xASL EBC PP PATH DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN link exe DEF EBC BIN link exe DDK3790xASL EBC CC PATH DDK3790xASL EBC DLINK PATH DDK3790xASL EBC SLINK PATH DDK3790xASL EBC VFRPP PATH DEF EBC_BIN iec exe DDK3790xASL EBC CC FLAGS nologo c WX W3 FlAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT DDK3790xASL EBC SLINK FLAGS lib NOLOGO MACHINE EBC DDK3790xASL EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib
172. ME lib lt Command MSFT Command INTEL gt S SLINK SLINK_FLAGS OUT dst GQ OBJECT FILES LIST lt Command GCC gt S SLINK cr dst SLINK_FLAGS OBJECT FILES LIST lt Command RVCT gt SS SLINK S SLIN FLAGS dst via OBJECT FILES LIST lt Command RVCTCYGWIN gt S OBJECT FILES LIST has wrong paths for cygwin S SLINK S SLINK FLAGS dst S OBJECT FILES lt Command XCODE gt SSASLINK S SLIN FLAGS dst filelist OBJECT FILES LIST Static Library File lt InputFile gt 5 Tab lt ExtraDependency gt MAKE_FILE lt OutputFile gt DEBUG DIR MODULE NAME dl1 lt Command MSFT Command INTEL gt S DLINK OUT dst S DLINK FLAGS DLINK_SPATH 8 STATIC LIBRARY FILES LIST lt Command GCC gt S DLINK o dst S DLINK FLAGS DLINK_SPATH STATIC_LIBRARY_ FILES LIST S DLINK2 FLAGS u u 7 S OBJCOPY OBJCOPY FLAGS dst 1 22 May 2010 263 BUILD lt Command RVCT gt S DLINK DLINK FLAGS o dst DLINK_SPATH via STATIC LIBRARY FILES LIST S DLINK2 FLAGS lt Command RVCTCYGWIN gt STATIC LIBRARY FILES LIST has wrong paths for cygwin S DLINK DLINK_FLAGS o dst DLINK_SPATH S STATIC LIBRARY FILES S DLINK2 FLAGS lt Command XCODE gt S DLINK S DLINK FLAGS o dst DLINK_SPATH filelist S STATIC LIBRARY FILES LIST S DLINK2 FLAGS Static Library File US
173. N SECTION HEADER This is the common definition for all EFI SECTION headers The EFI COMMON SECTION HEADER is for sections less than 16MB in size while the EFI COMMON SECTION HEADER2 is for sections 16MB or larger If the Size field is OxFFFFFF then the section header is the EFI COMMON SECTION HEADER2 typedef struct UINT8 Size 3 EFI SECTION TYPE Type EFI COMMON SECTION HEADER typedef struct UINT8 Size 3 EFI SECTION TYPE Type UINT32 ExtendedSize EFI COMMON SECTION HEADER2 Parameters Size A 24 bit unsigned integer that contains the total size of the section in bytes including the EFI COMMON SECTION HEADER For example a zero length section has a Size of 4 bytes Type One of the EFI SECTION type 8 bit values May 2010 47 BUILD EFI_VERSION_SECTION This is the entire EFI_VERSION_SECTION A version section is a leaf section that contains a numeric build number and an optional Unicode string that represents the file revision To facilitate versioning of PEIMs DXE drivers and other files a version section may be included in a file There must never be more than one version section contained within a file EFI_LVERSION_SECTION2 must be used if the section is 16MB or larger typedef struct EFI_COMMON SECTION HEADER CommonHeader UINT16 BuildNumber CHAR16 VersionString 1 EFI_VERSION_SECTION typedef struct EFI_COMMON SECTION HEADER2 CommonHeader UINT16 BuildNumber CHAR16 VersionStr
174. NK FLAGS TEE HER ERE EH EHE REE HE IA32 definitions bed zg zd HE E HHHH VS2005xASL IA32 DLL VS2005xASL IA32 MAKE PATH VS2005xASL IA32 CC PATH VS2005xASL IA32 VFRPP PATH VS2005xASL IA32 SLINK PATH VS2005xASL IA32 DLINK PATH VS2005xASL IA32 ASMLINK PATH VS2005xASL IA32 APP PATH VS2005xASL IA32 PP PATH VS2005xASL IA32 ASM PATH VS2005xASL IA32 ASLCC PATH VS2005xASL IA32 ASLPP PATH VS2005xASL IA32 ASLDLINK PATH DEF MS ASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS DEF MSFT ASLDLINK FLAGS DEF VS2005 DLL DEF VS2005_BIN nmake exe DEF VS2005_BIN cl exe DEF VS2005_BIN cl exe DEF VS2005_BIN lib exe DEF VS2005_BIN link exe DEF WINDDK_BIN16 link16 exe DEF VS2005_BIN cl exe DEF VS2005_BIN cl exe DEF VS2005_BIN ml exe DEF VS2005 BIN cl exe DEF VS2005 BIN cl exe DEF VS2005_BIN link exe VS2005xASL IA32 MAKE FLAGS nologo DEBUG VS2005xASL IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR GF Gy Zi Gm RELEASE VS2005xASL IA32 CC FLAGS Olib2 GL FIAutoGen h EHs c GR GF DEBUG VS2005xASL IA32 ASM FLAGS RELEASE VS2005xASL IA32 ASM FLAGS DEBUG VS2005xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION DEBUG nologo c WX GS W4 Gs8192 D UNICODE nologo c WX GS w4 Gs8192 D UNICODE nologo c WX W3 Cx coff Zd Zi nologo c WX W3 Cx coff Zd xdata D SE
175. NOLOGO MACHINE EBC DDK3790 EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER FEE FE FE AE FE IEEE IHE KOA EE EIE IHE EIE IEEE E FE FE FE FE FE E FE FE FE FE HE FE FE FE FE FE E FE FE FE KAI ARKA FE FE E FE FE FE FE E FE FE HE FE FE FE FE E FE FE FE BER Microsoft Device Driver Kit 3790 1830 IA 32 X64 Itanium with Link Time Code Generation And Microsoft ACPI Compiler FEFE EE FE HE EE E E FE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE FE HE HE HE E HE E HE E HE HE HE HE HE HE HE HE HE HE AA FE FE FE FE FE FE FE FE FE FE FE FE FE FE FE IH E BE HE DDK3790xASL Microsoft Windows DDK 3790 1830 ASL Microsoft ACPI Source Language Compiler asl exe DDK3790xASL FAMILY MSFT DDK3790xASL MAKE PATH DEF WINDDK BIN32 nmake exe DDK3790xASL MAKE FLAGS nologo DDK3790xASL RC PATH DEF WINDDK_BIN32 rc exe nologo E TC FIAutoGen h nologo E TC nologo LTCG nologo E TC DVFRCOMPILE DDK3790xASL PP FLAGS DDK3790xASL APP FLAGS DDK3790xASL SLINK FLAGS DDK3790xASL VFRPP FLAGS FI MODULE NAME StrDefs h bed zg zd dd izo ASL definitions bed zg Aiz dd izo DDK3790xASL ASL PATH DDK3790xASL ASL FLAGS DDK3790xASL ASL OUTFLAGS DDK3790xASL ASLCC FLAGS DDK3790xASL ASLPP FLAGS DDK3790xASL ASLDLINK FLAGS DEF W
176. NT 128K EFI FVB2 ALIGNMENT 256K EFI FVB2 ALIGNMNET 512K EFI FVB2 ALIGNMENT 1M EFI FVB2 ALIGNMENT 2M EFI FVB2 ALIGNMENT 4M EFI FVB2 ALIGNMENT 8M EFI FVB2 ALIGNMENT 16M EFI FVB2 ALIGNMENT 32M EFI FVB2 ALIGNMENT 64M EFI FVB2 ALIGNMENT 128M EFI FVB2 ALIGNMENT 256M EFI FVB2 ALIGNMENT 512M EFI FVB2 ALIGNMENT 1G EFI FVB2 ALIGNMENT 2G 0x001F0000 0x00000000 0x00010000 0x00020000 0x00030000 0x00040000 0x00050000 0x00060000 0x00070000 0x00080000 0x00090000 0x000A0000 0x000B0000 0x000C0000 0x000D0000 0x000E0000 0x000F0000 0x00100000 0x00110000 0x00120000 0x00130000 0x00140000 0x00150000 0x00160000 0x00170000 0x00180000 0x00190000 0x001A0000 0x001B0000 0x001C0000 0x001D0000 0x001E0000 0x001F0000 May 2010 BUILD 1 22 UEFI and PI Image Specification EFI FIRMWARE VOLUME EXT HEADER The extended header is always 32 bit aligned relative to the start of the file header typedef struct EFI GUID FvName UINT32 ExtHeaderSize EFI FIRMWARE VOLUME EXT HEADER Parameters FvName Firmware volume name ExtHeaderSize Size of the rest of the extension header including this structure 1 22 May 2010 59 BUILD EFI FIRMWARE VOLUME EXT ENTRY After the extension header there is an array of variable length extension header entries each prefixed with the EFI FIRMWARE VOLUME EXT ENTRY Structure The EDK II build tools will always append either the content of a binary file or convert a user specified FDF file d
177. Name of the INF file for a given component Can be used for dependencies in the makefiles Specifies the directory where EFI libraries are deposited after building Typically BUILD_DIR PROCESSOR Name of the output makefile for the component Default is makefile This value can be overridden to support building different variations of a component in the same DEST DIR directory Unused but typically BUILD_DIR PROCESSOR If defined then the utility will create a package file named DEST_DIR BASE_NAME pkg and copy with macro expansion the package COMPONENT_TYPE PACKAGE section from the DSC file to the output file If defined then the utility will not generate a package file The build can then use the value PACKAGE FILE to have GenFfsFile use an existing package file for creating the firmware file 182 May 2010 1 22 1 22 Variable Name G L Description PLATFORM PROCESSOR SOURCE_DIR G L This symbol can be used to provide more selectivity of files in the Platform DSC files If assigned then the utility will also process any files in the INF file under sections sources PROCESSOR PLATFORM includes PROCESSOR PLATFORM and libraries PROCESSOR PLATFORM Defines the target processor for which the code is to be built This symbol will typically be used to include or exclude source files in Platform DSC files and to define the tool ch
178. ODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG X W4 Gs8192 D UNICODE X WA Gs8192 D UNICODE May 2010 215 216 BUILD DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE DDK3790xASL X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text bed zg Aiz dd izo IPF definitions bed zg Aiz dd izo DDK3790xASL IPF CC PATH DEF WINDDK_BIN64 cl exe DDK3790xASL IPF SLINK PATH DEF WINDDK_BIN64 lib exe DDK3790xASL IPF DLINK PATH DEF WINDDK_BIN64 link exe DDK3790xASL IPF PP PATH DEF WINDDK_BIN64 cl exe DDK3790xASL IPF VFRPP PATH DEF WINDDK_BIN64 cl exe DDK3790xASL IPF APP PATH DEF WINDDK_BIN64 cl exe DDK3790xASL IPF ASM PATH DEF WINDDK BIN64 Mias exe DDK3790xASL IPF ASLCC PATH DEF WINDDK_BIN64 cl exe DDK3790xASL IPF ASLPP PATH DEF WINDDK_BIN64 cl exe DDK3790xASL IPF ASLDLINK PATH DEF WINDDK_BIN64 link exe DEBUG DDK3790xASL IPF CC FLAGS nologo c WX GS X W4 EHs c GR Gy Os GL FIAutoGen h QIPF fr32 Zi RELEASE DDK3790xASL IPF CC FLAGS nologo c WX GS X W4 EHs c GR Gy Os GL FIAutoGen h QIPF fr32 DEBUG DDK3790xASL IPF AS
179. ON FIRMWARE VOLUME IMAGE DOS style 16 bit executable PI Firmware Volume Image EFI SECTION FREEFORM SUBTYPE GUID Raw data with GUID in header to define format EFI SECTION RAW Raw data for example a logo EFI SECTION PEI DEPEX PEI Dependency Expression 2 6 2 Firmware Files Multiple EFI Sections are combined into a Firmware file FFS which consists of zero or more EFI sections Each FFS consists of a FFS header plus the data Figure 9 show the basic FFS File layout and Figure 10 shows the FFS File layout for files of 16MB or larger 18 May 2010 BUILD 1 22 Design Discussion 31 1615 0 One or more EFI SECTIONs File Data FFS File Header Figure 9 Typical FFS File Layout 16MB One or more EFI SECTIONs Extended Size File Data FFS File Header Figure 10 File Header 2 layout for files larger than 16Mb Table 3 lists the different FV file types architecturally defined in the PI specification 1 22 May 2010 19 describing the content FFS of the Firmware Volume Data Table 3 Defined FV File Types BUILD Name Description Code EFI FV FILETYPE RAW Binary data 0x01 EFI FV FILETYPE FREEFORM Sectioned Data 0x02 EFI FV FILETYPE SECURITY CORE Platform core code used 0x03 during the SEC phase EFI FV FILETYPE PEI CORE PEI Foundation code 0x04 EFI FV FILETYPE DXE CORE DXE Foundation code
180. ORMATION FileInfo void Buffer int Status UINT32 DestinationSize VOID Destination Status 0 printf test d n argc if argc lt 1 return 0 hFile CreateFile argv 1 GENERIC_READ FILE SHARE READ NULL OPEN EXISTING 0 0 IK if hFile INVALID HANDLE VALUE Error GetLastError return Error if GetFileInformationByHandle hFile Error GetLastError return Error if FileInfo nFileSizeHigh 0 Assume input file is less than 4GB in size May 2010 amp FileInfo BUILD 1 22 1 2 1 return 0 Buffer Malloc FileInfo nFileSizeLow if ReadFile hFile Buffer FileInfo nFileSizeLow amp BytesRead NULL Error GetLastError return Error Process File DestinationSize Destination I a 2nd argument exists it is a file name to write data to if argc gt 3 amp amp Status 0 hOutFile CreateFile argv 2 GENERIC WRITE GENERIC READ 0 NULL CREATE ALWAYS FILE ATTRIBUTE NORMAL NULL IK if hOutFile INVALID HANDLE VALUE if WriteFile hOutFile Destination DestinationSize amp BytesRead NULL Error GetLastError CloseHandle hOutFile CloseHandle hFile return 0 To pass an argument in to the console application Do the following Be NT Update the lt project name gt Property Pages Right click on the lt project name gt in the Solution Explorer pain
181. PATH iasl XCODE32 X64 ASLCC PATH gcc XCODE32 X64 ASLPP PATH gcc XCODE32 X64 ASLDLINK PATH ld May 2010 1 22 XCODE32 X64 DLINK FLAGS arch x86 64 u _ IMAGE ENTRY POINT e _ IMAGE ENTRY POINT preload segalign 0x20 slow stubs pie segladdr 0x240 read only relocs suppress map DEST DIR DEBUG BASE NAME map XCODE32 X64 SLINK FLAGS static o DEBUG XCODE32 X64 ASM FLAGS RELEASE XCODE32 X64 ASM FLAGS XCODE32 X64 PP FLAGS DEST DIR DEBUG AutoGen h XCODE32 X64 VFRPP FLAGS arch x86 64 x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h arch x86 64 g arch x86 64 arch x86 64 E x assembler with cpp include DEBUG XCODE32 X64 CC FLAGS arch x86 64 save temps g 00 combine mms bitfields fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno address fomit frame pointer static c include AutoGen h fno stack protector RELEASE XCODE32 X64 CC FLAGS arch x86 64 Oz combine mms bitfields fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno address fomit frame pointer static c include AutoGen h fno stack protector JUS HE HE HE HEHE HEHE H H HH ARM definitions still a work in progress Assumes iPhone SDK installed FEE FE FE AE FE HE ET FE E HE HE HE HEHE HE XCODE32 ARM ARCHCC FLAGS arch armv6 march armv6 mthumb XCODE32 ARM ARCHASM FLAGS arch armv6 XCODE32 ARM ARCHDLINK FLAGS arch armv6 XCOD
182. PORTED_ARCHITECTURES statement the command should fail 6 2 4 Third Party tools using t TOOL CHAIN TAG It is possible to specify a different set of third party tools using the t TOOL CHAIN TAG option to the build command This option takes precedence over the target txt file setting Highest build command t TOOL CHAIN TAG option Lowest target txt file TOOL CHAIN TAG statement 6 2 5 Precedence of FLAGS values The flags needed by third party tools can be specified on a file module or platform basis The default flags provided in the tools def txt file are for size optimization These flags may be modified to provide better debugging capability The precedence of the FLAGS values for third party tools follows The reasoning behind this precedence is that flags are appended to a single line from the lowest to highest with third party tools using the right most option If a flag line for the Microsoft compiler contains O1 specified in the tools def txt file and Od for example from the DSC file s BuildOptions section then the compiler only recognizes the Od flag Highest DSC file INF lt BuildOptions gt section statements DSC file BuildOptions section statements INF file BuildOptions section statements tools def txt file FLAGS statements Lowest The following demonstrates the way tools should process the flags statements CCFLAGS ToolsDef CC FLAGS INF BuildOptions DSC BuildOptions CC FLAGS
183. Pkg Include Library BaseLib h OUTPUT_DIR Ia32 WriteGdtr obj WORKSPACE MdePkg Include Library TimerLib h OUTPUT_DIR Ia32 WriteGdtr obj WORKSPACE MdePkg Include Library BaseMemoryLib h OUTPUT_DIR Ia32 WriteGdtr obj WORKSPACE MdePkg Include Library PcdLib h OUTPUT_DIR Ia32 WriteGdtr obj WORKSPACE MdePkg Library BaseLib Ia32 WriteGdtr c OUTPUT_DIR Ia32 WriteGdtr obj WORKSPACE MdePkg Library BaseLib BaseLibInternals h CC Fo OUTPUT_DIR Ia32 WriteGdtr obj CC FLAGS INC WORKSPACE MdePkg Library BaseLib Ia32 WriteGdtr c OUTPUT_DIR Ia32 WriteDr3 obj COMMON DEPS OUTPUT_DIR Ia32 WriteDr3 obj WORKSPACE MdePkg Library BaseLib Ia32 WriteDr3 c CC Fo OUTPUT_DIR Ia32 WriteDr3 obj CC_FLAGS INC WORKSPACE MdePkg Library BaseLib Ia32 WriteDr3 c One makefile is generated for each combination of TARGET_TOOLCHAIN and ARCH The build_rule txt file specifies how files are to be processed with the generated makefiles containing valid syntax for the given tool chain 4 4 1 1 Parse DSC file 1 Obtain platform Feature Flag PCD values may be used in the Conditional Directives if the value of a Feature Flag PCD used in the conditional directives cannot be determined the build will break Second pass over the DSC files will crush out any conditional directives where the feature flag expression used in the conditional directive is False Obta
184. R DEBUG BASE NAME pdb ICCx86 IPF SLINK FLAGS nologo TEE HERE HERE ER EHE HE BE HE EBC definitions TEE HERE ERE EH EHE HE BE HE ICCx86 EBC FAMILY INTEL ICCx86 EBC MAKE PATH DEF VS2005x86_BIN nmake exe ICCx86 EBC PP PATH DEF EBC BIN iec exe ICCx86 EBC VFRPP PATH DEF EBC_BIN iec exe ICCx86 EBC CC PATH DEF EBC BIN iec exe ICCx86 EBC SLINK PATH DEF EBC_BIN link exe ICCx86 EBC DLINK PATH DEF EBC_BIN link exe ICCx86 EBC MAKE FLAGS nologo ICCx86 EBC PP FLAGS nologo E TC FlAutoGen h ICCx86 EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT ICCx86 EBC VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h ICCx86 EBC SLINK FLAGS lib NOLOGO MACHINE EBC ICCx86 EBC DLINK FLAGS C Program Files x86 Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP FEFE AE HE HE EHE HE AE FE FE FE HE FE AE E FE AE FE FE EHE EA EA EAO EH IEEE IEEE FE FE E FE FE E HE FE AE FE FE EA EA EA EA EALO FE AE FE FE E FE EE EE IE E IE IE E E H Intel R C Compiler Version 9 1 x86 32 bit on 64 bit OS ICCx86xASL Intel R C Compiler for Itanium R Version 9 1 Build 20060928 Package ID W CC C 9 1 032 ASL Microsoft ACPI Source Language Compiler God ipad E FE FE AE KOA KOA KOA IEEE EE EIE ARGA IHE EIE IHE FE FE FE
185. RCHCC FLAGS PLATFORM FLAGS E x assembler with cpp include DEST DIR DEBUG AutoGen h ARMGCC ARM VFRPP FLAGS ARCHCC FLAGS PLATFORM FLAGS x c E P DVFRCOMPILE include DEST DIR DEBUG MODULE NAME StrDefs h ARMGCC ARM MAKE PATH make ARMGCC ARM SLINK FLAGS r ARMGCC ARM DLINK FLAGS ARCHDLINK FLAGS emit relocs oformat elf32 littlearm nostdlib u IMAGE ENTRY POINT e IMAGE ENTRY POINT Map DEST DIR DEBUG BASE NAME map gc sections DEBUG ARMGCC ARM CC FLAGS ARCHCC FLAGS PLATFORM FLAGS mfpu fpa mlittle endian g 02 mabi aapcs mapcs fno short enums save temps combine fsigned char fshort wchar fno strict aliasing ffunction sections fdata sections Wall Werror Wno missing braces fomit frame pointer c include AutoGen h RELEASE ARMGCC ARM CC FLAGS ARCHCC FLAGS PLATFORM FLAGS mfpu fpa mlittle endian O2 mabi aapcs mapcs fno short enums save temps combine fsigned char May 2010 1 22 fshort wchar fno strict aliasing ffunction sections fdata sections Wall Werror Wno missing braces fomit frame pointer c include AutoGen h AEAEE RH RTT EH REE ETH VfrCompiler definitions THHEHHBHHHHHHHHHE E E VFR PATH VFR FLAGS FEFE EE HER ER E BH E RE RE HE OptionRom tool definitions FEFE EE HERE HERE FE FE FE HE HE HEHE HEHE HEHE OPTROM PATH OPTROM FLAGS THEE AERE TEE HERE EHE SG Asl Compiler definitions TEE
186. RY DscFile else MOD BUILD DIR1 getValue OUTPUT DIRECTOR DscFile Foreach Target in ActiveTargetList Foreach ToolChainTag in ActiveToolChain MOD BUILD DIR2 MOD BUILD DIR1 Target ToolChainTag V foreach Arch in ActiveArchList MODULE BUILD DIR MOD BUILD DIR2 Arch MODULE BUILD DIR getDirPart InfFile VN MODULE BUILD DIR getValue BASE N InfFIle VN MAKEFILE MODULE BUILD DIR Makefile genModuleMakefile MAKEFILE addModuleToList MAKEFILE MakefileList genTopMakefile MOD BUILD DIR2 Makefile 7 4 1 1 Macro definitions 7 4 1 1 1 Platform information These come from Defines section in the DSC file MakefileList PLATFORM MAKEFILE Foreach InfFile MakefileList MODULE MAKEFILE foreach Makefile in MakefileList include statement MODULE BUILD DIR MMakefile PLATFORM NAME getValue PLATFORM NAME DscFile PLATFORM GUID getValue PLATFORM GUID DscFile PLATFORM VERSION getValue PLATFORM VERSION DscFile PLATFORM RELATIVE DIR getDirPart ActivePlatform PLATFORM DIR WORKSPACE getDirPart ActivePlatform PLATFORM OUTPUT DIR getValue OUTPUT DIRECTOR DscFile ys Example PLATFORM NAME NT32 PLATFORM GUID EB216561 961F 47EE 9EF9 CA426EF547C2 PLATFORM VERSION 0 3 PLATFORM RELATIVE DIR Nt32Pkg PLATFORM DIR WORKSPACE Nt32Pkg PLATFORM OUTPUT DIR Build NT32
187. S2005x86 IPF APP PATH DEF VS2005x86_BIN64 cl exe VS2005x86 IPF VFRPP PATH VS2005x86 IPF CC PATH VS2005x86 IPF ASM PATH VS2005x86 IPF SLINK PATH VS2005x86 IPF DLINK PATH DEF VS2005x86_BIN64 cl exe DEF VS2005x86_BIN64 cl exe DEF VS2005x86_BIN64 ias exe DEF VS2005x86_BIN64 lib exe DEF VS2005x86_BIN64 link exe VS2005x86 IPF ASLCC PATH DEF VS2005x86_BIN64 cl exe VS2005x86 IPF ASLPP PATH DEF VS2005x86_BIN64 cl exe VS2005x86 IPF ASLDLINK PATH DEF VS2005x86_BIN64 link exe DEBUG VS2005x86 IPF CC FLAGS GL FIAutoGen h QIPF fr32 Zi RELEASE VS2005x86 IPF CC FLAGS GL FIAutoGen h QIPF fr32 DEBUG VS2005x86 IPF ASM FLAGS N us X explicit M ilp64 N so W4 d debug RELEASE VS2005x86 IPF ASM FLAGS N us X explicit M ilp64 N so W4 DEBUG VS2005x86 IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEBUG DIR BASE NAME map PDB DEBUG DIR BASE NAME pdb DEBUG RELEASE VS2005x86 IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF ICF IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 nologo c WX GS X WA EHs c GR Gy Os nologo c WX GS X WA EHs c GR Gy Os 1 22 May 2010 205 BUILD ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SER
188. SecCoreData PPILISE OldCoreData return ENTRY POINT SecCoreData PpiList OldCoreData AAK 126 May 2010 1 22 AutoGen Stage If MODULE TYPE DXE_CORE include statement AutoGen c const UINT32 gUefiDriverRevision 0 VOID lt ENTRY_POINT gt IN VOID HobStart IKO VOID EFIAPI ProcessModuleEntryPointList IN VOID HobStart lt ENTRY_POINT gt HobStart wi If MODULE TYPE PEIM include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED const UINT32 _gPeimRevision 0 If Number of ENTRY_POINT 0 include statement AutoGen c EFI_STATUS EFIAPI ProcessModuleEntryPointList IN EFI PEI FILE HANDLE FileHandle IN EFI PEI SERVICES PeiServices return EFI SUCCESS Ore If Number of ENTRY POINT 1 include statement AutoGen c EFI STATUS XENTRY POINT IN EFI PEI FILE HANDLE FileHandle IN EFI PEI SERVICES PeiServices UE EFI_STATUS EFIAPI ProcessModuleEntryPointList 1 22 May 2010 127 BUILD IN EFI_PEI_FILE HANDLE FileHandle IN EFI_PEI_SERVICES PeiServices return ENTRY POINT FileHandle PeiServices ys If Number of ENTRY POINT 1 include statement AutoGen c SENTRY POINT1 IN EFI PEI FILE HANDLE FileHandle IN EFI PEI SERVICES PeiServices lt ENTRY_POINT2 gt IN EFI_PEI_FILE HANDLE FileHandle IN EFI_PEI_SERVICES PeiServices UE EFI_STATUS EFIAPI ProcessMo
189. T16 Magic UINT8 MajorLinkerVersion UINT8 MinorLinkerVersion UINT32 SizeOfCode UINT32 SizeOfInitializedData UINT32 SizeOfUninitializedData UINT32 AddressOfEntryPoint UINT32 BaseOfCode IA32 X64 EBC definitions follow UINT32 BaseOfData UINT32 ImageBase UINT32 SectionAlignment UINT32 FileAlignment UINT16 MajorOperatingSystemVersion UINT16 MinorOperatingSystemVersion UINT16 MajorimageVersion UINT16 MinorImageVersion UINT16 MajorSubsystemVersion UINT16 MinorSubsystemVersion UINT32 Win32VersionValue UINT32 SizeOfImage UINT32 SizeOfHeaders UINT32 CheckSun UINT16 Subsystem UINT16 DllCharacteristics UINT32 SizeOfStackReserve UINT32 SizeOfStackCommit UINT32 SizeOfHeapReserve UINT32 SizeOfHeapCommit UINT32 LoaderFlags UINT32 NumberOfRvaAndSizes EFI IMAGE DATA DIRECTORY DataDirectory EFI IMAGE NUMBER OF DIRECTORY ENTRIES EFI IMAGE OPTIONAL HEADER32 typedef struct Common structure UINT16 Magic UINT8 MajorLinkerVersion UINT8 MinorLinkerVersion UINT32 SizeOfCode May 2010 43 UINT32 UINT32 UINT32 UINT32 IPF Definitions follow UINT64 UINT32 UINT32 UINT16 UINT16 UINT16 UINT16 UINT16 UINT16 UINT32 UINT32 UINT32 UINT32 UINT16 UINT16 UINT64 UINT64 UINT64 UINT64 UINT32 UINT32 EFI IMAGE DATA DIRECTORY BUILD SizeOfInitializedData SizeOfUninitializedData AddressOfEntryPoint BaseOfCode ImageBase SectionAlignment FileAlignment Ma
190. TCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE DDK3790xASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text DDK3790xASL IA32 ASMLINK FLAGS nologo tiny GOZ HE HE HE HE HE HEHE SG x64 definitions bed zg zd dd izo _DDK3790xASL_X64_CC_PATH DDK3790xASL X64 SLINK PATH DDK3790xASL X64 DLINK PATH DDK3790xASL X64 PP PATH DDK3790xASL X64 VFRPP PATH DDK3790xASL X64 APP PATH DEF WINDDK_BINX64 cl exe DDK3790xASL X64 ASM PATH DEF WINDDK BINX64 m164 exe DDK3790xASL X64 ASLCC PATH DEF WINDDK_BINX64 cl exe DDK3790xASL X64 ASLPP PATH DEF WINDDK_BINX64 cl exe DDK3790xASL_X64_ASLDLINK_PATH DEF WINDDK_BINX64 link exe DEF WINDDK_BINX64 cl exe DEF WINDDK_BINX64 lib exe DEF WINDDK_BINX64 link exe DEF WINDDK_BINX64 cl exe DEF WINDDK_BINX64 cl exe DEBUG DDK3790xASL X64 CC FLAGS nologo c WX GS Olib2s GL Gy FIAutoGen h EHs c GR GF Zi Gm RELEASE DDK3790xASL X64 CC FLAGS nologo c WX GS Olib2s GL Gy FIAutoGen h EHs c GR GF DEBUG DDK3790xASL X64 ASM FLAGS nologo c WX W3 Cx Zd Zi RELEASE DDK3790xASL X64 ASM FLAGS nologo c WX W3 Cx Zd DEBUG DDK3790xASL X64 DLINK FLAGS NOLOGO N
191. TOOLS PREFIX ld DEF UNIXGCC IPF PETOOLS PREFIX gcc DEF UNIXGCC IPF PETOOLS PREFIX gcc DEF UNIXGCC IPF PETOOLS PREFIX gcc DEF UNIXGCC IPF PETOOLS PREFIX gcc DEF UNIXGCC IPF PETOOLS PREFIX objcopy DEF UNIXGCC IPF PETOOLS PREFIX objcopy DEF UNIXGCC IPF PETOOLS PREFIX objcopy UNIXGCC IPF CC FLAGS Os fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno array bounds c include AutoGen h minline int divide min latency UNIXGCC IPF DLINK FLAGS nostdlib 02 gc sections dll static entry IMAGE ENTRY POINT undefined IMAGE ENTRY POINT Map DEST DIR DEBUG BASE NAME map UNIXGCC IPF OBJCOPY FLAGS I elf64 ia64 little O efi bsdrv ia64 UNIXGCC IPF SYMRENAME FLAGS redefine sym memcpy CopyMem UNIXGCC IPF RC FLAGS I binary O elf64 ia64 rename section data hii FE EE HE HE FE FE HE HE HE E FE HE HE HE FE FE FE HE HE AR FE HE HE FE FE FE HE E FE FE FE UR FE HE HE HE AU FE HE FE FE FE AU HE FE FE FE FE A FE FE HE FE AR HE HE HE FE HE HE HE FE FE FE HE HE HE E FE HHHH HE Cygwin GCC And Intel ACPI Compiler M enne A CYGGCC CygWin GCC May 2010 219 ASL Intel ACPI Source Language Compiler iasl exe CYGGCC FAMILY CYGGCC DLL CYGGCC MAKE PATH CYGGCC MAKE FLAGS CYGGCC PP FLAGS CYGGCC DLINK FLAGS 0x20 CYGGCC ASM FLAGS CYGGCC APP FLAGS CYGGCC VFRPP FLAGS MODULE NAME StrDefs h TEE HERE HERE EH EH
192. TRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE VS2005 X64 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D Machine AMD64 LTCG May 2010 1 22 1 22 DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text THEE HERE ERE E EHE HE BEBE IPF definitions THEE AERE THERE HE HEHE HEHE H H HH VS2005 IPF DLL VS2005 IPF PP PATH VS2005 IPF APP PATH VS2005 IPF VFRPP PATH VS2005 IPF CC PATH VS2005 IPF ASM PATH VS2005 IPF SLINK PATH VS2005 IPF DLINK PATH VS2005 IPF ASLCC PATH VS2005 IPF ASLPP PATH VS2005 IPF ASLDLINK PATH DEBUG VS2005 IPF CC FLAGS DEF VS2005 DLL DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 ias exe DEF VS2005_BIN64 lib exe DEF VS2005_BIN64 link exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 cl exe DEF VS2005_BIN64 link exe nologo c WX GS X W4 GL FIAutoGen h QIPF fr32 Zi RELEASE VS2005 IPF CC FLAGS GL FIAutoGen h QIPF fr32 DEBUG VS2005 IPF ASM FLAGS RELEASE VS2005 IPF ASM FLAGS DEBUG VS2005 IPF DLINK FLAGS nologo c WX GS X W4 N us X explicit M ilp64 N us X explicit M ilp64 EHs c GR Gy Os EHs c GR Gy Os N so W4 d debug N so W4 NOLOGO NODEF
193. ULE include statement AutoGen h extern lt DatumType gt gPcd BinaryPatch TokenCName define PCD GET MODE lt DatumSize gt lt TokenCName gt VN _gPcd BinaryPatch lt TokenCName gt define PCD SET MODE lt DatumSize gt lt TokenCName gt Value gPed BinaryPatch lt TokenCName gt Value pus If PCD type DYNAMIC include statement AutoGen h define PCD GET MODE lt DatumSize gt lt TokenCName gt LibPcdGet DatumSize PCD TOKEN lt PcdTokenCName gt If DatumType VOID include statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt SizeOfBuffer Buffer LibPcdSet DatumSize gPcd BinaryPatch lt TokenCName gt SizeOfBuffer Buffer Else include_statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt Value LibPcdSet DatumSize gPcd BinaryPatch TokenCName Value If PCD_type DYNAMIC EX include statement AutoGen h 118 May 2010 1 22 AutoGen Stage define PCD GET MODE lt DatumSize gt lt TokenCName gt VN LibPcdGetEx lt DatumSize gt amp lt TokenSpaceGuidCName gt PCD TOKEN lt PcdTokenCName gt Tg If DatumType VOID include statement AutoGen h define _PCD_SET_MODE lt DatumSize gt lt TokenCName gt SizeOfBuffer Buffer LibPcdSetEx lt DatumSize gt amp lt TokenSpaceGuidCName gt _gPcd BinaryPatch lt TokenCName gt VN
194. VERSION 0x00020000 EFI SPECIFICATION VERSION 0x00020000 Binaries common BIN Logo bmp This inf file shows that binary file Logo bmp will be wrapped into the Logo FFS file This kind of INF file is specified using standard INF statement in an FV section of the FDF file 9 3 2 Creating EFI Sections Sections are produced by GenSec tool using information in FDF file of what type and content the section should contain Section information in FDF file belongs to two 1 22 May 2010 153 BUILD categories either it is a leaf section or it is an encapsulate section Encapsulation sections may contain one or more leaf sections or other encapsulate section The leaf section information appears in the FILE statement in Section 9 2 1 the PE32 section type for the Fat efi file Normally this information is enough for GenSec tool however more information can be specified by specifying a RULE section in the FDF file Rules in an FDF file look like Rule Common SEC FILE SEC NAMED GUID TE TE Align 8 efi RAW BIN Align 16 com The above rule stipulates that for file type SEC in all build architectures the generated FFS should contain one TE section with 8 byte alignment and one RAW section with 16 byte alignment Different information can be specified for different section types Rule Common PEIM FILE PEIM NAMED GUID PEI DEPEX PEI DEPEX Optional depex TE TE efi UI STRING MODULE NAME Optional VERS
195. VICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEBUG DIR BASE_NAME map PDB DEBUG DIR BASE NAME pdb TEHET HERE HERE ER EHE NR EBC definitions TEE ETHER FE HE FE HE HE HEHE HEHE HEH VS2005x86 EBC FAMILY INTEL VS2005x86 EBC MAKE PATH DEF VS2005x86 BIN nmake exe VS2005x86 EBC PP PATH VS2005x86 EBC VFRPP PATH VS2005x86 EBC CC PATH VS2005x86 EBC SLINK PATH DEF EBC_BINx86 iec exe DEF EBC_BINx86 iec exe DEF EBC_BINx86 iec exe DEF EBC_BINx86 link exe VS2005x86 EBC DLINK PATH DEF EBC_BINx86 link exe VS2005x86 EBC MAKE FLAGS nologo VS2005x86 EBC PP FLAGS nologo E TC FlAutoGen h VS2005x86 EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT VS2005x86 EBC VFRPP FLAGS nologo E TC DVFRCOMPILE FI MODULE NAME StrDefs h VS2005x86 EBC SLINK FLAGS lib NOLOGO MACHINE EBC VS2005x86 EBC DLINK FLAGS C Program Files x86 Intel EBC Lib EbcLib 1lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP THE HERE EE E HE FE FE HE FE HE FE dg FE HE FE HE FE HE ETERS THE HE E HE E HE HE HE HE HE HE HE HE THERE AA AA SERE FE FE FE FE FE IHE IHE IHE IHE IHE E Microsoft Visual Studio 2005 x86 VS2005 Microsoft Visual Studio 2005 All Edition including Standard Professional Express TeamSuite ASL Microsoft ACPI Source Language Com
196. Y POINT ARCH ENTRY POINT ICCxASL EBC VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h ICCxASL EBC SLINK FLAGS lib NOLOGO MACHINE EBC ICCxASL EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib 1lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP FEFE AE HE HE EHE FE AE FE FE FE HE FE AEE FE AE FE FE EHE EA EA EAO AO FE AE FE FE E HE FE AE IEEE FE E HE FE EE ERE ERE ERE BEE EE EE EE IE E EE E AG Intel R C Compiler Version 9 1 x86 32 bit on 64 bit OS ICCx86 Intel R C Compiler for Itanium R Version 9 1 Build 20060928 Package ID W CC C 9 1 032 ASL Intel ACPI Source Language Compiler HEHEHE HE HE HEHE HE HE HE HE HE HE FE HE HE HE HE HE FE HE HE FE FE FE HE HE HE HE FE FE E FE HE HE FE FE E E HE HE FE dd FE FE HE HE FE FE FE FE HE HE FE FE FE FE FE HE FE FE FE E HE EE FE FE HE HE FE FE EE E ICCx86 Intel C Compiler V9 1 ICCx86 FAMILY INTEL ICCx86 MAKE PATH ICCx86 RC PATH DEF VS2005x86 BIN nmake exe DEF VS2005x86 BIN rc exe ICCx86 MAKE FLAGS nologo ICCx86 VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h ICCx86 APP FLAGS ICCx86 PP FLAGS nologo E TC nologo E TC FIAutoGen h Ld ER EHE REE HE ASL definitions TEE HERE FE HE FE HE FE HE HE HEHE HEHE HEH ICCx86 ASL PATH DEF WIN IASL BIN 1 22 May 2010 23
197. YTOOLS IPF ASM PATH DEF WINDDK_BIN64 ias exe MYTOOLS IPF ASLCC PATH DEF WINDDK_BIN64 cl exe MYTOOLS IPF ASLPP PATH DEF WINDDK BIN64 cl exe MYTOOLS IPF ASLDLINK PATH DEF WINDDK_BIN64 link exe MYTOOLS IPF RC PATH DEF WINDDK_BIN32 rc exe MYTOOLS IPF ASM OUTPUT Yo DEBUG MYTOOLS IPF CC FLAGS nologo c WX GS X W4 Gy Ox GL FIAutoGen h EHs c GR GF Zx QIPF fr32 Zi RELEASE MYTOOLS IPF CC FLAGS nologo c WX GS X WA Gy Ox GL FIAutoGen h EHs c GR GF Zx QIPF fr32 DEBUG MYTOOLS IPF ASM FLAGS N us X explicit M ilp64 N so W4 d debug RELEASE MYTOOLS IPF ASM FLAGS N us X explicit M ilp64 N so W4 DEBUG MYTOOLS IPF DLINK FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF OPT ICF 10 IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEBUG DIR BASE NAME pdb DEBUG RELEASE MYTOOLS_IPF_DLINK_FLAGS NOLOGO NODEFAULTLIB LTCG DLL OPT REF OPT ICF 10 IGNORE 4086 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER May 2010 1 22 SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEBUG_DIR BASE NAME pdb MYTOOLS IPF SLINK FLAGS nologo LTCG FEFE EE FE HE ER ER EHE RE RE
198. a File Specifications permitted only for the FAMILY DLL and DPATH attributes see Attributes below Table 16 Predefined Command Codes CommandCode Function APP C compiler for applications ASL ACPI Compiler for generating ACPI tables ASM A Macro Assembler for assembly code in some libraries ASMLINK The Linker to use for assembly code generated by the ASM tool CC C compiler for PE32 PE32 Coff images DLINK The C dynamic linker MAKE Required for tool chains This identifies the utility used to process the Makefiles generated by the first phase of the build PCH The compiler for generating pre compiled headers PP The C pre processor command SLINK The C static linker TIANO This special keyword identifies a compression tool used to generate compression sections as well as the library needed to uncompress an image in the firmware volume VFRPP The C pre processor used to process VFR files Attribute A keyword to uniquely identify a property of the command the fifth and last field Several pre defined attributes have been defined DLL DPATH FAMILY FLAGS GUID OUTPUT and PATH Use quotation marks only if the quotation marks must be included in the flag string The following example shows the format for the required quoted string C Program Files Intel EBC Lib EbcLib 1ib Normally the quotation characters are not required as everything following the equal sign to the end of the line is used for the flag EBC DLINK FL
199. able bootable media such as a Floppy CD ROM or USB storage device e An image that is contains update information that will be processed by OS Runtime services to interact with EFI Runtime services to update a traditional ROM image e A UEFI application that can be accessed during boot at an EFI Shell Prompt prior to hand off to the OS Loader Foundation The set of code and interfaces that glue implementations of EFI together Framework Intel Platform Innovation Framework for EFI consists of the Foundation plus other modular components that characterize the portability surface for modular components designed to work on any implementation of the EFI architecture GUID Globally Unique Identifier A 128 bit value used to name entities uniquely A unique GUID can be generated by an individual without the help of a centralized authority This allows the generation of names that will never conflict even among multiple unrelated parties GUID values can be registry format 8 4 4 4 12 or C data structure format HII Human Interface Infrastructure This generally refers to the database that contains string font and IFR information along with other pieces that use one of the database components May 2010 3 BUILD IFR Internal Forms Representation This is the binary encoding that is used for the representation of user interface pages Library Class A library class defines the API or interface set for a library The cons
200. ader Size of the optional header Characteristics 1 22 File characteristics the bits of this field are interpreted as follows Bit O Relocations if 1 then relocation information has been stripped Bit 1 Executable if set there are no unresolved external references Bit 2 Line Numbers if set line numbers have been stripped from the file Bit 3 Local symbols if set local symbols have been stripped from the file Bits 4 5 amp 6 reserved Bit 7 Machine Word if set the bytes of machine word are reversed Bit 8 32 bit word machine if set target is a 32 bit OS Bit 9 Debug if set debugging info stripped from the file in the DBG file Bit 10 amp 11 reserved Bit 12 System File if set this is a system file Bit 13 DLL if set this is a DLL Bit 14 reserved Bit 15 Machine Word if set bytes of machine word are reversed May 2010 45 EFI IMAGE SECTION HEADER 46 This replaces the text and data headers in PE32 images typedef struct UINT8 Name EFI IMAGE SIZEOF SHORT NAME union UINT32 UINT32 Misc UINT32 UINT32 UINT32 UINT32 UINT32 UINT16 UINT16 UINT32 PhysicalAddress VirtualSize VirtualAddress SizeOfRawData PointerToRawData PointerToRelocations PointerToLinenumbers NumberOfRelocations NumberOfLinenumbers Characteristics EFI IMAGE SECTION HEADER May 2010 BUILD 1 22 UEFI and PI Image Specification EFI COMMO
201. ageHandle IN EFI_PEI_SERVICES SystemTable ka include statement AutoGen c ys If DESTRUCTOR defined in INF If MODULE TYPE BASE include statement AutoGen c EFI STATUS Status Status lt DESTRUCTOR gt ASSERT_EFI_ERROR Status If MODULE TYPE PEI CORE MODULE TYPE PEIM include statement AutoGen c EFI STATUS Status Status lt DESTRUCTOR gt FileHandle PeiServices ASSERT EFI ERROR Status ue 1 22 May 2010 125 BUILD If MODULE TYPE DXE CORE MODULE TYPE DXE_DRIVER MODULE TYPE DXE SMM DRIVER MODULE TYPE DXE RUNTIME DRIVER MODULE TYPE DXE SAL DRIVER MOODULE TYPE UEFI_DRIVER MODULE TYPE UEFI APPLICATION include statement AutoGen c EFI STATUS Status Status lt DESTRUCTOR gt ImageHandle SystemTable ASSERT EFI ERROR Status AR B include statement AutoGen c 7 3 4 5 Module Entry Point Statements Contained if there are ENTRY POINTS defined Defines section in INF file If ENTRY POINT defined in INF If MODULE TYPE PEI CORE include statement AutoGen c EFI STATUS ENTRY POINT IN CONST EFI SEC PEI HAND OFF IN CONST EFI PEI PPI DESCRIPTOR IN VOID EFI STATUS EFIAPI ProcessModuleEntryPointList IN CONST EFI SEC PEI HAND OFF IN CONST EFI PEI PPI DESCRIPTOR IN VOID SecCoreData PpiList OldCoreData
202. ain for building For a component defines the directory of the component source files May 2010 183 BUILD 184 May 2010 1 22 Appendix B tools_def txt The following is the default version of the tools_def txt file Note that the lines wrap in this document however no line wrapping is permitted in the tools_def txt file May 2010 185 BUILD Copyright c 2006 2009 Intel Corporation All rights reserved Portions copyright c 2008 2009 Apple Inc 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 Tk Cb CH Db che db HE HE HE db db d IDENTIFIER Default TOOL CHAIN CONF common path macros DEFINE VS2003 BIN C Program Files Microsoft Visual Studio NET 2003 Vc7 bin DEFINE VS2003 DLL C Program Files Microsoft Visual Studio NET 2003 Common7 IDE DEFINE VS2005_BIN DEFINE VS2005 DLL DEFINE VS2005 BINX64 8 Vc bin x86_amd64 DEFINE VS2005 BIN64 C Program Files Microsoft Visual Studio 8 Vc bin x86 ia64 C Program Files Microsoft Visual Studio 8 Vc bin C Program Files Microsoft Visual Studio 8 Common7 IDE C Program Files Microsof
203. ain specified in target txt s is not specified in the tools def txt file n TOOL CHAIN TAG BreakTheBuild Build ActivePlatform ActiveModule ActiveArchList ActiveTargetList ActiveToolChain BuildMode 7 2 2 Parse file pointed to by TOOL CHAIN CONF The file specified by TOOL CHAIN CONF in target txt is the tool chain definition file toold def txt that contains all the definitions of external tools used to build modules and platforms in the form of name value The definition of a tool includes the path of the executable the path of dynamic libraries the executable needs and command line options Each set of tools can be referenced by a tag name either in the command line or in target txt For example WINDDK3790x1830 is used to refer a set of tools from WINDDK of version 3790x1830 The parser of the tool chain definition file needs to expand macros and in the tool definitions The expanded definitions are put in a database for easier access later For example if one overrides a tool s options in DSC or INF file the tool will look up the tool s definition in the database and append the options to the end of options in the file specified by TOOL_CHAIN_CONF Note The supported third party compiler tools will use the right most or last option it encounters permitting appended options to override options specified first For example specifying a compiler option FLAG line Od c Og will result the compile
204. an by language string MY STRING 1 language eng My first English string language spa Mi primera secuencia inglesa string MY STRING 2 language eng My second English string language spa Mi segunda secuencia inglesa Any of these formats may be used and all result in identical outputs of StrGather Longer strings can be split across lines and the StrGather utility will combine them For example the following two string definitions are equivalent string MY STRING 1 language eng This string is split string MY STRING 1 language eng This string is split H 3 String Control Sequences Several control sequences are also available within the actual strings These sequences are converted to the appropriate binary encoding within the strings These include the following nbr non breaking code br breaking code not modified by StrGather narrow display the following characters as narrow glyphs Nwide display the following characters as wide glyphs An insert carriage return and line feed 282 May 2010 1 22 1 22 r insert carriage return insert a single backslash uL insert a double quote Examples of how these would be used in the Unicode string file are listed below string STR1 language string STR2 language string STR3 language string STRA language string STR5 language eng eng eng eng eng This string is meant to be Mn split across two lines This string has a q
205. are deposited during build Typically BUILD_DIR PROCESSOR Defines the build tip directory for the current platform For example this may be EFI_SOURCE Platform Anacortes_870 If defined then the utility will copy the build PROCESSOR BUILD_TYPE section from the DSC file to the component s makefile If not specified then the build PROCESSOR COMPONENT_TYPE section will be used to emit command to build the component For acomponent defines the directory typically under BUILD_DIR where the component object files are to be built Name of the DSC file as specified on the command line Can be used for dependencies in the makefiles Defines the root directory of the local EFI source tree for example C EFI2 0 If not defined as an environmental variable when the tool is invoked the utility will attempt to determine a reasonable value based on the current working directory As the utility processes each source file in the Platform DSC file this symbol gets assigned the name of the file less the file extension Common component type BS driver application etc have predefined file name extensions assigned dxe app etc If there is a deviation from the convention or a new unknown to the utility component type is being built then FV EXT may need to be defined for the component so the utility knows the result file name extension This information is necessary to generate dependencies in makefile out
206. ase acpi lt ExtraDependency gt MAKE FILE lt Command MSFT Command INTEL gt S ASLCC Fo OUTPUT DIR s_dir s_base obj CC FLAGS S ASLCC FLAGS S INC S src S ASLDLINK OUT OUTPUT_DIR s_dir s_base dll S ASLDLINK FLAGS OUTPUT DIR s_dir s_base obj GenFw o dst c OUTPUT_DIR s_dir s_base dll lt Command GCC gt 1 22 May 2010 265 BUILD ASLCC o OUTPUT DIR s_ dir 4 s base obj CC FLAGS ASLCC FLAGS S INC S src ASLDLINK OUTPUT DIR 4 s dir s base dll ASLDLINK FLAGS OUTPUT DIR s dir s base obj GenFw o dst c OUTPUT DIR 4 s dir s_base dil Acpi Table Code File lt InputFile gt asle act lt OutputFile gt OUTPUT DIR s_dir s_base acpi lt ExtraDependency gt MAKE FILE lt Command MSFT Command INTEL gt ASLCC Fo OUTPUT DIR s_ dir s_base obj CC FLAGS ASLCC_FLAGS S INC S src ASLDLINK OUT OUTPUT DIR s_dir s_base dll S ASLDLINK FLAGS OUTPUT DIR s_dir s_base obj GenFw o dst c S OUTPUT DIR s_dir s_base dll lt Command GCC gt ASLCC o OUTPUT DIR s_ dir 4 s base obj CC FLAGS ASLCC FLAGS S INC src ASLDLINK o OUTPUT DIR 4 s dir s base dll ASLDLINK FLAGS OUTPUT DIR s dir s base o
207. asts with situations A and B where only the targets specified as valid in the DSC file can be used 11 1 1 Debugging Files For a debugging build the files created will be saved to WORKSPACE OUTPUT_DIRECTORY BUILDTARGET _ TOOL_CHAIN_TAG ARCH For each single module the temporary files created in DEBUG building process will be saved to WORKSPACE OUTPUT_DIRECTORY BUILDTARGET _ TOOL_CHAIN_TAG ARCH PACKAGE_NAME MODULE_NAME DEBUG and WORKSPACE OUTPUT_DIRECTORY BUILDTARGET _ TOOL_CHAIN_TAG ARCH PACKAGE_NAME MODULE_NAME OUTPUT so such as map pdb and other DEBUG files can be found in these two directories User can also define a specific directory to save DEBUG files A detailed example is given in the next subsection May 2010 165 BUILD 11 1 2 Debugging Options Build tool supports customized DEBUG flags in the lt BuildOptions gt section of the DSC file the INF file and tools_def txt The highest priority for a same complier flag is the one defined in INF file the medium is that in DSC file and the lowest is the one in tools def txt For example to generate the cod files for the obj files of a platform user can add one line such as MYTOOLS CC FLAGS FAcs FA OUTPUT DIR N in section BUILD OPTIONS of DSC file This option tells build tool to generate a cod file for each obj file and put them to OUTPUT DIR For only generating the cod files for one single mo
208. ata array to binary for the content following this entry The build tools must calculate the ExtEntrySize and use the TYPE value specified in the FDF file typedef struct UINT16 ExtEntrySize UINT16 ExtEntryType EFI FIRMWARE VOLUME EXT ENTRY Parameters ExtEntrySize Size of this header extension ExtEntryType Type of the header See EFI FV EXT TYPE x 60 May 2010 1 22 UEFI and PI Image Specification EFI_FIRMWARE_VOLUME_EXT_TYPE_OEM_TYPE The EDK II build tool do not currently support generating this information A user wishing to use this structure must construct either a binary file or specify an data array completing all of this information typedef struct EFI FIRMWARE VOLUME EXT ENTRY Hdr UINT32 TypeMask EFI GUID Types EFI FIRMWARE VOLUME EXT ENTRY OEM TYPE Parameters Hdr Standard extension entry with the type EFI FV EXT TYPE OEM TYPE TypeMask A bit mask one bit for each file type between OxCO bit 0 and OxDF bit 31 If a bit is 1 then the GUID entry exists in Types If a bit is 0 then no GUID entry exists in Types For example the value 0x01010301 would indicate that there would be five total entries in Types for file types OxCO bit 0 OxC8 bit 4 OxC9 bit 5 OxDO bit 16 and OxD8 bit 24 Types An array of GUIDs each GUID representing an OEM file type This extension header provides a mapping between a GUID and an OEM file type 1 22 May 2010 61 EFI_ BUILD CAPSULE_HE
209. ath gt lt Sep gt lt Entries gt lt RequiredEntry gt lt Required gt lt OptionalEntry gt Fieldl Target lt Field2 gt lt Tagname gt lt PreDefinedTags gt lt Field3 gt lt Arch gt lt Field4 gt lt CommandCode gt lt Attributes gt lt ExecAttrs gt lt MiscAttrs gt lt D11Path gt MetaData File Specifications If OS MICROSOFT amp amp ENV CYGWIN lt Letter gt lt PATH gt else lt PATH gt lt Word gt Sep lt Path gt ENV lt SysEnvironmentVariable gt Sep lt Word gt Sep If OS MICROSOFT amp amp ENV CYGWIN EN else nn lt RequiredEntry gt lt OptionalEntry gt XFieldl lt Tagname gt Arch Required MAKE PATH lt EXECPATH gt Command lt EOL gt XFieldl lt Field2 gt lt Field3 gt Target DEBUG RELEASE lt UserDefinedWord gt lt TagName gt lt PreDefinedTags gt lt UserDefinedWord gt MYTOOLS VS2003 VS2005PRO VS2005TEAMSUITE WINDDK3790x1830 UNIXGCC CYGWINGCC ICC Arch lt Field4 gt Attributes IA32 X64 IPF EBC ARM lt CommandCode gt App ASL ASM ASMLINK AU CC AU DLINK AU PCH AU PP AU SLINK TIANO VFRPP lt UserDefinedWord gt lt ExecAttrs gt lt FlagAttr gt lt MiscAttrs gt PATH
210. ation File UEFI HII lt InputFile gt TOovifr SOME VFR lt ExtraDependency gt MAKE FILE lt OutputFile gt OUTPUT DIR 4 s dir s base hpk lt Command gt MD OUTPUT DIR s dir gt NUL 2 gt amp 1 S VFRPP S VFRPP FLAGS INC src gt OUTPUT DIR s dir s base i MD OUTPUT DIR s dir gt NUL 2 gt amp 1 S VER S VER FLAGS create ifr package output directory OUTPUT DIR s dir OUTPUT DIR s_dir s_base i Hii Binary Package UEFI_HII lt InputFile gt hpk lt OutputFile gt OUTPUT DIR MODULE NAME hii lib lt Command MSFT Command INTEL gt GenFw o OUTPUT DIR MODULE NAME hii rc g MODULE GUID hiipackage S HII BINARY PACKAGES S RC Fo dst S OUTPUT DIR MODULE NAME hii rc lt Command GCC gt GenFw o OUTPUT DIR MODULE NAME hii rc g MODULE GUID hiipackage S HII BINARY PACKAGES RC RC FLAGS OUTPUT DIR MODULE NAME hii rc dst May 2010 1 22 Appendix E build exe command This section describes the build exe command line tool s options Build exe is generated from Python code E 1 Overview Under normal circumstances the build tool will Process the command line options Parse the meta data files Generate the C files Generate the Makefiles Call the make command u o M pt E 2 Makefile actions The Makefile is responsibl
211. ation is attached prior to generating the EFI SECTION files The format of the binary data is 8 bit aligned with a single byte per opcode with op codes that require a GUID value BEFORE AFTER and PUSH being followed by 16 bytes to contain the GUID value See Table 6 below 28 May 2010 1 22 Design Discussion Table 6 Dependency Section Type Codes Section Type Value EFI SECTION PEI DEPEX 0x1B EFI SECTION DXE DEPEX 0x13 EFI SECTION SMM DEPEX Ox1C Once the binary file is created an EFI SECTION file can be created and the EFI_COMMON SECTION HEADER Will be prefixed to the file Dependency Binary File Dependency Binary File EFI SECTION Header Figure 14 Depex File 2 7 6 1 Reference Implementation Guidelines Use of a separate file for describing the dependencies is discouraged Grammar of the INF DSC and FDF files permit specifying the dependency expressions Libraries may also have a dependency depex section These dependencies should be appended to the module s DEPEX sections unless the module includes a depex dxs file even if the module does not contain a depex section When a developer chooses to write the dxs file the developer is responsible for specifying all dependencies in the dxs file Libraries that are linked to a VEFI DRIVER may have DEPEX sections There are three rules for the tools e Tools are coded so that for a given module the depex sections of all linked in library instance
212. b section 1 22 This sub section holds module build flags information The sub section header holds the module tool chain tag and the sub section contents list all related build flags Example Build Flags Tool Chain Tag MYTOOLS CC FLAGS nologo c WX GS W4 Gs8192 Gy D UNICODE Olib2 GL FIAutoGen h EHs c GR GF Zi Gm D EFI SPECIFICATION VERSION 0x0002000A D TIANO RELEASE VERSION 0x00080006 od DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 LTCG DLL May 2010 179 BUILD ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG PDB DEBUG_DIR BASE_NAME pdb Note This sub section presents when BUILD FLAGS or ALL is specified in Y option 12 7 6 Notification Sub section This sub section contains module notification functions information This sub section does not exist if the module does not have notification functions All the notification functions are listed with the following triple line by line e Address Order Name The predicted address order and name of the notification function Example Doo oo Ho on nn no en oo een nn ne enn ee een lt Notification Functions Information Address Seq Name Oxfffff8a38 3 MemoryDiscoveredPpiNotifyCallback Ox3ef8a8a38 6 EndOfPeiSignalPpiNotifyCallback Note This sub section presents when PREDICTION or ALL is specified in Y opt
213. bj GenFw o dst c OUTPUT DIR 4 s dir s base dll lt Command XCODE gt S ASLCC o OUTPUT_DIR s dir s base obj S ASLCC FLAGS INC src ASLDLINK o OUTPUT DIR s dir s base dll ASLDLINK FLAGS OUTPUT DIR s_dir s_base obj DS MTOC subsystem MODULE TYPE MTOC FLAGS OUTPUT DIR s dir s base dll OUTPUT DIR s_dir s_base efi GenFw o dst c S OUTPUT DIR S s dir s_base efi Masm16 Code File lt InputFile gt asml6 Asml6 ASM16 lt ExtraDependency gt MAKE FILE lt OutputFile gt OUTPUT DIR s base com lt Command MSFT Command INTEL gt cd OUTPUT DIR s dir ASM nologo c omf Fo OUTPUT DIR s_dir s_base obj src ASMLINK S ASMLINK FLAGS OUTPUT DIR s dir s_base obj dst lt Command GCC gt PP PP_FLAGS INC src gt d_path s_base i Trim source code o d_ path s_base iii d_path s_base i ASM o OUTPUT_DIR s_dir s_base obj ASM FLAGS INC d_path s_base iii DLINK o dst DLINK FLAGS DLINK SPATH LIBS OUTPUT DIR s_dir s_base obj 266 May 2010 1 22 lt Command XCODE gt PP PP_FLAGS INC src gt d_path s_base i Trim source code o d_path s_base iii d_path s_base
214. ble SUBSYSTEM CONSOLE NODEFAULTLIB libmmt NODEFAULTLIB libirc DEFINE IPHONE TOOLS Developer Platforms iPhoneOS platform Developer DEFINE RVCT31 TOOLS PATH c Program Files ARM RVCT Programs 3 1 761 win 32 pentium DEFINE RVCT31CYGWIN TOOLS PATH cygdrive c Program Files ARM RVCT Programs 3 1 761 win 32 pentium Update to the location of the gcc executables DEFINE ARMGCC BIN God EE FE HE E FE FE FE FE EIE KOA KOA KOA FE FE FE E FE FE FE FE EE FE FE FE AE FE EE aE FE FE FE EAE FE FE FE FE aE FE FE FE FE BE EE a a Ea FE FE FE E FE FE a EB FE FE BE 188 format TARGET TOOLCHAIN ARCH COMMANDTYPE ATTRIBUTE string priority TARGET TOOLCHAIN ARCH COMMANDTYPE ATTRIBUTE Highest X TOOLCHAIN ARCH COMMANDTYPE ATTRIBUTE TARGET ARCH COMMANDTYPE ATTRIBUTE RR poran ARCH COMMANDTYPE ATTRIBUTE TARGET TOOLCHAIN COMMANDTYPE ATTRIBUTE k TOOLCHAIN COMMANDTYPE ATTRIBUTE TARGET k pr COMMANDTYPE ATTRIBUTE KkKKKKK oko kc kc kc k ko kk ke _ COMMANDTYPE ATTRIBUTE TARGET TOOLCHAIN ARCH ATTRIBUTE X amp x TOOLCHAIN ARCH seeeeeeceeek ATTRIBUTE TARGET kkk ARCH kkkkkkk ATTRIBUTE br Sb gd ARCH bd Kd bd ATTRIBUTE TARGET TOOLCHAIN pr ATTRIBUTE okck kc kk TOOLCHAIN _ KKKK KKKKKKKKKKK _ATTRIBUTE TARGET RTK Kr eee gd ga _ATTRIBUTE Jekdekdek ee _ATTRIBUTE Lowest EEE EA HE HE HE HEHE FE AE FE F
215. d in the FDF file Since the tool is not present during a system boot any optional tool must be able to provide code that can be used by any decompression signing or verification drivers during boot The following shows the use of the TianoCompress GUID in a sample FDF file for an FVMAIN image that contains all post PEI modules FILE FV IMAGE E76CB2EC A71A 42e8 8F34 56237870BD12 DEBUG MYTOOLS IPF SECTION GUIDED A31280AD 481E 41B6 95E8 127F4C984779 D SECTION FV_IMAGE FVMAIN In the example above the first GUID starting with E76CB2EC is the EFI Name for the firmware volume while the second following the SECTION GUIDED statement identifies the tool TianoCompress exe that will be used on the FV section specified within the curly brackets after the GUID The provided reference build requires that all such tools take a minimum of three options on the command line The e option specifies that the tool will encrypt compress encode or sign the file specified on the command line The o option specifies the name of the output file to be created when using the e option A third option d is used to decrypt decompress decode or verify the file specified on the command line Note Additional options may be included with the tool however the build system only requires these three options 2 7 12 Implementing Encryption or Signing The same techniques used for implementing custom compression can be used for tools that are used for s
216. dDebugPrintErrorLevel PATCH UINT32 0x80000042 DEC DEFAULT 0x80000000 M Tcp4Dxe inf 0x80000000 Note Global PCD section presents when PCD is specified in Y option 12 6 FD Section This section contains platform flash device information and its layout 12 6 1 FD Section Header Given that a platform may have multi Firmware device this section may appear more than once in the output report The section header lists the name of FD and its base address and size The contents of the section consist of one or more FD region sub section e FD Name FD UI name FD file base name e Base Address Base address for the FD image e Size Size of the FD image 1 22 May 2010 173 BUILD Example 2S EEE TEE TE TE Fe ee DB m ne Firmware Device FD FD Name Nt32 Base Address 0 Size 0x2a0000 2688KB one or more FD Region Sub section EC G 12 6 2 FD Region Sub section This sub section contains FD region information of platform flash device If the region is a firmware volume it lists the set of modules and its space information otherwise it only lists its region name base address and size in its sub section header Region Type The type of the FD region FV Data File or None Base Address Base address for the FD region Size Size of the FD region FV Name FV name and occupation percentage Occupied Size The occupied size of the FV Free Size The free size of the FV The contents
217. define define define define define define define define define define define EFI FVB2 READ DISABLED CAP EFI FVB2 READ ENABLED CAP EFI FVB2 READ STATUS EFI FVB2 WRITE DISABLED CAP EFI FVB2 WRITE ENABLED CAP EFI FVB2 WRITE STATUS EFI FVB2 LOCK CAP EFI FVB2 LOCK STATUS EFI FVB2 STICKY WRITE EFI FVB2 MEMORY MAPPED EFI FVB2 ERASE POLARITY EFI FVB2 READ LOCK CAP EFI FVB2 READ LOCK STATUS EFI FVB2 WRITE LOCK CAP EFI FVB2 WRITE LOCK STATUS 0x00000001 0x00000002 0x00000004 0x00000008 0x00000010 0x00000020 0x00000040 0x00000080 0x00000200 0x00000400 0x00000800 0x00001000 0x00002000 0x00004000 0x00008000 May 2010 UEFI and PI Image Specification 57 58 Alignment Attribute bit definitions define define define define define define define define define define define define define define define define define define define define define define define define define define define define define define define define define EFI FVB2 ALIGNMENT EFI FVB2 ALIGNMENT 1 EFI FVB2 ALIGNMENT 2 EFI FVB2 ALIGNMENT 4 EFI FVB2 ALIGNMENT 8 EFI FVB2 ALIGNMENT 16 EFI FVB2 ALIGNMENT 32 EFI FVB2 ALIGNMENT 64 EFI FVB2 ALIGNMENT 128 EFI FVB2 ALIGNMENT 256 EFI FVB2 ALIGNMENT 512 EFI FVB2 ALIGNMENT 1K EFI FVB2 ALIGNMENT 2K EFI FVB2 ALIGNMENT 4K EFI FVB2 ALIGNMENT 8K EFI FVB2 ALIGNMENT 16K EFI FVB2 ALIGNMENT 32K EFI FVB2 ALIGNMENT 64K EFI FVB2 ALIGNME
218. dg FE HE FE HE FE HE ETERS THE HE E HE E HE HE HE E HE HE HE HE THERE AA AA AERE FE FE FE FE FE IHE FE FE FE FE FE FE INE E Microsoft Visual Studio 2005 VS2005 Microsoft Visual Studio 2005 All Edition including Standard Professional Express TeamSuite ASL Intel ACPI Source Language Compiler HEHEHE HE HE HEHE HE HE HE HE HE FE FE Ago FE FE FE HE HE HE HE FE FE E HE HE HE FE FE AA FE FE E E RE FE FE HE HE FE FE dA HE HE FE FE FE FE FE HE HE FE FE FE FE EE FE FE HE HE FE HE EE IE HE VS2005 Microsoft Visual Studio 2005 ALL Edition including Standard Professional Express TeamSuite VS2005 FAMILY MSFT VS2005 MAKE PATH DEF VS2005_BIN nmake exe VS2005 MAKE FLAGS nologo VS2005 RC PATH DEF VS2005_BIN rc exe VS2005 SLINK FLAGS NOLOGO LTCG VS2005 APP FLAGS nologo E TC VS2005 PP FLAGS nologo E TC FlAutoGen h VS2005 VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h HEEE HE HE HEHE HE HE HE HE HE HEHE H H HH ASL definitions THEE HE HE HEHE HE HE HE HE HE HEHE EE HH 194 May 2010 1 22 1 22 VS2005 ASL PATH VS2005 ASL FLAGS VS2005 ASL OUTFLAGS VS2005 ASLCC FLAGS VS2005 ASLPP FLAGS VS2005 ASLDLINK FLAGS bed zg Az dd izo IA32 definitions bed zg Aiz d dd izo VS2005 IA32 DLL VS2005 IA32 MAKE PATH VS2005 IA32 CC PATH VS2005 IA32 VFRPP PATH VS2005 IA32 SLINK PATH VS2005 IA32 D
219. dir OUTPUT DIR 7 4 1 2 6 Miscellaneous build targets Targets which are used to build source files to object files and then in turn into final lib file efi file or other files These targets are generated according to the rule chains in WORKSPACE Conf build_rule txt For example May 2010 141 BUILD OUTPUT_DIR ModuleFile obj COMMON DEPS CC Fo OUTPUT_DIR ModuleFile obj CC FLAGS INC WORKSPACE MyPlatformPkg MySubDir ModuleFile c OUTPUT_DIR MODULE NAME lib OBJECT FILE LIST SLINK SLINK_FLAGS OUT OUTPUT DIR MODULE NAME lib OBJECT FILE LIST DEBUG_DIR MODULE NAME dll OUTPUT DIR MODULE NAME lib LIBS MAKE FILE DLINK OUT DEBUG DIR MODULE NAME dll DLINK FLAGS DLINK SPATH LIBS OUTPUT DIR MODULE NAME lib DEBUG DIR MODULE NAME efi DEBUG DIR MODULE NAME d1l1 GenFw e MODULE TYPE o DEBUG DIR MODULE NAME efi V DEBUG_DIR MODULE NAME dll CP DEBUG DIR MODULE NAME efi OUTPUT DIR CP DEBUG DIR MODULE NAME efi BIN DIR CP DEBUG_DIR map OUTPUT DIR OUTPUT_DIR AutoGen obj WORKSPACE Build MyPlatform DEBUG_ICC IPF MyPlatformPkg MyModDir MyModDir DEBU G AutoGen c CC Fo OUTPUT_DIR AutoGen obj CC FLAGS INC WORKSPACE Build MyPlatform DEBUG_ICC IPF MyPlatformPkg MyModDir MyModDir DEBU G AutoGen c
220. dule one way is to add the option in section BUILD OPTIONS of the module s INF file anther way is to add the option to DSC file s BuildOptions for the INF file like below MdeModulePkg Universal PCD Pei Pcd inf lt BuildOptions gt MYTOOLS CC FLAGS FAcs FA OUTPUT_DIR Please refer to 5 2 tools def txt and Appendix B tools_def txt for more detailed information about build options 11 1 3 Advanced Debugging For generating disassembly cod files for debugging the following is one way to setup dumpbin disasm for individual modules as well as using it for every efi file generated To generate the disasm for the efi files the user can add two definitions in tools def txt DEBUG MYTOOLS IA32 DISASM PATH DEF VS2005TEAMSUITE BIN dumpbin exe DEBUG MYTOOLS IA32 DISASM FLAGS dump disasm out DEST DIR Then user can use build option y define with a reserved MACRO name DISASM to start building The build tool automatically detects if a DISASM tool defined in the Tagname of ToolChain then after ever link command that generates an EFI file the tool will run the DISASM tool with the flags against the EFI file In the example the output file will be next to the EFI file based on the FLAGS entry out DEST_ DIR which is the same location as the efi file 11 2 Adding Custom Compression Tools 166 This section covers how to add a customized compress tool such as TianoCompress tool First one specif
221. duleEntryPointList IN EFI_PEI_FILE HANDLE FileHandle IN EFI_PEI_SERVICES PeiServices EFI_STATUS Status EFI_STATUS CombinedStatus CombinedStatus EFI_LOAD ERROR Status ENTRY POINT1 FileHandle PeiServices if EFI ERROR Status EFI ERROR CombinedStatus CombinedStatus Status Status lt ENTRY_POINT2 gt FileHandle PeiServices if EFI ERROR Status EFI ERROR CombinedStatus CombinedStatus Status return CombinedStatus yc If MODULE TYPE DXE SMM DRIVER 128 May 2010 1 22 AutoGen Stage If Number of ENTRY POINT 0 include statement AutoGen c EFI STATUS EFIAPI ProcessModuleEntryPointList IN EFI HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable return EFI SUCCESS 75 If Number of ENTRY POINT 1 include statement AutoGen c EFI STATUS XENTRY POINT IN EFI HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable static BASE_LIBRARY_JUMP_BUFFER mJumpContext static EFI_STATUS mDriverEntryPointStatus EFI_LOAD_ERROR VOID EFIAPI ExitDriver IN EFI_STATUS Status if EFI ERROR Status EFI ERROR mDriverEntryPointStatus mDriverEntryPointStatus Status LongJump amp mJumpContext UINTN 1 ASSERT FALSE EFI STATUS EFIAPI ProcessModuleEntryPointList IN EFI HANDLE ImageHandle IN EFI_SYSTEM TABLE SystemTable if SetJump amp mJumpContext 0 ExitDr
222. e 1 22 May 2010 167 168 BUILD and then make customizations in the sources PROCESSOR PLATFORM section of the library INF file An alternative to this method is to simply create a new INF file for the library and then use it in place of the existing library INF file May 2010 1 22 Reports 12 Reports This section introduces the build report generation tool functionality and its output report format It describes the external behaviors of the tool i e the accepted command line options and the detailed output report format 12 1 Build Report Generation BRG Tool Report Generation tool is part of build process to report the following platform information after platform build ends successfully PCD INFO Complete platform configuration database information LIBRARY INFO Library class and instance mapping constructor destructor information DEPEX INFO Module dependency information BUILD INFO Module build tool chain tag specific compiler or linker options FLASH INFO Module firmware device and firmware volume information PREDICTION INFO The predicted dispatch order of modules PEIMs drivers and their notification invoking sequence Also the predicted addresses of module image loading entry point and notification functions The information in the reports listed above is useful for platform integrators to diagnose the platform issues in an efficient way Integrators must specify which reports t
223. e DEF WINDDK_BIN16 link16 exe VS2003xASL IA32 VFRPP PATH VS2003xASL IA32 SLINK PATH VS2003xASL IA32 DLINK PATH VS2003xASL IA32 ASMLINK PATH VS2003xASL IA32 APP PATH DEF VS2003_BIN cl exe VS2003xASL IA32 PP PATH DEF VS2003_BIN cl exe VS2003xASL IA32 ASM PATH DEF VS2003_BIN ml exe VS2003xASL IA32 ASLCC PATH DEF VS2003 BIN cl exe VS2003xASL IA32 ASLPP PATH DEF VS2003_BIN cl exe VS2003xASL IA32 ASLDLINK PATH DEF VS2003 BIN Mlink exe VS2003xASL IA32 RC PATH DEF VS2003_BIN rc exe VS2003xASL IA32 MAKE FLAGS nologo VS2003xASL IA32 APP FLAGS VS2003xASL IA32 PP FLAGS nologo E TC ETS MODULE NAME StrDefs h exe exe nologo E TC FIAutoGen h VS2003xASL IA32 VFRPP FLAGS nologo E TC DVFRCOMPILE DEBUG VS2003xASL IA32 CC FLAGS nologo c WX W4 Gs8192 Gy D UNICODE Olib2 GL FIAutoGen h EHs c GR GF GX Zi Gm RELEASE VS2003xASL IA32 CC FLAGS nologo c WX W4 Gs8192 Gy D UNICODE Olib2 GL FIAutoGen h EHs c GR GF GX DEBUG VS2003xASL IA32 ASM FLAGS RELEASE VS2003xASL IA32 ASM FLAGS VS2003xASL IA32 SLINK FLAGS DEBUG VS2003xASL IA32 DLINK FLAGS nologo LTCG nologo c WX W3 coff Cx Zd Zi nologo c WX W3 coff Cx Zd NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0
224. e The GUID used in depex section must be the GUID C name First the GUID C name in the dependency expression string will be converted into its value in C structure format Then the expression string will be converted into postfix notation Before saving to a file the operator and GUID value in the postfix notation will be converted to their binary value For example the following dependency expression NOT gEfiHiiDatabaseProtocolGuid AND gEfiHiiStringProtocolGuid OR gPcdProtocolGuid will be converted to include statement MODULE BUILD DIR OUTPUT BASE NAME dxs PUSH gEfiHiiDatabaseProtocolGuid 72 cl 9f ef b2 al 93 46 b3 27 6d 32 fc 41 60 42 PUSH gEfiHiiStringProtocolGuid 74 69 d9 Of aa 23 dc 4c b9 cb 98 di 77 50 32 2a AND NOT PUSH gPcdProtocolGuid 06 40 b3 11 5b d8 Oa 4d a2 90 d5 a5 71 31 Oe f7 OR END T The binary dependency expression file will be generated in MODULE BUILD DIR OUTPUT with depex file extension 7 3 2 HII String Pack The human readable HII string pack data is stored in Unicode format in uni files The build tools will do following steps to convert the strings information into HII string pack data structure e The build tools will get all the string IDs the associated string and language code from the uni files Note that the DSC file or options on the command line may be used to filter the languages used for generating the autogen code The RFC LANGU
225. e if the INF file is not listed in the ACTIVE_PLATFORM s dsc file the build will result in an error The m option is used to specify building an individual module in the context of the ACTIVE_PLATFORM Lowest Content of the current working directory If the ACTIVE_PLATFORM value is not set using the methods above then if the current working directory contains a DSC file then the platform is built unless a specific module is specified by the m option on the command line 6 2 2 The precedence of the TARGET value It is possible to build more than one TARGET i e DEBUG RELEASE etc with a single build command The precedence of the TARGET value is Highest build exe b TARGET option statements One or more of the b TARGET options may be specified on the command line of the build tool target txt file statements Lowest DSC file s BUILD TARGETS statement 6 2 3 The precedence of the TARGET_ARCH values Highest build exe option statements target txt file statements INF file s Sources section statements If a module s INF file does not contain a Sources or Sources common section and does contain a Sources IA32 section then the module is only valid for IA32 builds The module will not be built for other architectures 1 22 May 2010 97 Build Environment Lowest DSC file s SUPPORTED ARCHITECTURES statement If an architecture set on a command line is not in the list of the DSC file s SUP
226. e EDK II builds may incorporate EDK components and their required libraries the EDK SOURCE directory EDK tree structure can reside outside of the WORKSPACE directory tree Multiple workspaces are allowed on any given development workstation Each workspace has its own configuration files for the build tools meta data All builds occur using code from the defined WORKSPACE and or EDK SOURCE directories see Environment Variables below A build is always performed within the context of a platform defined in a single workspace Multiple platforms can be defined in any one workspace While some developers will not be building actual platform firmware the platform definition file DSC format is suitable for OptionROM and stand alone application development as well as flexible enough to create binary distribution code for individual modules as well as a full platform firmware file While the EDK II Subversion development tree from http edk2 svn sourceforge net svnroot edk2 trunk edk2 contains the Win32 binaries for building EDK II modules only one set of EDK II build tools is required on a development system The source code for all EDK II build tools is maintained on the TianoCore org server under the buildtools trunk BaseTools project The source code for these tools is written in either generic C or Python Developers using UNIX style operating systems for the development workstations will need to obtain the sources and build the tools se
227. e can be built as well as just a single module within the context of a platform This section of the document describes the techniques provided to limit what is built Typically the target txt file is used to limit the scope of a build restricting the build to specified values for Platform Architectures Targets and Tool Chains With all values in this file commented out the build system will build all valid targets for all architectures where tools exist However options specified on the build tool s command line will override the TARGET TARGET ARCH and TOOL CHAIN TAG values 96 May 2010 1 22 6 2 1 The precedence of what platform or module gets built Highest Content of the current working directory If the current working directory contains an INF file then only the module is built in the context of an ACTIVE PLATFORM otherwise the following apply build exe option statements command line options where options can be a zA Z a zA Z a zA Z09 a zA Z Something or a zA Z a zA Z09 Something where something is just that can be a filename a directory or some other thing like an assignment FOO 1 target txt file s ACTIVE_PLATFORM statement Note There are two different options the p option specifies the ACTIVE_PLATFORM to be used for a build so that if the current working directory contains a module INF file then the module will be built in the context of the ACTIVE_PLATFORM Not
228. e for compilation of the source code and executing the genFw command on the intermediate object files in order to create the efi files The actions taken by the Makefile are Create the build output directories Build the libraries Build the modules Call the genfds tool The last step of the makefile processing is to call the GenFds tool that will a Process the command line options b Parse the meta data files c Create FFS Capsules FV images and the final FD image s DE ds CAE ps E 3 Build Targets and options In order to provide flexibility the build command supports stopping the build process after specific actions have taken place These targets will ensure that all previously required actions have been completed New for this release is the implemenation of targets that permit processing files for only one given step such that previous steps are NOT processed Table 28 provides the descriptions of targets supported by the build as well as the GenFds tools 1 22 May 2010 269 BUILD Note The flag skip autogen is required to prevent the build tool from re creating the autogenerated C and makefiles Table 28 Build Targets and Comand line Options Target genc genmake libraries modules fds Description Generates the C code files autogen c autogen h and module depex then stops Generates the C code files autogen c autogen h and module depex then the Makefiles then stops Generates
229. e them when read On an update operation software must preserve any reserved field The data structures described in this document generally have the following format May 2010 5 BUILD STRUCTURE NAME The formal name of the data structure Summary A brief description of the data structure Prototype An EBNF type declaration for the data structure Example Sample data structure using the prototype Description A description of the functionality provided by the data structure including any limitations and caveats of which the caller should be aware Related Definitions The type declarations and constants that are used only by this data structure 1 5 2 Pseudo Code Conventions Pseudo code is presented to describe algorithms in a more concise form None of the algorithms in this document are intended to be compiled directly The code is presented at a level corresponding to the surrounding text In describing variables a list is an unordered collection of homogeneous objects A queue is an ordered list of homogeneous objects Unless otherwise noted the ordering is assumed to be FIFO Pseudo code is presented in a C like format using C conventions where appropriate The coding style particularly the indentation style is used for readability and does not necessarily comply with an implementation of the Extensible Firmware Specification 1 5 3 Typographic Conventions This document uses the typographic and illus
230. eading ox characters The format for an FD Layout Region is Offset Size TokenSpaceGuidCName PcdOffsetCName TokenSpaceGuidCName PcdSizeCName RegionType Setting the optional PCD names in this fashion is shortcut The two regions listed below are identical with the first example using the shortcut and the second using the long method May 2010 159 BUILD 0x000000 0x0C0000 gEfiMyTokenSpaceGuid PcdFlashFvMainBaseAddress gEfiMyTokenSpaceGuid PcdFlashFvMa inSize FV FvMain 0x000000 0x0C0000 SET gEfiMyTokenSpaceGuid PcdFlashFvMainBaseAddress 0x000000 SET gEfiMyTokenSpaceGuid PcdFlashFvMainSize 0x0C0000 FV FvMain The shortcut method is preferred as the user does not need to maintain the values in two different locations The optional RegionType if specified must be one of the following Fv DATA Or FILE Or NO RegionType at all Not specifying the RegionType implies that the region starting at the Offset of length Size should not be touched This unspecified region type is typically used for event logs that are persistent between system resets and modified via some other mechanism and SMM Event Log module for example EDK II FDF does not use the concept of sub regions which existed in EDK FDF files 9 5 1 FV Region Type The FV RegionType is used as a pointer to either one of the unique FV names that are defined in the Fv section or a file specified in an rv section s CREATE FILE statement
231. eclares various file attribute bits Type EFI FFS FILE ATTRIBUTES is defined as Bit 0 1 and 7 are reserved and must be set to 0 Bit 2 is the FIXED bit if set the file may not be moved from its present location XIP Bits 3 4 and 5 are the Data Alignment bits Bit 6 is the Checksum bit If set to 0 then the Integrity Checksum File must initialized to 0x55AA otherwise if it is set to 1 then the IntegrityCheck Checksum File is an 8 bit checksum of the entire file The length of the file in bytes including the FFS header The length of the file data is either Size sizeof EFI FFS FILE HEADER This calculation means a zero length file has a Size of 24 bytes which is sizeof EFI FFS FILE HEADER Size is not required to be a multiple of 8 bytes Given a file F the next file header is located at the next 8 byte aligned firmware volume offset following the last byte of the file F If the value of Size equals OxFFFFFFF then the actual size is specified in the ExtendedSize field and the header is EFI FFS FILE HEADER2 May 2010 1 22 1 22 UEFI and PI Image Specification State Used to track the state of the file throughout the life of the file from creation to deletion Type EFI FFS FILE STATE is a UINT8 with the following bit fields bit 0 EFI FILE HEADER CONSTRUCTION bit 1 EFI FILE HEADER VALID bit 2 EFI FILE DATA VALID bit 3 EFI FILE MARKED FOR UPDATE bit 4 EFI FILE DELETED bit 5 EFI FILE HEADER INVALID bits
232. ed with can occur more than once in one parent instance 12 3 2 Section and Sub section Format The output report of BRG is divided into platform and module part Each part may further consist of sections and sub sections with the following rules 170 Seda ede Ero ie DUM Each section starts with marker gt lt Each section ends with marker lt gt There must be a section header after each section start marker There must a separator to separate the section header and contents if the section has non empty contents The section contents can further be divided into one level sub sections Each sub section starts with marker lt Each sub section ends with marker lt gt There must be a sub section header after each section start marker There must a separator to separate the section header and contents if the section has non empty contents 10 In general each line in section should not exceed 120 characters December 2007 1 22 Reports Example Platform Name Nt32 Platform DSC Path c edk2 Nt32Pkg Nt32Pkg dsc Architectures IA32 Tool Chain MYTOOLS Target DEBUG Build Environment Windows XP 5 1 2600 Build Duration 05 12 Report Contents LIBRARY FLASH PREDICTION En amp hO O Firmware
233. er multiple devices 2 6 Generic Build Process All code starts out as either C sources and header files assembly sources and header files or binary data native instructions such as microcode files Per the UEFI and PI specifications the C and Assembly files must be compiled and linked into PE32 PE32 images While some code is designed to execute only from ROM most UEFI PI modules are written to be relocate able These are written and built different For example Execute In Place XIP module code is written and compiled to run from ROM while the majority of the code is written and compiled to execute from memory which requires that the code be relocate able Some modules may also permit dual mode where it will execute from memory only if memory is available otherwise it will execute from ROM Additionally modules may permit dual access such as a driver that contains both PEI and DXE implementation code Code is assembled or compiled then linked into PE32 PE32 images the relocation section may or may not be stripped and an appropriate header will replace May 2010 1 22 Design Discussion the PE32 PE32 header Additional processing may remove more non essential information generating a Terse TE image The binary executables are converted into EFI firmware file sections Each module is converted into an EFI Section consisting of an Section header followed by the section data driver binary 2 6 1 EFl SECTION File
234. ermit the user to define the content of the FFS file when an FFS type is not specified by either PI or UEFI specifications The Rules can have multiple modifiers as shown below Rule ARCH MODULE_TYPE TEMPLATE NAME If no TEMPLATE NAME is given then the match is based on ARCH and MODULE TYPE modifiers The TEMPLATE NAME must be unique to the ARCH and MODULE TYPE It is permissible to use the same TrEMPLATE NAME for two or more Rule sections only if 1 22 May 2010 155 BUILD the aRcH and the MODULE_TYPE listed are different for each of the sections A Rule Section is terminated by another section header or the end of file The content of the Rule section is based on the FILE and section grammar of the FV section The difference is the FILE referenced in the RULE is a Macro The section grammar is extended to include an optional argument Optional The Optional argument is used to say a section is optional that is to say if it does not exist it s O K The generic form of the entries for leaf sections is lt SectionType gt lt FileType gt Options lt Filename gt lt Extension gt When processing the FDF file the rules apply in the following order 1 If lt sectionType gt not defined or not a legal name then error 2 If lt FileType gt not defined or not a legal name then error 3 If FilePath FileName then a Add one section to FFS with a section type of lt SectionType gt
235. es Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER MAP God ipad E FE FE AE KOA EE EIE EE EIE IEEE E FE FE FE AROA A FE HE FE FE FE FE KAIA KAIA FE FE FE FE E FE E FE FE E FE FE FE FE FE FE FE E FE FE FE HH Microsoft Visual Studio NET 2003 and Microsoft ACPI compiler FE EE HE HE FE FE HE HE HE HE FE A FE FE FE HE HE FE FE FE FE HE HE FE FE FE HE HE FE FE FE HE HE HE FE FE HE HE HE FE FE FE HE HE FE FE FE HE HE FE FE FE FE FE FE FE FE FE HE FE FE FE FE HE HE HE FE HE HE HE FE FE FE HE HE HE FE FE E I HE VS2003xASL Microsoft Visual Studio NET 2003 and Microsoft ACPI Source Language Compiler asl exe VS2003xASL FAMILY MSFT Ld HE FE HE FE HE FE HE HE HEHE HEHE HEH ASL definitions FEFE EE FE HE ERE ER FE HE HE HEHE HEHE HEH VS2003xASL ASL PATH DEF WIN ASL BIN VS2003xASL ASL FLAGS VS2003xASL ASL OUTFLAGS VS2003xASL ASLCC FLAGS VS2003xASL ASLPP FLAGS DEF MS ASL OUTFLAGS DEF MSFT ASLCC FLAGS DEF MSFT ASLPP FLAGS VS2 00 3xASL ASLDLINK FLAGS DEF MS FT ASLDLINK FLAGS Ld NR IA32 definitions Ld FE HE FE HE FE HE FE HE HE HEHE HEHE HEH VS2003xASL IA32 DLL DEF VS2003 DLL VS2003xASL IA32 MAKE PATH DEF VS2003_BIN nmake exe 192 May 2010 1 22 1 22 VS2003xASL IA32 CC PATH DEF VS2003_BIN cl DEF VS2003_BIN cl DEF VS2003_BIN lib exe DEF VS2003_BIN link ex
236. essennenenvnnnnnnnerenee 27 Table 5 Encapsulation EFI SECTION Type Codes rss 28 Table 6 Dependency Section Type Codes rss ao 29 Table 7 VER Compatibility Matrix sert 30 Table 8 Descriptions of Bit Fields for Attributes rss 53 Table 9 Supported Compiler TOGO 64 Table 10 Additional Compiler Tools ss 65 Table 11 AutoGen Stage Input File Extensions ss 71 Table 12 MAKE Stage Intermediate Output File Extensions nun anne enen 71 Table 13 MAKE Stage Output File Extensions sura 72 Table 14 GenFds Image Generation Intermediate File Extensions 73 Table 15 ImageGen Final Output File Extensions ss 73 Table 16 Predefined Command Codes sa 83 Table 17 Predefined Attributes rrua 84 Table 18 Reserved Variable Strings rruna aa 91 Table 19 Valid Macro Values rrura 92 Table 20 Standard C File Compiler Options ss 100 Table 21 Assenibly Elags de elez dE er edo coax que neden Node M dee EON ed ek 101 Table 22 C Compiler s Preprocessor Options ra 101 Table 23 C Compiler s Preprocessor Options for VFR files ONLY ss 101 Table 24 Pre compiled Header PCH Creation Flags rss 101 Table 25 Stauc Finker Flags een una en 103 Table 26 Dynamic Linker Flags zena ec 103 Table 27 Variable Descriptions rrura 182 Table 28 Build Targets and Comand line Options ss 270 Table 29 HII Double Byte Encoding MG 298 Table 30 EDK II Module Types neret ee ee 299 May 2010 xi BUILD xii May 2010 1 22 Figure
237. ext file and processing the file to create the UCS 2 file Unicode strings defined in a C file are quoted ASCII text prefixed with a L character These types of strings may also be defined in meta data files L This string must be converted to UCS 2 format Because the string token name in UNI file will be generated into AutoGen header file as define MACRO name EDKII coding style document requires using all capital letters for both define and typedef declarations So string token name in UNI file must also be uppercase unicode characters 1 22 May 2010 295 296 Prototype lt StringFileFormat gt lt LanguageDefs gt lt Content gt lt CommentLine gt lt Text gt lt Chars gt lt DefaultCtrlChar gt lt ControlRefactor gt lt UnicodeLines gt lt SecurityLines gt lt CFormatGUID gt lt HexDigitU gt lt Token gt lt LangCode gt lt ISO639part1 gt lt ISO639part2 gt lt RFC3066 gt lt QuotedWord gt lt Word gt lt String gt lt Attributes gt lt StartAttribute gt BUILD lt CommentLine gt lt LanguageDefs gt lt Content gt lt CtrlChar gt langdef lt LangCode gt lt QuotedWord gt lt EOL gt lt CommentLine gt lt BlankLine gt lt UnicodeLines gt lt ControlRefactor gt lt LanguageDefs gt lt SecurityLines gt L Text lt EOL gt lt Whitespaces gt lt Chars gt lt Text gt 0x0001 OxF6FF Ly lt CtrlChar gt
238. f all PCDs in the package etc Finally the build tools attempt to parse FDF file if specified obtained from DSC file Parsing FDF file at this time is just for the PCD information which might be used by some modules and merge these PDC values into the information set of PCDs in DSC file 7 2 5 Post processing 110 Once all files are parsed the build tools will do following work for each EDK II module e Resolve the library classes to library instances inherit and resolve library classes from them recursively until no new library instances are found e Re order the library instances according to the consuming relationship and their constructors e Inherit GUIDs Protocols PPIs and PCDs from all library instances obtained above and determine values or type of them The value of a GUID Protocol or PPI is defined in DEC file The value and type of a PCD are obtained from DSC file or DEC file if it cannot be found in DSC file e Inherit library instance dependency depex sections expressions if a module does not list a separate dependency file May 2010 1 22 AutoGen Stage 7 3 Auto generated code The section covers in sequence the processes used to generate code files that will be used during the build 7 3 1 Dependency expression file The dependency expression file depex is generated from the depex section in module s INF file if the section presents or dxs file if DPX SOURCE definition is found in INF fil
239. f the current working directory does not contain one or more DSC files TargetVal Arch Zero or more of the following DEBUG RELEASE a user defined word in the tools def txt file separated by a space character If the line is missing or no value is specified all valid targets specified in the DSC file will attempt to be built What kind of architecture is for which the binary being target One or more of the following IA32 IPF X64 EBC or ARM Multiple values can be specified on a single line using space characters to separate the values These are used during the parsing of an DSC file restricting the build output target s The Build tool target ARCH is determined by a logical AND of target txt TARGET ARCH values DSC file Defines SUPPORTED ARCHITECTURES tag Command line a ARCH option If not specified then all valid architectures specified in the DSC file for which tools are available will be built May 2010 87 BUILD ToolDefs Specify the name of the filename to use for specifying the tools to use for the build If not specified the file WORKSPACE Conf tools def txt will be used for the build This file MUST be located in the WORKSPACE Conf directory TagName Specify the name s of the tools def txt TagName to use If not specified all applicable Tool Chain Tag name tools will be used for the build The list uses space character separation Integer The number of concurrent threads The default if no
240. ff Cx Zd DEBUG DDK3790 IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE DDK3790 IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 LTCG May 2010 211 BUILD DLL JENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text DDK3790 IA32 ASMLINK FLAGS nologo tiny HEHEHE HE HE HEHE HE HE HE HE HE HEHE EE HH x64 definitions THEE HE HE HEHE HE HE HE HE HE HEHE EE HH _DDK3790_X64_CC_PATH DEF WINDDK_BINX64 cl exe DDK3790 X64 SLINK PATH DEF WINDDK_BINX64 lib exe DDK3790 X64 DLINK PATH DEF WINDDK_BINX64 link exe _DDK3790_X64_PP_PATH DEF WINDDK_BINX64 cl exe _DDK3790_X64_VFRPP_PATH DEF WINDDK_BINX64 cl exe DDK3790 X64 APP PATH DEF WINDDK_BINX64 cl exe DDK3790 X64 ASM PATH DEF WINDDK BINX64 m164 exe DDK3790 X64 ASLCC PATH DEF WINDDK_BINX64 cl exe DDK3790 X64 ASLPP PATH DEF WINDDK_BINX64 cl exe DDK3790 X64 ASLDLINK PATH DEF WINDDK_BINX64 link exe DEBUG DDK3790 X64 CC FLAGS nologo c WX GS X W4 Gs8192 D UNICODE Olib2s GL Gy FlAutoGen h EHs c GR GF Zi Gm RELEASE DDK3790 X64 CC FLAGS nologo c WX GS X W4 Gs8192
241. g at the first location pointed to by the Offset value The format of the FILE RegionType iS FILE FILE DIR Filename bin The following is an example of the FILE RegionType 0Ox0CC000 0x002000 gEfiCpuTokenSpaceGuid PcdCpuMicrocodePatchAddress gEfiCpuTokenSpaceGuid PcdCpuMi crocodePatchSize FILE FV Microcode bin 1 22 May 2010 161 BUILD 162 May 2010 1 22 ImageGen Stage Other Images 10 ImageGen Stage Other Images This chapter describes the processing of the EFI files generated by the MAKE Stage into images such as Applications or images used by PCI Option ROMs and or Update Capsules Creating images that do not go into a flash part directly such as stand alone Applications and PCI Option ROM images do not need an FDF file This also applies to binary driver images that are to be used for a binary distribution the files for these images are created during the MAKE stage 10 1 EFI PCI OptionROM Images To generate the EFI PCI OptionROM the EFI PE32 files and optionally the legacy OptROM from a separate tool are needed The EfiRom tool is used on the PE32 and optionally the legacy OptionROM binary images The tool will checkthe header of each file to determine the type e If the input file s are EFI PE32 image fill in EFI PCI OptROM header and PCI data structure in the output EFI PCI OptionROM image then copy the input EFI PE32 file content to the output EFI PCI OptionROM image to create the
242. generated The file will contain 7 3 4 1 Header files inclusion Which files are included is determined by module type 120 Switch case case in br case case case in EA br case in br case case case case case case in MODULE TYPE BASE USER DEFINED clude statement AutoGen c include lt Base h gt eak BEER PEI_CORE PEIM clude statement AutoGen c include lt PiPei h gt include lt Library DebugLib h gt r eak DXE_CORE clude statement AutoGen c include lt PiDxe h gt include lt Library DebugLib h gt f eak DXE DRIVER DXE_SMM DRIVER DXE RUNTIME DRIVER DXE SAL DRIVER UEFI DRIVER UEFI APPLICATION clude statement AutoGen c include lt PiDxe h gt include lt Library BaseLib h gt include lt Library DebugLib h gt include lt Library UefiBootServicesTableLib h gt May 2010 1 22 AutoGen Stage break default PrintError s n message BreakTheBuild 7 3 4 2 Caller ID GUID variable definition Because not all GUID variables are required a link time optimization removes items that are not referenced by other parts ofthe code to save on space in the image include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED GUID gEfiCallerIdGuid 0x4A9B9DB8 OxEC62 0x4A92 0x81 Ox8F Ox8A OxAO 0x24 Ox6D 0x24 Ox6E 7 3 4 3 Library Constructor Statements If
243. ges may be processed into either a terse image or have the reloc section removed for images that will always execute directly from ROM 2 7 1 1 Reference Implementation Best Known Safe flags The reference build provided with EDK II provides files for the supported tested compiler tool chains that contain Best Known Safe flags for generating libraries drivers and applications These flags are set for speed optimization The build system does provide for modifying flags for individual modules so flags may be modified for better debugability 2 7 2 Creating a Terse Image 24 The following is an partial view of the process ommissions may exist To create a Terse image 1 The DOS PE and or optional headers must be replaced with a minimal header The TE header will have a signature of VZ Per the PE COFF specification at offset 0x3C in the file is a 32 bit offset from the start of the file to the PE signature which always follows the MSDOS stub The PE signature is immediately followed by the COFF file header 2 After verifying the DOS header s magic number 0x5A4D the PE signature PE 0 0 is verified then obtains the Machine type from the optional header s subsystem field e Since this process removes bytes from the file the number of bytes stripped must be calculated based on the location of the PESigOffset 0x3C plus the 4 bytes SEN the offset pointer plus the size of the Coff header plus the size of any Optiona
244. h an EDK build unless they do not include the extended grammar Table 7 shows the compatibility matrix Table 7 VFR Compatibility Matrix Code non UEFI 2 1 Compliant UEFI 2 3 Compliant VFR VFR Tools Tools pre UEFI 2 1 Unicode Yes Yes pre UEFI 2 1 VFR Source Yes Yes pre UEFI 2 1 IFR binaries Yes No UEFI 2 1 Unicode No Yes UEFI 2 1 Vfr No Yes UEFI 2 1 IFR binaries No Yes 2 7 8 Generating EFI FFS Files 30 This section provides the overview for generating an FFS file Once the EFI Section files have been created they need to be placed within an FFS file An FFS file contains an FFS header and one or more section files The ordering of the section files within the FFS is not specified by the PI specification so sections may appear in any order The Name of the FFS file which is placed in the FfsFileHeader data structure is a GUID value with a structure of UINT64 UINT32 UINT32 UINT8 8 May 2010 1 22 Design Discussion The alignment of data within the FFS must match the alignment specified for a given section so padding may be required between the FFS header and the section headers Alignment must be set and padding inserted prior to calculating the size or performing the Integrity check checksum on the header itself and all of the section data The size of the FFS in the F sFileHeader Size array is computed using the size of all files including all pad files plus the size of the header The size value must be
245. h shell also has a built in source command so the following will also work source edksetup sh Building under Unix systems requires the BaseTools source code from the http edk2 buildtools svn sourceforge net BaseTools project You might see an error from the edksetup sh script related to not having the BaseTools source To resolve this error download the source code from http edk2 buildtools svn sourceforge net Then set the EDK TOOLS PATH environment variable For example if you wanted to download the BaseTools source to src buildtools directory you might use the following commands cd sre svn co http edk2 buildtools svn sourceforge net viewvc edk2 buildtools trunk buildtools export EDK TOOLS PATH src buildtools BaseTools Now running the edksetup sh script should no longer give an error Atthis point you can try running the build tool to see if you have successfully configured the BaseTools Try running this build help This command should print out the help text for the BaseTools build utility Please note the edksetup sh script will save load the EDK TOOLS PATH setting in the Conf BuildEnv sh file so it is not necessary to set the EDK TOOLS PATH again if a new command shell is started and edksetup sh is sourced into that shell The build utility is written in the Python language and therefore does not require pre compilation before it can be used But there are several other BaseTools utilities which
246. h square brackets used to separate different sections and angle lt gt brackets separating content within a given section Sections are terminated by either another section or the end of file All entries in this file are case sensitive The entries in the build rule txt files if one or more additional build rule format files are specified in the target txt file are positional A second section heading that matches a previous section heading will cause the tools to use the rule defined in the second section rather than the rules in the section that was found first May 2010 1 22 1 22 Prototype lt BuildRules gt lt SectionHeading gt lt FileArg gt lt OptArgs gt lt NextBuild gt lt VerArg gt lt FileType gt lt Version gt lt Inputs gt lt Outputs gt lt ExtraDependency gt lt Commands gt lt InFamilyOpt gt lt OutFamilyOpt gt lt CmdFamilyOpt gt lt Family gt lt InputFileSpec gt lt FileSpec gt lt LineList gt MetaData File Specifications lt SectionHeading gt lt Inputs gt lt Outputs gt lt ExtraDependency gt lt Commands gt lt FileArg gt lt EOL gt lt FileType gt lt OptArgs gt lt VerArg gt lt NextBuild gt Build lt FileArg gt lt Version gt Acpi Source Language File Acpi Table Code File Assembly Code File C Code File C Header File Dependency Expression File Dynamic Library File
247. ial target is used to execute the emulation platform such as NT32 It should never be used for real platforms 144 May 2010 1 22 AutoGen Stage run cd BUILD_DIR IA32 SecMain cd BUILD_DIR 7 5 Binary Modules EDK II accommodates distribution of binary module code for inclusion into a firmware volume This feature is used by vendors who have a proprietary code base but need to provide their customers with the ability to use that code in a platform Vendors may protect their IP by distributing only module code in either lib bin or efi format without distributing debug files or sources A binary module must have a binaries section Its INF file should not be put in DSC file and the build tools should not try to do module build for a binary module unless there s LIB type of files declared The INF file of a binary module is always put in FDF file for flash image generation The binary files can also be referenced directly in FDF Please refer to Section 9 for details Binary modules are used only with FDF files May 2010 145 BUILD 146 May 2010 1 22 MAKE Stage 8 S MAKE Stage This chapter describes the processing of the source files into EFI files The make stage starts out by building required libraries followed by the EDK components and finally EDK II modules The outputs of this stage are linked PE32 COFF images that have been processed to replace the standard header with an appropriate EFI header
248. ic GUID is assigned to the added tool which can be used to specify this tool and its compressed data Then the tool path and guid needs to be added into tools def txt file for example TianoCompress tool used for all tool chains Target and Archs can be added like TIANOCOMPRESS PATH DEF TOOL PATH TianoCompress exe TIANOCOMPRESS GUID A31280AD 481E 41B6 95E8 127F4C984779 Next TOOLNAME can be specified in build rule txt file to call this tool And its guid value is supported in FDF file to call this tool which is used to create the EFI guided section data For TianoCompress tool TIANOCOMPRESS is used in build rule txt file A31280AD 481E 41B6 95E8 127F4C984779 is used in FDF file May 2010 1 22 Build Changes and Customizations NT32 fdf file uses TianoCompress tool to create the guided data like Rule Common BEIN TIANOCOMPRESSED FILE PEIM NAMED GUID DEBUG MYTOOLS IA32 PEI_DEPEX PEI_DEPEX Optional depex GUIDED A31280AD 481E 41B6 95E8 127F4C984779 PE32 PE32 l efi UI STRING MODULE NAME Optional VERSION STRING INF VERSION Optional BUILD NUM BUILD NUMBER 11 3 Using Custom Build Tools This section introduces how to use the custom tools in EDKII build system The custom tools can be classified to two types One is used to create the EFI guided section data which must have its matched GUID value such as the custom compression tool introduced in the last section Anothe
249. ic functions Ob2 Ob2 default inline Inline any function at the compiler s discretion same as Qip GL Enable link time code generation EHs EHs Disable C EH no SHE exceptions EHc EHc Disable extern C defaults to no throw GF GF Enable read only string pooling Gs8192 Gs8192 Control stack 8192 bytes checking calls TC TC Compile as c files Yc Create the pch file Gm Enable minimal rebuilds FpAutoGen h gc h X X Ignore standard places Zi Zi Produce debugging information 102 May 2010 1 22 Table 25 Static Linker Flags Microsoft GCC Description nologo Do not display compiler version information LTCG Use link time code generation Table 26 Dynamic Linker Flags Microsoft GCC Description NOLOGO Do not display compiler version information NODEFAULTLIB nostdlib Disable using default libraries IGNORE 4086 N A USE Gz option instead OPT ICF 10 Perform identical COMDAT folding 10 iterations to remove duplicates MAP Map filename map Create a map file ALIGN 32 section alignment 0x20 Use 32 byte alignment instead of the MACHINE DLL LTCG ENTRY ENTRYPOINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG file alignment 0x20 N A dll entry _ ENTRYPOINT subsystem console image base 0x0 02 gc sections export all symbols default 4K Where is one of I386 AMD64 or IA64 The outp
250. ield is set to either 0x0000 for no compression or 0x0001 for standard EFI compression no other compression types are permitted The reserved bits are typically set to 0 However they may be used The EfiImageHeaderOffset is set to the size of this header while the PcirOffset is the offset to the EFI header the OptionROM header size plus any padding bytes to align the driver on its natural alignment boundary Additionally the PCI Data Structure PCI 3 0 compliant is the default is also inserted The Vendor ID and Device ID are inserted into the PCI Data Structure The ClassCode and CodeRevision are determined from the input file header information while the ImageLength field is set to the OptionROM Header s InitializationSize field All other fields are currently set to O by the reference implementation s EfiRom tool PCI device Expansion ROMs may contain code for multiple processor architectures This may be implemented in a single physical ROM image which can contain as many code images as desired for different system and processor architectures Figure 16 below PCIR Data Structure PCIR Data Structure EFI PCI Expansion ROM Header Figure 16 EFI PCI Expansion Option ROM layout May 2010 1 22 Design Discussion Each image must start on a 512 byte boundary and must contain the PCI Expansion ROM header The starting point of each image depends on the size of previous images The last image in a ROM has a special encoding in
251. ification Version 1 1 Unified EFI Inc 2006 http www uefi org e Intel Platform Innovation Framework for EFI Specifications Intel 2006 http www intel com technology framework http sourceforge net projects edk2 files EDK II Module Writers Guide Intel 2010 PCD Infrastructure Intel 2009 EDK II User Manual Intel 2010 EDK II C Coding Standard Intel 2010 EDK II DSC Specification Intel 2010 EDK II INF File Specification Intel 2010 EDK II FDF Specification Intel 2010 EDK II Build Specification Intel 2010 VFR Programming Language Intel 2010 EDK II MDE Library Specification Intel 2007 1 4 Terms The following terms are used throughout this document to describe varying aspects of input localization BaseTools The BaseTools is a separate project from EDK II which supports the tools required for an EDK II build This project is hosted at http sourceforge net projects edk2 buildtools files BDS Framework Boot Device Selection phase BNF BNF is an acronym for Backus Naur Form John Backus and Peter Naur introduced for the first time a formal notation to describe the syntax of a given language Component An executable image Components defined in this specification support one of the defined module types DXE Framework Driver Execution Environment phase 2 May 2010 1 22 1 22 Introduction DXE SAL A special class of DXE mod
252. igning or encrypting an image 2 7 13 Generating an FD image file This section provides the overview for generating a platform flash file When generating the FD file the flash device is assumed to be partitioned into different areas with the content of each added in sequence with zero filled padding of any partial blocks to the next specified offset 2 7 13 1 Reference Implementation Data structures The Reference Build system will create an FD file in the FV output directory and using 34 May 2010 1 22 Design Discussion the information in the FDF file will add all FV files as well as any data structures that are specified in the FDF file Each FV will be added to the FD file in the order specified by the FD section at the location specified Data structures in the FDF are typically used to initialize the data area for use by EFI drivers and as such may require an FV header to identify the region such as NV storage in Flash 2 7 14 Generating Applications This section provides and overview to generating UEFI applications which may or may not be resident in a flash device Applications fall into three different types applications that execute from within a flash image applications that execute from the EFI Shell and applications that execute from an Operating System accessing UEFI runtime services or need to access UEFI System Table fields The build only provides support for UEFI applications that execute from within the
253. iles will be processed at the same time is used to indicate that the source files will be processed one by one lt File Type gt lt Build Type gt lt Arch gt lt File Type gt lt Build Type gt lt Arch gt J lt EOL gt lt InputFile lt ToolChainFamily gt gt lt EOL gt 2 File Extension n lt File Extension gt lt OutputFile lt ToolChainFamily gt gt lt EOL gt lt FileFullPath gt lt ExtraDependency gt lt FileFullPath gt lt Command lt ToolChainFamily gt gt lt EOL gt lt Command1 gt lt Command2 gt lt Build Type gt is the MODULE TYPE in EDK2 or COMPONENT TYPE in EDK Missing lt InputFile gt will cause an exception and break build Missing Command will cause that related build target won t be generated but won t break build Placeholders for string substitution eisrc Source file s to be built full path s path Source file directory absolute path s dir Source file relative directory within a module Note s dir is always equals to if source file is given in absolute path s name Source file name without path s base Source file name without extension and path S s ext Source file extension S dst Destination file s built from src full path d_path Destination file directory absolute path d_name Destination file name without path d_base Destination file name without extension and path d ex
254. ill try to build just that module only rather than building a whole platform Once the build tool gets what to build and how to build it starts to parse the platform description file DSC From the DSC file the build tools will locate the INF files for all modules and libraries as well as other settings of the platform including DEC specified default values for PCDs used by modules and libraries that do not have values specified in the DSC file From module description files the build tool will find out what package description files 1 22 May 2010 105 BUILD the module depends on In this way the build tool will find out and parse all modules and packages that make up a platform The next thing to do in the AutoGen stage is to generate files required to build a module The files include AutoGen h AutoGen c depex and makefile AutoGen c and depex files will not be generated for library modules and depex file is generated only if there s depex section found in the module s INF file Each module found in DSC file will have a makefile generated for it A top level makefile will be generated for the platform from which all modules makefile will be called Note When building a module only the module s makefile will be called 7 2 Auto generation Process This section covers in sequence the steps taken by the build exe tool 7 2 1 Determine What to Build 106 The build tool will use following algorithm to determi
255. in Hand Off Blocks HOBs e Describing the firmware volume locations in HOBs May 2010 1 22 Design Discussion e Passing control into the Driver Execution Environment DXE phase 2 4 3 Drive Execution Environment DXE Prior to the DXE phase the Pre EFI Initialization PEI phase is responsible for initializing permanent memory in the platform so that the DXE phase can be loaded and executed The state of the system at the end of the PEI phase is passed to the DXE phase through a list of position independent data structures called Hand Off Blocks HOBs HOBs are described in detail in the Platform Initialization Specification There are several components in the DXE phase e DXE Foundation e DXE Dispatcher e Asetof DXE Drivers 2 4 4 Boot Device Selection BDS The Boot Device Selection BDS phase is implemented as part of the BDS Architectural Protocol The DXE Foundation will hand control to the BDS Architectural Protocol after all of the DXE drivers whose dependencies have been satisfied have been loaded and executed by the DXE Dispatcher The BDS phase is responsible for the following e Initializing console devices e Loading device drivers e Attempting to load and execute boot selections 2 4 5 Transient System Load TLS and Runtime RT The Transient System Load TLS primarily the OS vendor provided boot loader along with the Runtime Services RT phases may access persistent UEFI drivers and applications Drivers in
256. in platform PCD values which will go into the individual module AutoGen h files where needed Obtain the FDF filename and obtain the Flash related PCDs from the FDF file Create the list of EDK Libraries that will need to be built a Create the makefiles b Add the makefile to the top level makefile Create the list of EDK Components that will need to be built a Create the makefiles b Add the makefile to the top level makefile Create the list of EDK II Modules that will need to be built For each EDK II Module parse the Module s INF file a Create a directed graph list of the EDK II Library Instances that will be use for the module e Individual modules may require different compilation options over riding any global definitions b Create the Library Instance s AutoGen c files containing PCD Guid Protocol Ppi and EntryPoint definitions and data structures c Create the module s library instance makefiles May 2010 67 BUILD d Create the AutoGen c files containing PCD Guid Protocol Ppi and EntryPoint definitions and data structures e Create any Strings header file required for VFR processing The VFR file name can not be same as a C file name in a module directory If so the u dda files will be generated and overwritten A vfr gt A c gt A obj A c gt A obj f Need the EDK II Build Spec to add this warning g Create the module s makefiles h Add the makefile to the top level makefile Add a last call
257. in the top level makefile to build the GenFds program only if an FDF file was specified in the DSC file 4 4 2 Build Binary EFI Images MAKE stage Binary EFI images are created in two steps the first step uses 3rd party assemblers compilers and linkers to generate a PE32 PE32 COFF image file while the second step uses the GenFw application provided in EDK II to modify the PE32 PE32 COFF image file to create an EFI file with an EFI IMAGE SECTION HEADER structure Since different EFI SECTION types may require different values for alignment offsets the GenFw tool must specify the component type which is derived from the INF meta data s ModuleType statement This stage is executed via either the NMAKE or the GMAKE build tool The makefiles Makefile or GNUMakefile are created during the meta data processing stage The makefiles specify the compiler linker assembler and GenFw tool commands and options The Makefile or GNUmakefile which is a list of other NMAKE or GMAKE commands will call the GenFds application to initiate the third stage of a build IFF there is a Flash Definition File FDF specified in the DSC file If no FDF file is specified then the build will terminate with the creation of individual module EFI formatted EFI images 4 4 3 Assemble FLASH Images ImageGen stage 68 Once all the modules EFI image files have been created the final stage of a build process is called For FLASH images this stage uses the
258. indow 2 VOID 50 This defines label for the two windows that are started May 2010 273 BUILD 274 May 2010 1 22 Appendix G Firmware Volume INF The Firmware Volume INF file is generated by the EDK II build tools as an intermediate file between the code generation stage and the final image creation stage G 1 Firmware Volume INF Description The Firmware Volume INF files are generated by tool based on content from Platform description files DSC and Flash definition files FDF and may contain these three sections options attributes and files This file is an input to the GenFvImage utility lt FIRMWARE VOLUME INF gt lt options gt lt attributes gt lt files gt G 2 Attributes Section Summary Defines the Attributes tag is found only in Firmware Volume INF files This file is created by the tools and is an input to the GenFvImage utility Refer to the document Intel Platform Innovation Framework for EFI Firmware Volume Block Specification for more information on these values This is an optional section Prototype lt attributes gt lt expression gt attributes lt EOL gt lt expression gt EFI READ DISABLED CAP TrueFalse lt EOL gt EFI READ ENABLED CAP lt TrueFalse gt lt EOL gt EFI READ STATUS lt TrueFalse gt lt EOL gt EFI WRITE DISABLED CAP lt TrueFalse gt lt EOL gt EFI WRITE ENABLED CAP TrueFalse lt EOL
259. ing 1 EFI VERSION SECTION2 Parameters BuildNumber A UINT16 value that represents a particular build Subsequent builds have monotonically increasing build numbers relative to earlier builds VersionString The VersionString is a null terminated UNICODE string that contains a text representation of the version If there is no text representation of the version then an empty string must be provided CommonHeader Common section header CommonHeader Type EFI SECTION VERSION 48 May 2010 1 22 UEFI and PI Image Specification EFI USER INTERFACE SECTION This is the entire SE USER INTERFACE SECTION The user interface file name section is a leaf section that contains a Unicode string that contains a human readable file name This section is optional and is not required for any file types There must never be more than one user interface file name section contained within a file EFI USER INTERFACE SECTION2 must be used if the section is 16MB or larger typedef struct EFI COMMON SECTION HEADER CommonHeader CHAR16 FileNameString EFI USER INTERFACE SECTION typedef struct EFI COMMON SECTION HEADER2 CommonHeader CHAR16 FileNameString EFI USER INTERFACE SECTION2 Parameters FileNameString The FileNameString is a UNICODE string that contains a human readable file name This section is optional and is not required for any of the file types CommonHeader Common section header CommonHeader Type
260. ion 180 December 2007 1 22 Appendix A Variables One of the core concepts of this utility is the notion of symbols Use of symbols follows the makefile convention of enclosing within for example EFI_SOURCE As the utility processes files during execution it will often perform parsing of variable assignments These variables can then be referenced in other sections of the DSC file Variable assignments will be saved internally in either a local or global symbol table The local symbol table is purged following processing of individual Platform DSC files Global symbol values persist throughout execution of the utility Local symbol values take precedent over global symbols The following table describes the symbols generated internally by the utility They can be overridden either on the command line in the DSC file or in individual INF files The G L column indicates whether the symbol is typically a global or a local symbol Variable descriptions follow in Table 27 May 2010 181 Note BUILD This table does not list required system environment variables or optional system environment variable Table 27 Variable Descriptions Variable Name G L Description BIN_DIR BUILD_DIR BUILD_TYPE DEST_DIR DSC_FILENAME EDK_SOURCE FILE FV_EXT INF_FILENAME LIB_DIR MAKEFILE_NAME OUT_DIR PACKAGE PACKAGE_FILE L L G Specifies the directory where final component binaries
261. is not maintained in the Attributes field of the firmware volume header Type EFI FVB ATTRIBUTES is UINT32 which is a bit encoded field see Related Definitions below HeaderLength Length in bytes of the complete firmware volume header Checksum A 16 bit checksum of the firmware volume header A valid header sums to zero ExtHeaderOffset Offset relative to the start of the header of the extended header EFI FIRMWARE VOLUME EXT HEADER or zero if there is no extended header The extended header is followed by zero or more variable length extension entries Each extension entry is prefixed with the EFI FIRMWARE VOLUME EXT ENTRY structure which defines the type and size of the extension entry The extended header is always 32 bit aligned relative to the start of the file header Reserved In this version of the specification this field must always be set to zero 56 May 2010 1 22 1 22 Revision Set to 2 Future versions of this specification may define new header fields and will increment the Revision field accordingly FvBlockMap An array of run length encoded FvBlockMapEntry structures The array is terminated with an entry of 0 0 FvBlockMapEntry NumBlocks The number of sequential blocks in the run which are of the same size FvBlockMapEntry BlockLength The length of each block in the run Related Definitions EFI FVB ATTRIBUTES 2 Attributes bit definitions define define define define
262. iver lt ENTRY_POINT gt ImageHandle SystemTable ASSERT FALSE 1 22 May 2010 129 return mDriverEntryPointStatus KO E If MODULE TYPE DXE RUNTIME DRIVER MODULE TYPE DXE DRIVER MODULE TYPE DXE SAL DRIVER MODULE TYPE UEFI DRIVER MODULE TYPE UEFI APPLICATION include statement AutoGen c const UINT32 gUefiDriverRevision 0 MOK If Number of ENTRY POINT 0 include statement AutoGen c EFI STATUS EFIAPI ProcessModuleEntryPointList IN EFI HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable return EFI_SUCCESS ys If Number of ENTRY POINT 1 include statement AutoGen c EFI STATUS Function IN EFI HANDLE ImageHandle IN EFI_SYSTEM TABLE SystemTable EFI_STATUS EFIAPI ProcessModuleEntryPointList IN EFI_HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable return ENTRY POINT ImageHandle SystemTable VOID 130 May 2010 BUILD 1 22 1 22 EFIAPI ExitDriver IN EFI_STATUS Status if EFI_ERROR Status ProcessLibraryDestructorList gImageHandle gST gBS gt Exit gImageHandle Status 0 NULL If Number of ENTRY_POINT gt 1 include_statement AutoGen c lt ENTRY_POINT1 gt IN EFI HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable IE lt ENTRY_POINT2 gt IN EFI_HANDLE ImageHandle IN EFI SYSTEM TABLE SystemTable EFI STATUS
263. jorOperatingSystemVersion MinorOperatingSystemVersion MajorimageVersion MinorImageVersion MajorSubsystemVersion MinorSubsystemVersion Win32VersionValue SizeOfImage SizeOfHeaders CheckSun Subsystem DilCharacteristics SizeOfStackReserve SizeOfStackCommit SizeOfHeapReserve SizeOfHeapCommit LoaderFlags NumberOfRvaAndSizes DataDirectory EFI IMAGE NUMBER OF DIRECTORY ENTRIES EFI IMAGE OPTIONAL HEADER64 Related Definitions Magic For EFI IMAGE OPTIONAL HEADER32 Magic IMAGE NT OPTIONAL HDR32 which is defined as Ox10b For EFI IMAGE OPPTIONAL HEADER64 Magic IMAGE NT OPTIONAL HDR64 which is defined as Ox20b EFI IMAGE FILE HEADER This is the COFF header defined in the PE specification and is 20 bytes in length 44 May 2010 1 22 UEFI and PI Image Specification typedef struct UINT16 UINT16 UINT32 UINT32 UINT32 UINT16 UINT16 Machine NumberOfSections TimeDateStamp PointerToSymbolTable NumberOfSymbols SizeOfOptionalHeader Characteristics EFI IMAGE FILE HEADER Parameters Machine Subsystem type NumberOfSections The number of text data rdata and reloc sections in the image TimeDateStamp The time and date of image creation typically during a platform build all modules will have this field set to one common date and time PointerToSymbolTable Pointer to the Symbol Table NumberOfSymbols Number of symbols SizeOfOptionalHe
264. k16 exe DEF ICC_BIN32 icl exe DEF ICC_BIN32 icl exe DEF ICC_BIN32 icl exe DEF MS_VS_BIN ml exe DEF MS VS DLL DEF ICC_BIN32 icl exe DEF ICC_BIN32 icl exe DEF ICC_BIN32 xilink exe nologo c WX w4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR L INTEL FIAutoGen h EHs c GF Zi Gm RELEASE ICC IA32 CC FLAGS nologo c WX w4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR L INTEL FIAutoGen h EHs c GF DEBUG ICC IA32 ASM FLAGS RELEASE ICC IA32 ASM FLAGS ICC IA32 SLINK FLAGS DEBUG ICC IA32 DLINK FLAGS nologo c WX W3 Zd Zi nologo c WX W3 Zd nologo NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE 1386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICC IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text ICC IA32 ASMLINK FLAGS TEE HERE ERE ER EHE HEB HE X64 definitions FEFE EE FE HE ER E EHE HE RE HE ICC X64 CC PATH ICC X64 SLINK PATH xilib exe needs lib exe from Visual ICC X64 SLINK DLL ICC X64 DLINK PATH ICC X64 PP PATH ICC X64 VFRPP PATH ICC X64 APP PATH IC
265. kSize 0x10000 FvAlignment 16 ERASE POLARITY 1 MEMORY MAPPED TRUE STICKY WRITE TRUE LOCK CAP TRUE LOCK STATUS TRUE WRITE DISABLED CAP TRUE WRITE ENABLED CAP TRUE WRITE STATUS TRUE WRITE LOCK CAP TRUE WRITE LOCK STATUS TRUE READ DISABLED CAP TRUE READ ENABLED CAP TRUE READ STATUS TRUE READ LOCK CAP TRUE READ LOCK STATUS TRUE FILE FV IMAGE EDBEDF47 6EA3 4512 83C1 70F4769D4BDE SECTION GUIDED SECTION FV IMAGE BiosUpdateCargo This FV is very simple it contains only one FILE But this file contains an entire FV image named BiosUpdateCargo which must be available when GenFds creates the BiosUpdate FV The GenFds tool will process the FDF file and place the FV attributes and contents in to an INF file in this example the BiosUpdate inf file and then processing is transferred to GenFv tool when creating FV images The following example is what this generated FV style INF file looks like 158 May 2010 1 22 ImageGen Stage FLASH Images options EFI_BLOCK_SIZE 0x10000 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 EFI WRITE LOCK STATUS 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 EFI READ STATUS TRUE EFI WRITE LOCK CAP TRUE EFI STICKY WRITE
266. kage ID W CC C 9 1 032 ASL Intel ACPI Source Language Compiler bed ide HERH HE HE FE E dde A zg HE TEE HE HE FE d dr FE ERE EIE TEE FE FE HE A eg E ERE EAE ERE AA A gd Ad Habe d gg Ag ZAA ICC Intel C Compiler V9 1 ICC FAMILY INTEL ICC MAKE PATH ICC RC PATH DEF MS VS BIN nmake exe DEF MS VS BIN rc exe ICC MAKE FLAGS ICC VFRPP FLAGS nologo nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h ICC APP FLAGS nologo E TC ICC PP FLAGS nologo E TC FIAutoGen h HEHEHE HE HE HEHE HE GGA ASL definitions HEEE HEHE HEHE HE HE HE HE HE HEHE EE HH ICC ASL PATH DEF WIN IASL BIN ICC ASL FLAGS ICC ASL OUTFLAGS DEF IASL OUTFLAGS ICC ASLCC FLAGS DEF ICC WIN ASLCC FLAGS ICC ASLPP FLAGS DEF ICC WIN ASLPP FLAGS ICC ASLDLINK FLAGS DEF ICC WIN ASLDLINK FLAGS bed zg Az dd izo IA32 definitions HEHEHE HE HE HEHE HE GGA ICC IA32 CC PATH DEF ICC BIN32 icl exe ICC IA32 SLINK PATH DEF ICC BIN32 xilib exe 4 xilib exe needs lib exe from Visual Studio ICC IA32 SLINK DLL DEF MS VS BIN 226 May 2010 1 22 ICC IA32 DLINK PATH ICC IA32 ASMLINK PATH ICC IA32 PP PATH ICC IA32 VFRPP PATH ICC IA32 APP PATH ICC IA32 ASM PATH ICC IA32 ASM DLL ICC IA32 ASLCC PATH ICC IA32 ASLPP PATH ICC IA32 ASLDLINK PATH DEBUG ICC IA32 CC FLAGS DEF ICC_BIN32 xilink exe DEF WINDDK_BIN16 lin
267. l EdkFrameworkProtocolLi b inf c edk2 EdkCompatibilityPkg Foundation Efi Guid EfiGuidLib inf c edk2 EdkCompatibilityPkg Foundation Efi Protocol EfiProtocolLib inf c edk2 EdkCompatibilityPkg Foundation Library EfiCommonLib EfiCommonLib inf c edk2 EdkCompatibilityPkg Foundation Framework Guid EdkFrameworkGuidLib inf innen mL enn ne ann LL mL uL nne gt Note This sub section presents when LIBRARY or ALL is specified in Y option 12 7 3 PCD Sub section 178 This sub section holds the information for all PCDs used in this module The content of module PCD sub section is divided by token space such as gEfiNt32PkgTokenSpaceGuid gEfiMdeModulePkgTokenSpaceGuid Each item of module PCD maybe contains three lines 1 The first line is a mandatory lines as P F lt PcdCName gt lt PcdType gt lt DatumType gt lt PcdValue gt P means the Pcd s value is override in DSC file F means the PCD s value is override in FDF file If no P or F mean the PCD s value comes from DEC file For example P PcdWinNtFirmwareVolume FIXED VOID L Fv Nt32 f d 2 The second line is the optional line a if lt PcdType gt is DYN HII lt VariableGuid gt lt VariableName gt lt Offset gt For example P PcdGMchDvmtTotalSize DYN HII UINT8 0 gSysConfigGuid L Setup OxAA b if lt PcdType gt is DYN VPD lt offset relative to VPD base address gt For example December 2007 1 22 Reports F PcdVpdSample
268. l Header from the Coff header s SizeOfOptionalHeader e The number of bytes stripped must always be less than 64K bytes The original file size oie the number of bytes stripped is then inserted into the TE header s StrippedSize value May 2010 1 22 Design Discussion e The optional header s magic number is used to determine whether the Optional Header data structure is IPF EFI OPTIONAL IMAGE HEADER64 or non IPF EFI OPTIONAL IMAGE HEADER32 e Using the correct optional header format the TE header s AddressOfEntryPoint is set to the optional header s AddressOfEntryPoint Additionally the Subsystem entry from the optional header s Subsystem entry will be packed into one byte e Additional entries Baseo Code and ImageBase in the TE header come from the optional Header If the optional header s NumberOfRvaAndSizes is greater than 0 then the relocation data from the optional header DataDirectory 0 VirtualAddress and Size is set based on the content of the optional header s DataDirectory 0 values e Likewise if the NumberOfRvaAndSizes is greater than 1 then the debug data from the optional header s DataDirectory 1 VirtualAddress and Size is set in the TE header s DataDirectory 1 entry 3 Asa last step before creating the image the COFF header specifies the value of the NumberOfSections in the file which needs to be packed into a single byte of the TE header The number of sections must be less than 255 for this to succeed 4
269. l commands for gnu make RD rm r f RM rm f MD mkdir p CP cp lt u f MV mv f 7 4 1 1 8 Source files and target files list macro In these lt FILF_TYPES gt macros are generated from WORKSPACE Conf build rule txt and files listed in Sources section in INF file INC macro is generated from Includes section in DEC file and Packages section in INF file LIBS macro is generated from LibraryClasses section in INF file and DSC file and COMMON DEPS macro is generated by parsing recursively the include preprocessor directives in source code files C CODE FILES V WORKSPACE MdeModulePkg App Hello HelloWorld c DYNAMIC LIBRARY FILE LIST DEBUG_DIR MODULE NAME d11 UNKNOWN_TYPE FILE LIST DEBUG_DIR MODULE_NAME efi OBJECT FILE LIST OUTPUT DIR HelloWorld obj STATIC LIBRARY FILE LIST OUTPUT DIR MODULE NAME lib INC lt include search path list gt LIBS lt dependent library file list gt COMMON DEPS lt header file list gt 7 4 1 1 9 Target macros In these copa TARGET is generated according to the last rule s in rule chains defined in WORKSPACE Conf build_rule txt INIT TARGET CODA TARGET init DEBUG DIR MODULE NAME efi 7 4 1 2 Target definitions 7 4 1 2 1 all target Default target which actually executes against the mbuild target 7 4 1 2 2 pbuild target Target which is used to build the source files of cur
270. l supported tools that may be required 64 May 2010 1 22 Reference Build Process Overview Note How to use the Izma tool is not included in this document however it is a well known compression algorithm and is included in the table for reference Table 10 Additional Compiler Tools Vendor Tool Name Version Description Microsoft asl exe 3 0 0NT ACPI Source Language Assembler May 3 2006 ACPICA iasl exe 20060113 ASL Optimizing Compiler 7 zip Izma exe 4 06 LZMA compression tool Note Install the tool chains for compilers and or additional tools prior to building any image 4 3 GCC Setup Unlike Microsoft and Intel compiler tools that are distributed with installation software the GCC tool chains can be pulled directly from the Internet Since different Linux distributions and OS X installations may use different and possibly incompatible versions testing of EDK II with GCC is limited to specific releases To ensure UEFI PI compliant GCC tools scripts have been provided in the BaseTools gcc folder of the BaseTools source tree part of buildtools tianocore org The GCC tools built by these tools are the only recommended GCC tool suite for creating UEFI PI images Note Although your OS distribution may bundle a MinGW based GCC binutils these are not supported amp validated for UEFI PI compatibility Please refer to the README file under BaseTools gcc for more information on building the GCC tool sui
271. lags of current module Current module name Current module type Architecture of current module Tool chain used to build current module Target of current module DEBUG RELEASE Path of tool Path of build tools Search path of the current module A file containing search paths of the current module File list of each file type Note The macro name is derived from file type name For example C Code File will have C CODE FILES macro This Macro points to a file containing a list of files for a given file type Note Note The macro and file name are derived from file type name For example C Code File will have C CODE FILES LIST macro pointing to OUTPUT_DIR c code files Ist The list file and macro name will be generated only when this macro is used in command line This is intended to get over the long command line limitation This Macro points to the individual module s MAKEFILE System copy command System move command System delete command System create dir command System remove dir command May 2010 BUILD 1 22 MetaData File Specifications Example C Code File lt InputFile gt TO 2E Se GE CPP Cpp CPP VV s lt ExtraDependency gt MAKE FILE lt OutputFile gt OUTPUT DIR s dir s_base obj lt Command MSFT Command INTEL gt CC Fo dst CC FLAGS INC src lt Command GCC gt CC o dst CC FLAGS INC src C Header
272. le EFI STATUS EFIAPI ProcessModuleUnloadList IN EFI HANDLE ImageHandle return lt UNLOAD IMAGE gt ImageHandle IE 1 22 May 2010 133 BUILD If Number of UNLOAD IMAGE in INF gt 1 include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED const UINT8 _gDriverUnloadImageCount NumberOfUnloadImage EFI_STATUS lt UNLOAD_IMAGEI gt IN EFI_HANDLE ImageHandle EFI_STATUS lt UNLOAD IMAGE2 gt IN EFI HANDLE ImageHandle EFI_STATUS EFIAPI ProcessModuleUnloadList IN EFI_HANDLE ImageHandle EFI_STATUS Status Status EFI_SUCCESS if EFI_ERROR Status lt UNLOAD_IMAGE1 gt ImageHandle else Status lt UNLOAD IMAGE1 gt ImageHandle if EFI_ERROR Status lt UNLOAD IMAGE2 gt ImageHandle else Status lt UNLOAD IMAGE2 gt ImageHandle return Status 7 3 4 7 Global variables These are generated from Guids Protocols Ppis xxxPcd sections of the inf file and uni files 134 May 2010 1 22 AutoGen Stage InfList add ModuleInf InfList foreach LibraryInstance add LibraryInf InfList foreach DependentLibraryInstance add LibraryInf InfList foreach INF in InfList If Guids defined in INF foreach GuidCName include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED EFI GUID lt GuidCName gt lt GuidValue gt If Protocols defined in INF foreach Pr
273. le LIST entries with a SINGLE SPACE character do not use comma characters Un set an option by either commenting out the line or not setting a value PROPERTY Type Use Description C gea el at e e a eee giaren ACTIVE PLATFORM Filename Recommended Specify the WORKSPACE relative Path and Filename of the platform DSC file that will be used for the build This line is required if and only if the current working directory does not contain one or more DSC files ACTIVE_PLATFORM Nt32Pkg Nt32Pkg dsc TARGET List Optional Zero or more of the following DEBUG RELEASE a User Defined word separated by a space character If the line is missing or no value is specified all valid targets specified in the DSC file will attempt to be built The following line will build all platform DEBUG targets TARGET DEBUG TARGET_ARCH List Optional What kind of architecture is the binary being target for One or more of the following IA32 IPF X64 EBC or ARM Multiple values can be specified on a single line using space characters to separate the values These are used during 256 May 2010 1 22 target txt DSC file Command line Tk tE CH Db SE He HE HE HE Gb db d TARGET ARCH IA32 TOOL DEFINITION FILE Filename Optional TOOL CHAIN CONF Conf tools def txt TOOL CHAIN TAG List Optional 8 8 8 8 TOOL_CHAIN
274. ll target The default target It determines the build order of parts consisting of a platform all init build libraries build modules build fds 7 4 2 2 2 init target Performs initialization work such as creating directories init echo Building PLATFORM NAME PLATFORM VERSION IA32 if not exist BUILD DIR MIA32 mkdir BUILD DIR IA32 if not exist FV DIR mkdir FV DIR 7 4 2 2 3 libraries target This is used to build all libraries only libraries init build libraries build libraries cd WORKSPACE Build NT32 DEBUG MYTOOLS IA32 MdePkg Library BaseLib BaseLib amp amp S MAKE MAKE FLAGS pbuild cd WORKSPACE Build NT32 DEBUG_MYTOOLS IA32 MdePkg Library BaseMemoryLibOptDxe Ba seMemoryLibOptDxe amp amp MAKE MAKE FLAGS pbuild cd WORKSPACE Build NT32 DEBUG_MYTOOLS IA32 MdePkg Library BasePcdLibNull BasePcd LibNull amp amp MAKE MAKE FLAGS pbuild 7 4 2 2 4 modules target This is used to build all modules and the libraries they depend on modules init build libraries build modules 1 22 May 2010 143 BUILD build modules cd WORKSPACE Build NT32 DEBUG MYTOOLS IA32 Nt32Pkg Sec SecMain amp amp MAKE MAKE FLAGS pbuild cd WORKSPACE Build NT32 DEBUG MYTOOLS IA32 MdeModulePkg Core Pei PeiMain amp amp MAKE MAKE FLAGS pbuild cd WORKSPACE Build NT32 DEBUG_MYTOOLS IA32 MdeModulePkg Universal PCD Pei Pcd SE MAKE MAKE FLAGS
275. ls the build script tool giving the Platform Makefile as an argument The Platform Makefile in turn launches the build script tool for each Module s Makefile In Module mode the build tool calls the build script tool giving the Module Makefile as an argument However in Module Mode if the build tool target is fds then the build tool calls the build script tool giving the Module Makefile as an argument It then calls the build script tool giving the Platform Makefile as an argument with a target of fds 7 4 1 Module Makefile This section describe the formats of the individual component module Makefiles Users may generate a custom makefile for their EDK component or EDK II module based on the information provided by this section The module makefile is composed by two parts macro definitions and target definitions In the pseudo code provided the MACRO MODULE BUILD DIR is constructed using the following rules e If the dsc file s OUTPUT DIRECTORY value path starts with an alpha character the value of the OUTPUT DIRECTORY statement is relative to the WORKSPACE otherwise it is considered an absolute directory path e Separate Top Level Makefiles are required for each TARGET and ToolChainTag e The Top Level Makefile processes all makefiles in different architectures 136 May 2010 1 22 AutoGen Stage If isalphs getValue OUTPUT_DIRECTORY DscFile 0 MOD BUILD DIR SWORKSPACE getValue OUTPUT_DIRECTO
276. macro replacement before calling assembler VFR files asl files and dxs files also need preprocessing step to allow using macros in them In addition the preprocessed assembly files VFR files and dxs files need an additional Trim step to remove unnecessary contents left by preprocessor 8 3 Compile Assembly For C and assembly files the usual C compiler or assembler is used to generate object files for them For VFR files there s a special VfrCompiler tool used to generate C and header files from them then the standard compiler is used to generate object files There s a special C file with aslc extension The standard C compiler is used to generate object files For ASL files the ASL compiler is used to generate ACPI machine language files 148 May 2010 1 22 MAKE Stage 8 4 Static Link Static link step is used for all modules with C files For library modules linking all object files into static library file is the last step A static link step for non library modules is not necessary to generate the final image file however for better optimization purpose for MSFT tool chains this step is included For those modules with no C files the static link step is skipped 8 5 Dynamic Link Dynamic link step is used for non library modules which have c files aslc files and or asm16 real mode assembly files declared in their INF files The static library file generated in static link step will be linked DLIN
277. mber of your computer cores pr CPUs Specify the name of the filename to use for the build rules that are followed when generating Makefiles May 2010 257 258 BUILD_RULE_CONF ADD_BUILD_RULE TE tE db db db db ADD BUILD RULE Conf build rule txt Filename Optional May 2010 BUILD If not specified the file WORKSPACE Conf build rule txt will be used Specify the name of the filename to use for additional build rules that are followed when when generating Makefiles The build tools will append this file to the end of the BUILD RULE CONF file 1 22 Appendix D build_rule txt The following is the default version of the build_rule txt file Note that the lines wrap in this document however no line wrapping is permitted in the build_rule txt file May 2010 259 BUILD Copyright c 2007 2009 Intel Corporation Portions copyright c 2008 2009 Apple Inc All rights reserved 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 Filename build rule template Syntax is used to indicate that the source f
278. me A keyword that uniquely identifies a tool chain group the second field Wildcard characters are permitted only if a command is common to all tools that will be used by a developer As an example if the development team only uses IA32 Windows workstations the ACPI compiler can be specified as DEBUG ASL PATH and RELEASE ASL PATH Arch A keyword that uniquely identifies the tool chain target architecture the third field This flag is used to support the cross compiler features such as when a development platform is IA32 and the target platform is X64 Using this field a single TagName can be setup to support building multiple target platform architectures with different tool chains For example if a developer is using Visual Studio NET 2003 for generating IA32 platform and uses the WINDDK version 3790 1830 for X64 or IPF platform images a single tag See the MYTOOLS PATH settings in the generated Conf tools def txt or provided BaseTools Conf tools def template file The wildcard character is permitted only if the same tool is used for all target architectures CommandCode A keyword that uniquely identifies a specific command the fourth field Several CommandCode keywords have been predefined however users may add additional keywords with appropriate modifications to build rule txt See Table 16 below for the pre defined keywords and functional mappings The wildcard character is May 2010 1 22 1 22 MetaDat
279. ms e ImageGen stage takes the EFI format files and creates EFI FLASH images UEFI Applications or EFI PCI Option ROMs Figure 18 shows the relationship of these three stages Platform INF Files Marama Module Makefiles le A generated Files Meta Dara Source Files Files Binary Files C efi acpi aml bin Parsing Tool Figure 18 EDK II Build Process Flow 1 22 May 2010 63 BUILD Note In Figure 18 Meta Data Files indicates build tool meta data files build_rule txt tools_def txt target txt and the like The Build process is organized so that if a FLASH image file is not required such as in generating a Binary Module that will be distributed to other end users stage three can be skipped Option ROM and or UEFI applications can also be distributed in this fashion Note The Nt32Pkg Nt32Pkg Nt32Pkg dsc emulation platform requires Windows header files In order to include Windows header files execute the edk2setup bat utility with the nt32 option This option should detect the Microsoft Visual Studio installation and will execute it s setup command for example vsvars32 bat 4 1 Supported Development Environments The reference build system supports development on the following operating systems running on IA32 or X64 platforms IPF development platforms are not supported IPF targets are supported using cross compiler features Microsoft Windows 2003 Server Micro
280. n use EFI compression for the driver so that the ROM image fits into a smaller size device on the PCI add in card These drivers can use NV storage space in the primary on board flash device provided they register the system table data Ifthe driver is compressed the size of the compressed file must be an even multiple of 512 bytes Note The maximum size for the driver code is 16MB so drivers that are larger than 16MB must be compressed The EFI file PE32 with modifications to the data text reloc and debug sections see Generating Leaf EFI SECTION Files above will have an EFI PCI EXPANSION ROM HEADER prefixed to the EFI file aligned on a 4 byte boundary The header structure is defined in the PCI industry standard specification and is shown below May 2010 35 BUILD typedef struct UINT16 Signature UINT16 InitializationSize UINT32 EfiSignature UINT16 EfiSubsysten UINT16 EfiMachineType UINT16 CompressionType UINT8 Reserved 8 UINT16 EfilmageHeaderOffset UINT16 PcirOffset EFI PCI EXPANSION ROM HEADER The Signature value of the PCI 3 0 version header is defined as oxaass and the EfiSignature is defined as oxogri The InitializationSize is the number of 512 byte blocks of the driver image plus the size of this header The EfiSubsystem is set to the value of PE32 Optional Header s Subsystem value while the EfiMachineType is set to the EFI IMAGE FILE HEADER s Machine Type The CompressionType f
281. nclude statement AutoGen h undef EFI SPECIFICATION VERSION define EFI SPECIFICATION VERSION 0x00020000 undef EDK RELEASE VERSION define EDK RELEASE VERSION 0x00020000 AR 7 3 3 3 Header file inclusion Only one header file is included include statement AutoGen h include lt Base h gt 7 3 3 4 Caller ID GUID definition The GUID value is the same as INF file GUID The macro EFI CALLER ID GUID iS generated only for non library module include statement AutoGen h extern GUID gEfiCallerIdGuid following definition is not needed for library module define EFI CALLER ID GUID 0x6987936E OxED34 Ox44db OxAE 0x97 OxlF OxA5 OxE4 OxED 0x21 0x16 s 7 3 3 5 PCD definitions There are differences in the generated code for library and non library modules which are illustrated in pseudo code below 114 May 2010 1 22 AutoGen Stage 7 3 3 5 1 Non library Module include statement AutoGen h define PCD TOKEN TokenCName lt TokenNumber gt yg If PCD type FIXED AT BUILD PCD type FEATURE FLAG If DatumType VOID amp amp PcdValue array include statement AutoGen h define PCD PATCHABLE lt TokenCName gt SIZE lt MaxDatumSize gt include statement AutoGen h define PCD VALUE lt TokenCName gt lt PcdValue gt extern const lt DatumType gt _gPcd FixedAtBuild lt TokenCName gt define PCD GET MODE lt DatumSize gt lt TokenCName
282. nd b Verify the files Conf target txt and Conf tools def txt 4 7 6 Simple Build Environment Tests 76 There are two rudimentary build tests that you can use to test out your build environment These two tests are building the MdePkg and the MdeModulePkg The MdePkg is about the most simplistic build test possible It will only build some libraries The MdeModulePkg will actually build some UEFI image binaries and if it successfully completes there is a good chance that you can successfully develop UEFI applications To build the MdePkg modify the Conf target txt file to match your tool chain and target architecture IA32 X64 or IPF You can optionally set your ACTIVE PLATFORM to MdePkg MdePkg dsc but this can also be specified as a parameter to the build utility If you set the ACTIVE PLATFORM then you should be able to just run the build command from your shell prompt to start the BaseTools edk2 build process If the MdePkg builds successfully try the MdeModulePkg After building the MdeModulePkg you should be able to find some UEFI images efi underneath the WORKSPACE Build directory This is a sign that your build environment is set up correctly May 2010 1 22 MetaData File Specifications 5 MetaData File Specifications This chapter defines the format of three files used by the build The three files are tools_def txt which defines the location and options for third party tools target txt which defines the t
283. ne what will be built May 2010 1 22 AutoGen Stage If t lt DscFile gt Command line option specified ActivePlatform lt DscFile gt ElseIf lt ACTIVE_PLATFORM gt specified in WORKSPACE Conf target txt ActivePlatform ACTIVE PLATFORM Elself one lt DscFile gt found in current working directory ActivePlatform DscFile Else if Number of DscFiles 1 PrintError There are s DSC files in the folder Use p to specify one NumDscFiles else PrintError No active platform specified in target txt or command line n Nothing to build BreakTheBuild If m lt InfFile gt one lt InfFile gt found in working directory Either a command line option was specified or one and only one INF file was found in the current working directory ActiveModule InfFile BuildMode SingleModuleBuild Else ActiveModule NONE BuildMode PlatformBuild Parse WORKSPACE Conf target txt Parse ActivePlatform If a lt ArchListFromCommandLine gt command line option given ActiveArchList Intersection lt ArchListFromCommandLine gt lt ArchListFrom ActivePlatform gt 1 22 May 2010 107 BUILD Else ActiveArchList Intersection lt ArchListFromTarget Txt gt lt ArchListFrom ActivePlatform gt If ActiveArchList NULL if ArchListFromCommandLine NULL PrintEr
284. nes take a finite amount of time which can be additive especially on copy commands which can result in an unacceptable boot speed Additionally most compression algorithms provide better compression over larger data sets The EDK II Build system supports EFI standard compression as well as CRC32 validation within the tools Any other form of compression encoding or signing must be through external tools A TianoCompress tool is provided with the reference build The GUIDED encapsulation section method is used to control these additional tools By definition UEFI PI specifications a named GUID for a GUIDED encapsulation section is May 2010 33 BUILD used to provide information about how to process the section Assigning a GUID to a tool such as TianoCompress in the tools_def txt file refer to Section 5 the TianoCompress exe application can be used to compress an EFI image FV FFS and or SECTION The following shows two lines that are in the tools def txt file to identify the TianoCompress tool MYTOOLS TIANO PATH MYTOOLS TIANO GUID TianoCompress exe A31280AD 481E 41B6 95E8 127F4C984779 2 7 11 1 Reference Implementation GUIDED encapsulation sections When the Build system encounters a GUIDED encapsulation section in the FDF file the GUID is tested against GUIDs registered in the tools def txt file If a match is found then the executable tool associated in the GUID is executed on the encapsulated data define
285. ng lines are an example of setting this variable in a Microsoft Windows Command Prompt window The first line sets an absolute path to single location outside of the workspace while the second line uses tools located within the workspace set EDE TOOLS PATH C Tools set EDK TOOLS PATH WORKSPACE BaseTools 6 1 2 Optional Environment Variables The optional environment variables are needed to build EDK components and libraries for use in an EDK II platform Some EDK components and libraries can be used without modifications while other EDK components and libraries will require porting to the new EDK II development environment The first optional environment variable is EDK SOURCE This must point to either the head of an existing EDK directory tree not the EDK II directory or the EDK II s EdkCompatibilityPkg directory The second optional environment variable EFI SOURCE is needed if the EDK SOURCE environment variable is set and an EDK component and or library is located outside of the EDK SOURCE tree If these values are not set the reference build system will automatically set both values to point to the EdkCompatibilityPkg directory in the WORKSPACE 6 2 Build Scoping The reference build process was designed for maximum flexibility The meta data files and command line options enable the developer to build only what they need rather than having to build a single platform from scratch Multiple versions of a platform and or modul
286. nk exe ICCxASL IA32 ASMLINK PATH DEF WINDDK BIN16 Mlink16 exe ICCxASL IA32 PP PATH DEF ICC_BIN32 icl exe ICCxASL IA32 VFRPP PATH DEF ICC_BIN32 icl exe ICCxASL IA32 APP PATH DEF ICC_BIN32 icl exe ICCxASL IA32 ASM PATH DEF MS VS BIN ml exe ICCxASL IA32 ASM DLL DEF MS VS DLL ICCxASL IA32 ASLCC PATH DEF ICC_BIN32 icl exe ICCxASL IA32 ASLPP PATH DEF ICC_BIN32 icl exe ICCxASL IA32 ASLDLINK PATH DEF ICC_BIN32 xilink exe DEBUG ICCxASL IA32 CC FLAGS nologo c WX W4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR L INTEL FIAutoGen h EHs c GF Zi Gm RELEASE ICCxASL IA32 CC FLAGS nologo c WX W4 Gy Gs8192 D UNICODE Olib2 GL DEFI FIRMWARE VENDOR LV INTEL FIAutoGen h EHs c GF DEBUG ICCxASL IA32 ASM FLAGS nologo c WX W3 Zd Zi RELEASE ICCxASL IA32 ASM FLAGS nologo c WX W3 Zd ICCxASL IA32 SLINK FLAGS nologo DEBUG ICCxASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE ICCxASL IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 SECTION xdata D SECTION pdata D MACHINE I386 May 2010 1 22 1 22 LTCG DLL ENTRY IMAGE ENTRY POINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER MERGE data text MERGE rdata text
287. nments ss 64 4 2 Supported Development Tools rrua 64 GERO geiau aA 65 4 4 Build Specific Meta Data ESS 65 4 4 1 Parse Meta Data AutoGen stage sss 66 4 4 2 Build Binary EFI Images MAKE stage rra 68 4 4 3 Assemble FLASH Images ImageGen stage sseeeeee 68 4 4 4 EFI PCI Expansion Option ROM Images rss 69 44 5 UEFI Applications e Pete e Rr AE ed e ti a 69 4 5 File Specificato NS a ri et a e ER nissen nis RA UE Rr E den vega Ede ge 69 4 6 Ee EXtenslOriS 3 cider alata Ce te teet Re oae Fab e Fev idu Un eet et Pfad ed 70 4 6 1 AutoGen Stage File Extensions urrsser 44444400 neHnnnnnnnnnnnenhnnnnnnnnnne 70 4 6 2 File Extensions for UEFI image files aa 71 4 6 3 ImageGen File Extensions u es 72 4 7 Getting Standen Lm 73 4 7 1 Workstation GSR 73 47 2 Downloading COUG u a ae 74 4 7 3 Path and Target VeriTiCallOPi s at a ea E bara ed arde 74 4 7 4 Pre b lld S8tU rer ern innen arara arira 74 4 7 5 Building Nt32 Emulation Environment rss 75 4 7 6 Simple Build Environment Tests rss 76 MetaData File Specifications eeeeeeeeeeee eere 77 5 1 AGS Ber Seu irc Re u Rn atten ov on IR 77 5 1 1 Section Entries build rule txt only rruna 7T 5 1 2 galai 77 5 1 3 Valid EEE 5c neta ete ei RR 77 5 1 4 Macro statements tools def txt only rss 78 5 1 5 Conditional Directive Statements c rire ae 78 5 2 to ols def AE aan in
288. ns preinclude AutoGen h diag warning 167 RELEASE RVCT31CYGWIN ARM CC FLAGS CCPATH FLAG ARCHCC FLAGS S PLATFORM FLAGS c90 c no autoinline asm gnu apcs interwork May 2010 1 22 signed chars no unaligned access split sections preinclude AutoGen h diag warning 167 FEFE HE HER ER E EHE HEB E RE ARM definitions FEE FE FE AE FE HE HE FE FE E HE HE HE HEHE HE RVCT31CYGWIN ARM CC PATH i686 armcc wrapper py RVCT31CYGWIN ARM SLINK PATH i686 armcc wrapper py RVCT31CYGWIN ARM DLINK PATH i686 armcc wrapper py RVCT31CYGWIN ARM ASM PATH i686 armcc wrapper py RVCT31CYGWIN ARM PP PATH i686 armcc wrapper py RVCT31CYGWIN ARM VFRPP PATH i686 armcc wrapper py RVCT31CYGWIN ARM FROMELF PATH a i686 armcc wrapper py ENV WORKSPACE BaseTools Bin CYGWIN NT 5 1 ENV WORKSPACE BaseTools Bin CYGWIN NT 5 1 ENV WORKSPACE BaseTools Bin CYGWIN NT 5 1 ENV WORKSPACE BaseTools Bin CYGWIN NT 5 1 ENV WORKSPACE BaseTools Bin CYGWIN NT 5 1 ENV WORKSPACE BaseTools Bin CYGWIN NT 5 1 ENV WORKSPACE BaseTools Bin CYGWIN NT 5 1 THEE EIE IEEE AE FE E FE EE FE E KOA IHE EIE IEEE E FE FE FE ARGA FE FE FE E FE FE FE FE KAIA KAI ARKA FE FE FE FE FE FE FE E FE FE FE FE FE FE FE E FE FE FE HH HE FE ARM GCC GCC 4 1 1 etc THEE EHE HE AE FE FE FE HE FE ERE ERE ERE ERE ERE EHE FE E FE AE FE FE E HE FE AE FE FE E FE FE E HE FE AE FE FE E EE FE AE FE BEE BE EAE EE E
289. o include in the report file 12 2 Sample Launch Steps NT32 platform BRG functionality is switched on by y or Y option from build command The following steps output the build report for NT32 platform 1 2 3 4 Check out edk2 packages from https edk2 tianocore org svn edk2 trunk edk2 to c edk2 directory Run Cmd exe and enter c edk2 Run edksetup bat nt32 Run build exe p Nt32Pkg Nt32Pkg dsc y ReportFile txt Y ALL a y This option specifies the output file name for build report b Y This option specifies flags that control the type of build report It must be from set of ALL PCD LIBRARY DEPEX BUILD FLAGS FLASH and PREDICTION To specify more than one flag repeat the option on the command line Example of usage On the command line y report filename ext Y PCD Y FLASH Y DEPEX 12 3 Output The output is in raw text file encoded in ASCII character set so that it can be portable to all OS environments The text file is supposed to be organized in a logical way for May 2010 169 BUILD human readability and QA team s validation 12 3 1 Layout The whole layout of BRG tool report Platform summary 7592 25 Global PCD section eea FD section FD Region sub section Module section Basic Information summary PCD sub section Library sub section DEPEX sub section Build_flags sub section Notification sub section Note Items mark
290. o exceptions datacompressor off strict symbols map list DEST DIR DEBUG BASE NAME map ENV EDK TOOLS PATH Bin Win32 ARM DEBUG RVCT31 INTRINSIC FLAGS RELEASE RVCT31 ARM DLINK FLAGS ARCHDLINK FLAGS entry IMAGE ENTRY POINT ro base 0 no scanlib reloc no exceptions datacompressor off strict 248 May 2010 1 22 symbols map list DEST DIR DEBUG BASE NAME map ENV EDK TOOLS PATH Bin Win32 ARM RELEASE RVCT31 INTRINSIC FLAGS RVCT31 ARM ASM FLAGS ARCHASM FLAGS apcs interwork RVCT31 ARM PP FLAGS ARCHCC FLAGS PLATFORM FLAGS E RVCT31 ARM VFRPP FLAGS ARCHCC FLAGS PLATFORM FLAGS E DVFRCOMPILE preinclude DEST DIR DEBUG MODULE NAME StrDefs h RVCT31 ARM MAKE PATH nmake RVCT31 ARM SLINK FLAGS partial o DEBUG RVCT31 ARM CC FLAGS ARCHCC FLAGS PLATFORM FLAGS c90 c g 02 no autoinline asm gnu apcs interwork signed chars no unaligned access split sections enum is int preinclude AutoGen h diag warning 167 RELEASE RVCT31 ARM CC FLAGS ARCHCC FLAGS PLATFORM FLAGS c90 c no autoinline asm gnu apcs interwork signed chars no unaligned access split sections enum is int preinclude AutoGen h diag warning 167 TEE ERE HERE ER EHE HE BE HE ARM definitions bed zg zd HERE HHHH RVCT31 ARM CC PATH DEF RVCT31 TOOLS PATH armcc RVCT31 ARM SLINK PATH DEF RVCT31 TOOLS PATH armlink RVCT31 ARM DLINK
291. objcopy CYGGCC IPF RC PATH DEF CYGWIN BINIPF objcopy CYGGCC IPF CC FLAGS Os fshort wchar fno strict aliasing Wall Werror Wno missing braces Wno array bounds c include AutoGen h minline int divide min latency CYGGCC IPF DLINK FLAGS nostdlib 02 gc sections dll static entry IMAGE ENTRY POINT undefined IMAGE ENTRY POINT Map DEST DIR DEBUG BASE NAME map CYGGCC IPF OBJCOPY FLAGS I elf64 ia64 little O efi bsdrv ia64 CYGGCC IPF SYMRENAME FLAGS redefine sym memcpy CopyMem CYGGCC IPF RC FLAGS I binary O elf64 ia64 rename section data hii Ld EE FE HE FE HE FE HE HE HEHE HEHE HEH EBC definitions TEHETEHERE ERE ER FE HE HE HEHE HEHE HEH CYGGCC EBC FAMILY INTEL CYGGCC EBC PP PATH DEF EBC_BIN iec exe CYGGCC EBC CC PATH DEF EBC_BIN iec exe CYGGCC EBC DLINK PATH DEF EBC_BIN link exe CYGGCC EBC SLINK PATH DEF EBC_BIN link exe CYGGCC EBC VFRPP PATH DEF EBC_BIN iec exe CYGGCC EBC RC PATH DEF MS VS BIN rc exe CYGGCC EBC CC FLAGS nologo c WX W3 FIAutoGen h D MODULE ENTRY POINT ARCH ENTRY POINT CYGGCC EBC SLINK FLAGS lib NOLOGO MACHINE EBC CYGGCC EBC DLINK FLAGS C Program Files Intel EBC Lib EbcLib lib NOLOGO NODEFAULTLIB MACHINE EBC OPT REF ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER 1 22 May 2010 221 BUILD FE EE HE HE FE FE HE HE HE HE FE HE HE HE FE FE FE HE HE FE FE aR H
292. of FD region sub section contain the list Offset Module The list offset and module INF file path in the FV The items marked with are only available when the region type is FV Example1 174 Type FV Base Address O0 Size 0x280000 2560K FV Name FvRecovery Occupied Size 0x221F60 2183K Free Size 0x5E0A0 376K Offset Module 0x000048 PeiAprioriFileName 0x000078 Apriori OxOO0FE8 PeiCore c edk2 MdeModulePkg Core Pei PeiCore inf 0x011FE8 PcdPeim c edk2 MdeModulePpkg Universal Pcd Pei PcdPei inf More list of offset and modules December 2007 1 22 Reports Example2 Note FD Region Type DATA Base Address 0x280000 Size 0xc000 48K More list of FD regions The whole FD section presents when FLASH or ALL is specified in Y option 12 7 Module Section Module section lists all modules involved in the platform build If PREDICTION option is specified in Y option the module sections are sorted according to their PEI or DXE dispatch order otherwise the module sections are listed according to their DSC position 12 7 1 Module Section Summary This sub section lists the module basic information Module name file Guid module size module build time stamp driver type Specification version Module Name Module UI name MODULE NAME in INF Defines section Module INF Path Path of Module INF file File GUID Module GUID FILE GUID in INF Defines section Size
293. omes with the following Tool Chain Tag names defined VS2003 VS2005PRO VS2005TEAMSUITE WINDDK3790x1830 UNIXGCC CYGWINGCC ICC and MYTOOLS 4 7 4 Pre build Setup After obtaining the edk2 sources the developer will need to open a Command Prompt Window or Terminal Shell The developer should change directories to the directory containing the edk2 sources downloaded per Section 4 7 2 The system environment variable WORKSPACE can be set if not set the setup script below will set the WORKSPACE environment variable to the current working directory UNIX developers may need to setup additional environment variables 4 7 4 1 Windows 74 The edksetup bat script is located at the top of the edk2 source tree should be run every time you open a new command prompt window The edksetup bat script needs an option nt32 in order to build the Nt32 emulation platform This option is required to setup the standard places for include h and dll files needed by the Nt32 emulation environment May 2010 1 22 Reference Build Process Overview 4 7 4 2 Unix The edksetup needs to be sourced under based Unix shells to allow environment variables to be modified For the commonly used bash shell this is accomplished by using a period character followed by a space character followed by the edksetup script At the root of the Edk II tree use the following shell command to setup the Edk II build environment edksetup sh The bas
294. on BDS run time RT services and After Life transition from the OS back to the firmware of system Refer to Figure 3 below May 2010 11 BUILD Poweron Platforminitialization OS boat pk Shutdown Figure 3 Pl Firmware Phases 2 4 1 Security SEC The Security SEC phase is the first phase in the PI Architecture and is responsible for the following e Handling all platform restart events e Creating a temporary memory store e Serving as the root of trust in the system e Passing handoff information to the PEI Foundation The security section may contain modules with code written in assembly Therefore some EDK II module development environment MDE modules may contain assembly code Where this occurs both Windows and GCC versions of assembly code are provided in different files 2 4 2 Pre EFI Initialization PEI The Pre EFI Initialization PEI phase described in the PI Architecture specifications is invoked quite early in the boot flow Specifically after some preliminary processing in the Security SEC phase any machine restart event will invoke the PEI phase The PEI phase initially operates with the platform in a nascent state leveraging only on processor resources such as the processor cache as a call stack to dispatch Pre EFI Initialization Modules PEIMs These PEIMs are responsible for the following e Initializing some permanent memory complement e Describing the memory
295. onType EFI COMPRESSION SECTION2 Parameters UncompressedLength A 24 bit unsigned integer that contains the total size of the section in bytes including the EFI COMMON SECTION HEADER after decompression CompressionType 0x01 for PI STD compression 0x00 if not compressed CommonHeader Usual common section header CommonHeader Type EFI SECTION COMPRESSION 1 22 May 2010 51 BUILD EFI_GUID_DEFINED_SECTION The header of an EFI_GUID DEFINED SECTION A GUID defined section contains a section type specific header that contains an identifying GUID followed by an arbitrary amount of data It is an encapsulation section in which the method of encapsulation is defined by the GUID A matching instance of EFI_LGUIDED_SECTION_EXTRACTION_PROTOCOL DXE or EFI_GUIDED_SECTION_EXTRACTION_PPI PEI is required to extract the contents of this encapsulation section The GUID defined section enables custom encapsulation section types for any purpose One commonly expected use is creating an encapsulation section to enable a cryptographic authentication of the section contents EFI GUID DEFINED SECTION2 must be used if the section is 16MB or larger typedef struct EFI COMMON SECTION HEADER CommonHeader EFI GUID SectionDefinitionGuid UINT16 DataOffset UINT16 Attributes EFI GUID DEFINED SECTION typedef struct EFI COMMON SECTION HEADER2 CommonHeader EFI GUID SectionDefinitionGuid UINT16 DataOffset UINT16 Attribu
296. op level default configuration and build_rule txt which specifies the rules for creating binary files Templates for these files are in the BaseTools Conf directory The edksetup script installs the active copies of these files into the WORKSPACE Conf directory only if they do not exist 5 1 Meta Data File Format The following subsections describe at a high level the different parts of meta data files 5 1 1 Section Entries build rule txt only The build rule file consists of sections delineated by section names enclosed within square brackets Section names are case insensitive The different sections and their usage are described below The text of a given section can be used for multiple section names by separating the section names with a comma For example Microcode File USER DEFINED Microcode File Microcode Following is an example that does not use a comma C Code File The content below each section heading is processed by the parsing utilities in the order that they occur in the file 5 1 2 Comments Within a meta data file comments are encouraged with the hash character identifying a comment In line comments terminate the processing of a line In line comments must be placed at the end of the line and may not be placed within the section tags Comment characters can be at the start of a line or after a data element there must be one or more whitespace characters between the data element and
297. otocolGuidCName include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED EFI GUID lt ProtocolGuidCName gt lt GuidValue gt ys If Ppis defined in INF foreach PpiGuidCName include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED EFI GUID lt PpiGuidCName gt lt GuidValue gt If Pcd defined in INF foreach PcdCName If PcdDatumType VOID amp amp PcdValue is array include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED UINT8 PcdCName lt PcdValueMacro gt Else include statement AutoGen c GLOBAL REMOVE IF UNREFERENCED lt PcdDatumType gt lt PcdCName gt lt PcdValueMacro gt ME If UNI file found in INF SourcesSection 1 22 May 2010 135 BUILD include statement AutoGen c unsigned char MiscSubclassStrings Wo 7 4 Auto generated Makefiles The actual build actions are done via MAKE system This system is nmake in Windows environment and make in GCC Linux and Mac OS X environment The makefiles are composed in two levels platform level top level makefile and module level makefile For one platform one makefile is generated for each tool chain and build target DEBUG RELEASE Each module has a makefile generated and referenced in the platform level makefile The build tool calls the build script tool nmake or gmake or make for a platform or module Makefile In platform build mode the build tool cal
298. over ride stripping of the reloc section Like the PEI Foundation PEIMs that can should be shadowed in memory to speed up execution Once the PEI Foundation has been loaded PEIMs are dispatched and if a PEIM is dependent on the existence of another PEIM an EFI_SECTION_PEI_DEPEX section is used to define the dependency relationship The PEI Foundation will use this section if present in an FFS to ensure the required PEIMs are available prior to dispatch 2 6 8 EFI FV FILETYPE COMBINED PEIM DRIVER Notes Dual function PEI DXE drivers PEIMs that are coded to register for shadow should never have the reloc section stripped Additionally compression of these modules may decrease the overall size of the FD image in hardware Using the terse image format for drivers of this type is not permitted by the PI specification For this class of driver one PEI and or one DXE dependency section can be added to the FFS file containing the image 2 6 9 DXE BDS TLS and AL Notes Stripping the reloc section from these modules and any UEFI applications is not recommended but is allowed in certain cases Additionally these images cannot be converted to the terse format only elements of the PEI Foundation PEI Core and PEIMs can be converted to use the terse format headers Compression of the images is permitted however as most compression algorithms work better over a larger data set it is recommended that the images be combined into a Firmware
299. ow L underline L dblunder L n L L r L p L ospace L enquad L emquad L ensp L emsp L em3sp L em4sp L em6sp L usp L tsp L hsp L msp L bsp L nbsp L zsp L ah L hy L d L den L dem L bh L g L osp L Xk TUA If a 2 character ISO 639 1 language code exists along with a 3 character ISO 639 2 language code then the ISO 639 1 language code must be used When a language has no ISO 639 1 2 character code and the ISO 639 2 T Terminology code and the ISO 639 2 B Bibliographic code differ you MUST use the Terminology code When a language has both an IANA registered tag i something and a tag derived from an ISO registered code you MUST use the ISO tag HseChar In order to include some standard characters such as the back slash character within a string the character must be prefixed with the escape character Characters that may require a prefixed escape character include the following back slash character single quote character double quote character and the forward slash character The back slash always requires the escape character StandardAttrs The standard font attribute normal was not defined in the UEFI 2 1 Specification however it has been proposed and is included here Additional attributes defined in the UEFI 2 1 Specification such as double underline dblunder did not have the
300. parately 6 1 Environment Variables There are two required system level environment variables that must be set and two optional environment variables 6 1 1 Required Environment Variables The first of the two required variables is WORKSPACE This variable points to the root directory of an EDK II directory tree Since developers will normally have more than one development tree on their workstation this environment variable is used to identify the current working directory tree The following two lines are an example of setting this variable the first in a Microsoft Windows Command Prompt Window while the May 2010 95 Build Environment second represents setting the variable in a UNIX terminal bash shell set WORKSPACE C MyWork Proj1 edk2 export WORKSPACE usr local src projl edk2 The second required environment variable EDK_TOOLS_PATH required points to the directory containing the Bin directory for the BaseTools directory When using Subversion to obtain the EDK II project HEAD most recent version of every file a BaseTools directory containing setup scripts Win32 binary executables of the build tools template files and XML Schema files is included Only one copy of the BaseTools directories needs to be installed on a workstation although multiple copies are permitted such as having one in each workspace The EDKk_TOoLS_PATH variable must point to the directory containing the BaseTools Bin and Conf directories The followi
301. pbuild 7 4 2 2 5 fds target This is used to generated flash image of the platform fds init build fds build fds echo Generating flash image if any GenFds f H dev AllPackagesDev Nt32Pkg Nt32Pkg fdf o BUILD DIR t TOOLCHAIN TAG b TARGET p H dev AllPackagesDev Nt32Pkg Nt32Pkg dsc a IA32 7 4 2 2 6 clean cleanall and cleanlib targets These are used to clean part of all the files generated during platform build clean cd WORKSPACE Build NT32 DEBUG MYTOOLS IA32 MdePkg Library BaseTimerLibNullTempla te BaseTimerLibNullTemplate amp amp MAKE MAKE FLAGS clean cd WORKSPACE Build NT32 DEBUG_MYTOOLS IA32 MdePpkg Library BaseDebugLibNull BaseD ebugLibNull amp amp MAKE MAKE FLAGS clean cd WORKSPACE Build NT32 DEBUG_MYTOOLS IA32 MdePpkg Library BaseLib BaseLib amp amp MAKE MAKE FLAGS clean cleanlib cd WORKSPACE Build NT32 DEBUG MYTOOLS IA32 MdePkg Library BaseTimerLibNullTempla te BaseTimerLibNullTemplate amp amp MAKE MAKE FLAGS cleanall cd WORKSPACE Build NT32 DEBUG_MYTOOLS IA32 MdePpkg Library BaseDebugLibNull BaseD ebugLibNull amp amp MAKE MAKE FLAGS cleanall cd WORKSPACE Build NT32 DEBUG_MYTOOLS IA32 MdePpkg Library BaseLib BaseLib amp amp MAKE MAKE FLAGS cleanall cleanall if exist BUILD_DIR IA32 rmdir s q BUILD DIR IA32 if exist FV_DIR rmdir s q FV_DIR 7 4 2 2 7 run target This spec
302. perty Page tee ge Ple fecere einn tonc tenens 288 Figure 25 VS2005 Performance Summary rna a 292 Figure 26 VS2005 Call Tree View eese eene tenen denn 293 May 2010 xiii BUILD xiv May 2010 1 22 Introduction 1 Introduction 1 1 Overview This document describes the EDK II Build Architecture This specification was designed to support new build requirements for building EDK components within the EDK II build infrastructure EDK II Build utilities described in this document use INI style text based meta data files to describe components modules libraries platforms firmware volumes and firmware device images This document describes the high level EDK II Build Architecture which has the following goals Compatible The EDK II build environment must maintain backward compatibility with the existing EDK files This means that the changes made to this specification must not require changes to existing files Compatibility is maintained by providing the EDK Tools in the EDK Compatibility package Also some INF files may require modification for the EDK II build environment ifthey are used to access Flash firmware the PI 1 0 specification modified the flash data structures and defined some new GUID values Simplified platform build and configuration One goal of this format is to simplify the build setup and configuration for a given platform It was also designed to simplify the process of adding EDK and E
303. piler HEEE HE HE HE HE HE HE HE HE HE FE FE HH HE HE HE FE FE FE FE HE HE FE FE HH FE FE E E E EE FE FE HE HE FE FE IE IE FE FE FE ERE AA FE FE E HE RE FE FE HE HE FE HE E HE HHH VS2005x86xASL Microsoft Visual Studio 2005 ALL Edition including Standard Professional Express TeamSuite VS2005x86xASL FAMILY MSFT VS2005x86xASL MAKE PATH DEF VS2005x86 BIN nmake exe VS2005x86xASL MAKE FLAGS nologo VS2005x86xASL RC PATH DEF VS2005x86_ BIN rc exe VS2005x86xASL SLINK FLAGS NOLOGO LTCG VS2005x86xASL APP FLAGS nologo E TC VS2005x86xASL PP FLAGS nologo E TC FlAutoGen h VS2005x86xASL VFRPP FLAGS nologo E TC DVFRCOMPILE ETS MODULE NAME StrDefs h Ld HE FE HE FE HE FE HE HE HEHE HEHE HEH ASL definitions TEHET HERE ERE ER FE HE HE HEHE HEHE HEH VS2 005x8 6xASL ASL PATH DEF WIN ASL BIN VS2005x86xASL ASL FLAGS 206 May 2010 1 22 1 22 VS2005x86xASL ASL OUTFLAGS VS2005x86xASL ASLCC FLAGS VS2005x86xASL ASLPP FLAGS VS2005x86xASL ASLDLINK FLAGS FEFE EE HERE ERE ER EHE NR IA32 definitions bed zg Aiz dd izo VS2005x86xASL IA32 DLL VS2005x86xASL IA32 MAKE PATH VS2005x86xASL IA32 CC PATH VS2005x86xASL IA32 VFRPP PATH VS2005x86xASL IA32 SLINK PATH VS2005x86xASL IA32 DLINK PATH VS2005x86xASL IA32 ASMLINK PATH VS2005x86xASL IA32 APP PATH VS2005x86xASL IA32 PP PATH VS2005x86xASL IA32 ASM PATH VS2005x
304. r a given platform 38 May 2010 1 22 UEFI and PI Image Specification 3 UEFI and PI Image Specification This section defines the data structures used for UEFI PI images This section is listed for completeness however as specifications change or errata are published the actual data structure content may vary Consult other industry standards for the latest versions and updates to UEFI 2 3 and PI 1 2 specifications May 2010 39 BUILD EFI_TE_IMAGE_HEADER Header format for Terse TE images typedef struct UINT16 Signature UINT16 Machine UINT8 NumberOfSections UINT8 Subsystem UINT16 StrippedSize UINT32 AddressOfEntryPoint UINT32 BaseOfCode UINT64 ImageBase EFI IMAGE DATA DIRECTORY DataDirectoryl2 EFI TE IMAGE HEADER Parameters Signature TE format 0x5A56 VZ Machine From the original file header 0x014c i386 0x0200 IPF OxOEBC EBC 0x08664 X64 NumberOfSections 1 byte packed value from the original file header Subsystem 1 byte packed value from original optional header StrippedSize Original size minus the number of bytes we removed AddressOfEntryPoint Offset to entry point from original optional header BaseOfCode From original image required for ITP debug ImageBase From original file header DataDirectory Only two the base relocation and debug directory 40 May 2010 1 22 Related Definitions typedef struct UINT32 UINT32 VirtualAddress Size EFI IMAGE
305. r is only used to process files which may not require its GUID such as ASL compiler This section focuses on the later one First the custom tool path and name needs to be added into tools def txt file For ASL compiler it can be added like ASL PATH DEF ASL PATH iasl exe Then TOOLNAME is specified in build rule txt file to call this tool For ASL compiler it can be used to process ASL source file The rule to process ASL file is added in build rule txt like Build Acpi Source Language File lt InputFile gt asl Asl ASL lt OutputFile gt OUTPUT DIR s_base aml lt Command MSFT Command INTEL gt PP APP FLAGS INC src gt d path s_base i S ASL p dst d path s base i 11 4 Customizing Compilation for a Component There are several mechanisms for customizing the build for a firmware component These include e Creating a new Platform DSC file from an existing platform e Creating a custom INF file for individual components or modules e Using MACRO definitions with control statements lifxxx in the DSC and FDF files e Customizing the INF build options in the DSC file 11 5 Changing Files in a Library EDK I Only Library INF files are shared among different platforms However not all platforms require all the same source files To customize the library INF files for different platforms simply define PLATFORM either on the command line or in the DSC fil
306. r only processing c Og ignoring the Od flag The final result after AutoGen stage is that macros named by lt TOOLCODE gt and lt TOOLCODE gt _FLAGS gt will be generated in module s makefile For example CC and CC_FLAGS macros will be generated in the makefile for the compiler tool The path of dynamic libraries will be prefixed to system s PATH environment by the build tools so that the tools used in makefile can be called correctly 7 2 3 Parse build rule txt specified by BUILD RULE CONF and ADD BUILD RULE The files specified by BUILD RULE CONF and or ADD BUILD RULE in target txt contain command steps used to build the source files into intermediate files and then 1 22 May 2010 109 BUILD intermediate files into final image files to be put into FV FD The type of source files and intermediate files are determined by the file extension That means the same extension cannot be used to represent different file types But one type of file can have more than one file extension A single file can only have a single extension The parser of this file will convert the contents of the file into a build rule database Each item in this database will have tool chain family input file information output file information and command information Whenever a source file is found in module s INF file the build tools will attempt to find a build rule in the database corresponding to the input file s extension and then use the output file a
307. re that encounters a capsule which has the CAPSULE FLAGS INITIATE RESET Flag set in its header will initiate a reset of the platform which is compatible with the passed in capsule request and will not return back to the caller CapsulelmageSize The length in bytes of the entire image including all headers If this value is greater than the size of the current file the capsule was split into more than one file May 2010 1 22 Reference Build Process Overview 4 Reference Build Process Overview The EDK II reference build process provides backward compatibility for existing EDK components and platforms using EDK processes and tools will not be described in this document The EDK build tools are provided as part of a compatibility package or existing EDK trees containing the EDK build tools Some EDK components may also be built using the EDK II build tools where those components are included in an EDK II platform The exact list of EDK components is not provided here other EDK II documentation contains information on using EDK components with EDK II The EDK II Build Process is handled in three major stages e AutoGen stage parse meta data files to generate some C source code files and the makefiles e MAKE stage process source code files to create PE32 PE32 COFF images that are processed to EFI format using NMAKE Microsoft operating system development platforms or MAKE for UNIX style operating system development platfor
308. reation of a UEFI application after the EFI files have been created using UEFI application specific arguments for the GenFds tool 4 5 File Specifications The EDK II Build is used to generate UEFI 2 3 and PI 1 2 compliant images Additional reference modules may conform to Intel Framework Specifications only if there are no applicable UEFI or PI specification modules The EDK II Build Tools will only generate UEFI 2 3 PI 1 2 compliant images The EDK II Compatibility Package provides libraries and header files to permit building some EDK Libraries and EDK Components referenced in an EDK II platform DSC file Note indicates any EDK libraries or components that do not include assembly files and do not access flash memory can use the EDK Il compatibility Package For some development activities the EDK II Compatibility package can be used to develop and maintain original EDK platforms components and libraries This package also provides all of the tool source code used in the EDK These tools are for building components and platform using the original EDK code None of these tools is used for the EDK II build process This EDK Compatibility package can also be used to generate files conforming to earlier releases of EFI and UEFI specifications May 2010 69 BUILD This build specification does not cover the tools or build processes for EDK builds nor tools provide by the EDK II Compatibility Package The binary image files genera
309. rent module only It s always used in top level makefile because the libraries will be built above all non library modules pbuild INIT_TARGET CODA_TARGET 7 4 1 2 3 mbuild target Actual default target which is used for single module build mode Because in single 140 May 2010 1 22 AutoGen Stage module build mode the top level make file will not be called the build system has to build libraries that the current module needs in module s makefile mpuiid target is used for this purpose mbuild INIT TARGET gen libs CODA TARGET gen libs cd BUILD_DIR IPF MdePkg Library DxePcdLib DxePcdLib amp amp MAKE MAKE FLAGS cd BUILD_DIR IPF MdePkg Library BaseLib BaseLib amp amp MAKE MAKE FLAGS cd BUILD_DIR IPF CsiCpuUncorePkg Library ItcTimerLib ItcTimerLib amp amp MAKE MAKE FLAGS cd MODULE BUILD DIR 7 4 1 2 4 fds target Target used to re generate a flash image after a single module build It calls top level makefile to do this fds mbuild gen_fds gen_fds cd BUILD DIR amp amp MAKE MAKE FLAGS fds cd MODULE_BUILD_DIR 7 4 1 2 5 init target Target used to print verbose information and create necessary directories used for build init echo Building MODULE_NAME MODULE_VERSION ARCH in platform PLATFORM NAME PLATFORM VERSION if not exist DEBUG DIR mkdir DEBUG DIR if not exist OUTPUT DIR mk
310. ride PICOMPRESSED My Bus Pci UhciPei UhciPei inf INF RuleOverride PICOMPRESSED My Bus Usb UsbBusPei UsbBusPei inf INF RuleOverride PICOMPRESSED My Bus Usb UsbBotPei UsbBotPei inf INF RuleOverride PICOMPRESSED My Bus Isa IsaFloppyPei IsaFloppyPei inf INF RuleOverride PICOMPRESSED My Universal Disk FileSystem FatPei FatPei inf In the above example GenFds will use the PICOMPRESSED rule to generate the FFS regardless of the rules that would normally process the INF file 9 2 1 FILE Format Example If the file you want to place into flash is not built using information from an INF file for example a micro code that should be placed into FV the file can be directly specify using FILE statement The following is an example of the FILE format FILE DRIVER 961578FE B6B7 44c3 AF35 6BC705CD2B1F SECTION PE32 FatBinPkg EnhancedFatDxe X64 Fat efi In this example the Fat efi file is placed into a PE32 section first and then placed into the generated DRIVER FFS named with the specified GUID 9 3 Build Intermediate Images 9 3 1 Binary modules Binary modules can be inserted into flash image in one of two ways The first way is to use the FILE statement mentioned in Section 9 2 1 The second way uses an INF file that describes binary files like the one below Defines INF VERSION 0x00010005 BASE NAME Logo FILE GUID 7BB28B99 61BB 11D5 9A5D 0090273FC14D MODULE TYPE USER DEFINED VERSION STRING 1 9 EDK RELEASE
311. ring Description Source file s to be built full path Source file directory absolute path Source file relative directory within a module Note s_dir is always equals to if source file is given in absolute path Source file name without path Source file name without extension and path Source file extension Destination file s built from src full path Destination file directory absolute path Destination file name without path Destination file name without extension and path Destination file extension valid macro statements that are legal within this file May 2010 91 92 Table 19 Valid Macro Values Macro String Description WORKSPACE OUTPUT_DIR DEBUG_DIR BUILD_DIR BIN_DIR FV_DIR INC INC_LIST LIBS tool FLAGS MODULE NAME MODULE TYPE ARCH TOOLCHAIN TARGET lt tool gt EDK_TOOLS_PATH INC INC_LIST lt FILE_TYPES gt lt FILE_TYPES_LIST gt MAKE_FILE CP MV RM MD RD The current Workspace directory Directory for intermediate files for building a module Directory for files used to debug a module All files for building a platform will be put in this directory Common directory for executable files Directory to store flash image files Search path of current module A file containing search pathes of current module Static library files of current module Tools f
312. rogram Files Microsoft Visual Studio NET 2003 Vc7 bin cl exe ASM C Program Files Microsoft Visual Studio NET 2003 Vc7 bin ml exe TIANO TianoCompress exe SLINK C Program Files Microsoft Visual Studio NET 2003 Vc7 bin lib exe ASMLINK C WINDDK 3790 1830 bin bin16 link exe ASL C ASL iasl exe DEFAULT PP FLAGS nologo E TC FIS DEST DIR DEBUG AutoGen h DEFAULT CC FLAGS nologo W4 WX Gy c D UNICODE Olib2 GL FI DEST DIR DEBUG AutoGen h EHs c GF Gs8192 Zi Gm DEFAULT APP FLAGS nologo E TC DEFAULT VFRPP FLAGS nologo E TC DVFRCOMPILE FIAutoGen h DEFAULT DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 MACHINE I386 LTCG DLL ENTRY ENTRYPOINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG PDB DEST DIR DEBUG BASE NAME pdb DEFAULT PCH FLAGS nologo W4 WX Gy c D UNICODE Olib2 GL FI DEST DIR DEBUG AutoGen h EHs c GF Gs8192 Fp DEST DIR OUTPUT AutoGen h gch Yc TC Zi Gm DEFAULT ASM FLAGS nologo W3 WX c coff Cx Zd WO Zi DEFAULT TIANO FLAGS DEFAULT SLINK FLAGS nologo LTCG DEFAULT ASMLINK FLAGS link nologo tiny DEFAULT ASL FLAGS continued next page 66 May 2010 1 22 Reference Build Process Overview OUTPUT_DIR Ia32 WriteGdtr obj COMMON DEPS OUTPUT_DIR Ia32 WriteGdtr obj WORKSPACE MdePkg Include Library DebugLib h OUTPUT_DIR Ia32 WriteGdtr obj WORKSPACE Mde
313. ror The architecture s specified on the command line s are not valid for the active platform s n ArchListFromCommandLine ArchListFrom ActivePlatform else PrintError The active platform cannot be built the architectures s are not supported Mn ArchListFrom ActivePlatform BreakTheBuild If a lt TargetListFromCommandLine gt command line option given ActiveTargetList Intersection lt TargetListFromCommandLine gt lt TargetListFrom ActivePlatform gt Else ActiveTargetList Intersection lt TargetListFromTarget Txt gt lt TargetListFrom ActivePlatform gt If ActiveTargetList NULL if TargetListFromCommandLine NULL PrintError Target s specified on the command line is not valid for this platform s n TargetListFromCommandLine TargetListFrom ActivePlatform else PrintError Target s is not specified in the target txt file n TargetListFrom ActivePlatform BreakTheBuild If t lt ToolChainTag gt 108 May 2010 1 22 AutoGen Stage command line option given ActiveToolChain lt ToolChainTag gt ElseIf TOOL CHAIN TAG specified in WORKSPACE Conf target txt ActiveToolChain TOOL CHAIN TAG Else if ToolChainTag NULL PrintError Tool chain specified on the command line s is not specified in the tools def txt file n ToolChainTag else PrintError Tool ch
314. rran 0 467628 0 000000 By Source Fies GetFielnformationByHandee 0 010494 0 000000 3 bed GetProcessHeap 0 000263 0 000263 ReadMe bxt printf 0 078076 0 000000 0 000000 0 000000 0 000471 14 730501 3 062441 5 890013 0 190647 0 092755 1 855948 0 031907 0 017455 0 295897 0 120896 0 000172 0 000000 0 000036 Formar 4 GE Instrumentation m ig i Summary je Functions Ex Caler Calee le Call Tree Show outputfrom Performance 8 4 35d Collection file exite Profiler exited Work Decompress Decompress071218 vsp Starting analysis for C Vork Decompress Decompress071218 vsp Symbol Engine Loading symbols for module c Work Decoupress release Deconpress exe Symbol Engine Loading symbols for module C WINDOWS system32 kernel32 dll Symbol Engine Failed to load pdb for module at C WINDOWS system32 kernel32 dll Symbol Engine Loading symbols for module C WINDOWS WinSxS x86 Microsoft VC80 CRT lfc8b3bSalel8e3b 8 0 50727 762 x wv 65128700 VMSVCR80 d11 Symbol Engine Failed to load pdb for module at C WWINDOUS UinSxSVx86 Microsoft VC80 CRT lfcSb3bSalelGe3b 8 0 50727 762 x ww 6b128700 VISVCRSO dll Symbol Engine Loading symbols for module C WINDOWS system32 ntdli dl1 Symbol Engine Failed to load pdb for module at C iUINDOWS systen32 ntdll dll Completed Analysis for C Work Deconpress Deconpress071218 vsp Profiling Complete is B
315. rsion 9 1 IPF Intel R C Compiler for Itanium R Version 9 1 Build 20060928 Package ID W CC C 9 1 032 Li ASL Microsoft ACPI Source Language Compiler Li FE EE HE HEFE FE HE HE HE E FE HE HE aE FE FE HE HE AR FE HE HE FE FE FE HE HE FE FE HE UR ERE a AU FE HE FE FE FE AU HE FE FE FE FE A FE FE HE FE AR HE HE E FE HE HE HE HE FE FE HE doo ICCxASL Intel C Compiler V9 1 ICCxASL FAMILY INTEL ICCxASL MAKE PATH ICCxASL RC PATH DEF MS_VS_BIN nmake exe DEF MS VS BIN rc exe ICCxASL MAKE FLAGS ICCxASL VFRPP FLAGS FI MODULE NAME StrDefs h ICCxASL APP FLAGS ICCxASL PP FLAGS nologo nologo E TC DVFRCOMPILE nologo E TC nologo E TC FIAutoGen h FEFE HE FE HE ER ER B HE HEB EHE ASL definitions TEE HERE ERE ER EHE HE BE HE ICCxASL ASL PATH ICCxASL ASL FLAGS DEF WIN IASL BIN May 2010 229 230 BUILD ICCxASL ASL OUTFLAGS ICCxASL ASLCC FLAGS ICCxASL ASLPP FLAGS ICCxASL ASLDLINK FLAGS DEF IASL OUTFLAGS DEF ICC WIN ASLCC FLAGS DEF ICC WIN ASLPP FLAGS DEF ICC WIN ASLDLINK FLAGS TEE HERE FE HE FE FE FE HE HE HEHE HEHE HEH IA32 definitions THE HE HE HEHE HE HE HE HE HE HEHE H H HH ICCxASL IA32 CC PATH DEF ICC_BIN32 icl exe ICCxASL IA32 SLINK PATH DEF ICC_BIN32 xilib exe xilib exe needs lib exe from Visual Studio ICCxASL IA32 SLINK DLL DEF MS VS BIN ICCxASL IA32 DLINK PATH DEF ICC_BIN32 xili
316. s Figure 1 UEFI PI Firmware Image Creation ss nenennnenneeene nennen 10 Figure 2 EFI PCI Expansion OptionROM and UEFI Application Creation 11 Fig re 3 PI Firmware Sau EAN 12 Figure 4 NT32 Flash Device Layout sensssenus enen enseeeeenen ennn ennerseneveneenennnenentennnennend 14 Figure 5 Typical IA32 X64 Flash Device Layout rrura 15 Figure 6 Typical IPE FD Layout ee een 16 Figure 7 General EFI Section Format lt 16MB rrura 17 Figure 8 General EFI Section Format for Large Size Sections nnee 17 Figure 9 Typical FFS File Layout lt 16MB an 19 Figure 10 File Header 2 layout for files larger than 16Mb annen 19 Figure 11 General FV Layout E aate rea en Ge 21 Figure 12 Standard Image to Terse Image Comparison neven eenen 25 Figure 13 EFI Image Files ee 27 Figure 14 De ae 29 Figure 15 Firmware Volume Layout usa eene nennen nnnm nnn 33 Figure 16 EFI PCI Expansion Option ROM layout rss 36 Figure 17 EFI Capsule Layout eet etre tnmen a en 38 Figure 18 EDK II Build Process FlOW wars entrer ee er 63 Figure 19 EDK I AutoGen Process ep 105 Figure 20 EDK II Build Process Platform Point of View EON rss 147 Figure 21 EDK II Build Process Module PoV rrura 148 Figure 22 FD image generation proC SS raa 152 Figure 23 Capsule Creation Process uuusssssssnnanannnnnnnsnnnnnnannnnnnnnnnnnnnnnanannnnen nen 164 Figure 24 VS2005 Pro
317. s The general section format for sections less than 16MB in size is shown in Figure 7 Figure 8 shows the section format for sections 16MB or larger in size using the extended length field 31 1615 0 Section data Format defined by the EFI SECTION TYPE Figure 7 General EFI Section Format lt 16MB Section data Format defined by the EFI SECTION TYPE Extended Length Field Figure 8 General EFI Section Format for Large Size Sections Table 2 below lists the different architecturally defined section types refer to the PI Specification Volume 3 for additional details 1 22 May 2010 17 Table 2 EFI Section Types Name Description EFI SECTION COMPRESSION Encapsulation section where other sections are compressed EFI SECTION GUID DEFINED Encapsulation section where other sections have a format defined by a GUID EFI SECTION DISPOSABLE Encapsulation section used during the build process but not required for execution EFI SECTION PE32 PE32 Executable Image EFI_SECTION_PIC Position Independent Code EFI SECTION TE Terse Executable image EFI SECTION DXE DEPEX DXE Dependency Expression EFI SECTION VERSION EFI SECTION SMM DEPEX EFI SECTION USER INTERFACE Version Text and Numeric UNICODE Leaf section type for determining the dispatch order for an SMM driver User Friendly name of the driver UNICODE EFI SECTION COMPATIBILITY16 EFI SECTI
318. s TEHETHER ER ER EHE RE HEHE HEH VS2003 IA32 DLL DEF VSNET2003 DLL VS2003 IA32 CC PATH DEF VSNET2003 BIN cl exe VS2003 IA32 VFRPP PATH DEF VSNET2003 BIN cl exe VS2003 IA32 SLINK PATH DEF VSNET2003 BIN Mlib exe VS2003 IA32 DLINK PATH DEF VSNET2003 BIN Mlink exe VS2003 IA32 ASMLINK PATH DEF VSNET2003 BIN link exe VS2003 IA32 APP PATH DEF VSNET2003 BIN cl exe VS2003 IA32 PP PATH DEF VSNET2003 BIN cl exe VS2003 IA32 ASM PATH DEF VSNET2003 BIN ml exe VS2003 IA32 PCH PATH DEF VSNET2003_BIN cl exe VS2003 IA32 NMAKE PATH DEF VSNET2003 BIN nmake exe VS2003 IA32 ASL FAMILY ACPICA VS2003 IA32 ASL PATH DEF ACPI BIN iasl exe VS2003 IA32 APP FLAGS VS2003 IA32 PP FLAGS nologo E TC nologo E TC FIAutoGen h VS2003 IA32 VFRPP FLAGS nologo E TC DVFRCOMPILE FIAutoGen h DEBUG VS2003 IA32 CC FLAGS nologo W4 WX Gy c D UNICODE Olib2 GL FlAutoGen h EHs c GF Gs8192 Zi Gm May 2010 BUILD 1 22 1 22 MetaData File Specifications RELEASE VS2003 IA32 CC FLAGS nologo W4 WX Gy c D UNICODE A Olib2 GL FlAutoGen h EHs c GF Gs8192 DEBUG VS2003 IA32 PCH FLAGS nologo W4 WX Gy c D UNICODE V Olib2 GL FlAutoGen h EHs c GF Gs8192 Fp DEST DIR OUTPUT AutoGen h gch Yc TC Zi Gm RELEASE VS2003 IA32 PCH FLAGS nologo W4 WX Gy c D UNICODE Olib2 GL FIAutoGen h EHs c GF Gs8192 Fp DEST DIR OUTPUT A
319. s a stand alone command GenFds f WORKSPACE Nt32Pkg Nt32Pkg fd o WORKSPACE Build NT32 DEBUG MYTOOLS t MYTOOLS b DEBUG v p WORKSPACE Nt32Pkg Nt32Pkg dsc a IA32 GenFds calls several other tools during the generation of an FD image GenSec This application is used to generate valid EFI_SECTION type files from PE32 PE32 COFF image files or other binary files The utility will attach a valid section or PEIM header to the input file as defined in the PI specification GenFfs This application is used to generate FFS files for inclusion in a firmware volume Rules specified in the FDF file stipulate how the FFS file will be organized what kind of sections should reside in it and in what format GenFv This application is used to generate FV image by taking what and how to place FFS into it from the corresponding FV inf file GenFw This application is used to generate UEFI Firmware Image files based on Component or Module types listed in the INF files from the PE PE32 COFF images generated by the third party tool chains GenVtf This application generates the Boot Strap File AKA Volume Top File or VTF for IA32 X64 and IPF images Figure 22 shows how the above tools involved in the GenFds process May 2010 151 BUILD Full Firmware Image FD Firmware File System FFS EFI Section Files Section Files Firmware Image Files Figure 22 FD image generation process 9 2 Parsing FDF Meta Data File
320. s are logically AND d with the DEPEX section of the module If no DEPEX section is specified in the module then only the library instances DEPEX sections are logically AND d to create the DEPEX section for the module e Tools are also coded to ignore the depex sections of libraries that are linked to UEFI DRIVER or PCI Option ROM code e The tools should break the build if one module using one of the noted module types contains a depex section in the INF file 2 7 7 Generating Visual Forms IFR HII Files This section covers the generation of the Human Interface Infrastructure HII format files used for displaying information on the console While all error messages from the EFI drivers are written in English displaying data on the console selection and configuration menus is performed using HII formats This permits the user to select an alternate language for these displays Strings intended for these displays must be written in Unicode UCS 2 format rather May 2010 29 BUILD than plain ASCII text The Unicode strings for these forms should be kept in separate files uni extension or optionally within C code either c source or h header files Forms Strings fonts and images are stored in an HII database encoded to an Internal Forms Representation IFR with each object and attribute a byte stream All HII files are included as part of a driver module s code the data that makes up IFR content is compiled in
321. s input file information to find another build rule until no build rule uses the output file information as its input file If there s no build rule for a type of source file the build tools just skip it But if there s build rule for it one or more makefile targets will be generated for it The sequence of build rules applied to source files and intermediate files determines the dependency relationship between targets in makefile One type of file cannot be used in more than one build rule as an input file and the build rules must not be cyclic 7 2 4 Parse DSC FDF INF DEC files From the DSC file the build tools collect the mapping between library classes and library instances PCD data for the whole platform the list of INF file of modules specified for the platform and the build output directory Optionally the name of the flash image layout description FDF file and build options specific to the platform are also obtained The build tools try to parse the INF file one by one including the INF file for library instances From the INF file the build tools collect information such as source file list library class list package list GUID Protocol PPI list PCD list etc After all INF files are parsed the build tools retrieve the list of all of the dependent DEC files and then parse them From the DEC file the build tools will get the information such as common include folders the values of GUID Protocol PPI the default setting o
322. s of the given language are defined langdef eng English langdef spa Spanish Once these directives have been specified the shorthand eng or spa may be used to tag the languages of strings defined in the file H 2 String Definitions The string and language directives are used to declare string identifiers and the corresponding strings for different languages If a control character in column 1 is used to indicate the end of strings then the Unicode string definitions for two strings for two different languages could take the form May 2010 281 BUILD string MY_STRING 1 language eng My first English string string MY_STRING_2 language eng My second English string string MY_STRING 1 language spa Mi primera secuencia inglesa string MY_STRING_2 language spa Mi segunda secuencia inglesa If control characters are used to terminate strings as shown above and the string contains double quotes as the first and last non blank character on the first line of the input Unicode file then the uqs command line option must be used By using quotes to mark the start and end of strings a more columnar view is presented string MY STRING 1 language eng My first English string string MY STRING 2 language eng My second English string string MY STRING 1 language spa Mi primera secuencia inglesa string MY STRING 2 language spa Mi segunda secuencia inglesa Or to group strings by identifier rather th
323. section uses an EFI SECTION GUID DEFINED header The size for these sections is defined as a 24 bit unsigned integer that contains the total size of the section in bytes including the size of the header For the EFI_ SECTION COMPRESSION the CompressionType field must be set to 0x01 for standard compression or 0x00 if the image is not compressed Note In the specification only ex srp compression is supported for this section type For the EFI_GUID_ DEFINED SECTION Which is used for non standard compression see above the named GUID that defines the section follows the EFI COMMON SECTION HEADER After this GUID are two additional uzNT16 parameters the first is the Dataoffset which contains the offset in bytes from the beginning of the common header to the first byte of the data An Attributes parameter is a bit field code which declares specific characteristics of the section contents These headers are prefixed to the data files which may include the standard PE32 headers 2 7 6 Generating DEPEX EFI SECTION Files This section provides the overview for creating PEI DXE and SMM DEPEX sections The DEPEX grammar is defined in the PI Specification Volume 1 Dependency Expression Grammar chapter while the Opcodes for the Mnemonic are defined in Volume 2 DXE Dispatcher chapter The translation of the mnemonic and or GUID involves creating a binary file using postfix notation The file does not conform to PE32 COFF and no header inform
324. set to EFI IMAGE SUBSYSTEM EFI APPLICATION EFI IMAGE SUBSYSTEM EFI BOOT SERVICE DRIVER EFI IMAGE SUBSYSTEM EFI RUNTIME DRIVER and EFI IMAGE SUBSYSTEM SAL RUNTIME DRIVER respectively For a Security Module the Subsystem type is set to EFI IMAGE SUBSYSTEM EFI BOOT SERVICE DRIVER For PEI CORE DXE CORE PEIM DXE SMM DRIVER UEFI APPLICATION UEFI DRIVER the Subsystem type is set to EFI IMAGE SUBSYSTEM EFI BOOT SERVICE DRIVER ASL or IASL compiled ACPI tables Compiled dependency sections Microcode Binary files BUILD Additional modifications to the files are permitted Modifications that recommended are as follows TimeStructure can be modified to a given date using a data structure of tm mon months since January 0 11 tm mday day of the month 1 31 tm year years since 1900 tm hour hours since midnight 0 23 tm min minutes after the hour 0 59 tm sec seconds after the minute 0 59 Subsystemfield is changed to one of the following EFI IMAGE SUBSYSTEM UNKNOWN 0 EFI IMAGE SUBSYSTEM NATIVE 1 EFI IMAGE SUBSYSTEM WINDOWS GUI 2 EFI IMAGE SUBSYSTEM WINDOWS CUI 3 EFI IMAGE SUBSYSTEM OS2 CUI 5 EFI IMAGE SUBSYSTEM POSIX CUI 7 EFI IMAGE SUBSYSTEM EFI APPLICATION 10 EFI IMAGE SUBSYSTEM EFI BOOT SERVICE DRIVER 11 EFI IMAGE SUBSYSTEM EFI RUNTIME DRIVER 12 EFI IMAGE SUBSYSTEM SAL RUNTIME DRIVER 13 The Machine value in the PE image file header is used to indicate the machine code type of the image
325. sion Oi Enable Intrinsic functions Ob2 default inline Inline any function at the compiler s discretion same as Qip O Optimize output file GL Enable link time code generation EHs c Combine EHs and EHc EHs Disable C EH no SHE exceptions EHc Disable extern C defaults to no throw GF GF Enable read only string pooling GR Disable C RTTI EDK II Specific Flags D UNICODE D UNICODE DUNICODE define macro UNICODE FIAutoGen h FIAutoGen h include AutoGen h Always include AutoGen h file Debug Specific Flags Zi Zi g Enable debugging information Gm Gm Enable minimum rebuild fshort wchar Force the underlying type for wchar t to be unsigned short IPF Specific Flags Ox Maximum Optimization Ogityb2 Gs X ignore standard places QIPF fr32 Do not use upper 96 Floating Point Registers Zx Generates debug able optimized code Only available in the IPF cross compiler or IPF native compiler 100 May 2010 1 22 Table 21 Assembly Flags Microsoft GCC Description nologo Do not display assembler version information C C Generate object obj files do not link WX Treat warnings as errors W3 Warning level 3 Cx Preserve case in publics and externs coff Generate COFF format object files Zd Add line number debug info Zi Add symbolic debug info DEBUG target x assembler Input files are in assembly language imacros AutoGen h Accept definition of macros in AutoGen h
326. soft WindowsXP Professional Microsoft Windows Vista Red Hat Enterprise Linux 4 Update 5 Server and Desktop SuSE Linux Enterprise 10 Server and Desktop and Apple Mac OS X 10 4 x running on iMac hardware Note Microsoft compiler tools are 32 bit applications Running 32 bit applications on a 64 bit Windows operating system is possible but the application will run up to 4 times slower than if it were run on a system with a 32 bit Windows operating system Installing a Windows 32 bit operating system on a 64 bit system is also permitted and no performance degradation has been seen using this configuration 4 2 Supported Development Tools Table 9 lists the Third Party Compiler Tool chains supported under the reference build Note The GCC compiler tool chains should be built using provided scripts for generating the tools Table 9 Supported Compiler Tools Vendor Target Tool Version Architecture Microsoft IA32 X64 IPF Visual Studio Team Suite 2005 Microsoft IA32 X64 IPF Visual Studio Team Suite 2008 Microsoft IA32 X64 IPF Driver Development Kit DDK 3790 1830 Intel IA32 X64 IPF Intel C Compiler for Windows 11 1 Intel IA32 X64 IPF Intel C Compiler for Linux 11 1 Intel IA32 X64 IPF Intel C Compiler for Mac OS X 11 1 Intel EBC Intel C Compiler for EFI Byte Code 1 3 GCC IA32 X64 IPF GCC 4 4 Additional tools may be required for platform development Table 10 lists additiona
327. sule Raw data non FFS files can be included in a FV file using EFI_FV_FILETYPE_RAW The FFS file contains EFI section files see Table 2 for a list of EFI SECTION types All files generated by the MAKE stage will have the output located in a build directory either at the top of OUTPUT_DIRECTORY PLATFORM_NAME lt BuildTarget gt _ lt ToolChainTag gt ARCH or a sub directory created that replicates the INF file path All EFI section files and encapsulated section files are created based on their description in FDF file For a binary or raw file type the raw data can be any binary file One FV image or one FD image described in FV section or FD sections of the FDF file may also be treated as RAW data The process of creating a FV image is described in Section 9 4 the process of creating a FD image is described in Section 9 5 The MAKE stage creates EFI files During the ImageGen stage GenFds will create the required FFS files and FV images based on Capsule description in the FDF file Finally the capsule header will be prefixed to the capsule data to construct the complete capsule The overview of the Capsule creation process is shown in Figure 23 Full Firmware Image FD Firmware Volume Image Add basis dms GEV Capsule P g Firm ware Filesystem File EFI Section Files EFI Image or Binary File Figure 23 Capsule Creation Process May 2010 1 22 Build Changes and Customizations 11 Build Changes and Cus
328. t usr bin Specifying a MAKE command that will use an alternate make utility for NIX based tool chains is optional format TARGET TOOLCHAIN ARCH COMMANDTYPE ATTRIBUTE lt string gt priorty TARGET TOOLCHAIN ARCH COMMANDTYPE ATTRIBUTE Highest TOOLCHAIN ARCH COMMANDTYPE ATTRIBUTE TARGET ok kk dee ke k ARCH COMMANDTYPE ATTRIBUTE K kekek keke de ke ke dede ke k k k _ARCH_COMMANDTYPE_ATTRIBUTE TARGET TOOLCHAIN _ KKK _COMMANDTYPE ATTRIBUTE TOOLCHAIN COMMANDTYPE ATTRIBUTE TARGET _ KKKKKKKKK KKK _COMMANDTYPE ATTRIBUTE kkkkkk KkKkKKKKKKK eee COMMANDTYPE ATTRIBUTE TARGET TOOLCHAIN ARCH _ K kk kk kk kk k k _ATTRIBUTE TOOLCHAIN ARCH k ATTRIBUTE TARGET kkkkkkkkk _ARCH ckckckck dk ko ATTRIBUTE kkkkkk KkKKKKKKKK _ARCH kkkkkkkkkkxk _ATTRIBUTE TARGET TOOLCHAIN _ KKK 2 2 2 2 2 ek ee kk _ATTRIBUTE kk TOOLCHAIN onde de eR ee dee ATTRIBUTE TARGET eexickekekdek kkkk kkkkkkxkkkx xk ATTRIBUTE FOTO CII I I e GEO RI gd kk _ATTRIBUTE Lowest All entries in this 1 file are case sensitive Prototype lt ToolsDef gt IDENTIFIER lt Word gt 1 XDefineStatements lt Entries gt lt DefineStatements gt DEFINE MACRO lt ABSENVPATH gt lt EOL gt lt MACRO gt lt Word gt lt ABSENVPATH gt lt AbsolutePath gt Environ lt PATH gt Continued next page May 2010 1 22 1 22 lt AbsolutePath gt lt PATH gt lt Environ gt lt P
329. t Destination file extension Directory separator Macro WORKSPACE Workspace directory 260 May 2010 1 22 OUTPUT_DIR Directory for intermediate files for building a module DEBUG DIR Directory for files used to debug a module BUILD DIR All files for building a platform will be put in this directory BIN DIR Common directory for executable files FV DIR Directory to store flash image files INC Search path of current module INC LIST A file containing search pathes of current module LIBS Static library files of current module tool FLAGS Tools flags of current module MODULE NAME Current module name MODULE TYPE Current module type MODULE GUID Current module guid ARCH Architecture of current module TOOLCHAIN Toolchain used to build current module TARGET Target of current module DEBUG RELEASE tool Path of tool EDK TOOLS PATH Path of build tools lt FILE_TYPES gt File list of each file type Note The macro name is derived from file type name For example C Code File will have C CODE FILES macro S lt FILE TYPES LIST Macro point to a file containing list of files of a file type Note The macro and file name are derived from file type name For example C Code File will have C CODE FILES LIST macro pointing to S OUTPUT DIR c code files lst The list file and macro name will be generated only when this macro is used in command line
330. t gt gt 12 7 2 Library Sub section This sub section holds the information for all libraries used in this module If it is an EDKII style module it further lists its correspondent library class library constructor and destructor name ifthey exist The library instances are sorted by the order of their constructor calling sequence and the reverse order of their destructor calling sequence e Library INF Path Path of library INF file e Class The library class name of the library instance e C The library constructor if it exists e D The library destructor if it exists The items marked with are only available when the module is an EDKII style module and they must list in the next line immediately after library INF path 176 December 2007 1 22 1 22 Reports Example c edk2 MdePkg Library UefiDevicePathLib UefiDevicePathLib inf DevicePathLib c edk2 MdePkg Library BaseLib BaseLib inf BaseLib c edk2 MdePkg Library BaseMemoryLib BaseMemoryLib inf BaseMemoryLib c edk2 MdePkg Library UefiMemoryAllocationLib UefiMemoryAllocationLib inf MemoryAllocationLib c edk2 MdePkg Library UefiBootServicesTableLib UefiBootServicesTableLib inf UefiBootServicesTableLib C UefiBootServicesTableLibConstructor c edk2 MdePkg Library DxePcdLib DxePcdLib inf PcdLib C PcdLibConstructor c edk2 MdePkg Library UefiRuntimeServicesTableLib UefiRuntimeServicesTableLib i nf UefiRuntimeServicesTableLib C
331. t Visual Studio DEFINE VS2005x86 BIN DEFINE VS2005x86 DLL 8 Common7 IDE DEFINE VS2005x86 BINX64 DEFINE VS2005x86 BIN64 C Program Files x86 Microsoft Visual Studio 8 Vc bin C Program Files x86 Microsoft Visual Studio DEF VS2005x86_BIN x86_amd64 DEF VS2005x86 BIN Wx86 ia64 These defines are needed for certain Microsoft Visual Studio tools that are used by other toolchains An example is that ICC on Windows normally uses Microsoft s nmake exe Some MS VS BIN options DEF VS2003 BIN DEF VS2005 BIN DEF VS2005x86 BIN DEFINE MS VS BIN DEF VS2005 BIN Some MS VS DLL options DEF VS2003 DLL DEF VS2005 DLL DEF VS2005x86 DLL DEFINE MS VS DLL DEF VS2005 DLL DEFINE WINDDK BIN16 DEFINE WINDDK BIN32 DEFINE WINDDK BINX64 DEFINE WINDDK BIN64 C WINDDK 3790 1830 bin bin16 C WINDDK 3790 1830 bin x86 C WINDDK 3790 1830 bin win64 x86 amd64 C WINDDK 3790 1830 bin win64 x86 NOTE The Intel C Compiler for Windows requires one of the Microsoft C compiler tool chains for the linker and nmake commands This configuration assumes a Windows 2003 Server DDK installation DEFINE ICC_VERSION 9 1 DEFINE ICC_VERSION 10 1 021 DEFINE ICC_BIN32 C Program Files Intel Compiler C DEF ICC VERSION IA32 Bin DEFINE ICC ASM32 C Program 186 May 2010 1 22 Files Intel Compiler C DEF ICC VERSION IA32 Bin DEFINE ICC BIN32x86 C Program Files x86 Intel Compiler C DEF ICC VERS
332. t action is for the initial Boot drivers while the most common is for execute in place XIP drivers Some Runtime drivers may also need to be rebased As part of the rebase these execute from ROM drivers may need to be aligned to the natural alignment of the machine architecture or section alignment 2 7 10 1 Reference Implementation Combining FFS files into FV files 32 The reference build implementation uses the Firmware Description File FDF to describe how to combine FFS files into different FV files as well as the layout of the FD files within an FD description Each FV definition within the FDF is used to complete a data structure for constructing the FV It should also be noted that the reference build does not use extended headers The FvName in the FV INFO structure is used to identify the name of the files that will be created in the FV directory typedef struct EFI PHYSICAL ADDRESS BaseAddress EFI PHYSICAL ADDRESS BootBaseAddress EFI PHYSICAL ADDRESS RuntimeBaseAddress EFI GUID FvGuid UINTN Size CHAR8 FvName MAX PATH EFI FV BLOCK MAP ENTRY FvBlocks MAX NUMBER OF FV BLOCKS EFI FVB ATTRIBUTES FvAttributes CHAR8 FvFiles MAX NUMBER OF FILES IN FV MAX PATH FV INFO The FV file header see SE FIRMWARE VOLUME HEADER definition in Section 3 is constructed using the following information The first 16 bytes ZeroVector are set to zero The FV FileSystemGuid is assigned a PI Specification defined GUID
333. t specified or set to zero is 2 Recommend setting this value to one more than the number of computer cores or CPUs of the development workstation BuildRules Specify the file name to use for the build rules that are followed when generating Makefiles If not specified the file WORKSPACE Conf build_rule txt will be used MoreBuildRules Specify zero or more file names separated by a space character to use for additional build rules that are followed when generating Makefiles The build tools will append these files to the end of the BUILD RULE CONF file during processing Example ACTIVE PLATFORM Nt32Pkg Nt32Pkg dsc TARGET DEBUG TARGET ARCH IA32 TOOL CHAIN CONF Conf tools def txt TOOL CHAIN TAG MYTOOLS MAX CONCURRENT THREAD NUMBER 2 BUILD RULE CONF Conf build rule txt 5 4 build rule txt 88 This file provides templates to specify how individual modules are compiled and linked The tools and flags specified in the tools def txt file and the optional BuildOptions in the INF and or DSC files are used with the templates in this file to generate makefiles Two wildcard characters are used in this file the star character and the question mark character The star character is used to indicate that the source files can be processed in parallel while the question mark character is used to indicate sequential processing of the source files an the INF file This file is an INI style formatted file wit
334. te After building the gcc cross compiler tool chain it may be necessary to modify Conf tools def txt to configure the UNIXGCC tool chain paths The released tools source code is provided as part of the EDK II project in the BaseTools Source directory tree The Sources for the build tools is available via Subversion in the BuildTools project on TianoCore org Build tools are written in either C or Python tools that processes binary data are written in C while tools that process text files are written in Python Note It is not required to download the tool sources from the BuildTools project for systems running 32 bit versions of the Microsoft Operating systems Win32 binaries for the build tools are provided as part of the EDK II project 4 4 Build Specific Meta Data Files This section provides an overview of the meta data files that are used to control different aspects of the build There are three files of interest build rule txt tools def txt and target txt The build rule txt file describes how different file types are processed while tools def txt describes the location of third party tools and tool flags The target txt file is used as a filter allowing a developer to build items of interest without having to build everything 1 22 May 2010 65 BUILD 4 4 1 Parse Meta Data AutoGen stage Additional module and platform meta data in the EDK II reference build system is stored in text based INI style documents
335. ted at the end of the MAKE stage conform to the UEFI Images section of the UEFI specification UEFI uses a subset of the PE32 image format with a modified header signature The PE32 PE32 files are modified by the GenFw application Note that this application will also modify an ELF image and generate a PE32 PE32 image Each PE32 PE32 file will have sections of the original DOS Header over written a new NT HEADER for the PeHeader and possibly one Optional Header for 32 bit or 64 bit options 4 6 File Extensions The reference build system is designed to process files in the AutoGen stage with specific extensions for use in the MAKE stage producing files with intermediate extension names For some final targets such as UEFI applications the intermediate extension is the final extension The ImageGen makes use of the files with intermediate extensions to generate the final images 4 6 1 AutoGen Stage File Extensions 70 Table 11 provides the extension and a description of files processed during the AutoGen stage of the build The build rule txt file describes the processing rules for generating the Makefiles for the MAKE stage May 2010 1 22 Reference Build Process Overview Table 11 AutoGen Stage Input File Extensions Extension Description C cpp C code files h C header files asm 32 and 64 bit Windows assembly files S 32 and 64 bit GCC assembly files Ss IPF GCC and Windows assembly files
336. tements One or more individual elements may be within the scope of the conditional statements 5 2 tools def txt This file describes the tools used by a developer providing the flexibility to have multiple tool chains and different profiles for each tool chain In the simplest of terms the file provides a variable mapping of compiler tool chains and flags The structure of 1 22 May 2010 79 80 BUILD this text file is described below There are three types of statements the IDENTIFIER statement which defines a User Interface name for identifying this file The second statement type is the DEFINE statement which is used to identify a fully qualified path macro while the third type of statement is a record statement containing mappings that are processed by the build tools to generate Makefile and GNUMakefile commands that are executed by a compiler s make utility or function The left side of the record is subdivided into five groups defined below The build tools will process the file and assign the following priority during the parsing After parsing the right hand string is substituted into the makefile using the build rule txt templates If a wildcard value is permitted the wildcard character is the star character For tool chains that expect to use a Windows style nmake utility one entry the NMAKE COMMANDTYPE is required The NIX based make and gmake utilities are typically in a developer s path environmen
337. tes EFI GUID DEFINED SECTION2 Parameters SectionDefinitionGuid A GUID that defines the format of the data that follows It is a vendor defined format DataOffset Contains the offset in bytes from the beginning of the common header to the first byte of the data Attributes Bit field that declares some specific characteristics of the section contents The bits are defined in Related Definitions below If the bit is not defined below it is reserved and must be set to zero CommonHeader Usual common section header CommonHeader Type EFI SECTION GUID DEFINED Related Definitions Bit 0 EFI GUIDED SECTION PROCESSING REQUIRED Bit 1 EFI GUIDED SECTION AUTH STATUS VALID 52 May 2010 1 22 1 22 UEFI and PI Image Specification Table 8 Descriptions of Bit Fields for Attributes Field Description EFI_GUIDED_SECTION_ PROCESSING REQUIRED Set to 1 if the section requires processing to obtain meaningful data from the section contents Processing would be required for example if the section contents were encrypted or compressed If the EFI GUIDED SECTION PROCESSING REQUIRED bitis cleared to zero it is possible to retrieve the section s contents without processing in the absence of an associated instance of the EFI GUIDED SECTION EXTRACTION PROTOCOL DXE or EFI PEI GUIDED SECTION EXTRACTION PPI PEI In this case the beginning of the encapsulated section stream is indicated by the value of DataOffset
338. that will be used to create an EFI section The curpEp encapsulation section uses one of the following formats 156 May 2010 1 22 ImageGen Stage FLASH Images SECTION GUIDED GUID CNAME auth SECTION EFI SECTION TYPE FILENAME SECTION EFI SECTION TYPE string SECTION GUIDED GUID_CNAME auth FILENAME The required argument is the curpED name followed by an optional auth flag If the argument autn flag is specified then the attribute EFI GUIDED SECTION AUTH STATUS VALID must be set For statements that do not use a scoping notation the second secrron statement of the two listed above if FILENAME exists the attribute EFI GUIDED SECTION PROCESSING REQUIRED must be set to TRUE The file pointed to by FILENAME is the data If FILENAME does not exist EFI GUIDED SECTION PROCESSING REQUIRED is cleared and normal leaf sections must be used GenSec tool uses information from these encapsulated section definition as input parameters to generate the corresponding section format 9 4 Create the FV Image File s Once all of the EFI FFS files have been created these images are bundled into an FV image GenFv needs two kinds of information about the target FV e The FV attributes e The list of one or more files that will be placed into this FV This information is defined in the FV section of the FDF file The following example is for a FV section named BiosUpdate May 2010 157 BUILD FV BiosUpdate Bloc
339. the header to identify it as the last image PCI Firmware Specification Revision 3 0 Legacy Option ROM images must be the first image in the ROM image The following is a list of the image combinations that may be placed in a PCI option ROM This is not an exhaustive list Instead it provides what will likely be the most common PCI option ROM layouts EFI complaint system firmware must work with all of these PCI option ROM layouts plus any other layouts that are possible within the PCI Specification The format of a Legacy Option ROM image is defined in the PCI Specification e Legacy Option ROM image e Legacy Option ROM image IA 32 EFI driver e Legacy Option ROM image Itanium Processor Family EFI driver e Legacy Option ROM image IA 32 EFI driver Itanium Processor Family EFI driver e Legacy Option ROM image IA 32 EFI driver x64 EFI driver e Legacy Option ROM image EBC Driver e A 32 UEFI driver e Itanium Processor Family EFI driver e A 32 UEFI driver Itanium Processor Family EFI driver e EBC Driver It is also possible to place an application in a PCI Option ROM The exact mechanism by which applications can be loaded and executed from a PCI Option ROM is outside the scope of this document 2 7 15 1 Reference Implementation Binary Option ROM code Pre existing Binary OptionROM code can also be provided by hardware vendors These images are verified to be of the correct format and length If the length of the provided
340. this category include PCI Option ROMs 2 4 6 After Life AL The After Life AL phase consists of persistent UEFI drivers used for storing the state of the system during the OS orderly shutdown sleep hibernate or restart processes 2 5 Typical Flash Part Layout While a flash part layout is specific to a given platform there are some generalizations that apply The SEC and PEI code is typically put into a RECOVERY location while all remaining sections are put into the MAIN location The MAIN section may be compressed for size optimization provided the PEI or SEC code contains appropriate decompression drivers The PI specification defines only standard EFI compression if other compression mechanisms or verification mechanisms such as CRC32 are required then both the tools for creating a compressed image and a library for decompressing the image must be provided These non standard compression encryption signing or verification mechanisms are applied to a GUIED encapsulation section Each method needs a unique GUID however the methods may be applied to images more than once per FD image This is done in order to facility recovery and updates called capsules Other areas in flash may be reserved for non volatile NV 1 22 May 2010 13 BUILD data storage fault tolerant working FTW space or vital product data VPD areas These other regions are not defined in the PI specification and implementation is left to the platform
341. to standard object code and linked in to the driver 2 7 7 1 Reference Implementation Tools The reference build system provides tools for processing formatted Unicode files and Visual Forms Representation VFR files in order to create the IFR files Refer to the EDK II User s Manual for more information regarding the use of the Unicode and VFR files Refer to the VfrCompiler description and VFR BNF later in this document for more detailed information on the provided implementation Additionally the reference build AutoGen tools are used to process Unicode files listed in a module s INF file Also note that the IFR code is not compatible UFI compliant IFR code is different from the IFR code defined by early Intel Framework documents 2 7 7 2 Reference Implementation More than One Unicode File If more than one Unicode file is required by a module the rules for including these files are as follows If one Unicode file uses a include statement to include other Unicode files only the top level Unicode file should be listed These secondary Unicode files must not be listed in the INF file 2 7 7 3 Reference Implementation Compatability The EDK II Vfr compiler tools can process EDK and EDK II VFR and Unicode files and to generate UEFI PI compliant IFR files EDK II Unicode files can use the UEFI defined Unicode extended grammar The EDK VFR and Unicode files are a subset of the EDK II versions EDK II VFR and Unicode files may not be used wit
342. tomizations This chapter deals with customizing a build including options and settings for debugging using custom tools as well as how to customize EDK component builds 11 1 Building for Debug The build tool defaults support two building targets DEBUG and RELEASE This section describes how to enable DEBUG target when building and how to setup compiler flags used for DEBUG There are three ways provided in build tool to define which target should be used in the building process e Situation A Setup by overriding file target txt After executed command edksetup in workspace environment there will be a file named target txt under WORKSPACE Conf Users can edit this file and change the value of item TARGET A dize example of this is TARGET DEBUG which sets the current building method Inthis example the default value of the TARGET is set to DEBUG e Situation B Use a parameter b BUILDTARGET when executing building command Users can type a command with the format build b BUILDTARGET to specify the target used in current building A specific example of this command is build b DEBUG In this example the value set in the file target txt will be ignored e Situation C Setup in the DSC file of a platform When the BUILDTARGET is not specified in the command line or in the file dedo the build tool will attempt to build all valid targets specified in the DSC file This contr
343. trative conventions described below Typographic Typographic convention description Convention Plain text The normal text typeface is used for the vast majority of the descriptive text in a specification Plain text blue Any plain text that is underlined and in blue indicates an active link to the cross reference Click on the word to follow the hyperlink Bold In text a Bold typeface identifies a processor register name In other instances a Bold typeface can be used as a running head within a paragraph Italic In text an Italic typeface can be used as emphasis to introduce a new term or to indicate a manual or specification name 6 May 2010 1 22 Introduction Typographic Convention BOLD Monospace Bold Monospace VAR Italic Mono space Typographic convention description Computer code example code segments and all prototype code segments use a BOLD Monospace typeface with a dark red color These code listings normally appear in one or more separate paragraphs though words or segments can also be embedded in a normal text paragraph Words inaBold Monospace typeface that is underlined and in blue indicate an active hyperlink to the code definition for that function or type definition Click on the word to follow the hyperlink This symbol VAR defined by the utility or input files In code or in text words in Ttalic Monospace indicate placeholder names for variable information that must be supplied
344. tructures The naming within the data structures is consistent Therefore regardless of the machine type both the SizeOfImage and SizeOflnitializedData are adjusted by subtracting the length of the reloc section If the NumberOfRvaAndSizes is greater than the EFI IMAGE DIRECTORY ENTRY BASERELOC then the DataDirectory 0 VirtualAddress and the size are both set to O Finally the reloc section s header is modified setting the Misc VirtualSize and SizeOfRawData to 0 2 7 4 Generating LEAF EFI_SECTION Files 26 This section provides the overview for generating EFI sEcTION files EFI SECTION headers must be present on all leaf sections The EFI Section header see above will be prefixed to the file or data section VERSION and USER INTERFACE data can be generated on the fly rather than creating a separate UNICODE file first For the files that are PE32 code EFI_SECTION_PE32 EFI SECTION TE and EFI SECTION PIC the text debug reloc and data section headers if they exist are overwritten with the EFI IMAGE SECTION HEADER The section name i e text is copied into the Name entry while the remaining sections are set as follows Hdr gt Misc VirtualSize Size Hdr gt VirtualAddress Offset Hdr gt SizeOfRawData Size Hdr gt PointerToRawData Offset Hdr gt PointerToRelocations 0 Hdr gt PointerToLinenumbers 0 Hdr gt NumberOfRelocations 0 Hdr gt NumberOfLinenumbers 0 Hdr gt Characteristics
345. ture Types BASE Any Modules or Libraries can be ported to any execution environment This module type is intended to be used by silicon module developers to produce source code that is not tied to any specific execution environment SEC Any Modules of this type are designed to start execution at the reset vector of a CPU They are responsible for preparing the platform for the PEI phase PEI CORE Any This module type is used by PEI Core implementations that are compliant with the PI 1 2 Specification PEIM Any This module type is used by PEIMs that are compliant with PI 1 2 DXE CORE Any This module type is used by DXE Core implementations that are compliant with the PI 1 2 Specification DXE DRIVER Any This module type is used by DXE Drivers that are compliant with the PI 1 2 Specification DXE RUNTIME DRIVER Any This module type is used by DXE Drivers that are compliant to the PI 1 2 Specification These modules execute in both boot services and runtime services environments DXE SAL DRIVER IPF This module type is used by DXE Drivers that can be called in physical mode before SetVirtualAddressMap is called and either physical mode or virtual mode after SetVirtualAddressMap has been called This module type is only available for IPF processor types DXE SMM DRIVER IA32 X64 This module type is used by DXE Drivers that are loaded into SMRAM SMM CORE Any This is the SMM core UEFI DRIVER An
346. uffer Else include statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt Value LibPcdSet DatumSize gPcd BinaryPatch TokenCName Value If PCD type DYNAMIC EX include statement AutoGen h define PCD GET MODE lt DatumSize gt lt TokenCName gt LibPcdGetEx lt DatumSize gt amp lt TokenSpaceGuidCName gt PCD TOKEN PcdTokenCName V If DatumType VOID include statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt SizeOfBuffer Buffer LibPcdSetEx lt DatumSize gt amp lt TokenSpaceGuidCName gt _gPcd BinaryPatch lt TokenCName gt VN SizeOfBuffer Buffer Else include statement AutoGen h define PCD SET MODE lt DatumSize gt lt TokenCName gt Value LibPcdSetEx lt DatumSize gt amp lt TokenSpaceGuidCName gt gPcd BinaryPatch lt TokenCName gt 116 May 2010 1 22 Value May 2010 AutoGen Stage 117 BUILD 7 3 3 5 2 Library Module include statement AutoGen h define PCD TOKEN TokenCName lt TokenNumber gt ys If PCD type FIXED AT BUILD PCD type FEATURE FLAG include statement AutoGen h extern const lt DatumType gt _gPcd FixedAtBuild lt TokenCName gt define PCD GET MODE lt DatumSize gt lt TokenCName gt VN gPcd FixedAtBuild lt TokenCName gt ME If PCD type PATCHABLE IN MOD
347. ule that produces SAL Runtime Services DXE SAL modules differ from DXE Runtime modules in that the DXE Runtime modules support Virtual mode OS calls at OS runtime and DXE SAL modules support intermixing Virtual or Physical mode OS calls DXE SMM A special class of DXE module that is loaded into the System Management Mode memory DXE Runtime Special class of DXE module that provides Runtime Services EBNF Extended Backus Naur Form meta syntax notation with the following additional constructs square brackets surround optional items suffix for a sequence of zero or more of an item suffix for one or more of an item suffix for zero or one of an item curly braces enclosing a list of alternatives and super subscripts indicating between n and m occurrences EFI Generic term that refers to one of the versions of the EFI specification EFI 1 02 EFI 1 10 UEFI 2 0 UEFI 2 1 UEFI 2 2 or UEFI 2 3 EFI 1 10 Specification Intel Corporation published the Extensible Firmware Interface Specification Intel has donated the EFI specification to the Unified EFI Forum and the UEFI now owns future updates of the EFI specification FLASH This term is used throughout this document to describe one of the following e AO image that is loaded into a hardware device on a platform traditional ROM image e AO image that is loaded into an Option ROM device on an add in card e A bootable image that is installed on remov
348. ules While this option provides feedback that looks fast due to overhead of the AutoGen function this option is slower than letting AutoGen complete before starting the MAKE phase Build the platform using multi threaded compiler this option must combine with spawn option The value overrides target txt s MULTIPLE THREAD and MAX CONCURRENT THREAD NUMBER less than 2 will disable multi thread builds f FDFFILE fdf FDFFILE The name of the FDF file to use which overrides the setting in the DSC file r ROMIMAGE rom image ROMIMAGE The name of FD to be generated The name must be from FD section in FDF file i FVIMAGE fv image FVIMAGE The name of FV to be generated The name must be from FV section in FDF file k msft Make Option Generate only NMAKE Makefiles Makefile g gcc Make Option Generate only GMAKE Makefiles GNUmakefile 1 all Make Option Generate both NMAKE and GMAKE makefiles w warning as error May 2010 271 BUILD Treat warning in tools as error j LOGFILE log LOGFILE Putlog in specified file as well as on console q quiet Disable all messages except FATAL ERRORS v verbose Turn on verbose output with informational messages printed including library instances selected final dependency expression and warning messages etc d DEBUG debug DEBUG Enable debug messages at specified level 272 May 2010 1 22 Appendix F NT32 Platform Emulation
349. umer of the library is coded to the library class definition Library classes are defined via a library class h file that is published by a package Library Instance An implementation of one or more library classes Module A module is either an executable image or a library instance For a list of module types supported by this package see module type Module Type All libraries and components belong to one of the following module types BASE SEC PEI CORE PEIM DXE CORE SMM CORE DXE DRIVER DXE RUNTIME DRIVER DXE EMN DRIVER DXE SAL DRIVER UEFI DRIVER or UEFI APPLICATION These definitions provide a framework that is consistent with a similar set of requirements A module that is of module type BASE depends only on headers and libraries provided in the MDE while a module that is of module type DXE DRIVER depends on common DXE components For a definition of the various module types see Appendix K Module Surface Area MSA The MSA is an XML description of how the module is coded The MSA contains information about the different construction options for the module After the module is constructed the MSA can describe the interoperability requirements of a module Package A package is a container It can hold a collection of files for any given set of modules Packages may be described as one of the following types of modules source modules containing all source files and descriptions of a module binary modules ERE EF
350. uoted string Path takes the form s0 Display wide this text wide Display narrow this text narrow May 2010 283 BUILD 284 May 2010 1 22 Appendix I VS2005 Team Suite Performance Profile This appendix provides the best known method for using Microsoft Visual Studio 2005 Team Suite to get performance data It involves porting the EFI code to a Win32 console application and then using the VS Performance Wizard to figure out how to tune it I 1 Step 1 Create a new project On the Menu bar select File gt New gt Project In the Project types frame select Visual C gt Win32 In the Templates frame then select Win32 Console Application e Give the project a name and a solution e Accept the default settings from the wizard A project name gt cpp file will be generated Xproject name gt cpp Test cpp Defines the entry point for the console application include stdafx h int _tmain int argc _TCHAR argv return 0 I 2 Step 2 Update the project You will need to update the new project to support reading in input files and writing data to an output file 1 22 May 2010 285 286 include stdafx h include lt windows h gt include lt stdio h gt void Malloc int Size return HeapAlloc GetProcessHeap 0 Size int _tmain int argc _TCHAR argv HANDLE hFile HANDLE hOutFile DWORD Error DWORD BytesRead BY HANDLE FILE INF
351. ut is a DLL Use link time code generation The function that specifies a starting address Do not use the EFI subsystem interface as this is EFI 1 0 compliant not UEFI 2 1 Do not produce an image with a table of safe exception handles Base address is always 0 and will be adjusted later by the build tools when creating images Specify Kernel mode Create debugging information Optimize Enable garbage collection of unused input sections All global symbols in the objects used to build a DLL will be exported by the DLL May 2010 103 Build Environment 104 May 2010 1 22 AutoGen Stage 7 AutoGen Stage 7 1 Overview This chapter describes in detail the steps that are accomplished by the AutoGen stage which is the first step of building a platform or a module target txt Parsing Tool Parsing Tool Parsing Tool Parsing Tool Command Line Autogen c Autogen h depex Platform Makefile Figure 19 EDK Il AutoGen Process Module Makefiles The first file the build tool is looking for in AutoGen stage is target txt in directory WORKSPACE Conf All the configurations in target txt can be overridden by command line options of build tool If no platform description file is specified in either target txt and command line the build tool will try to find one in current directory And if build tool finds a description file of a module INF file in current directory it w
352. utoGen h gch Yc TC DEBUG VS2003 IA32 ASM FLAGS nologo W3 WX c coff Cx Zd WO Zi RELEASE VS2003 IA32 ASM FLAGS nologo W3 WX c coff Cx Zd WO VS2003 IA32 SLINK FLAGS nologo LTCG DEBUG VS2003 IA32 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 V OPT REF OPT ICF 10 MAP ALIGN 32 MACHINE I386 LTCG DLL ENTRY ENTRYPOINT SUBSYSTEM CONSOLE SAFESEH NO BASE 0 DRIVER DEBUG RELEASE VS20 03 IA3 2 DLINK FLAGS NOLOGO NODEFAULTLIB IGNORE 4086 OPT REF OPT ICF 10 MAP ALIGN 32 MACHINE I386 LTCG DLL ENTRY ENTRYPOINT SUBSYSTEM CONSOLE SAFESEH NO BASE O DRIVER MERGE data text MERGE rdata text God ipad E FE IEEE EIE EE EIE FE FE FE FE FE E FE FE FE FE FE ET EIE FE HE FE FE FE FE FE REIHE ERE EIE FE FE FE FE HE FE FE FE FE E FE IHE HIE E FE FE FE FE HE HE RE UINIXGCC UINIX GCC UNIXGCC FAMILY GCC FE EE HE HE FE HEHE HE HE HE HEHE HE HE HE EH Common definitions FEE FE FE E FE HE HE FE FE E HE HEHE HEHE HH UNIXGCC DLINK FLAGS nostdlib 02 gc sections dll export all symbols entry ENTRYPOINT file alignment 0x20 section alignment 0x20 UNIXGCC ASM FLAGS c x assembler imacros DEST DIR DEBUG AutoGen h UNIXGCC PP FLAGS E x assembler with cpp include DEST DIR DEBUG AutoGen h UNIXGCC VFRPP FLAGS x c E P DVFRCOMPILE V include AutoGen h UNIXGCC MAKE PATH make FEE FE FE E FE HE HE FE FE E HE HE HE HEHE HEH
353. with a binary file system The file system used is typically the Firmware File System FFS but other file systems may be possible in some cases Hence all modules are stored as files in the FV Some modules may be execute in place linked at a fixed address and executed from the ROM while others May 2010 9 BUILD are relocated when they are loaded into memory and some modules may be able to run from ROM if memory is not present at the time of the module load or run from memory if it is available Files themselves have an internally defined binary format This format allows for implementation of security compression signing etc Within this format there are one or more leaf images A leaf image could be for example a PE32 image for a DXE driver Therefore there are several layers of organization to a full UEFI 2 3 PI 1 2 firmware image These layers are illustrated below in Figure 1 Each transition between layers implies a processing step that transforms or combines previously processed files into the next higher level Also shown in Figure 1 are the reference implementation tools that process the files to move them between the different layers Full Firmware Image FD Firm ware Volume Image CFV Firm ware Filesystem File EFI Section Files Firmware Image Files GenFw Header Modifications Compilers Assemblers Linkers etc PE32 PE32 Files Figure 1 UEFI PI Firmware Image Creation
354. xe exe DEF ICC_BIN64x86 xilink exe DEF ICC_BIN64x86 icl DEF ICC_BIN64x86 icl DEF ICC_BIN64x86 icl DEF ICC_BIN64x86 ias DEF ICC_BIN64x86 icl DEF ICC_BIN64x86 icl nologo c WX W4 GX Gy Od Zi nologo c WX W4 GX Gy Od N us X explicit M ilp64 N so N us X explicit M ilp64 N so NOLOGO NODEFAULTLIB LTCG DLL SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE_NAME map PDB DEST_DIR_DEBUG BASE_NAME pdb DEBUG RELEASE_ICCx86xASL_IPF_DLINK_FLAGS OPT REF ICF IGNORE 4086 MAP ALIGN 64 SECTION xdata D SECTION pdata D MACHINE IA64 ENTRY IMAGE ENTRY POINT SUBSYSTEM EFI BOOT SERVICE DRIVER May 2010 NOLOGO NODEFAULTLIB LTCG DLL 1 22 SAFESEH NO BASE 0 DRIVER MAP DEST DIR DEBUG BASE NAME map PDB DEST_DIR_DEBUG BASE NAME pdb ICCx86xASL IPF SLINK FLAGS nologo HEHEHE HE HE HEHE HE HE HE HE HE HEHE NE EBC definitions THER HEHE HEHE HE HE HE HEHE EHE EE HH ICCx86xASL EBC FAMILY INTEL ICCx86xASL EBC MAKE PATH DEF VS2005x86 BIN nmake exe ICCx86xASL EBC PP PATH ICCx86xASL EBC VFRPP PATH ICCx86xASL EBC CC PATH ICCx86xASL EBC SLINK PATH DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN iec exe DEF EBC BIN link exe ICCx86xASL EBC DLINK PATH DEF EBC BIN Mlink exe ICCx86xASL EBC MAKE FLAGS nologo ICCx86xASL EBC PP FLAGS nologo E TC FlAuto
355. y 2010 277 BUILD lt arch gt IA32 X64 IPF EBC lt FVS gt FVs lt FvImageName gt lt FvImageName gt lt FvImageName gt lt Word gt lt FFSEXT gt FFSExt Extension lt APRIORI gt APRIORI lt FvImageNameldx gt FvlImageNameIdx lt FvImageNameldx gt lt FvImageName gt PositiveInt lt PositiveInt gt Integer value greater than 0 lt EFN gt EFI FILE NAME Path Arch lt FileSep gt Word Example files EFI FILE NAME C Edk Sample Platform Nt32 Build IA32 2D2E62CF 9ECF 43b7 8219 94E7FC713DFE UsbKb dxe EFI FILE NAME C Edk Sample Platform Nt32 Build IA32 A5C6D68B E78A 4426 9278 A8FOD9EB4D8F UsbMassStorage dxe EFI FILE NAME C Edk Sample Platform Nt32 Build IA32 2D2E62AA 9ECF 43b7 8219 94E7FC713DFE UsbMouse dxe EFI FILE NAME C Edk Sample Platform Nt32 Build IA32 961578FE B6B7 44c3 AF35 6BC705CD2B1F Fat dxe G 4 Options Section 278 Summary Defines the options tag is found only in Firmware Volume INF files This is an optional section Prototype lt options gt options lt EOL gt lt expression gt lt expression gt Variable Value lt EOL gt lt Variable gt EFI BASE ADDRESS EFI BLOCK SIZE EFI FILE NAME EFI NUM BLOCKS EFI SYM FILE NAME IA32 RST BIN lt CName gt A valid C variable name May 2010 1 22 Ox HexDigit lt V
356. y This module type is used by UEFI Drivers that are compliant with the EFI 1 10 and UEFI 2 0 specifications These modules provide services in the boot services execution environment UEFI Drivers that return EFI SUCCESS are not unloaded from memory UEFI Drivers that return an error are unloaded from memory UEFI APPLICATION Any This module type is used by UEFI Applications that are compliant with the EFI 1 10 and EFI 2 0 specifications UEFI Applications are always unloaded when they exit 1 22 May 2010 299 BUILD 300 May 2010 1 22

Download Pdf Manuals

image

Related Search

Related Contents

STD32 Bedienungsanleitung  manual  OPERATING INSTRUCTIONS  User manual - Almi Machine Fabriek  PUBLICATION TTRIMESTRIELLE DDE LL`UNION - Snam-Cgt  cWichtig  Mise en page 1    Samsung SGH-F330 Vartotojo vadovas  Parole à l`exil juin 2007  

Copyright © All rights reserved.
Failed to retrieve file