30.3 Create UEFI Driver Directory
The next step is to create a subdirectory in an EDK II package for the UEFI Driver contents including an INF file and all source files required to build the UEFI Driver. There are no restrictions on the directory structure organization within an EDK II package. The examples shown here are simple and only use one layer of directories. The
MdeModulePkgis an example of an EDK II package with about 100 UEFI Drivers and a more complex directory structure to organize the UEFI Drivers based on the protocol they consume and the features they provide.
Appendix A contains a template for an INF file for a UEFI Driver and a UEFI Runtime Driver. This template should be sufficient for most UEFI Driver implementations. The EDK Build Specifications on http://www.tianocore.org provide the full description of INF files and their supported syntax for describing all the packages, sources, library classes, protocols, and GUIDs required to compile and link a UEFI Driver.
The example below shows an example directory structure for an EDK II WORKSPACE after creating the new package called
MyDriverPkgfollowing the steps listed above and creating a subdirectory called
MyDriverand adding an INF file and a C source file.
The following example shows an example INF file
MyDriverPkg/MyDriver/MyDriver.inf. Every new INF must have a unique
BASE_NAME. This INF file example only uses the services from a single library class called
UefiDriverEntryPoint. Every UEFI Driver must use this Library Class. Examples in earlier chapters show more complex driver examples that use more library classes. The DSC file in the previous section contains a mapping for the
UefiDriverEntryPointlibrary and that mapping is to
INF_VERSION = 0x00010005
BASE_NAME = MyDriver
FILE_GUID = 1C0D95A7-C0D6-4054-9245-8E2C81FC9ECD
MODULE_TYPE = UEFI_DRIVER
VERSION_STRING = 1.0
ENTRY_POINT = MyDriverEntryPoint
The following example shows a sample C source file MyDriverPkg/MyDriver/MyDriver.c that does not do anything other than just return EFI_SUCCESS.
IN EFI_HANDLE ImageHandle,
IN EFI_SYSTEM_TABLE *SystemTable