1 / 11

How to build an UEFI application

How to build an UEFI application. An UEFI application consists of :- A source file 2. An component information file 3. A build description file. A sample source file : *** This Application Prints Hello World On The Screen ***

khan
Download Presentation

How to build an UEFI application

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How to build an UEFI application

  2. An UEFI application consists of :- • A source file • 2. An component information file • 3. A build description file

  3. A sample source file : *** This Application Prints Hello World On The Screen*** #include <Library/UefiApplicationEntryPoint.h> // Header files #include <Library/UefiLib.h> EFI_STATUS EFIAPI UefiMain // Entry Point (IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable) { SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Hello World\r\n"); // Body return EFI_SUCCESS; }

  4. A sample INF file : # - It is used for comments [Defines] INF_VERSION = 0x00010005 BASE_NAME = Hello FILE_GUID = 08f58693-1cba-4ddf-a204-f10a7dd01fae # The global unique identifier. You can generate a GUID for your application using a GUID generator available on the internet. MODULE_TYPE = UEFI_APPLICATION # It specifies whether this is an UEFI application or a driver VERSION_STRING = 1.0 ENTRY_POINT = UefiMain #entry point as defined in the source file. Click on the hyperlink to follow the source file [Sources] Hello.c # The name of the files to be included. (Source files)

  5. [Packages] #The [Packages] section lists all of the EDK II declaration files that are used by the component. Data from the INF and the DEC files is used to generate content for the AutoGen.c and AutoGen.h files. MdePkg/MdePkg.dec MdeModulePkg/MdeModulePkg.dec [LibraryClasses] #The EDK II INF [LibraryClasses] section is used to list the names of the library classes that are required, or optionally required by a component. A library class instance, as specified in the DSC file, will be linked into the component UefiApplicationEntryPoint UefiLib [GUIDS] #Not used in this application. See the HelloWorld application’s INF file. #The [guids] section of the EDK II INF file is a list of the global GUID C Names that are used by the module, and not already included [Protocols] # Not used n this application.See the FileSystem application for this section

  6. How to include your application in the build description file (.dsc) : Go to the root of your EDK2 directory. Suppose you have checked out EDK2 at: C:\EDK2, then Go to C:\EDK2\Nt32Pkg\ and open the Nt32Pkg.dsc file. In the [Components.IA32] section include the path of your application w.r.t the EDK2 source tree. For eg. MdeModulePkg/Application/Hello/Hello.inf Make sure that your libraries and packages are included in this dsc file.

  7. After completing these steps open the MS Visual studio command prompt and follow these steps- Enter the EDK2 directory: cd C:\Edk2 Execute this command: edksetup.bat To build just your module : For eg. I will build the “Hello” application build –p Nt32 Pkg\Nt32Pkg.dsc –a IA32 -m MdeModulePkg\Application\Hello\Hello.inf To execute your application go to: C:\EDK2\Build\NT32\DEBUG_VS2008\IA32 and run the SecMain.exe file. After the window opens type execute your .efi application. For eg. Hello.efi

  8. On Opening SecMain.exe

  9. To display text on screen SystemTable->ConOut->OutputString(SystemTable->ConOut, L"Hello World\r\n"); To read a keystroke EFI_INPUT Key; SystemTable->ConIn->ReadKeyStroke(SystemTable->ConIn, &Key) SystemTable: Pointer to the UEFI system Table ConIn: Console Input ConOut: Console Outuput OutputString: Function provided by the SIMPLE_TEXT_OUTPUT_PROTOCOL ReadKeyStroke: Function provided by the SIMPLE_TEXT_INPUT_PROTOCOL

More Related