]> git.proxmox.com Git - mirror_edk2.git/blob - OvmfPkg/README
OvmfPkg: Add section of memory to use for PEI on S3 resume
[mirror_edk2.git] / OvmfPkg / README
1
2 === OVMF OVERVIEW ===
3
4 The Open Virtual Machine Firmware (OVMF) project aims
5 to support firmware for Virtual Machines using the edk2
6 code base. More information can be found at:
7
8 http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF
9
10 === STATUS ===
11
12 Current capabilities:
13 * IA32 and X64 architectures
14 * QEMU (0.10.0 or later)
15 - Video, keyboard, IDE, CD-ROM, serial
16 - Runs UEFI shell
17 - Optional NIC support. Requires QEMU (0.12.2 or later)
18 * UEFI Linux boots
19 * UEFI Windows 8 boots
20
21 === FUTURE PLANS ===
22
23 * Test/Stabilize UEFI Self-Certification Tests (SCT) results
24
25 === BUILDING OVMF ===
26
27 Pre-requisites:
28 * Build environment capable of build the edk2 MdeModulePkg.
29 * A properly configured ASL compiler:
30 - Intel ASL compiler: Available from http://www.acpica.org
31 - Microsoft ASL compiler: Available from http://www.acpi.info
32
33 Update Conf/target.txt ACTIVE_PLATFORM for OVMF:
34 PEI arch DXE arch UEFI interfaces
35 * OvmfPkg/OvmfPkgIa32.dsc IA32 IA32 IA32
36 * OvmfPkg/OvmfPkgIa32X64.dsc IA32 X64 X64
37 * OvmfPkg/OvmfPkgX64.dsc X64 X64 X64
38
39 Update Conf/target.txt TARGET_ARCH based on the .dsc file:
40 TARGET_ARCH
41 * OvmfPkg/OvmfPkgIa32.dsc IA32
42 * OvmfPkg/OvmfPkgIa32X64.dsc IA32 X64
43 * OvmfPkg/OvmfPkgX64.dsc X64
44
45 Following the edk2 build process, you will find the OVMF binaries
46 under the $WORKSPACE/Build/*/*/FV directory. The actual path will
47 depend on how your build is configured. You can expect to find
48 these binary outputs:
49 * OVMF.FD
50 - Please note! This filename has changed. Older releases used OVMF.Fv.
51 * OvmfVideo.rom
52 - This file is not built separately any longer, starting with svn r13520.
53
54 More information on building OVMF can be found at:
55
56 http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF
57
58 === RUNNING OVMF on QEMU ===
59
60 * QEMU 0.12.2 or later is required.
61 * Be sure to use qemu-system-x86_64, if you are using and X64 firmware.
62 (qemu-system-x86_64 works for the IA32 firmware as well, of course.)
63 * Use OVMF for QEMU firmware (3 options available)
64 - Option 1: QEMU 1.6 or newer; Use QEMU -pflash parameter
65 * QEMU/OVMF will use emulated flash, and fully support UEFI variables
66 * Run qemu with: -pflash path/to/OVMF.fd
67 - Option 2: Use QEMU -bios parameter
68 * Note that UEFI variables will be partially emulated, and non-volatile
69 variables may lose their contents after a reboot
70 * Run qemu with: -bios path/to/OVMF.fd
71 - Option 3: Use QEMU -L parameter
72 * Note that UEFI variables will be partially emulated, and non-volatile
73 variables may lose their contents after a reboot
74 * Either copy, rename or symlink OVMF.fd => bios.bin
75 * Use the QEMU -L parameter to specify the directory where the bios.bin
76 file is located.
77 * The EFI shell is built into OVMF builds at this time, so it should
78 run automatically if a UEFI boot application is not found on the
79 removable media.
80 * On Linux, newer version of QEMU may enable KVM feature, and this might
81 cause OVMF to fail to boot. The QEMU '-no-kvm' may allow OVMF to boot.
82 * Capturing OVMF debug messages on qemu:
83 - The default OVMF build writes debug messages to IO port 0x402. The
84 following qemu command line options save them in the file called
85 debug.log: '-debugcon file:debug.log -global isa-debugcon.iobase=0x402'.
86 - It is possible to revert to the original behavior, when debug messages were
87 written to the emulated serial port (potentially intermixing OVMF debug
88 output with UEFI serial console output). For this the
89 '-D DEBUG_ON_SERIAL_PORT' option has to be passed to the build command (see
90 the next section), and in order to capture the serial output qemu needs to
91 be started with eg. '-serial file:serial.log'.
92 - Debug messages fall into several categories. Logged vs. suppressed
93 categories are controlled at OVMF build time by the
94 'gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel' bitmask (an UINT32
95 value) in the selected .dsc file. Individual bits of this bitmask are
96 defined in <MdePkg/Include/Library/DebugLib.h>. One non-default bit (with
97 some performance impact) that is frequently set for debugging is 0x00400000
98 (DEBUG_VERBOSE).
99 - The RELEASE build target ('-b RELEASE' build option, see below) disables
100 all debug messages. The default build target is DEBUG.
101
102 === Build Scripts ===
103
104 On systems with the bash shell you can use OvmfPkg/build.sh to simplify
105 building and running OVMF.
106
107 So, for example, to build + run OVMF X64:
108 $ OvmfPkg/build.sh -a X64
109 $ OvmfPkg/build.sh -a X64 qemu
110
111 And to run a 64-bit UEFI bootable ISO image:
112 $ OvmfPkg/build.sh -a X64 qemu -cdrom /path/to/disk-image.iso
113
114 To build a 32-bit OVMF without debug messages using GCC 4.5:
115 $ OvmfPkg/build.sh -a IA32 -b RELEASE -t GCC45
116
117 === Network Support ===
118
119 OVMF provides a UEFI network stack by default. Its lowest level driver is the
120 NIC driver, higher levels are generic. In order to make DHCP, PXE Boot, and eg.
121 socket test utilities from the StdLib edk2 package work, (1) qemu has to be
122 configured to emulate a NIC, (2) a matching UEFI NIC driver must be available
123 when OVMF boots.
124
125 (If a NIC is configured for the virtual machine, and -- dependent on boot order
126 -- PXE booting is attempted, but no DHCP server responds to OVMF's DHCP
127 DISCOVER message at startup, the boot process may take approx. 3 seconds
128 longer.)
129
130 * For each NIC emulated by qemu, a GPLv2 licensed UEFI driver is available from
131 the iPXE project. The qemu source distribution, starting with version 1.5,
132 contains prebuilt binaries of these drivers (and of course allows one to
133 rebuild them from source as well). This is the recommended set of drivers.
134
135 * Use the qemu -netdev and -device options, or the legacy -net option, to
136 enable NIC support: <http://wiki.qemu.org/Documentation/Networking>.
137
138 * For a qemu >= 1.5 binary running *without* any "-M machine" option where
139 "machine" would identify a < qemu-1.5 configuration (for example: "-M
140 pc-i440fx-1.4" or "-M pc-0.13"), the iPXE drivers are automatically available
141 to and configured for OVMF in the default qemu installation.
142
143 * For a qemu binary in [0.13, 1.5), or a qemu >= 1.5 binary with an "-M
144 machine" option where "machine" selects a < qemu-1.5 configuration:
145
146 - download a >= 1.5.0-rc1 source tarball from <http://wiki.qemu.org/Download>,
147
148 - extract the following iPXE driver files from the tarball and install them
149 in a location that is accessible to qemu processes (this may depend on your
150 SELinux configuration, for example):
151
152 qemu-VERSION/pc-bios/efi-e1000.rom
153 qemu-VERSION/pc-bios/efi-ne2k_pci.rom
154 qemu-VERSION/pc-bios/efi-pcnet.rom
155 qemu-VERSION/pc-bios/efi-rtl8139.rom
156 qemu-VERSION/pc-bios/efi-virtio.rom
157
158 - extend the NIC's -device option on the qemu command line with a matching
159 "romfile=" optarg:
160
161 -device e1000,...,romfile=/full/path/to/efi-e1000.rom
162 -device ne2k_pci,...,romfile=/full/path/to/efi-ne2k_pci.rom
163 -device pcnet,...,romfile=/full/path/to/efi-pcnet.rom
164 -device rtl8139,...,romfile=/full/path/to/efi-rtl8139.rom
165 -device virtio-net-pci,...,romfile=/full/path/to/efi-virtio.rom
166
167 * Independently of the iPXE NIC drivers, the default OVMF build provides a
168 basic virtio-net driver, located in OvmfPkg/VirtioNetDxe.
169
170 * Also independently of the iPXE NIC drivers, Intel's proprietary E1000 NIC
171 driver (PROEFI) can be embedded in the OVMF image at build time:
172
173 - Download UEFI drivers for the e1000 NIC
174 - http://downloadcenter.intel.com/Detail_Desc.aspx?agr=Y&DwnldID=17515&lang=eng
175 - Install the drivers into a directory called Intel3.5 in your WORKSPACE.
176
177 - Include the driver in OVMF during the build:
178 - Add "-D E1000_ENABLE -D FD_SIZE_2MB" to your build command,
179 - For example: "build -D E1000_ENABLE -D FD_SIZE_2MB".
180
181 * When a matching iPXE driver is configured for a NIC as described above, it
182 takes priority over other drivers that could possibly drive the card too:
183
184 | e1000 ne2k_pci pcnet rtl8139 virtio-net-pci
185 -------------+------------------------------------------------
186 iPXE | x x x x x
187 VirtioNetDxe | x
188 Intel PROEFI | x
189
190 === OVMF Flash Layout ===
191
192 Like all current IA32/X64 system designs, OVMF's firmware
193 device (rom/flash) appears in QEMU's physical address space
194 just below 4GB (0x100000000).
195
196 The layout of the firmware device in memory looks like:
197
198 +--------------------------------------- 4GB (0x100000000)
199 | VTF0 (16-bit reset code) and OVMF SEC
200 | (SECFV)
201 +--------------------------------------- varies based on flash size
202 |
203 | Compressed main firmware image
204 | (FVMAIN_COMPACT)
205 |
206 +--------------------------------------- base + 0x20000
207 | Fault-tolerant write (FTW)
208 | Spare blocks (64KB/0x10000)
209 +--------------------------------------- base + 0x10000
210 | FTW Work block (4KB/0x1000)
211 +--------------------------------------- base + 0x0f000
212 | Event log area (4KB/0x1000)
213 +--------------------------------------- base + 0x0e000
214 | Non-volatile variable storage
215 | area (56KB/0xe000)
216 +--------------------------------------- base address
217
218 OVMF supports building a 1MB or a 2MB flash image. The base address for
219 a 1MB image in QEMU physical memory is 0xfff00000. The base address for
220 a 2MB image is 0xffe00000.
221
222 The code in SECFV locates FVMAIN_COMPACT, and decompresses the
223 main firmware (MAINFV) into RAM memory at address 0x800000. The
224 remaining OVMF firmware then uses this decompressed firmware
225 volume image.
226
227 === UNIXGCC Debug ===
228
229 If you build with the UNIXGCC toolchain, then debugging will be disabled
230 due to larger image sizes being produced by the UNIXGCC toolchain. The
231 first choice recommendation is to use GCC44 or newer instead.
232
233 If you must use UNIXGCC, then you can override the build options for
234 particular libraries and modules in the .dsc to re-enable debugging
235 selectively. For example:
236 [Components]
237 OvmfPkg/Library/PlatformBdsLib/PlatformBdsLib.inf {
238 <BuildOptions>
239 GCC:*_*_*_CC_FLAGS = -UMDEPKG_NDEBUG
240 }
241 IntelFrameworkModulePkg/Universal/BdsDxe/BdsDxe.inf {
242 <BuildOptions>
243 GCC:*_*_*_CC_FLAGS = -UMDEPKG_NDEBUG
244 }
245