mirror of
https://github.com/acidanthera/audk.git
synced 2025-04-08 17:05:09 +02:00
This module measures and log the boot environment. It also produces the Tcg2 protocol, which allows for example to read the log from OS. The linux kernel doesn't yet read the EFI_TCG2_EVENT_LOG_FORMAT_TCG_2, which is required for crypto-agile log. In fact, only upcoming 4.16 adds support EFI_TCG2_EVENT_LOG_FORMAT_TCG_1_2: [ 0.000000] efi: EFI v2.70 by EDK II [ 0.000000] efi: SMBIOS=0x3fa1f000 ACPI=0x3fbb6000 ACPI 2.0=0x3fbb6014 MEMATTR=0x3e7d4318 TPMEventLog=0x3db21018 $ python chipsec_util.py tpm parse_log binary_bios_measurements [CHIPSEC] Version 1.3.5.dev2 [CHIPSEC] API mode: using OS native API (not using CHIPSEC kernel module) [CHIPSEC] Executing command 'tpm' with args ['parse_log', '/tmp/binary_bios_measurements'] PCR: 0 type: EV_S_CRTM_VERSION size: 0x2 digest: 1489f923c4dca729178b3e3233458550d8dddf29 + version: PCR: 0 type: EV_EFI_PLATFORM_FIRMWARE_BLOB size: 0x10 digest: fd39ced7c0d2a61f6830c78c7625f94826b05bcc + base: 0x820000 length: 0xe0000 PCR: 0 type: EV_EFI_PLATFORM_FIRMWARE_BLOB size: 0x10 digest: 39ebc6783b72bc1e73c7d5bcfeb5f54a3f105d4c + base: 0x900000 length: 0xa00000 PCR: 7 type: EV_EFI_VARIABLE_DRIVER_CONFIG size: 0x35 digest: 57cd4dc19442475aa82743484f3b1caa88e142b8 PCR: 7 type: EV_EFI_VARIABLE_DRIVER_CONFIG size: 0x24 digest: 9b1387306ebb7ff8e795e7be77563666bbf4516e PCR: 7 type: EV_EFI_VARIABLE_DRIVER_CONFIG size: 0x26 digest: 9afa86c507419b8570c62167cb9486d9fc809758 PCR: 7 type: EV_EFI_VARIABLE_DRIVER_CONFIG size: 0x24 digest: 5bf8faa078d40ffbd03317c93398b01229a0e1e0 PCR: 7 type: EV_EFI_VARIABLE_DRIVER_CONFIG size: 0x26 digest: 734424c9fe8fc71716c42096f4b74c88733b175e PCR: 7 type: EV_SEPARATOR size: 0x4 digest: 9069ca78e7450a285173431b3e52c5c25299e473 PCR: 1 type: EV_EFI_VARIABLE_BOOT size: 0x3e digest: 252f8ebb85340290b64f4b06a001742be8e5cab6 PCR: 1 type: EV_EFI_VARIABLE_BOOT size: 0x6e digest: 22a4f6ee9af6dba01d3528deb64b74b582fc182b PCR: 1 type: EV_EFI_VARIABLE_BOOT size: 0x80 digest: b7811d5bf30a7efd4e385c6179fe10d9290bb9e8 PCR: 1 type: EV_EFI_VARIABLE_BOOT size: 0x84 digest: 425e502c24fc924e231e0a62327b6b7d1f704573 PCR: 1 type: EV_EFI_VARIABLE_BOOT size: 0x9a digest: 0b5d2c98ac5de6148a4a1490ff9d5df69039f04e PCR: 1 type: EV_EFI_VARIABLE_BOOT size: 0xbd digest: 20bd5f402271d57a88ea314fe35c1705956b1f74 PCR: 1 type: EV_EFI_VARIABLE_BOOT size: 0x88 digest: df5d6605cb8f4366d745a8464cfb26c1efdc305c PCR: 4 type: EV_EFI_ACTION size: 0x28 digest: cd0fdb4531a6ec41be2753ba042637d6e5f7f256 PCR: 0 type: EV_SEPARATOR size: 0x4 digest: 9069ca78e7450a285173431b3e52c5c25299e473 PCR: 1 type: EV_SEPARATOR size: 0x4 digest: 9069ca78e7450a285173431b3e52c5c25299e473 PCR: 2 type: EV_SEPARATOR size: 0x4 digest: 9069ca78e7450a285173431b3e52c5c25299e473 PCR: 3 type: EV_SEPARATOR size: 0x4 digest: 9069ca78e7450a285173431b3e52c5c25299e473 PCR: 4 type: EV_SEPARATOR size: 0x4 digest: 9069ca78e7450a285173431b3e52c5c25299e473 PCR: 5 type: EV_SEPARATOR size: 0x4 digest: 9069ca78e7450a285173431b3e52c5c25299e473 $ tpm2_pcrlist sha1 : 0 : 35bd1786b6909daad610d7598b1d620352d33b8a 1 : ec0511e860206e0af13c31da2f9e943fb6ca353d 2 : b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236 3 : b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236 4 : 45a323382bd933f08e7f0e256bc8249e4095b1ec 5 : d16d7e629fd8d08ca256f9ad3a3a1587c9e6cc1b 6 : b2a83b0ebf2f8374299a5b2bdfc31ea955ad7236 7 : 518bd167271fbb64589c61e43d8c0165861431d8 8 : 0000000000000000000000000000000000000000 9 : 0000000000000000000000000000000000000000 10 : 0000000000000000000000000000000000000000 11 : 0000000000000000000000000000000000000000 12 : 0000000000000000000000000000000000000000 13 : 0000000000000000000000000000000000000000 14 : 0000000000000000000000000000000000000000 15 : 0000000000000000000000000000000000000000 16 : 0000000000000000000000000000000000000000 17 : ffffffffffffffffffffffffffffffffffffffff 18 : ffffffffffffffffffffffffffffffffffffffff 19 : ffffffffffffffffffffffffffffffffffffffff 20 : ffffffffffffffffffffffffffffffffffffffff 21 : ffffffffffffffffffffffffffffffffffffffff 22 : ffffffffffffffffffffffffffffffffffffffff 23 : 0000000000000000000000000000000000000000 sha256 : 0 : 9ae903dbae3357ac00d223660bac19ea5c021499a56201104332ab966631ce2c 1 : acc611d90245cf04e77b0ca94901f90e7fa54770f0426f53c3049b532243d1b8 2 : 3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969 3 : 3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969 4 : 7a94ffe8a7729a566d3d3c577fcb4b6b1e671f31540375f80eae6382ab785e35 5 : a5ceb755d043f32431d63e39f5161464620a3437280494b5850dc1b47cc074e0 6 : 3d458cfe55cc03ea1f443f1562beec8df51c75e14a9fcf9a7234a13f198e7969 7 : 65caf8dd1e0ea7a6347b635d2b379c93b9a1351edc2afc3ecda700e534eb3068 8 : 0000000000000000000000000000000000000000000000000000000000000000 9 : 0000000000000000000000000000000000000000000000000000000000000000 10 : 0000000000000000000000000000000000000000000000000000000000000000 11 : 0000000000000000000000000000000000000000000000000000000000000000 12 : 0000000000000000000000000000000000000000000000000000000000000000 13 : 0000000000000000000000000000000000000000000000000000000000000000 14 : 0000000000000000000000000000000000000000000000000000000000000000 15 : 0000000000000000000000000000000000000000000000000000000000000000 16 : 0000000000000000000000000000000000000000000000000000000000000000 17 : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 18 : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 19 : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 20 : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 21 : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 22 : ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff 23 : 0000000000000000000000000000000000000000000000000000000000000000 sha384 : The PhysicalPresenceLib is required, it sets some variables, but the firmware doesn't act on it yet. Laszlo Ersek explained on the list why Tpm2DeviceLib has to be resolved differently for DXE_DRIVER modules in general and for "Tcg2Dxe.inf" specifically: * We have a library class called Tpm2DeviceLib -- this is basically the set of APIs declared in "SecurityPkg/Include/Library/Tpm2DeviceLib.h". Its leading comment says "This library abstract how to access TPM2 hardware device". There are two *sets* of APIs in "Tpm2DeviceLib.h": (a) functions that deal with the TPM2 device: - Tpm2RequestUseTpm(), - Tpm2SubmitCommand() This set of APIs is supposed to be used by clients that *consume* the TPM2 device abstraction. (b) the function Tpm2RegisterTpm2DeviceLib(), which is supposed to be used by *providers* of various TPM2 device abstractions. * Then, we have two implementations (instances) of the Tpm2DeviceLib class: (1) SecurityPkg/Library/Tpm2DeviceLibTcg2/Tpm2DeviceLibTcg2.inf (2) SecurityPkg/Library/Tpm2DeviceLibRouter/Tpm2DeviceLibRouterDxe.inf (1) The first library instance ("Tpm2DeviceLibTcg2.inf") implements the APIs listed under (a), and it does not implement (b) -- see EFI_UNSUPPORTED. In other words, this lib instance is strictly meant for drivers that *consume* the TPM2 device abstraction. And, the (a) group of APIs is implemented by forwarding the requests to the TCG2 protocol. The idea here is that all the drivers that consume the TPM2 abstraction do not have to be statically linked with a large TPM2 device library instance; instead they are only linked (statically) with this "thin" library instance, and all the actual work is delegated to whichever driver that provides the singleton TCG2 protocol. (2) The second library instance ("Tpm2DeviceLibRouterDxe.inf") is meant for the driver that offers (produces) the TCG2 protocol. This lib instance implements both (a) and (b) API groups. * Here's how things fit together: (i) The "SecurityPkg/Library/Tpm2DeviceLibDTpm/Tpm2InstanceLibDTpm.inf" library instance (which has no lib class) is linked into "Tcg2Dxe.inf" via NULL class resolution. This simply means that before the "Tcg2Dxe.inf" entry point function is entered, the constructor function of "Tpm2InstanceLibDTpm.inf" will be called. (ii) This Tpm2InstanceLibDTpmConstructor() function calls API (b), and registers its own actual TPM2 command implementation with the "Tpm2DeviceLibRouter" library instance (also linked into the Tcg2Dxe driver). This provides the back-end for the API set (a). TCG2 protocol provider (Tcg2Dxe.inf driver) launches | v NULL class: Tpm2InstanceLibDTpm instance construction | v Tpm2DeviceLib class: Tpm2DeviceLibRouter instance backend registration for API set (a) (iii) The Tcg2Dxe driver exposes the TCG2 protocol. (iv) A TPM2 consumer calls API set (a) via lib instance (1). Such calls land in Tcg2Dxe, via the protocol. (v) Tcg2Dxe serves the protocol request by forwarding it to API set (a) from lib instance (2). (vi) Those functions call the "backend" functions registered by Tpm2DeviceLibDTpm in step (ii). TPM 2 consumer driver | v Tpm2DeviceLib class: Tpm2DeviceLibTcg2 instance | v TCG2 protocol interface | v TCG2 protocol provider: Tcg2Dxe.inf driver | v Tpm2DeviceLib class: Tpm2DeviceLibRouter instance | v NULL class: Tpm2InstanceLibDTpm instance (via earlier registration) | v TPM2 chip (actual hardware) * So that is the "router" pattern in edk2. Namely, - Consumers of an abstraction use a thin library instance. - The thin library instance calls a firmware-global (singleton) service, i.e. a PPI (in the PEI phase) or protocol (in the DXE phase). - The PEIM providing the PPI, or the DXE driver providing the protocol, don't themselves implement the actual service either. Instead they offer a "registration" service too, and they only connect the incoming "consumer" calls to the earlier registered back-end(s). - The "registration service", for back-ends to use, may take various forms. It can be exposed globally to the rest of the firmware, as another member function of the PPI / protocol structure. Then backends can be provided by separate PEIMs / DXE drivers. Or else, the registration service can be exposed as just another library API. In this case, the backends are provided as NULL class library instances, and a platform DSC file links them into the PEIM / DXE driver via NULL class resolutions. The backend lib instances call the registration service in their own respective constructor functions. Cc: Laszlo Ersek <lersek@redhat.com> Cc: Stefan Berger <stefanb@linux.vnet.ibm.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
=== OVMF OVERVIEW === The Open Virtual Machine Firmware (OVMF) project aims to support firmware for Virtual Machines using the edk2 code base. More information can be found at: http://www.tianocore.org/ovmf/ === STATUS === Current capabilities: * IA32 and X64 architectures * QEMU (0.10.0 or later) - Video, keyboard, IDE, CD-ROM, serial - Runs UEFI shell - Optional NIC support. Requires QEMU (0.12.2 or later) * UEFI Linux boots * UEFI Windows 8 boots * UEFI Windows 7 & Windows 2008 Server boot (see important notes below!) === FUTURE PLANS === * Test/Stabilize UEFI Self-Certification Tests (SCT) results === BUILDING OVMF === Pre-requisites: * Build environment capable of build the edk2 MdeModulePkg. * A properly configured ASL compiler: - Intel ASL compiler: Available from http://www.acpica.org - Microsoft ASL compiler: Available from http://www.acpi.info * NASM: http://www.nasm.us/ Update Conf/target.txt ACTIVE_PLATFORM for OVMF: PEI arch DXE arch UEFI interfaces * OvmfPkg/OvmfPkgIa32.dsc IA32 IA32 IA32 * OvmfPkg/OvmfPkgIa32X64.dsc IA32 X64 X64 * OvmfPkg/OvmfPkgX64.dsc X64 X64 X64 Update Conf/target.txt TARGET_ARCH based on the .dsc file: TARGET_ARCH * OvmfPkg/OvmfPkgIa32.dsc IA32 * OvmfPkg/OvmfPkgIa32X64.dsc IA32 X64 * OvmfPkg/OvmfPkgX64.dsc X64 Following the edk2 build process, you will find the OVMF binaries under the $WORKSPACE/Build/*/*/FV directory. The actual path will depend on how your build is configured. You can expect to find these binary outputs: * OVMF.FD - Please note! This filename has changed. Older releases used OVMF.Fv. * OvmfVideo.rom - This file is not built separately any longer, starting with svn r13520. More information on building OVMF can be found at: https://github.com/tianocore/tianocore.github.io/wiki/How%20to%20build%20OVMF === RUNNING OVMF on QEMU === * QEMU 0.12.2 or later is required. * Be sure to use qemu-system-x86_64, if you are using and X64 firmware. (qemu-system-x86_64 works for the IA32 firmware as well, of course.) * Use OVMF for QEMU firmware (3 options available) - Option 1: QEMU 1.6 or newer; Use QEMU -pflash parameter * QEMU/OVMF will use emulated flash, and fully support UEFI variables * Run qemu with: -pflash path/to/OVMF.fd * Note that this option is required for running SecureBoot-enabled builds (-D SECURE_BOOT_ENABLE). - Option 2: Use QEMU -bios parameter * Note that UEFI variables will be partially emulated, and non-volatile variables may lose their contents after a reboot * Run qemu with: -bios path/to/OVMF.fd - Option 3: Use QEMU -L parameter * Note that UEFI variables will be partially emulated, and non-volatile variables may lose their contents after a reboot * Either copy, rename or symlink OVMF.fd => bios.bin * Use the QEMU -L parameter to specify the directory where the bios.bin file is located. * The EFI shell is built into OVMF builds at this time, so it should run automatically if a UEFI boot application is not found on the removable media. * On Linux, newer version of QEMU may enable KVM feature, and this might cause OVMF to fail to boot. The QEMU '-no-kvm' may allow OVMF to boot. * Capturing OVMF debug messages on qemu: - The default OVMF build writes debug messages to IO port 0x402. The following qemu command line options save them in the file called debug.log: '-debugcon file:debug.log -global isa-debugcon.iobase=0x402'. - It is possible to revert to the original behavior, when debug messages were written to the emulated serial port (potentially intermixing OVMF debug output with UEFI serial console output). For this the '-D DEBUG_ON_SERIAL_PORT' option has to be passed to the build command (see the next section), and in order to capture the serial output qemu needs to be started with eg. '-serial file:serial.log'. - Debug messages fall into several categories. Logged vs. suppressed categories are controlled at OVMF build time by the 'gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel' bitmask (an UINT32 value) in the selected .dsc file. Individual bits of this bitmask are defined in <MdePkg/Include/Library/DebugLib.h>. One non-default bit (with some performance impact) that is frequently set for debugging is 0x00400000 (DEBUG_VERBOSE). - The RELEASE build target ('-b RELEASE' build option, see below) disables all debug messages. The default build target is DEBUG. === Build Scripts === On systems with the bash shell you can use OvmfPkg/build.sh to simplify building and running OVMF. So, for example, to build + run OVMF X64: $ OvmfPkg/build.sh -a X64 $ OvmfPkg/build.sh -a X64 qemu And to run a 64-bit UEFI bootable ISO image: $ OvmfPkg/build.sh -a X64 qemu -cdrom /path/to/disk-image.iso To build a 32-bit OVMF without debug messages using GCC 4.5: $ OvmfPkg/build.sh -a IA32 -b RELEASE -t GCC45 === SMM support === Requirements: * SMM support requires QEMU 2.5. * The minimum required QEMU machine type is "pc-q35-2.5". * SMM with KVM requires Linux 4.4 (host). OVMF is capable of utilizing SMM if the underlying QEMU or KVM hypervisor emulates SMM. SMM is put to use in the S3 suspend and resume infrastructure, and in the UEFI variable driver stack. The purpose is (virtual) hardware separation between the runtime guest OS and the firmware (OVMF), with the intent to make Secure Boot actually secure, by preventing the runtime guest OS from tampering with the variable store and S3 areas. For SMM support, OVMF must be built with the "-D SMM_REQUIRE" option. The resultant firmware binary will check if QEMU actually provides SMM emulation; if it doesn't, then OVMF will log an error and trigger an assertion failure during boot (even in RELEASE builds). Both the naming of the flag (SMM_REQUIRE, instead of SMM_ENABLE), and this behavior are consistent with the goal described above: this is supposed to be a security feature, and fallbacks are not allowed. Similarly, a pflash-backed variable store is a requirement. QEMU should be started with the options listed below (in addition to any other guest-specific flags). The command line should be gradually composed from the hints below. '\' is used to extend the command line to multiple lines, and '^' can be used on Windows. * QEMU binary and options specific to 32-bit guests: $ qemu-system-i386 -cpu coreduo,-nx \ or $ qemu-system-x86_64 -cpu <MODEL>,-lm,-nx \ * QEMU binary for running 64-bit guests (no particular options): $ qemu-system-x86_64 \ * Flags common to all SMM scenarios (only the Q35 machine type is supported): -machine q35,smm=on,accel=(tcg|kvm) \ -m ... \ -smp ... \ -global driver=cfi.pflash01,property=secure,value=on \ -drive if=pflash,format=raw,unit=0,file=OVMF_CODE.fd,readonly=on \ -drive if=pflash,format=raw,unit=1,file=copy_of_OVMF_VARS.fd \ * In order to disable S3, add: -global ICH9-LPC.disable_s3=1 \ === Network Support === OVMF provides a UEFI network stack by default. Its lowest level driver is the NIC driver, higher levels are generic. In order to make DHCP, PXE Boot, and eg. socket test utilities from the StdLib edk2 package work, (1) qemu has to be configured to emulate a NIC, (2) a matching UEFI NIC driver must be available when OVMF boots. (If a NIC is configured for the virtual machine, and -- dependent on boot order -- PXE booting is attempted, but no DHCP server responds to OVMF's DHCP DISCOVER message at startup, the boot process may take approx. 3 seconds longer.) * For each NIC emulated by qemu, a GPLv2 licensed UEFI driver is available from the iPXE project. The qemu source distribution, starting with version 1.5, contains prebuilt binaries of these drivers (and of course allows one to rebuild them from source as well). This is the recommended set of drivers. * Use the qemu -netdev and -device options, or the legacy -net option, to enable NIC support: <http://wiki.qemu.org/Documentation/Networking>. * For a qemu >= 1.5 binary running *without* any "-M machine" option where "machine" would identify a < qemu-1.5 configuration (for example: "-M pc-i440fx-1.4" or "-M pc-0.13"), the iPXE drivers are automatically available to and configured for OVMF in the default qemu installation. * For a qemu binary in [0.13, 1.5), or a qemu >= 1.5 binary with an "-M machine" option where "machine" selects a < qemu-1.5 configuration: - download a >= 1.5.0-rc1 source tarball from <http://wiki.qemu.org/Download>, - extract the following iPXE driver files from the tarball and install them in a location that is accessible to qemu processes (this may depend on your SELinux configuration, for example): qemu-VERSION/pc-bios/efi-e1000.rom qemu-VERSION/pc-bios/efi-ne2k_pci.rom qemu-VERSION/pc-bios/efi-pcnet.rom qemu-VERSION/pc-bios/efi-rtl8139.rom qemu-VERSION/pc-bios/efi-virtio.rom - extend the NIC's -device option on the qemu command line with a matching "romfile=" optarg: -device e1000,...,romfile=/full/path/to/efi-e1000.rom -device ne2k_pci,...,romfile=/full/path/to/efi-ne2k_pci.rom -device pcnet,...,romfile=/full/path/to/efi-pcnet.rom -device rtl8139,...,romfile=/full/path/to/efi-rtl8139.rom -device virtio-net-pci,...,romfile=/full/path/to/efi-virtio.rom * Independently of the iPXE NIC drivers, the default OVMF build provides a basic virtio-net driver, located in OvmfPkg/VirtioNetDxe. * Also independently of the iPXE NIC drivers, Intel's proprietary E1000 NIC driver (from the BootUtil distribution) can be embedded in the OVMF image at build time: - Download BootUtil: - Navigate to https://downloadcenter.intel.com/download/19186/Ethernet-Intel-Ethernet-Connections-Boot-Utility-Preboot-Images-and-EFI-Drivers - Click the download link for "PREBOOT.EXE". - Accept the Intel Software License Agreement that appears. - Unzip "PREBOOT.EXE" into a separate directory (this works with the "unzip" utility on platforms different from Windows as well). - Copy the "APPS/EFI/EFIx64/E3522X2.EFI" driver binary to "Intel3.5/EFIX64/E3522X2.EFI" in your WORKSPACE. - Intel have stopped distributing an IA32 driver binary (which used to match the filename pattern "E35??E2.EFI"), thus this method will only work for the IA32X64 and X64 builds of OVMF. - Include the driver in OVMF during the build: - Add "-D E1000_ENABLE" to your build command (only when building "OvmfPkg/OvmfPkgIa32X64.dsc" or "OvmfPkg/OvmfPkgX64.dsc"). - For example: "build -D E1000_ENABLE". * When a matching iPXE driver is configured for a NIC as described above, it takes priority over other drivers that could possibly drive the card too: | e1000 ne2k_pci pcnet rtl8139 virtio-net-pci ---------------------+------------------------------------------------ iPXE | x x x x x VirtioNetDxe | x Intel BootUtil (X64) | x === OVMF Flash Layout === Like all current IA32/X64 system designs, OVMF's firmware device (rom/flash) appears in QEMU's physical address space just below 4GB (0x100000000). OVMF supports building a 1MB, 2MB or 4MB flash image (see the DSC files for the FD_SIZE_1MB, FD_SIZE_2MB, FD_SIZE_4MB build defines). The base address for the 1MB image in QEMU physical memory is 0xfff00000. The base address for the 2MB image is 0xffe00000. The base address for the 4MB image is 0xffc00000. Using the 1MB or 2MB image, the layout of the firmware device in memory looks like: +--------------------------------------- 4GB (0x100000000) | VTF0 (16-bit reset code) and OVMF SEC | (SECFV, 208KB/0x34000) +--------------------------------------- varies based on flash size | | Compressed main firmware image | (FVMAIN_COMPACT) | +--------------------------------------- base + 0x20000 | Fault-tolerant write (FTW) | Spare blocks (64KB/0x10000) +--------------------------------------- base + 0x10000 | FTW Work block (4KB/0x1000) +--------------------------------------- base + 0x0f000 | Event log area (4KB/0x1000) +--------------------------------------- base + 0x0e000 | Non-volatile variable storage | area (56KB/0xe000) +--------------------------------------- base address Using the 4MB image, the layout of the firmware device in memory looks like: +--------------------------------------- base + 0x400000 (4GB/0x100000000) | VTF0 (16-bit reset code) and OVMF SEC | (SECFV, 208KB/0x34000) +--------------------------------------- base + 0x3cc000 | | Compressed main firmware image | (FVMAIN_COMPACT, 3360KB/0x348000) | +--------------------------------------- base + 0x84000 | Fault-tolerant write (FTW) | Spare blocks (264KB/0x42000) +--------------------------------------- base + 0x42000 | FTW Work block (4KB/0x1000) +--------------------------------------- base + 0x41000 | Event log area (4KB/0x1000) +--------------------------------------- base + 0x40000 | Non-volatile variable storage | area (256KB/0x40000) +--------------------------------------- base address (0xffc00000) The code in SECFV locates FVMAIN_COMPACT, and decompresses the main firmware (MAINFV) into RAM memory at address 0x800000. The remaining OVMF firmware then uses this decompressed firmware volume image. === UNIXGCC Debug === If you build with the UNIXGCC toolchain, then debugging will be disabled due to larger image sizes being produced by the UNIXGCC toolchain. The first choice recommendation is to use GCC44 or newer instead. If you must use UNIXGCC, then you can override the build options for particular libraries and modules in the .dsc to re-enable debugging selectively. For example: [Components] OvmfPkg/Library/PlatformBootManagerLib/PlatformBootManagerLib.inf { <BuildOptions> GCC:*_*_*_CC_FLAGS = -UMDEPKG_NDEBUG } MdeModulePkg/Universal/BdsDxe/BdsDxe.inf { <BuildOptions> GCC:*_*_*_CC_FLAGS = -UMDEPKG_NDEBUG } === UEFI Windows 7 & Windows 2008 Server === * One of the '-vga std' and '-vga qxl' QEMU options should be used. * Only one video mode, 1024x768x32, is supported at OS runtime. * The '-vga qxl' QEMU option is recommended. After booting the installed guest OS, select the video card in Device Manager, and upgrade its driver to the QXL XDDM one. Download location: <http://www.spice-space.org/download.html>, Guest | Windows binaries. This enables further resolutions at OS runtime, and provides S3 (suspend/resume) capability.