Home

EDKII User Manual - The UK Mirror Service

image

Contents

1. Figure 5 Select Boot Maintenance Manager from Front Page 3 Select the Boot From File menu and enter it 46 March 2010 Boot Maintenance Manager Figure 6 Select Boot From File menu 4 Select the disk that contains the shell binary in the device path list for disks File Explorer Figure 7 Select disk contains EFI Shell binary image 47 March 2010 4 3 2 5 In File Explorer menus navigate the disk and find the shell efi file Figure 8 Select Shell efi binary image 6 Select Shell efi in the file list and enter Shell command Obtain the user manual and development manual for shell environment from http sourceforge net apps mediawiki tianocore index php title Efi shell Some useful internal shell commands are Table 9 Internal shell commands 48 Command Description alias Displays creates or deletes aliases in the EFI Shell attrib Displays or changes the attributes of files directories cd Displays or changes the current directory cls Clears the standard output with a background color connect Binds an EFI driver to a device and starts the driver copy Copies one or more files directories to another location cp T copies one or more files directories to another location March 2010 4 4 Command date del dh dir disconnect drivers drvcfg drvdiag echo exit help load Is map mkdir mv reconnect reset rm set
2. For an Nt32 platform its OUTPUT_DIRECToRY is set to Build NT32 in NT32 dsc The build configuration is as follows TARGET is DEBUG TOOL_CHAIN_TAG iS MYTOOLS ARCH iS IA32 The components of an EFI image are in WORKSPACE Build Nt32 DEBUG_MYTOOLS IA32 The FV and FD images are in WORKSPACE Build Nt32 DEBUG_MYTOOLS FV The output directory for the Helloworld application of MdeModulePkg Application HelloWorld HelloWorld inf is WORKSPACE Build Nt32 DEBUG_MYTOOLS IA32 MdeModulePkg Application Hello World HelloWorld OUTPUT Autogen c and Autogen h for a Helloworld application are in WORKSPACE Build Nt32 DEBUG_MYTOOLS IA32 MdeModulePkg Application Hello World HelloWorld DEBUG Build Single Module In general the single module such as UEFI application and Option ROM can be built by the following steps 1 Create a new package to contain this module Skip if the package exists 2 Add this module into a package Skip if the module is in a package 3 Run the edksetup script to set up the build environment 4 Configure the active platform to the package platform 5 Call the build command with m option to build this module 23 March 2010 3 4 1 Example Create new Package This step is only needed for a module that is not in any package Creating the package also creates two package metadata files DEC and DSC The package declaration DEC file is used to define the package public information s
3. Print Debug Message The DebugLib library class defined in MdePkg provide useful interfaces such as DEBUG ASSERT ASSERT_EFI_ERROR etc which are easily used in a module s source code For example 51 March 2010 4 5 2 DEBUG EFI D ERROR This is error debug information DEBUG EFI D INFO This is help debug information EFI_D_ERROR EFI_D_INFO indicates information level To get more information level definition reference MdePkg Include Libarry DebugLib h For example define DEBUG_INFO 0x00000040 Verbose define DEBUG_ERROR 0x80000000 Error define EFI D INFO DEBUG INFO define EFI D ERROR DEBUG ERROR PcdDebugPrintErrorLevel is used to control platform s debug information level Its value equals sum of all valid information level It can be customized in a platform s DSC file For example for a platform to enable debug and info message the value of PcdDebugPrintErrorLevel would be 0x80000040 InstallProtocolInterface 18A 31AB B443 4D1A ASCO GCH9261E9F71 9004084 InstallProtocolInterface 107A772C D5E1 11D4 9A46 0090273FC14D 9004178 InstallProtocolInterface 6A7ASCFF E8D9 4F76 BADA 75AB3G25CE14 96D417C InstallProtocolInterface S5B1B31A1 9562 11D2 8E3F 00A4C969723B 428A928 LoadLibraryEx CM tree r9 Build NT32 DEBUG_MYTOOLS IA32 Nt32Pkg WinNtGopDxe WinN it Go pDxe DEBUG WinNtGopDxe DLL NULL DONT_RESOLVE_DLL_REFERENCES gt Loading driver at DEEUG EFI_D ERROR This is error
4. 0x00000100 Variable define DEBUG_BM 0x00000400 Boot Manager define DEBUG_BLKIO 0x00001000 BlkIo Driver define DEBUG_NET 0x00004000 SNI Driver define DEBUG_UNDI 0x00010000 UNDI Driver define DEBUG_LOADFILE 0x00020000 UNDI Driver define DEBUG_EVENT 0x00080000 Event messages define DEBUG_ERROR 0x80000000 Error The platform developer can change value 0x80000000 to any other valid value in the range above Sum Up Create Release Tip for a Platform This section provides an example of how to make a release tip for an existing platform by using customization instructions mentioned in preceding sections To make the release binary take the following steps 1 Turn off all debug code which around with DEBUG_CODE macro PcdDebugPropertyMask is used to provide this type customization Its value is bit or from the following macros define DEBUG_PROPERTY_DEBUG_ASSERT_ENABLED 0x01 define DEBUG_PROPERTY_DEBUG_PRINT_ENABLED 0x02 define DEBUG_PROPERTY_DEBUG_CODE_ENABLED 0x04 define DEBUG_PROPERTY_CLEAR_MEMORY_ENABLED 0x08 define DEBUG_PROPERTY_ASSERT_BREAKPOINT_ENABLED 0x10 36 March 2010 define DEBUG_PROPERTY_ASSERT_DEADLOOP_ENABLED 0x20 In the platform release version changing its value to 0x0 will turn off all debug code 2 Turn off all debug message output PcdDebugPrintErrorLevel is used for controlling what type of debug message could be output as mentioned above In platform release
5. Nt32 platform Step 3 Configure the active platform such as build options target build tool chain and build rules The build configuration is introduced in section 3 2 Step 4 Call build command to build the platform module or target configured in step 3 See section 3 2 2 regarding the build command option See section 3 5 regarding the platform build and customization The module build is introduced in section 3 4 The build targets are listed in the end of this section Step 5 Post build steps can be done according to custom requirements For an NT32 platform execute the build run command to run NT32 emulation For the option ROM image create the option ROM The above run is a build target for build command to start NT32 emulation Besides there are other useful build targets They are e build e build all Build all libraries component PE COFF images and FV FD images e build clean 17 March 2010 3 2 3 2 1 Clean the intermediate output files such as the compiled obj files except the generated Makefile files top level and module makefiles and AutoGen files e build cleanall Clean all generated files and directories during build e build fds Only generate FV and FD image Build Configuration Build configuration includes three aspects They are separate for the active platform the tool chain and build rule The build configuration information is stored in three txt files target txt tools_def t
6. at the location to be debugged 2 Enter WORKSPACE Build Unix DEBUG ELFGCC IA32 3 ELF execution SecMain module should be loaded by GDB program in Unix host machine For example gdb SecMain 54 March 2010
7. generate at WORKSPACE OUTPUT DIRECTORY TARGET _ TOOL CHAIN TAG FV Unlike building a single module a general platform building requires an FDF Flash Device File that is specified in the DSC defines section An FDF file is a plain text file that describes the contents and layout of FV and FD file section by section Customize Platform This section provides general customization instructions e Add Remove Module e Adjust Flash Layout such as size and base address e Customize Build Option e Change Library Instance To customize for specific purpose one or more of the above instructions can be used At the end of the section an example of creating release platform is given for elaborating these instructions Add Remove module Add a module MdeModulePkg Universal Network Tcp4Dxe Tcp4Dxe inf Add this into FvRecovery firmware volume in Nt32 emulation as follows 1 Add the module INF file into NT32 DSC file if the module is not in the DSC file Refer to section 3 4 2 2 Search for the Fv FvRecovery section in Nt32Pkg Nt32Pkg fdf Fv FvRecovery looks as follows 30 March 2010 3 5 2 1 2 FV FvRecovery Basic definitions for a Firmware Volume FvAlignment 16 FV alignment and FV attributes setting ERASE POLARITY 1 READ LOCK STATUS TRUE FV s Apriori file definition the line start with INF indicate following INF path is for a module whose dispatching order will be sp
8. host Unix like operating systems such as various Unix and Linux distribution etc The SecMain module the Unix emulate platform loader is an executable ELF program It establishes emulate environment in host Unix like operating systems such as creating emulate system memory and flash device into host OS memory SecMain invokes PeiCore s entry as a real platform to handle off to PEI phase Unix platform provides many emulate devices to simulate device in an actual platform These emulate devices are written in POSI X X11 API For example GOP device is a window based X11 API and physical virtual disk is a mapping of the host operating system s directory Unix platform requires the following packages which can be downloaded from http edk2 svn sourceforge net svnroot edk2 trunk edk2 Please refer to chapter 2 e MdePkg e MdeModulePkg e _IntelFrameworkPkg e _IntelFrameworkModulePkg e UnixPkg e edkShellBinPkg e EdkFatBinPkg e BaseTools Build and Launch The build steps for Unix emulation platforms are follows d Build tools are executed from Python source code directly in a Unix like OS First download build tools from http edk2 svn sourceforge net svnroot edk2 trunk edk2 BaseTools 2 Some build related tools are written in C code Type make f GNUmakefile to build these tools under the downloaded build tools directory 3 Create a soft link to the downloaded directory into WORKSPACE Conf directo
9. instructions at http sourceforge net apps mediawiki tianocore index php title Step by step_instructions which help new developers set up their build environment and build their first EDK II package The instructions also cover setting up builds for Unix like platforms including building a GCC UEFI cross compiler for EDK II development The EDKII source repository is https edk2 svn sourceforge net svnroot edk2 trunk edk2 Before downloading EDKII source obtain an account on http www sourceforge net Please register it at https sourceforge net account registration EDKII Packages EDKII source consists of several packages shown in the following directories of the download directory BaseTools Provides the binary build tools and the templates of configuration files for building Build tools belong to another project please visit http sourceforge net apps mediawiki tianocore index php title Edk2 buildtools to get the source codes of build tools Conf Only has one readme txt file This directory will be used to contain the configuration files of building target and compiler parameters used for building MdePkg Declares PROTOCOLS PPIs GUIDs and related data structures defined in UEFI EFI and PI Specifications http www uefi org and industry standards In addition this package encompasses library instances defined in Module Development Environment which provides services for all the
10. should be customized Specific build option for module The build options for module can be overridden in the module INF or in the build option section of the platform build DSC file To override the build option in the module INF add a BuildOptions section into the module INF file This section is same as the BuildOptions section in the platform s build DSC To override the build option in the DSC file use the following steps 1 Find the module INF in Components section of DSC file 2 Add the module s override section by using 4 and under the module s INF Components IA32 MdeModulePkg Core Pei PeiMain inf lt Module Override section gt 3 Add the lt BuildOptions gt override section Components IA32 MdeModulePkg Core Pei PeiMain inf lt BuildOptions gt MSFT CC FLAGS Fa FAsc FRS R SBR 33 March 2010 3 5 2 4 3 5 2 5 The final build option for a module is based on global build option in tools_def txt Append build options from the module s INF Append the platform s overridden build option in the DSC file then append the module s overridden build options in the DSC file Note A reserved macro named MDEPKG_NDEBUG is introduced here for the intention of size reduction when compiler optimization is disabled If MDEPKG_NDEBUG is defined then debug and assert related macros wrapped by it are the NULL implementations Change library instance Different library instances th
11. version changing its value to 0x0 will turn off all debug message output 3 Review all library instances and try to select optimized library instances for library class 4 Remove unnecessary module from firmware volume file In the release version platform does not need internal shell functionality so remove the binary shell from FDF file 5 Use RELEASE target build platform For example build p Nt32Pkg Nt32Pkg dsc b RELEASE Under RELEASE target the compiler linker options are selected for maximum optimization in tools_def txt 3 6 Common Build Errors The following lists the common build errors and their solutions build is not recognized as an internal or external command The workspace and tools path are not set before build edksetup Script can be used to set build environment No active platform specified in target txt or build command line Active platform is not set Nothing is to be built The target build platform must be set to ACTIVE_PLATFORM in target txt or build command line build p active_platform dsc Active platform supports I A32 only but X64 is given The chosen ARCH is not supported by the active platform Nothing is to be built Only supported ARCH by the active platform can be set to TARGET_ARCH in target txt or build command line build a ARCH Module is not employed by active platform Single module build does not succeed This module needs to be specified in the active platform DSC fil
12. 0 3 5 2 5 1 3 5 2 5 2 Configure PCD type The PCD type comes from section name in the INF DEC DSC file If the PCD section s name is PCDs in the module s INF the Module developer is unconcerned about how to produce or consume an customizable value in a specific platform In another words the Module developer is not concerned about the final PCD type in the DSC file This is because a PCD s value may be fixed at build time in a specific platform but may be produced at runtime in another specific platform Module developers should use the following macro defined in MdeLib I nclude Library PcdLib h to get the value of this customizable information define PcdGet8 TokenName PCD GET MODE 8 TokenName define PcdGet16 TokenName PCD GET MODE 16 TokenName define PcdGet32 TokenName PCD GET MODE 32 TokenName define PcdGet64 TokenName PCD GET MODE 64 TokenName define PcdGetPtr TokenName PCD GET MODE PTR TokenName define PcdGetBool TokenName PCD GET MODE BOOL TokenName The Platform developer must determine the final PCD type for a PCD token For example the module MdePkg Library BasePciExpressLib BasePciExpressLib inf uses PCD PcdPciExpressBaseAddress which indicates the base address of PciExpress Bar Its value is fixed at 0xE0000000 in specific platforms so that in the platform s DSC file the PCD is written as follows PcdsFixedAtBuild common gEfiMdePkgTokenSpaceGuid PcdPciExpressBa
13. 010 Contents EDKII latroduetiori as no aaa taina i at i a ana at n rss i i 3 a i NT i 1 1 1 ON IA sasea cite c n a Beata oi Ba aia ot se ate la a i lat aa lat al el 1 1 1 1 UER and Pisici oa ca ni ata aaa a teii ial 2 1 1 2 EDK amp EDKV si sia at ai a oc a i 785 arie e 2 132 Related mformatiOn snsrnarinre shnaneowsnascaiienss detec catia i a reinen eed et 4 1 2 1 Useful publications and sources of information 4 1 3 1 4 Setting Up EDKII Development Environment nnen vereen enen eee ennn 9 2 1 How to Get the EDKII SOURCE it ee atatia initia a ati iai 9 2 2 EDK I PACKAGES occ ee cic atata lat ana a ad t a act ai iata a a ast i 9 2 3 Third Party Tools nn aseze siana ai mt tdi en eu 13 2 3 1 Target for A 32 and Intel64 Processors nnee eenen 13 2 3 2 Target for Intel Itanium Family Processors IPF n ees 15 2 3 3 Target for EFI Byte Code EBC Image nnen eenen 15 2 4 A Quick Build EE NE 16 EDKII BuildPFOCESS anneer nen ai iapa aa de dee ac 17 3 1 Basic build steps introduction aaa ate rea aer an aa aia art aaa an 17 3 2 Build Configuration stenen eden iin ti ea la 18 3 2 1 Configure the active platform vooor venen ennen venen 18 3 2 2 Build command options ses vaa ema area ante n sata aaa ae ennen inn 19 3 2 3 Configure the build tool chain and flags vennen eneen 20 3 2 4 Configure the build rules naars ien rca ede a ao a al a ta 22 3 3 Build Output DIrECtOrY isca si
14. A 32 and Intel64 processors based platforms 2 Intel C Compiler ICC Table 2 Intel C Compiler Name Version URL Intel C Compiler for 9 1 http www intel com support performancetools c wi Windows ndows index htm After the downloading web page select the correct version number to download 13 March 2010 Build EDKII using an Intel C Complier requires a Microsoft Visual Studio installation Please refer to Table 1 to install one version of Microsoft Visual Studio 3 Microsoft Windows Driver Development Kit DDK To build a physical platform because it has 16 bit assembly codes the Microsoft Windows Driver Development Kit must be installed Please refer to Table 3 to install it Table 3 Microsoft Window Driver Development Kit DDK Name Version URL Microsoft Windows 2790 1830 http download microsoft com download 9 0 f 90fO Driver Development 19ac 8243 48d3 91cf Kit DDK 81fc4093ecfd 1830_usa_ddk iso 4 GCC Tool Chain There are two GCC tool chains One is used to build and launch Unix Emulation Platform on platforms based on the IA 32 processor Another is used to build UEFI images running on the actual platforms To build and launch Unix Emulation Platform target requirements include the 32 bit Unix like operating system environments and a group of software that includes GNU C Compiler GNU Binutils GNU Glib C X11 SQlite and Python The software provided by a Unix like operat
15. Developers also can put all modules that are independent of various platforms into a single package Therefore developers only need focus on platform specific code when porting to a new platform The EDKII provides a set of packages which are introduced in next chapter As some of the packages are not necessary for building a given module or firmware Firmware developers can only choose relevant packages to finish building or releasing Additionally a developer can also create and distribute his or her own package based on the EDKII code base For further information please refer to the EDKII Package Specification Library class Library Instance Because demand exists for the same functionality in the development of firmware but different implementations may be needed such as e using C code to provide cross architecture ability rather than using assembly to provide better performance e using I O port to perform PCI configuration cycles but not using memory 1 0 instructions The Library Class is a set of standard API definitions that are used to provide certain functionality A module writer can directly use them to program A library instance supplies the implementation of these APIs The relationship between library class and library instance is one to many A library class may have multiple implementations that is multiple library instances A module only depends on a library class and not concrete implementations so the same m
16. EDKII User Manual March 1 2010 Revision 0 7 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 Except for a limited copyright license to copy this specification for internal use only no license express or implied by estoppel or otherwise to any intellectual property rights is granted herein Intel disclaims all liability including liability for infringement of any proprietary rights relating to implementation of information in this specification Intel does not warrant or represent that such implementation s will not infringe such rights 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 This document is an intermediate draft for comment only and is subject to change without notice Readers should not design products based on this document Intel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States and other countries Other names and brands may be claimed as the property of others Copyright 2008 2010 Intel Corporation ii March 2
17. ED_ARCHITECTURES lists the supported ARCHs BUILD_TARGETS defines the supported target LibraryClasses section This section includes all library instances required by the modules in Components section The library instance is specified as follows LibraryClassName Library Instance INF file relative to workspace Pcds section These sections set the values for the different type PCD used by the module If the value of the used PCD is not set in the DSC file the PCD value will be the default value in the package DEC file that publishes this PCD 25 March 2010 3 4 1 4 3 4 2 Components section The modules to be built are specified here Add the module into a package The module should be grouped into a package It can be placed into the package directory according to the package layout For the recommended package layout refer to section 2 2 To build the module its INF file must be specified into the Components section of a DSC file and its dependent library instances and PCD values also need to be set in the corresponding section of the DSC file The module I NF file includes the source files the used Ppi Protocol Guid CName the dependent library classes and PCD The following example is from MdeModulePkg Application HelloWorld INF file It does not depend on any Ppi Protocol or Guid but it uses five library classes and two PCDs 26 March 2010 Example HelloWorld inf 3 4 2 1 Defines INF_VERS
18. EFINE VS2003_BIN D Program Files Microsoft Visual Studio NET 2003 Vc7 bin DEFINE VS2003_DLL D Program Files Microsoft Visual Studio NET 2003 Common7 IDE 21 March 2010 3 2 3 2 3 2 3 3 3 2 4 3 3 Change tool flags When the default tool flags do not meet requirements update them in tools_def txt For example to disable all compiler optimization for vs2003 tool chain the vs2003 cc FLAGS needs to use od option in place of o1 option like DEBUG _VS2003 IA32 CC FLAGS nologo c WX W4 Gs8192 Gy D UNICODE Od GL FIAutoGen h EHs c GR GF GX Zi Gm Add new tool chain For tool chains other than the tool chain list given above defined in tools_def txt add it into tools_def txt file Similar to the existing tool chain definition such as vs2003 users can quickly define the new TagName to contain their tool chain and tool flags For more detail information refer to the template tools_def txt file and EDK II Build Specification Chapter 5 Configure the build rules The build rules describes how the individual source files are compiled and linked These rules are defined in build_rule txt file The template build_rule txt file provides the common build rules to cover all source files in EDKII such as c h asm files and so on However if a new type file is added to be built the corresponding build rule for this file must be created into build_rule txt The instructions on how to create build r
19. ION 0x00010005 BASE NAME HelloWorld FILE GUID 6987936E ED34 44db AE97 1FA5E4ED2116 MODULE TYPE UEFI APPLICATION VERSION STRING 1 0 ENTRY_POINT UefiMain Sources HelloWorld c Packages MdePkg MdePkg dec LibraryClasses UefiBootServicesTableLib UefiApplicationEntryPoint UefiLib DebugLib PcdLib Guids Ppis Protocols FeaturePcd gEfiMdeModulePkgTokenSpaceGuid PcdHelloWorldPrintEnable Pcd gEfiMdeModulePkgTokenSpaceGuid PcdHelloWorldPrintString gEfiMdeModulePkgTokenSpaceGuid PcdHelloWorldPrintTimes LibraryClasses section The names of library classes required by the module are listed here HelloWorld is an example to explain how to get all required library instances by the module From the above HelloWorld INF file we know that HelloWorld directly depends on UefiLib DebugLib UefiApplicationEntryPoint UefiBootServicesTableLib and PcdLib library classes For these library classes there are multiple library instances provided in MdePkg The following five instances are chosen for this application UefiApplicationEntryPoint MdePkg Library UefiApplicationEntryPoint UefiAp plicationEntryPoint inf UefiBootServicesTableLib MdePkg Library UefiBootServicesTableLib UefiBoot ServicesTableLib inf UefiLib MdePkg Library UefiLib UefiLib inf DebugLib MdePkg Library UefiDebugLibStdErr UefiDebugLibStdErr inf PcdLib MdePkg Library DxePcdLib DxePcdLib inf Of the five instances shown above the UefiLib librar
20. PI Compiler is irina maureen teren innn santen la aa ra ca te etende sne deense 15 Table 6 Microsoft Visual Studi anar nai ea as diane iat tea 15 Table 7 Intel C Compiler for EFI Byte Code Compiler ane eee 16 Table 8 The list of supported tool chain tags cece cece eee eee eneneneneneenenn 21 Table 9 Internal shell com Mand Shvann tente iv 48 vi March 2010 Revision History Revision Number 0 5 0 6 0 7 vii Description Initial document UnixPkg instruction and Tools_def txt updates plus Run network under NT32 DUET Unix build and set up Option ROM generation and general editing and formatting Edkll project website and repository update plus new core package introduction new MDEPKG_NDEBUG build macro generic build error info Revision Date 09 11 2008 June 9 2009 March 1 2010 March 2010 viii March 2010 1 EDKII Introduction This document provides detailed instructions for downloading configuring and building an EDKII project as well as running EDKII Emulation Environments 1 1 Overview This chapter describes the features introduced by EDKII project and elaborates the role played by several key features This chapter provides readers with a basic understanding on EDKII after reading The features introduced by EDKII include Minimal unit of distribution EDKII introduces the concept of Packages It is the basic unit of code release Compared to EDK EDK II users can rele
21. ase and work with Packages as opposed to the Whole Source Tree Different implementations for the same functionality EDKII introduces the concept of Library Class Library Instance Library class is a set of standard interfaces for common support routines and library instance supplies the implementation of these interfaces Platform integrator can select different implementations upon various application scenarios Uniform configuration interface for module writers Platform Configuration Database PCD is a mechanism that provides module writers a uniform interface to extract external input information determined in build time or run time of firmware This mechanism standardizes the exposure of platform and module settings that can in turn facilitate platform porting Cross architecture and Cross compiler ability EDKII source supports various architectures such as A32 X64 IA64 and various tool chains such as Microsoft VC GNU GCC and Intel ICC To support this capability EDKII offers specific implementations for architecture related or compiler related functions in libraries Binary compatibility for pre Pl modules The EDKII provides thunk drivers to address the binary compatibility issues with using existing pre P EDK modules in a platform comprised of mostly EDK II modules 1 1 1 1 1 2 1 1 2 1 Refined basic APIs known as Module Development Environment Library In EDKII there are many APIs that are
22. at produce the same library class are designed for different purposes such as for a PEI DXE phase optimization for performance or size for different architectures etc In the platform DSC different library instances can be selected for a specific library class in the LibraryClasses section For example IntelFrameworkModulePkg Library PeiDxeDebugLibReportStatusCode PeiDxeDebu gLibReportStatusCode inf library instance is selected for DebugLib library class for DXE_ DRIVER First search for the LibraryClasses common DXE DRIVER section in DSC file If not found the new section is added Then add this library instance into the section given above and remove the originally selected debug library instance LibraryClasses common DXE DRIVER DebugLib IntelFrameworkModulePkg Library PeiDxeDebugLibReportStatusCode P eiDxeDebugLibReportStatusCode inf Configure PCD The PCD mechanism provides FeatureFlag FixeAtBuild PatchabelnModule and Dynamic DynamicEx types for a PCD token These types are often used customization methods e Macro in which the value is fixed at build time e Global variable in which the value can be fixed at build time and could be changed at runtime e EFI variable in which the value is produced consumed at runtime The PCD mechanism unifies these customization methods The PCD type and value for a PCD token can be customized by platform developers as shown in the subsections below 34 March 201
23. by the pipe character and then followed by the size of region A layout region may contain a firmware volume variable or user defined data To adjust flash layout the offset and size value for each region may be updated to make sure that all regions are not overlapped in one FD section Customize build option As mentioned in section 3 2 3 WORKSPACE Conf tools_def txt file defines the global tool tag which group different compiler linker options Modifications in this file will affect all platform build or single module build in specified tool tag Developers can override the global compiler linker option for the specified platform or module 32 March 2010 3 5 2 3 1 3 5 2 3 2 Specific build option for platform The BuildOptions section in the platform build DSC file is used to override the global build option The build option in this section is appended to the end of the global build option For example this gives the following section in the platform build DSC file BuildOptions MSFT CC FLAGS Fa FAsc FR QR SBR MSFT Microsoft compiler family First Target means for all valid targets DEBUG RELEASE Second Tool chain tag means for all valid tool chain tags defined in tools_def txt Third Architecture means for all valid architectures such as 1A32 x64 IPF cc Command type The build command type CC is compiling command FLAGS Attribute The attributes of commands that
24. debug information InstallProtocolInte SS as GEE Ss aid This is error debug information This is help debug information InstallProtocollInterface 18AG31AB B443 4D1A 5CO GC09261 E9F71 96E5128 EIZ ann SAALE DEBUG EFI_D INFO This is help debug information InstallProtocolInte s oD PD iu p InstallProtocolInterface 5B1B31A1 9562 11D2 8E3F 00A0C969723B 428A7A8 LoadLibraryEx M tree r Build NT32 DEBUG_MYTOOLS IA32 Nt32Pkg WinNt impleFileS ystemDxe WinNtS impleFileS ystemDxe DEBUG WinNtS impleFileSystemDxe DLL NULL DONT_RESOLVE_DLL_REFERENCES gt Loading driver at 6x66663A93006 EntryPoint 6x86669GF1666 WinNtSimpleFileSystemDx e efi InstallProtocolInterface BC62157E 3E33 4FEC 9920 2D3B36D 50DF 4288698 InstallProtocolInterface 18A031AB B443 4D1A A5Ca ACA9261E9F71 9GF6GD8 InstallProtocolInterface 107A772C D5E1 11D4 9A46 0090273FC14D 9 F6GE8 Figure 10 Debug Info message output Single Step Debugging in Nt32 Emulate Platform Put _asm int 3 at the location to be debugged When launching Nt32 emulate platform Windows system default debugger is launched automatically and stops at the location of _asm int 3 52 March 2010 Figure 11 INT 3 is triggered Click the Cancel button and system debuggers will be listed in following dialog Select the New instance of Visual Studio 2005 if the emulation is built by Visual Studio 2005 isual Studio Just In Time Debugger New instance of Visual Stu
25. dio 2005 Select ajm debugger Click Yes to launch debugger Figure 12 Select System Debugger 53 March 2010 SecMain Debugging Microsoft isual Studio File Edit View Project Debug Tools Test Window Help TERETA VERE N ip ua als lt a he 3 2 0 88 ARABE secmain c UINTN StackPointer MemorySi zeStr FirmwareVolumesStr CHARI6 FixedPedGetPtr PcdWinNtMemorySizeForSecMain CHARI6 FixedPedGetPtr PedWinNtFirmwareVolume printf nEDK SEC Main NT Emulation Environment from www TianoCore orgin SRIF if ff Make some Windows calls to Set the process to the highest priority in the ff idle class We need this to have good performance if SetPriorityClass GetCurrentProcess IDLE_PRIORITY_CLASS SetThreadPriority GetCurrentThread J THREAD_PRIORITY_HIGHEST Name p SecMain exe main int Argc 0x00000001 char Arqv 0x003a48a0 char Envp 0x003a3138 Line 175 SecMain exe __tmainCRTStartup Line 586 0x19 bytes E SecMain exe mainCRTStartup Line 403 E aerul 32 Ze EEE iCall Stack Breakpoints Output fq Autos Locals 23 Memory 1 ex Registers 5 Threads Modules Watch 1 Ready Ln 176 Col 1 chi Figure 13 Debugger is launched at first break point 4 5 3 Single Step Debugging in Unix Emulate Platform Single step debugging in Unix emulates platforms is like the Nt32 emulated platform 1 Put asm int 3
26. directories Include public header files of MDE Package la32 internal header files specified to A 32 architecture X64 internal header files specified to x64 architecture Ip internal header files specified to IPF architecture 11 March 2010 Ebc internal header files specified to EBC architecture Uefi public header files containing UEFI2 1 definitions Pi public header files containing PI1 0 definitions Protocol public header files containing PROTOCOLs definitions Ppi public header files containing PPIs definitions Guid public header files containing GUIDs definitions IndustryStandard public header files containing Industry Standard Library public header files containing MDE Libraries classes Library MDE libraries instances The internal header files only could be referred by those public header files A dependency relationship exists among EDKII packages For example the module in MdeModulePkg uses the protocols defined in MdePkg so MdeModulePkg will depend on MdePkg The following chart illustrates the dependencies among the packages in EDKII Nt32Pkg UnixPkg DuetPkg IntelFrameworkModulePkg MdeModulePkg EdkFatBinPkg IntelFrameworkPkg P MdePkg EdkShellBinPkg A EEEN Ge ia EdkCompatibilityPkg OptionRomPkg A EdkShellPkg Figur
27. e 37 March 2010 File directory not found I ntelFrameworkPkg ntelFrameworkPkg dec Package DEC file is not found The required package needs to be placed into the workspace Cannot open include file windows h No such file or directory This error may happen when building an NT32 platform Windows header files required by NT32 are not in system path edksetup bat nt32 can set this path Failed to start command C Program Files Microsoft Visual Studio 8 Vc bin nmake exe VS2005 nmake command is not found VS2005 may not be installed Because the default tool chain is MYTOOLS with VS2005 change the default tool chain to the third party tool chain For example for a VS2003 compiler set VS2003 tool chain to TOOL CHAIN TAG in target txt or build command line build t VS2003 Error LNK2001 Unresolved external symbol memset The MS compiler may optimize code by the means of using intrinsic functions as possible as it can Because we disable the link of the C standard run time library it may cause compiler link break The developer has two ways to avoid it 1 Update the sources to call MdePkg Library functions 2 Decrease the optimization level in the BuildOptions section of the DSC file i e the GL or Od 38 March 2010 4 1 4 2 4 2 1 4 2 1 1 4 EDKI I Emulation Environment Overview An Emulation platform is not an actual platform but is designed to prove the stability of EDKII s core module
28. e 1 Packages Dependency From this chart the following basic dependencies can be discovered for example 12 March 2010 2 3 2 3 1 1 To build OptionRomPkg only MdePkg and BaseTools are required 2 To build EdkCompatibilityPkg only MdePkg IntelFrameworkPkg and BaseTools are required 3 To build EdkShellPkg only EdkCompatibilityPkg and BaseTools are required 4 To build the NT32 Unix Duet emulation platforms MdePkg MdeModulePkg IntelFrameworkPkg IntelFrameworkModulePkg EdkFatBinPkg EdkShellBinPkg and BaseTools are required Third Party Tools Besides downloading EDKII source some third party tools are still needed to build EDKII The third party tools include a C compiler and an assembler An ACPI compiler is required to build ACPI table Target for A 32 and Intel64 Processors To build EDKII for the platforms based on IA 32 or Intel64 processors the following compiler tool chains may be selected 1 Microsoft Visual Studio One version of Microsoft Visual Studio from Table 1 may be installed to build EDKII Table 1 Microsoft Visual Studio Name Version URL Microsoft Visual 2005 http msdn2 microsoft com en us vstudio Studio Professional Microsoft Visual 2003 NET http msdn2 microsoft com en us vstudio Studio By default the EDKII source on http sourceforge net apps mediawiki tianocore index php title Edk2 is set to use Microsoft Visual Studio 2005 Professional to build the
29. e INF or binary image description in FDF file 2 Delete the reference of module INF path or binary image description 31 March 2010 3 5 2 2 3 5 2 3 3 If the module is also included in platform build DSC file it will be removed from the Component section in DSC file Adjust flash layout Flash device image is described as FD XXX section in FDF file An example NT32 FD section follows FD Nt32 FD basic definitions BaseAddress 0x0 The base address of the FLASH Device Size 0x002a0000 The size in bytes of the FLASH Device ErasePolarity 1 BlockSize 0x10000 NumBlocks Ox2a HEHEHE HE HE HE HE HE E FE HE HE HE FE FE HE HE HH FE HE HE FE FE HE HE HE HE HE HE E FE FE HE HE FE FE FE E HE FE FE REE HH FE HE HE HE EH ERR EE HEHE HEH H EEE Following are lists of FD Region layout which correspond to the locations of different images within the flash device Regions must be defined in ascending order and may not overlap HEHEHEHE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE HE E HE HE HE HE HE HE HE HE HE HE FE FE FE FE FE HE FE FE FE FE FE FE FE FE FE FE FE HE HE HE HE HE HEHE HEHEHEHEHE HEHHEHE 0x00000000 0x00280000 FV FvRecovery 0x00280000 0x0000c000 0x0028c000 0x00002000 0x0028e000 0x00002000 0x00290000 0x00010000 NV_FTW_SPARE An FD section includes basic definitions and region information A layout region start with an eight digital hex offset followed
30. ecified in PEI DXE Apriori file APRIORI PEI INF MdeModulePkg Universal PCD Pei Pcd inf INF IntelFrameworkModulePkg Universal StatusCode Pei PeiStatusCode inf APRIORI DXE INF MdeModulePkg Universal PCD Dxe Pcd inf INF Nt32Pkg MetronomeDxe MetronomeDxe inf i Module which will be put into this FV The line start with INF indicate following INF path is for a module which will be put into this FV All modules will be put into this FV as their following order INF MdeModulePkg Core Pei PeiMain inf INF MdeModulePkg Universal PCD Pei Pcd inf INF IntelFrameworkModulePkg Universal StatusCode Pei PeiStatusCode inf INF Nt32Pkg BootModePei BootModePei inf INF MdeModulePkg Application HelloWorld HelloWorld inf Binary image will be put into this FV FILE DRIVER 961578FE B6B7 44c3 AF35 6BC705CD2B1F SECTION PE32 FatBinPkg EnhancedFatDxe Ia32 Fat efi New moudle will be added into this FV INF MdeModulePkg Universal Tcp4Dxe Tcp4Dxe inf As descriptions in the sample FvRecovery a general FV section includes the basic definition Apriori file definition modules and binary images The Apriori file is generated at the beginning of FV image The following module s order in the generated FV image is the same as their order specified in the FV section 3 Put the INF MdeModulePkg Universal Network Tcp4Dxe Tcp4Dxe inf at end of FV section Remove a module binary image from FV J Search for the modul
31. execution phases in the Intel Platform Innovation Framework for EFI MdeModulePkg Provides a group of modules crossing platforms based on UEFI EFI and PI Specifications It also includes the libraries instances serviced for these modules IntelFrameworkPkg Declares PROTOCOLs PPIs GUIDs and related data structures are defined in Intel Platform Innovation Framework Specification for EFI http developer intel com technology framework spec htm In addition this package encompasses library instances based on Intel Platform Innovation Framework Specification IntelFrameworkModulePkg Provides a group of libraries instances and modules crossing platforms based on Intel Platform Innovation Framework Specification It also includes the libraries instances serviced for these modules EdkShellPkg Provides the build instructions of Shell project EFI Shell belongs to another project please visit http sourceforge net apps mediawiki tianocore index php title Efi shell for more details EdkShellBinPkg Provides the binary Shell files and the binary shell applications for different CPUs architectures EdkFatBinPkg Provides the binary FAT drivers for different CPUs architectures FAT driver belongs to another project please visit http sourceforge net apps mediawiki tianocore index php title Edk2 fatdriver2 to get the source code of FAT driver 10 March 2010 Nt32Pkg Launched at 32 bit Microsoft Wind
32. gPrintErrorLevel to extract its value The value of the PCD is determined by a platform configuration in the module build Various values may cause different behavior such as enabling or disabling the display of particular debug print statements Related Information Useful publications and sources of information Unified Extensible Firmware Interface Specification Version 2 1 The Unified EFI Forum Inc 2007 http www uefi org Extensible Firmware Interface Specification Version 1 10 Intel 2001 http developer intel com technology efi Intel Platform Innovation Framework for EFI Specifications Intel 2006 http www intel com technology framework TianoCore org site documentation http sourceforge net projects edk2 files EDK II INF File Specification Version 1 2 Intel 2009 EDK II DSC File Specification Version 1 2 Intel 2009 EDK II DEC File Specification Version 1 2 Intel 2009 EDK II FDF Flash Description File File Specification Version 1 2 Intel 2009 EDK II Build Specification Version 1 2 Intel 2009 Terms The following terms are used throughout this document to describe varying aspects of input localization 4 March 2010 EDK EDK II EFI Developer s kit the open source project of the Intel Platform Innovation Framework for EFI that can be found at http sourceforge net apps mediawiki tianocore index php title EDK A generic term to describe the open source
33. get for Intel Itanium Family Processors IPF To build EDKII for the platforms based on Itanium Processor Family IPF processors the following compiler tool chains may be selected 1 Microsoft Visual Studio Table 6 Microsoft Visual Studio Name Version URL Microsoft Visual 2005 Team Suite http msdn2 microsoft com en us vstudio Studio When installing Microsoft Visual Studio 2005 Team Suite IA64 support must be selected 2 Intel C Compiler ICC Please refer to Table 2 to install the Intel C Compiler To build EDKII with Intel C Complier a Microsoft Visual Studio installation is also required Please refer to Table 1 to install one version of Microsoft Visual Studio 3 Microsoft Windows Driver Development Kit DDK By default the EDKII source on http sourceforge net apps mediawiki tianocore index php title Welcome_to TianoCore is set to use Microsoft Windows Driver Development Kit DDK to build the Intel Itanium Processor Family processors based platforms Please refer to Table 3 to install Microsoft Windows Driver Development Kit DDK 4 ACPI Compiler To build ACPI tables one of ACPI compilers listed in Table 5 must be installed Target for EFI Byte Code EBC Image The Intel C Compiler for EFI Byte Code creates EFI Byte Code EBC images that can be executed by systems implementing the EFI 1 10 UEFI 2 0 or later specifications 15 March 2010 2 4 These systems include an EBC interpreter tha
34. ging in Nt32 Emulate Platform 52 4 5 3 Single Step Debugging in Unix Emulate Platform eee 54 March 2010 FIGURES Figure 1 packages Dependency weiss ie iai a gta n i gata a ede 12 Figure 2 Startup flow for Duet environment nnen eneen er venen enen enene eneen 42 Figure 3 Select Boot Manager Menu nonnen enen enenrereenenenenenene eneen 45 Figure 4 Select EFI Internal Shell from Boot Manager nnee enen eneen 45 Figure 5 Select Boot Maintenance Manager from Front Page nnen 46 Figure 6 Select Boot From File MENU rennen iens tre dae 47 Figure 7 Select disk contains EFI Shell binary image eenen eneen eenen 47 Figure 8 Select Shell efi binary image nde eenen eenen eeneneneneneneneneneen ven 48 Figure 9 EFI network driver layout an enor te a e i a na ini ar m a i ai a la 50 Figure 10 Debug Info message output eee eee eee nenea tana ee 52 Figure 11 INT 3 iS triggered nerven iri ce ia a oa i aa de 53 Figure 12 Select System Debugger ii ese vaa canta aaa mia e tn sata aa i aie aa a 53 Figure 13 Debugger is launched at first break point nnee eneen 54 v March 2010 TABLES Fable Microsoft Visual Studio scite tea it vat ia ii ta a 13 Table 2 Intel C Com piletiis csc imita atelier amo ata n a i tat a tei a a 13 Table 3 Microsoft Window Driver Development Kit DDK eee eee 14 Table 4 Software Needed by GCC Tool Chain nnen eneen eneen enen en ennen 14 Table 5 AC
35. he drivers is shown in the following image 49 March 2010 Figure 9 EFI network driver layout To help develop networking applications EDKII provides a SNPNT32Dxe driver in Nt32Pkg SnpNt32Dxe folder that implements the EFI_SIMPLE_NETWORK_PROTOCOL for the NT32 platform In conjunction with the UEFI network stack drivers this driver can be used to develop and test networking applications on Windows NT operating system through the EDK s NT32 platform emulation environment The SNPNT32 driver depends on the WinPcap download it from http www winpcap org install default htm to transmit and receive packets on the Windows system To limit the number of symbols imported into the NT32 platform SnpNt32 call the functions in the SnpNt32lo dynamic library to transmit receive packets The SnpNt32lo library in turn consumes the service provided by WinPcap To enable test network functionality following steps should be taken 1 Install WinPcap application 2 Download SnpNt32lo dynamic library source code from http sourceforge net apps mediawiki tianocore index php title Network io build it and generate SnpNt32lo dll 3 Add following drivers into Nt32Pkg dsc s Components section MdeModulePkg Universal Network DpcDxe DpcDxe inf MdeModulePkg Universal Network ArpDxe ArpDxe inf MdeModulePkg Universal Network Dhcp4Dxe Dhcp4Dxe inf MdeModulePkg Universal Network Ip4ConfigDxe Ip4ConfigDxe inf MdeModulePkg Universal Netwo
36. ich binary targeted One or more of IA32 IPF X64 or EBC can be set Multiple values can be specified on a single line by using space character to separate them If the platform requires multiple architectures for example 32bit Pei module and 64bit Dxe module this option must be set to TA32 x64 If the module is built for multiple architectures for example a library is built for TA32 and x64 this option must also be set to IA32 x64 If the line is missing or no value is specified all supported architectures specified in the platform description file will attempt to be built The current setting is to build TA32 platform TOOL_CHAIN_TAG TOOL CHAIN TAG specifies the tool TagName defined in tools_def txt to be used for build By default MyrooLs TagName is chosen It refers to Microsoft Visual Studio 2005 for TA32 and x64 target architecture and the Microsoft Windows DDK WINDDK version 3790 1830 for IPF target architecture MULTIPLE THREAD and MAX_CONCURRENT_THREAD_ NUMBER MULTIPLE THREAD and MAX CONCURRENT THREAD NUMBER are used to enable multi thread build We recommend setting the number of concurrent threads to one more than the number of computer cores or CPUs in the machine used This feature is only available for spawn build mode such as platform build However the clean cleanall or stand alone module build continue to use the normal method TOOL CHAIN CONF and BUILD RULE CONF TOOL CHAIN CONF and BUILD RULE CONF spec
37. ify the name of the files which specify the tool chains and build rules to be used for build By default tools_def txt and build_rule txt are used Build command options Build command provides the command line options to configure the build process which can override the build configurations in target txt If the corresponding build option is not set the build setting is from target txt Otherwise the build setting is decided by build command line options Some usual usages of Build command are followed Set the build configuration Target Arch and Tool chain build a X64 t MYTOOLS b DEBUG 19 March 2010 3 2 2 2 3 2 2 3 3 2 2 4 3 2 3 The active platform defined in target txt file will be built to the debug images for x64 arch under MyTOOLs tool chain The active platform is not overridden a option sets the build arch to override TARGET_ARCH setting in target txt t option sets the tool chain to override TOOL_CHAIN_TAG setting in target txt b option sets the build target to override TARGET setting in target txt Set the active platform build p MyPlatform MyPlatformPkg dsc MyPlatform is built as the active platform p option sets the active platform to override ACTIVE PLATFORM setting in target txt Build a specified module build m MdeModulePkg Application HelloWorld HelloWorld inf The HelloWorld application is built as the single module based on the active platform specified in target tx
38. ing system can be used directly or downloaded and built as listed in Table 4 Table 4 Software Needed by GCC Tool Chain Name Version URL GNU C Compiler GCC 4 2 1 http gcc qnu org qcc 4 2 GNU Binutils 2 17 50 http ftp qnu org gnu binutils GNU Glib C 2 3 6 http ftp gnu org gnu glibc X11 7 2 http ftp x org pub X11R7 2 SQLite 3 0 or later http www sqlite or Python 2 5 2 or later http www python org To build EDKII as a target for IA32 and Intel64 architectures the updated software to generate the UEFI images capable of running on actual platforms will be needed First the SQLite and Python version listed in the upper table will need to be downloaded and installed Then use the script http edk2 svn sourceforge net svnroot edk2 trunk edk2 BaseTools gcc min gw gcc build py to download all needed software and to build automatically This script belongs to BaseTools project Use your account on http sourceforge net apps mediawiki tianocore index php title Welcome_to TianoCore to download it 14 March 2010 2 3 2 2 3 3 5 ACPI Compiler To build ACPI tables one of ACPI compilers listed below needs to be installed Table 5 ACPI Compiler Name Version URL ACPI Component 20061109 http acpica org downloads Architecture or later Microsoft ACPI 3 0 0NT or http www microsoft com whdc system pnppwr powe Source Language later rmgmt default mspx ASL Assembler Tar
39. ionRom package to the release EFI images for EBC arch under the default MyTOOLS tool tag build m OptionRomPkg AtapiPassThruDxe inf a EBC t MYTOOLS b RELEASE p OptionRomPkg OptionRomPkg dsc If AtapiPassThruDxe module sets PCI options in its INF Defines section the EFI option ROMimage will also be generated PCI options can be set as follows Defines INF_VERSION 0x00010005 BASE NAME AtapiPassThruDxe FILE GUID E49061CE 99A7 41d3 AB3A 36E5CFBAD63E MODULE TYPE ENTRY POINT UEFI DRIVER InitializeAtapiPassThru PCI option for VendorId DeviceId ClassCode and Revision PCI VENDOR ID 0x8086 PCI DEVICE ID 0x29c2 PCI CLASS CODE 0x030000 PCI_REVISION 0x1000 Build Customize Existing Platform This section introduces how to build an existing platform in detail and how to customize the platform for different purposes such as debug or release image optimization for performance optimization for small size etc Build Existing Platform Use the following steps to build an existing platform 1 Download all packages required by this platform into workspace 2 Run edksetup script to setup build environment 29 March 2010 3 5 2 3 5 2 1 3 5 2 1 1 3 Configure WORKSPACE Conf taget txt file 4 Run build command After building all output files will be generated into WORKSPACE OUTPUT_DIRECTORY TARGET _ TOOL CHAIN TAG Refer to section 3 3 FD image burned to flash device is
40. is built from EDK project s Edk Sample Platform Duet Tools Efildrl mage to create boot sector in target hard disk in an VEFI environment Linux The Duet platform also can be built with the Mingw tool chain under a Linux environment Steps for building Mingw tool chain 1 Check out the build project from the svn repository http edk2 svn sourceforge net svnroot edk2 trunk edk2 BaseTools 2 Build the buildtools with command make f GNUmakefile 3 Enter gcc folder and run mingw gcc install py which will download build install MinGw GCC and corresponding binutil automatically 4 Create soft symbol link to match the default path provided in tools_def txt with the following command In s BaseTools gcc symlinks ar opt tiano i386 tiano pe i386 tiano pe bin ar In s BaseTools gee symlinks gee opt tiano i386 tiano pe i386 tiano pe bin gcc 43 March 2010 4 3 4 3 1 4 3 1 1 In s BaseTools gcc symlinks 1d opt tiano i386 tiano pe i386 tiano pe bin 1d Note File lt Workspace gt Conf tools_def txt gives UNI XGCC tool chain to describe the build options for MinGW GCC UNIXGCC tool chain is used to build Duet platform Steps for building Duet platform under UNI XGCC tool chain 1 Open a Linux shell command and enter workspace folder 2 Create soft link BaseToolsSource under lt Workspace gt Conf folder to point the repository of build tools such as In s BaseTools edk2 Conf BaseT
41. l 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 1 4 Target Audience This document is intended to be a reference for those who are just starting EDKII development for the following e BVs and OEMs who will implement UEFI PI drivers or other firmware products based on EDKII 6 March 2010 e IHVs who will be create supported firmware drivers for hardware device as well as platform integrators using EDKII components and modules 7 March 2010 March 2010 2 1 2 2 2 Setting Up EDKII Development Environment This chapter explains how to download the EDKII source code and introduces the third party software needed by the EDKII build process This chapter also introduces the basic structure of the EDKII source code and provides a quick start to build and launch an NT32 emulation platform How to Get the EDKII Source TianoCore org http sourceforge net apps mediawiki tianocore index php title Welcome_to_Tiano Core is the website of the EFI and Framework Open Source Community where there are the documentation source and binaries available Users may also access the Forums Issue Tracking Mailing Lists RSS Feeds and Source Control on this website The Source Control is Subversion for all projects on this website including EDKII project There are systematic
42. le PcdHelloWorldPrintString and PcdHelloWorldPrintTimes are directly used by HelloWorld Other PCDs are from these chosen library instances Although the used PCDs seem numerous most of them can directly use their default value defined in package DEC file For users not wanting to use the default value the new value can be set in the PcD section of DSC file to override the default setting 28 March 2010 3 4 3 3 5 3 5 1 PcdsFixedAtBuild gEf iMdePkgTokenSpaceGuid PcdSpinLockTimeout gEfiMdePkgTokenSpaceGuid PcdMaximumLinkedListLength gEfiMdePkgTokenSpaceGuid PcdMaximumAsciiStringLength gEfiMdePkgTokenSpaceGuid PcdMaximumUnicodeStringLength gEf iMdePkgTokenSpaceGuid PcdDebugPrintErrorLevel gEfiMdePkgTokenSpaceGuid PcdDebugClearMemoryValue gEfiMdePkgTokenSpaceGuid PcdDebugPropertyMask gEfiMdeModulePkgTokenSpaceGuid PcdHelloWorldPrintString gEfiMdeModulePkgTokenSpaceGuid PcdHelloWorldPrintTimes PcdsFeatureFlag gEfiMdePkgTokenSpaceGuid PcdDriverDiagnosticsDisable gEfiMdePkgTokenSpaceGuid PcdComponentNameDisable gEfiMdePkgTokenSpaceGuid PcdDriverDiagnostics2Disable gEfiMdePkgTokenSpaceGuid PcdComponentName2Disable gEfiMdeModulePkgTokenSpaceGuid PcdHelloWorldPrintEnable Configure the active platform and build module To configure the active platform the target txt file or the build command can be used The instructions refer to sections 3 2 1 and 3 2 2 The following example builds AtapiPassThruDxe module in EDKII Opt
43. n executable image or a library instance For a list of module types supported by this package see module type March 2010 Module Type All libraries and components belong to one of the following module types BASE SEC PEI_CORE PEIM DXE_CORE DXE_DRIVER DXE_RUNTIME_DRIVER SMM_CORE DXE_SMM_DRIVER DXE_SAL_DRIVER UEFI_ DRIVER or UEFI_APPLICATI ON 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 Package A package is a container in which a set of modules are organized together in accordance with certain purpose or rule PCD Platform Configuration Database PI Platform Initialization Specification UEFI Application An application that follows the UEFI specification The only difference between a UEFI application and a VEFI 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 when its entry point exits UEFI Driver A driver that follows the UEFI specification UEFI Specification Version 2 1 2 2 and 2 3 A series of the UEFI specifications released by the Unified EFI Forum These specifications build on the EFI 1 10 specification and transfers ownership of the EFI specification from Inte
44. nce ca ei vanette neee 22 3 4 Build Single Module sac cc soia acne acei a dend a a ca a elanden deden ande 23 3 4 1 Create New Package san sardines enne vante he 24 3 4 2 Add the module into a package ccc cece cece eee eee eee eens eee eee 26 3 4 3 Configure the active platform and build module eee 29 3 5 Build Customize Existing Platform eee en eee eee ener eenenenenenen 29 3 9 1 Build Existing Platform samsara an a panta 29 3 5 2 Customize PIAEFORM cine sarea acarieni e i a ati a a ata 30 3 5 3 Sum Up Create Release Tip for a Platform nnee 36 3 6 COMMON Build ECKOMS ine ses sonore eenn gat n i i dagens eee hand a 37 EDKI Emulation Environment iii caiac nnee inca senden ensen ded ini pai 39 4 1 OVERVIEW susanne aia dt ae sanke atat coat a de i 39 4 2 Emulation Platformi Scissors a Da r oa nara pa Elita ata i Du iede 39 4 2 1 NT32 PIGEON anr intaia it aaa aia E pa caii a tasta 39 4 2 2 Unix platformi zic arca e ra ts ri a ri a a a a ta a a ra 40 4 2 3 Duet PlathOnM iste nadere en Dea a ate ee nnen iata e iat 41 4 3 Shell Environ MEME sereen a nde ent 44 4 3 1 LAUNCH SE narren ineen voer idnerdaad dee daden ea a de 44 4 3 2 Shell comiand marsen zeemeerman tene 48 iii March 2010 4 4 4 5 Enable Network on Nt32 platform nononono en en eee eee eee 49 Debugging in Emulation Environment ee eee eee an 51 4 5 1 Print Debug MESSAGE ne e tea ta e coast tea recente debielen neen den dae wee 51 4 5 2 Single Step Debug
45. odule source code can be easily configured to link with different library instances for various requirements The EDKII provides many library classes library instances to facilitate user development in the MdePkg For example MdePkg provides a library class named BaseMemoryLib in which there are many APIs related to memory operation For this library class there are multiple library instances such as the following e one implemented in C to cross platform e one implemented in ASM to improve the efficiency of memory operation The platform integrator can selectively choose various library instances Platform Configuration Database PCD is a unified mechanism used by a module to extract information from external sources and control procedure behavior The information can come from many different places Information could be known e at compile time 3 March 2010 1 2 1 2 1 1 2 1 1 1 3 e at flash image generation time e on the fly when firmware code is being executed The module writer does not need to know where the information has come from because the platform developer can make the selection The module s source code can remain unchanged to support multiple platforms as all the external input information is extracted by unified PCD interfaces For example a PCD PcdDebugPrintErrorLevel is used to control the debug print level Thus a module developer only needs to call the PCD interface PcdGet32 PcdDebu
46. oolsSource 3 Run edksetup sh BaseTools from workspace folder 4 Run build p DuetPkg DuetPkg dsc a IA32 t UNIXGCC 5 Run DuetPkg PostBuild sh IA32 Steps for creating Duet boot floppy disk 1 Inset a blank floppy 2 Run DuetPkg CreateBootDisk sh floppy media floppy0 dev fd0 FAT12 Shell Environment The EFI Shell is a simple interactive environment that allows EFI device drivers to be loaded EFI applications to be launched and operating systems to be booted In addition the EFI Shell also provides a set of basic commands used to manage files and the system environment variables etc Launch Shell The Shell actually an EFI application could be launched internally if the shell binary is built in the firmware volume or externally from a floppy usb hard disk Launch Internal Shell 1 After launching emulate environment access the Boot Manager menu as follows 44 March 2010 Figure 3 Select Boot Manager Menu 2 If shell binary is built in a firmware volume EFI Internal Shell item is listed as an boot option as follows Figure 4 Select EFI Internal Shell from Boot Manager 45 March 2010 4 3 1 2 Launch External Shell I Insert disk that contains a shell binary image or verify that the shell binary image is put at the directory that is emulated as a physical disk in an Nt32 Duet platform 2 Boot the machine to the front page select the Boot Maintenance Manager menu and enter it
47. ow operating system and provides a UEFI runtime environment UnixPkg Launched in general 32 bit Unix like operating system such as a UNIX or Linux distributions DuetPkg Provides UEFI runtime environment based on legacy BIOS on the real machine OptionRomPkg Shows the sample drivers to build PCI compliant Option ROMimage for different CPUs architectures EdkCompatibilityPkg ECP Includes EDK style definitions of EFI1 10 EFI2 0 and all definitions of Intel Framework Specification and the EDK libraries instances to allow EDK style modules to be used in EDKII context It also has some thunk drivers that provide transition between the different protocols defined in UEFI2 1 P11 0 specifications and the Intel Platform Innovation Framework Specification The primary goal of the ECP is to enable build compatibility of EDK modules in the EDKII and to address the binary compatibility issues with using existing pre P EDK modules in a platform comprised of mostly EDKII modules PcAtChipsetPkg Designed to public interfaces and implementation that follows PcAt de facto standard UefiCpuPkg Provides UEFI compatible CPU modules and libraries OvmfPkg Aims to support firmware for Virtual Machines using the edk2 code base More information can be found at http sourceforge net apps mediawiki tianocore index php title OVMF Each package has the similar structure of directories For example MdePkg has the following directories and sub
48. project found at http sourceforge net apps mediawiki tianocore index php title EDK2 In this document it refer to the new release of EDK II which support build infrastructure that makes use of the Extended INF DEC and Extended DSC EDK II Module A generic term to describe a module that is developed using the new release of EDK II project that supports the library class library instances packaging concept and Extended INF DEC and Extended DSC files EFI Generic term that refers to one of the versions of the EFI specification EFI 1 02 EFI 1 10 UEFI 2 1 UEFI 2 2 or UEFI 2 3 Framework Intel Platform Innovation Framework for EFI consists of the Foundation and other modular components that characterize the portability surface for modular components designed to work on any implementation of the Tiano architecture Library Class A library class defines the API or interface set for a library The consumer 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 See the EDK 2 0 Module Development Environment Library Specification for a list of libraries defined in this package Library Instance Module An implementation of one or more library classes See the EDK 2 0 Module Development Environment Package Document at http sourceforge net projects edk2 files for a list of library defined in this package A module is either a
49. refined and appended for module developers such as the PCI library I O library and Print library etc Enhanced build system Its infrastructure is based on Python that is independent of the operating system It exposes several configuration files that a user can utilize to choose the various tool chains even the build rule or generated target EDKII provides definitions and the library interface required by EDK modules so it makes EDK modules that can be integrated into the EDKII UEFI and PI The Unified Extensible Firmware Interface UEFI Specification defines a group of standard interfaces between the operating system OS and the platform firmware UEFI s predecessor was the Extensible Firmware Interface EFI originally developed by Intel Intel later contributed ownership of the EFI specification to a non profit industry trade organization The Unified EFI Forum who is now responsible for its development and promotion The UEFI Platform Initialization Specification also known as the PI is a set of specifications developed in conjunction with UEFI by The Unified EFI Forum The PI Specification was preceded by Intel Platform Innovation Framework for EFI also known as the Framework While VEFI EFI specifies the OS to firmware interface the PI Framework specification specifies the structure used to build the firmware beneath the OS to firmware interface EDK amp EDKII The EFI Developer Kit EDK is an Open So
50. rk Ip4Dxe Ip4Dxe inf MdeModulePkg Universal Network MnpDxe MnpDxe inf 50 March 2010 4 5 4 5 1 MdeModulePkg Universal Network Mtftp4Dxe Mtftp4Dxe inf MdeModulePkg Universal Network Tcp4Dxe Tcp4Dxe inf MdeModulePkg Universal Network Udp4Dxe Udp4Dxe inf Nt 32Pkg SnpNt32Dxe SnpNt32Dxe inf 4 Also add them into FD Fv_Recovery section in Nt32Pkg fdf file INF MdeModulePkg Universal Network DpcDxe DpcDxe inf INF MdeModulePkg Universal Network ArpDxe ArpDxe inf INF MdeModulePkg Universal Network Dhep4Dxe Dhcp4Dxe inf INF MdeModulePkg Universal Network Ip4ConfigDxe Ip4ConfigDxe inf INF MdeModulePkg Universal Network Ip4Dxe Ip4Dxe inf INF MdeModulePkg Universal Network MnpDxe MnpDxe inf INF MdeModulePkg Universal Network Mtftp4Dxe Mtftp4Dxe inf INF MdeModulePkg Universal Network Tcp4Dxe Tcp4Dxe inf INF MdeModulePkg Universal Network Udp4Dxe Udp4Dxe inf INF Nt32Pkg SnpNt32Dxe SnpNt32Dxe inf 5 Build Nt32 platform 6 Copy SnpNt32lo dll into Build NT32 DEBUG_MYTOOLS IA32 directory 7 To test the Network functionality launch Nt32 emulate and enter Internal shell The EFI application fconfig efi and ping efi are the commands to test network functionality Debugging in Emulation Environment There are two major debugging methods print debug messages and single step by break pointer Printing debug messages is a popular debug method and very simple but single step by break point may be different in each emulated platform
51. rom the EDKII OptionRom DSC file This DSC is created in order to build two option ROM drivers 24 March 2010 Example OptionRomPkg dsc 3 4 1 1 3 4 1 2 3 4 1 3 Defines PLATFORM NAME OptionRomPkg PLATFORM GUID C7B25F37 B1F4 4c46 99CB 3EA7DCF5FCDC PLATFORM VERSION 0d DSC SPECIFICATION 0x00010005 OUTPUT DIRECTORY Build OptionRomPkg SUPPORTED ARCHITECTURES BUILD TARGETS SKUID IDENTIFIER TA32 IPF X64 EBC DEBUG RELEASE DEFAULT SkuIds O DEFAULT The entry 0 DEFAULT is reserved and required LibraryClasses DebugLib MdePkg Library UefiDebugLibStdErr UefiDebugLibStdErr inf BaseLib MdePkg Library BaseLib BaseLib inf BaseMemoryLib MdePkg Library BaseMemoryLib BaseMemoryLib inf PcdsFeatureFlag gEfiMdePkgTokenSpaceGuid PcdComponentNameDi sable FALSE gEfiMdePkgTokenSpaceGuid PcdDriverDiagnosticsDisable FALSE gEf iMdePkgTokenSpaceGuid PcdComponentName2Disable FALSE gEfiMdePkgTokenSpaceGuid PcdDriverDiagnostics2Disable FALSE PcdsFixedAtBuild gEf iMdePkgTokenSpaceGuid PcdMaximumUnicodeStringLength 0x0 gEfiMdePkgTokenSpaceGuid PcdMaximumAsciiStringLength 0x0 gEfiMdePkgTokenSpaceGuid PcdMaximumLinkedListLength 0x0 Components OptionRomPkg AtapiPassThruDxe AtapiPassThruDxe inf OptionRomPkg CirrusLogic5430Dxe CirrusLogic5430Dxe inf Defines section The DSC name and guid are declared here OUTPUT_DIRECTORY specifies the platform output directory referred to in section 3 3 SUPPORT
52. ry The link name is BaseToolsSource for example 40 March 2010 4 2 3 4 2 3 1 In s home usr BaseTools home usr Edk2Workspace Conf BaseToolsSource 4 Run edksetup sh BaseTools under the workspace s directory to set system environment such as WORKSPACE EDK_TOOLS_PATH etc 5 Run build p UnixPkg UnixPkg dsc a IA32 t ELFGCC to build Unix emulated platform SecMain the loader program for emulate environment is built to the WORKSPACE Build Unix DEBUG ELFGCC IA32 directory The Unix emulation is launched by executing SecMain Duet platform Overview Unlike Nt32 and Unix emulation platforms a Duet platform provides a VEFI runtime environment based on Legacy BIOS or UEFI implementation with legacy supporting actual machines The Duet platform is started up by a boot loader from floppy usb hard disk Duet s boot loader collects following platform information e Memory description array from legacy E820 table e SMBIOS table e ACPI RSD Root System Description table e MPS MultiProcessor Specification table e Other ACPI table Because platform initialization has completed a Duet platform does not need the PEI phase The Duet boot loader transfers to DxeCore in by passing the collected platform information mentioned above 41 March 2010 Legacy BIOS call int 19 to load Duet boot sector to 0x7C00 Duet boot sector find and load Duet boot loader Duet boot loader collects platform informa
53. s and develop a hardware independent module The differences between emulated platforms and actual platforms are its loader and emulated hardware devices EDKII provides three emulation platforms Nt32 Unix and Duet platforms Emulation Platforms NT32 platform Overview Nt32 platform is launched in the 32 bit Microsoft Window operating system and provides UEFI runtime environment The SecMain module the Nt32 platform loader is a Windows application It establishes emulated hardware environment such as allocating Windows memory to simulate system memory for Nt32 platform and mapping FD file to a Windows memory region to simulate flash device After that SecMain invokes PeiCore s entry as an actual platform handing off to the PEI phase Nt32 platform provides many emulated devices written in a Windows API For example GOP device is a window and physical virtual disk is a mapping of the window s directory Nt32 platform requires following packages which can be downloaded from http edk2 svn sourceforge net svnroot edk2 trunk edk2 Please ref to chapter 2 e MdePkg e MdeModulePkg e I ntelFrameworkPkg e _IntelFrameworkModulePkg e Nt32Pkg e edkShellBinPkg 39 March 2010 4 2 2 4 2 2 1 4 2 2 2 e EdkFatBinPkg e BaseTools The steps of building launching NT32 platform has been introduced at chapter 3 1 Unix platform Overview Similar to Nt32 platform The Unix emulate platform is launched in general
54. seAddress 0xE0000000 In another platform the address of the PciExpress bar might be produced by a specific but not fixed PCIEX register so that the PCD would be used as type PcdDynamic as shown below PcdsDynamicDefault common gEfiMdePkgTokenSpaceGuid PcdPciExpressBaseAddress 0xE0000000 Above the PcdsDynamicDefault type is a dynamic type In the platform there are three dynamic types for a PCD token according to the storage of PCD value e PcdsDynamicDefault the PCD value is stored in PCD database e PcdsDynamicHii the PCD value is stored in a variable in flash e PcdsDynamicVpd the PCD value is stored in an fix address specified by platform Developer Configure PCD value Besides PCD type customization PCD value customization is common usage for a PCD token For example in platform s DSC file PcdsFixedAtBuild gEfiMdePkgTokenSpaceGuid PcdDebugPrintErrorLevel 0x80000000 35 March 2010 3 5 3 The value 0x80000000 means the message only marked as DEBUG_ERROR could be displayed The valid values for this PCD come from MdeLib nclude Library DebugLib h define DEBUG_INIT 0x00000001 Initialization define DEBUG_WARN 0x00000002 Warnings define DEBUG_LOAD 0x00000004 Load events define DEBUG_FS 0x00000008 EFI File system define DEBUG_POOL 0x00000010 Alloc amp Free s define DEBUG_PAGE 0x00000020 Alloc amp Free s define DEBUG_INFO 0x00000040 Verbose define DEBUG_VARIABLE
55. t This application INF file must be specified in the active platform DSC file m option sets the INF file name of the module to be built This setting is not supported in target txt Build a specified FV FD image build p Nt32Pkg Nt32Pkg dsc i FvRecovery r Nt32 The FvRecovery FvImage and Nt32 FD image will be created for NT32 platform r option sets the name of FD image to be generated The name must be from FD section in FDF file i option sets the name of FV image to be generated The name must be from FV section in FDF file The full build command usage can be obtained by build help and Build Utility Man Page located at http edk2 svn sourceforge net svnroot edk2 trunk edk2 BaseTools UserManuals Configure the build tool chain and flags The third party tools and tool flags are described in tools_def txt file The template tools_def txt file defines the following tool chain tags commonly used in EDKII 20 March 2010 3 2 3 1 Table 8 The list of supported tool chain tags Tool Chain Tags Description 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 UINIXGCC Mingwin GCC No EBC Intel ASL ELFGCC Linux ELF GCC No EBC Intel ASL CYGGCC win32 CygWin GCC Intel EBC In
56. t loads and interprets the EBC image allowing the image to be executed on multiple platforms and architectures including those based on Intel Itanium processors A 32 architecture based processors or Intel64 architecture based processors Table 7 Intel C Compiler for EFl Byte Code Compiler Name Version URL Intel C 1 2 http www3 intel com cd software products asmo Compiler for EFI na eng compilers efibc index htm Byte Code To build EBC image the Intel C Compiler for EFl Byte Code and Microsoft Visual Studio must be installed Refer to Table 1 for installation of Microsoft Visual Studio A Quick Build The following instructions will build and launch an NT32 emulation platform systematically 1 Enter EDKII root directory Run edksetup bat nt32 2 Run build 3 Execute build run 16 March 2010 3 1 3 EDKII Build Process Basic build steps introduction Chapter 2 explained how to build an NT32 platform In this chapter the basic build steps are introduced in detail Step 1 Download EDKII project as the basic workspace and install the required tool chain If necessary other modules and packages can also be added into this workspace This step is shown in Chapter 2 Step 2 In the workspace EDKII root directory run edksetup script to set up the build environment For an Nt32 platform the nt32 option is required to setup the standard places for include h and dll files required by the
57. tel ASL ICC win32 Intel C Compiler V9 1 Intel EBC Intel ASL MYTOOLS win32 VS2005 for 1A32 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 2005 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 Change tool chain location When the tool chain location is different from the default setting in tools_def txt users can change the tool path definition to point to their tool chain location For example if the VS2003 installation directory is D Program Files Microsoft Visual Studio NET 2003 these two path macros need to be changed as follows D
58. time touch type unload ver vol Description Displays the current date or sets the date in the system Deletes one or more files or directories Displays the handles in the EFI environment Displays a list of files and subdirectories Disconnects one or more drivers from a device Displays a list of drivers that follow the EFI Driver Model Invokes the Driver Configuration Protocol Invokes the Driver Diagnostics Protocol Displays messages or turns command echoing on or off Exits the EFI Shell Displays the list of commands or verbose help of a command Loads EFI drivers Displays a list of files and subdirectories Displays or defines mappings Creates one or more directories Moves one or more files directories to a destination Disconnects a driver from a device and then connects it again Resets the system Deletes one or more files or directories Displays creates changes deletes environment variables Displays the current time or sets the time of the system Updates the time with the current time Displays the contents of a file Unloads a protocol image Displays the version information Displays volume information of the file system Enable Network on Nt32 platform EDKII provides UEFI network stack drivers in the MdeModulePkg Universal Network folder and brings the support of TCP IP networking with different drivers implementing different TCP IP protocols The hierarchal layering of t
59. tion and builds them into HOB Duet Dxel pl module load FV in boot disk and find DxeCore in loaded FV Duet boot loader transfer to DXE phase Figure 2 Startup flow for Duet environment Duet platform requires the following packages which can be downloaded from http edk2 svn sourceforge net svnroot edk2 trunk edk2 Please refer to chapter 2 42 MdePkg MdeModulePkg IntelFrameworkPkg IntelFrameworkModulePkg DuetPkg edkShellBinPkg EdkFatBinPkg BaseTools March 2010 4 2 3 2 4 2 3 2 1 4 2 3 2 2 Build and Launch Windows Building steps for Duet platform is the same as other actual platforms described in chapter 3 To launch a Duet platform create a Duet boot disk and use the Duet boot disk to boot the machine CreateBootDisk bat under the DuetPkg is used to create a bootable floppy usb hard disk from which the Duet platform is launched The command line and options are CreateBootDisk usb floppy ide DiskNumber FAT12 FAT16 FAT32 e Ifthe boot media is floppy and the floppy disk number is a in the host machine run CreateBootDisk floppy a FAT12 e Ifthe boot media is usb and the usb disk number is e in the host machine run CreateBootDisk usb e FAT16 FAT32 e If the boot media is a hard disk it is not possible to create a bootable hard disk in the host machine directly Instead copy the boot and FV files to a usb disk then use EfiLdrimage tool shell application This EFI tool
60. uch as the header files Library Class Ppi Protocol Guid and PCD The following example is a dummy DEC file without any public information and only defines the package name and guid Package dec Defines DEC_SPECIFICATION 0x00010005 PACKAGE NAME PackageName PACKAGE GUID XXXXXXXX XXXX XXXX XXXX XXXXXXXXXXXX PACKAGE VERSION 0 1 Includes include header file path relative to package directory LibraryClasses libraryclassnamel librarclass header file name relative to workspace Guids GuidCName xxxxxxxx xXxxx xxxx xx XX XX XX XX XX xXx xx Ppis PpiGuidCName xxxxxxxx xxxx xxxx XX XX XX XX XX XX XX XX Protocols ProtocolGuidCName xxxxxxxx xxxx xxxx XX XX XX XX XX xXxX xXx xx PcdsFeatureFlag PcdTokenSpaceCGuidName PcdName TRUE or FLASE BOOLEAN TokenNumber PcdsFixedAtBuild PcdTokenSpaceCGuidName PcdName Value DataType TokenNumber PcdsPatchableInModule PcdTokenSpaceCGuidName PcdName Value DataType TokenNumber PcdsDynamic PcdTokenSpaceCGuidName PcdName Value DataType TokenNumber PcdsDynamicEx PcdTokenSpaceCGuidName PcdName Value DataType TokenNumber If necessary the module in this package can publish the information in this file For details refer to EDKII DEC Specification The platform build description DSC file includes the modules to be built and their dependent library instances and PCD values The following example is f
61. ule can be referred to in the EDK II Build Specification Chapter 5 Build Output Directory When the platform is built successfully all build output files are generated into the directory WORKSPACE OUTPUT DIRECTORY TARGET _ TOOL CHAIN TAG e WORKSAPCE is the EDKII root directory e OUTPUT DIRECTORY is from the platform DSC file Defines section For the platforms provided by EDKII this value is always set to Build Plat formName so that all output files are in the same build directory e TARGET TOOL CHAIN TAG and ARCH are determined by settings in target txt or the build command line options The EFI images efi and EFI OptionRom images rom are created in ARCH subdirectory WORKSPACE OUTPUT DIRECTORY TARGET _ TOOL_CHAIN_TAG ARCH The FV fv and FD fd images are created in Fv subdirectory 22 March 2010 3 4 WORKSPACE OUTPUT DIRECTORY TARGET _ TOOL CHAIN TAG FV Autogen c h is created in the DEBUG subdirectory of the module output directory WORKSPACE OUTPUT DIRECTORY TARGET _ TOOL_CHAIN_TAG ARCH MO DULE INF RELATIVE PATH to WORKSPACE MODULE INF NAME DEBUG Intermediate output files such as obj are created in the module OUTPUT subdirectory of the module output directory WORKSPACE OUTPUT DIRECTORY TARGET _ TOOL_CHAIN_TAG ARCH MO DULE INF RELATIVE PATH to WORKSPACE MODULE INF NAME DEBUG
62. urce release of the Framework Foundations defined in the Framework Core Interface Specifications CIS plus a set of sample drivers and three sample targets implemented for the Nt32 Unix and DUET platforms In addition to Open Sourcing the Framework Foundation code the EDK allows for the development debugging and testing of EFl and DXE drivers Option ROMs and pre Boot applications To solve customer feedback exposed by using EDK Intel started a remodeling plan now known as EDKII It focuses on how to make it easy for customers to write a specific kind of module to port and to customize modules to a platform The following sections elaborate on several key concepts introduced by EDKII such as Package Library Class Library Instance and PCD etc Package The EDK could not be compiled without the entire source tree Furthermore the unit of distribution required the EDK as the whole tree To solve this issue EDKII introduced the new concept the Package Using this a release and its work can be made with Packages as opposed to requiring the Whole Source Tree 2 March 2010 1 1 2 2 1 1 2 3 A package is the minimal unit of distribution as well as providing a natural split in a big project which serves various purposes For example from the viewpoint of hardware a developer may divide CPU chipset platform related definitions and drivers into three individual packages that facilitate a user s distribution and reuse
63. xt and build_rule txt Their template that contains the default setting provided by EDKII is created in the WORKSPACE Conf directory after build Step 2 The following sections introduce each txt file Configure the active platform The active platform is the built target It can be set in the target txt file or in build command line options Target txt is used to filter the build so that everything is not always built It contains a group of build settings listed in the following example Example Conf target txt 3 2 1 1 3 2 1 2 ACTIVE PLATFORM Nt32Pkg Nt32Pkg dsc TARGET DEBUG TARGET ARCH IA32 TOOL CHAIN CONF Conf tools def txt TOOL CHAIN TAG MYTOOLS MULTIPLE THREAD Enable MAX CONCURRENT THREAD NUMBER 2 BUILD RULE CONF Conf build rule txt ACTIVE PLATFORM ACTIVE PLATFORM Specifies the WORKSPACE relative path and filename of the platform description file DSC that will be used for the build The setting for the example above is the Nt32 platform DSC file TARGET TARGET refers to zero or more of DEBUG RELEASE Or UserDefined separated by a space character If the line is missing or no value is specified all valid targets specified in the platform description file will attempt to be built The current setting is to build the debug platform target 18 March 2010 3 2 1 3 3 2 1 4 3 2 1 5 3 2 1 6 3 2 2 3 2 2 1 TARGET_ARCH TARGET_ARCH specifies what kind of architecture is for wh
64. y instance requires more library classes PrintLib BaseLib BaseMemoryLib and MemoryAllocationLib Another four library instances are chosen 27 March 2010 3 4 2 2 PrintLib MdePkg Library BasePrintLib BasePrintLib inf MemoryAllocationLib MdePkg Library DxeMemoryAllocationLib DxeMemoryAlloca tionLib inf BaseMemoryLib MdePkg Library BaseMemoryLib BaseMemoryLib inf BaseLib MdePkg Library BaseLib BaseLib inf Finally BaseLib depends on the extra TimeLib The time library NULL instance is added TimerLib MdePkg Library BaseTimerLibNullTemplate BaseTimerLibNullTemplate Geb ahd To build HelloWorld module there are the ten library instances that must be specified in the LibraryClasses section in the DSC file Pcd section The different types of PCDs used by the module are specified into the PCD type sections such as FeaturePcd FixedPcd sections However if the PCD type is not limited it should be in Ped section and its PCD type is decided according to the setting in DSC file This application uses a feature flag PCD of PcdHelloWorldPrintEnable and two common type PCDs of PcdHelloWorldPrintString and PcdHelloWorldPrintTimes Next get all required library instances and PCDs and add them into DSC file HelloWorld is also an example for explaining their dependencies In last section all required library instances are chosen and the PCD used by them is decided The following PCDs are used Of PCDs PcdHelloWorldPrintEnab

Download Pdf Manuals

image

Related Search

Related Contents

RIDGID R86010B Use and Care Manual  Panas。mc 取扱説明書  EL74 / Bluetooth Speaker User`s Manual Please read  TDSHT3 HDMI Compliance Test Software QSUM  nanoPEB - SIO Compact Flash Drive, 32K RAM and RS  Model7210_UserManual  取扱説明書 FR-S36B, FF-S36B, FF-S40B  MARKETINg-INNOVATION / RELATION CLIENT  Mode d'emploi  Samsung ML-1860 คู่มือการใช้งาน  

Copyright © All rights reserved.
Failed to retrieve file