18.7.3 Using FDF File to Generate PCI Option ROM Image

When managing large numbers of UEFI Drivers and PCI Option ROMs, greater flexibility than the EfiRom utility or the INF methods allow may be required. The EDK II build system supports an FDF file format that provides methods to package UEFI Drivers into FLASH devices. The FDF file format also supports the description of PCI Option ROMs. The EDK II build system requires a DSC file to build UEFI Drivers. The DSC file format is covered in more detail in Chapter 30. A DSC file can optionally specify an associated FDF file in the [Defines] section of the DSC file with a FLASH_DEFINITION statement. The example below shows the [Defines] section of a DSC file specifying the FDF file AbcDriver.fdf. The FDF file is typically in the same directory as the DSC file.

Example 200-Specify name of FDF file from a DSC file
[Defines]
  PLATFORM_NAME           = AbcDriver
  PLATFORM_GUID           = 14893C02-5693-47ab-AEF5-61DFA089508A
  PLATFORM_VERSION        = 0.10
  DSC_SPECIFICATION       = 0x00010005
  OUTPUT_DIRECTORY        = Build/AbcDriver
  SUPPORTED_ARCHITECTURES = IA32|IPF|X64|EBC|ARM
  BUILD_TARGETS           = DEBUG|RELEASE
  SKUID_IDENTIFIER        = DEFAULT
  FLASH_DEFINITION        = AbcDriver/AbcDriver.fdf

The FDF file may describe one or more PCI Option ROM images These PCI Unlike the INF method, Option ROM images are not limited to a single UEFI Driver. The following example shows an FDF file that produces three PCI Option ROM images called AbcDriverAll.rom, AbcDriverIA32.rom, and AbcDriverX64.rom. The first PCI Option ROM image contains a UEFI Driver image compiled for IA32 and a UEFI Driver image compiled for X64 The syntax for specifying the PCI related definitions is the same as the INF example in the previous section. The second PCI Option ROM image contains only one UEFI Driver compiled for IA32 The third image contains one UEFI Driver compiled for X64 The UEFI Drivers are compressed in all three of these option ROM images.

Example 201-Using an FDF file to Generate PCI Option ROM images
[Rule.Common.UEFI_DRIVER]
  FILE
  DRIVER = $(NAMED_GUID) {
  PE32 PE32 |.efi
  }

[OptionRom.AbcDriverAll]
  INF
  USE            = IA32 AbcDriver/Abc.inf {
  PCI_VENDOR_ID  = 0xABCD
  PCI_DEVICE_ID  = 0x1234
  PCI_CLASS_CODE = 0x56789A
  PCI_REVISION   = 0x0003
  PCI_COMPRESS   = TRUE
  }
  INF
  USE            = X64 AbcDriver/Abc.inf {
  PCI_VENDOR_ID  = 0xABCD
  PCI_DEVICE_ID  = 0x1234
  PCI_CLASS_CODE = 0x56789A
  PCI_REVISION   = 0x0003
  PCI_COMPRESS   = TRUE
  }

[OptionRom.AbcDriverIAa32]
  INF
  USE            = IA32 AbcDriver/Abc.inf {
  PCI_VENDOR_ID  = 0xABCD
  PCI_DEVICE_ID  = 0x1234
  PCI_CLASS_CODE = 0x56789A
  PCI_REVISION   = 0x0003
  PCI_COMPRESS   = TRUE
  }

[OptionRom.AbcDriverX64]
  INF
  USE            = X64 AbcDriver/Abc.inf {
  PCI_VENDOR_ID  = 0xABCD
  PCI_DEVICE_ID  = 0x1234
  PCI_CLASS_CODE = 0x56789A
  PCI_REVISION   = 0x0003
  PCI_COMPRESS   = TRUE
  }