<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://linux-kvm.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lersek</id>
	<title>KVM - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://linux-kvm.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lersek"/>
	<link rel="alternate" type="text/html" href="https://linux-kvm.org/page/Special:Contributions/Lersek"/>
	<updated>2026-05-14T10:30:14Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.5</generator>
	<entry>
		<id>https://linux-kvm.org/index.php?title=WindowsGuestDrivers/Repository&amp;diff=173805</id>
		<title>WindowsGuestDrivers/Repository</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=WindowsGuestDrivers/Repository&amp;diff=173805"/>
		<updated>2017-02-15T16:56:14Z</updated>

		<summary type="html">&lt;p&gt;Lersek: update links to KVM Windows guest drivers upstream code&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;The master repository for development of the KVM Windows guest drivers is hosted on GitHub:&lt;br /&gt;
&lt;br /&gt;
* Anonymous clone of repository:&lt;br /&gt;
  &lt;br /&gt;
   git clone git://github.com/virtio-win/kvm-guest-drivers-windows.git&lt;br /&gt;
&lt;br /&gt;
* [https://github.com/virtio-win/kvm-guest-drivers-windows Browse GIT repository online]&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=173154</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=173154"/>
		<updated>2015-03-10T14:27:43Z</updated>

		<summary type="html">&lt;p&gt;Lersek: replace stale contents with link to whitepaper&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
The earlier contents of this article have been replaced with the following link to the OVMF whitepaper:&lt;br /&gt;
&lt;br /&gt;
http://www.linux-kvm.org/downloads/lersek/ovmf-whitepaper-c770f8c.txt&lt;br /&gt;
&lt;br /&gt;
The whitepaper covers everything this article used to cover, and the whitepaper is much more up-to-date and extensive. Please use the History link near the bottom if you&#039;d like to see the previous (now stale) contents.&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=KVM_Forum_2014_BOF&amp;diff=23035</id>
		<title>KVM Forum 2014 BOF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=KVM_Forum_2014_BOF&amp;diff=23035"/>
		<updated>2014-09-16T14:56:42Z</updated>

		<summary type="html">&lt;p&gt;Lersek: add OVMF BoF&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;= Introduction =&lt;br /&gt;
&lt;br /&gt;
We will reserve some time for people to get together and discuss&lt;br /&gt;
strategic decisions as well as other topics that are best solved within&lt;br /&gt;
smaller groups. This time can also be used for hands-on hacking&lt;br /&gt;
sessions.&lt;br /&gt;
&lt;br /&gt;
If you are interested in organizing such a group time event, please add&lt;br /&gt;
it to the list *before* KVM Forum, so people have time to organize which&lt;br /&gt;
one they will attend.&lt;br /&gt;
&lt;br /&gt;
All of these sessions will get the chance to quickly talk about results&lt;br /&gt;
they managed to achieve during their time in a quick &amp;quot;results&amp;quot; session.&lt;br /&gt;
&lt;br /&gt;
= BoF Ideas =&lt;br /&gt;
&lt;br /&gt;
== OVMF ==&lt;br /&gt;
&lt;br /&gt;
=== Open Virtual Machine Firmware ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Summary:&#039;&#039;&#039; OVMF (Open Virtual Machine Firmware) is a project to enable&lt;br /&gt;
UEFI support for Virtual Machines. This BoF should allow users and&lt;br /&gt;
developers of virtualization and/or UEFI software to discuss how OVMF fits&lt;br /&gt;
in the &amp;quot;intersection&amp;quot; of virt and UEFI, what it is good for, how it can be&lt;br /&gt;
used, how people can contribute, and how OVMF works, internally and in&lt;br /&gt;
combination with the other layers of the virt stack.&lt;br /&gt;
&lt;br /&gt;
The Unified Extensible Firmware Interface (UEFI) is a specification that&lt;br /&gt;
defines a software interface between an operating system and platform&lt;br /&gt;
firmware. UEFI is designed to replace the Basic Input/Output System (BIOS)&lt;br /&gt;
firmware interface.&lt;br /&gt;
&lt;br /&gt;
Hardware platform vendors have been increasingly adopting the UEFI&lt;br /&gt;
Specification to govern their boot firmware developments. OVMF (Open Virtual&lt;br /&gt;
Machine Firmware), a sub-project of Intel&#039;s EFI Development Kit II (edk2),&lt;br /&gt;
enables UEFI support for Ia32 and X64 Virtual Machines.&lt;br /&gt;
&lt;br /&gt;
In this BoF all areas and topics related to the overlap of virt and UEFI are&lt;br /&gt;
welcome (regardless of their &amp;quot;technical depth&amp;quot;), except politics and/or&lt;br /&gt;
historical controversy around UEFI Secure Boot. (Discussing Secure Boot per&lt;br /&gt;
se is fine.)&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;People:&#039;&#039;&#039;&lt;br /&gt;
* Laszlo Ersek (&amp;quot;organizer&amp;quot;)&lt;br /&gt;
* &amp;amp;lt;add your name here&amp;amp;gt;&lt;br /&gt;
&lt;br /&gt;
== BoF idea template ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
=== TITLE ===&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Summary:&#039;&#039;&#039; Short description of the idea&lt;br /&gt;
&lt;br /&gt;
Detailed description of the idea.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Links:&#039;&#039;&#039;&lt;br /&gt;
* Wiki links to relevant material&lt;br /&gt;
* External links to mailing lists or web sites&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;People:&#039;&#039;&#039;&lt;br /&gt;
* Your Name (organizer)&lt;br /&gt;
* People that want to attend this session&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4868</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4868"/>
		<updated>2013-08-26T10:01:18Z</updated>

		<summary type="html">&lt;p&gt;Lersek: specify &amp;quot;hd,cdrom&amp;quot; boot order -- makes no difference while the target disk is unpartitioned, and is preferred after completing the installation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffmann&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; among other things, verbosity of OVMF&#039;s debug log. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=hd,cdrom                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== qemu wrapper script under libvirt ===&lt;br /&gt;
&lt;br /&gt;
Libvirt (and its frontends, eg. virsh and virt-manager) provide a convenient way to manage virtual machines. However some qemu command line options are not directly exposed (at least not on a RHEL-6.4 host) that would prove useful otherwise. A script that wraps qemu and plays the emulator role for libvirt allows extra flexibility. On the other side of the coin, it may introduce extra confusion, so use with care.&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator binary. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never use a wrapper script in production.)&lt;br /&gt;
&lt;br /&gt;
An example script follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
# Operating modes:&lt;br /&gt;
# - AD_HOC: use local OVMF &amp;amp; SeaVGABIOS build, ignore iPXE roms,&lt;br /&gt;
# - AD_HOC_IPXE: same, but make use of ad-hoc iPXE roms,&lt;br /&gt;
# - KRAXEL_RPMS: use Kraxel&#039;s RPMs whole-sale&lt;br /&gt;
MODE=KRAXEL_RPMS&lt;br /&gt;
&lt;br /&gt;
# Location of ad-hoc ROMs.&lt;br /&gt;
AD_HOC_PATH=/home/virt-images&lt;br /&gt;
&lt;br /&gt;
# Root installation directory of Kraxel&#039;s RPMs.&lt;br /&gt;
KRAXEL_PATH=/usr/share/edk2.git/ovmf-x64&lt;br /&gt;
&lt;br /&gt;
# Whether to load extra SMBIOS tables.&lt;br /&gt;
SMBIOS_EXTRA=0&lt;br /&gt;
&lt;br /&gt;
# Argument array constructed for qemu-kvm.&lt;br /&gt;
NEW_ARGS=()&lt;br /&gt;
append()&lt;br /&gt;
{&lt;br /&gt;
  for I in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
    NEW_ARGS[${#NEW_ARGS[@]}]=$I&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# -vga cirrus found in AD_HOC* modes&lt;br /&gt;
AD_HOC_CIRRUS=0&lt;br /&gt;
&lt;br /&gt;
# -name XXX found; XXX saved in $NAME&lt;br /&gt;
NAME=&lt;br /&gt;
&lt;br /&gt;
# previous argument processed&lt;br /&gt;
LAST=&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x-vga = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ cirrus = &amp;quot;$ARG&amp;quot; ] \&lt;br /&gt;
      &amp;amp;&amp;amp; ([ AD_HOC = &amp;quot;$MODE&amp;quot; ] || [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]); then&lt;br /&gt;
    AD_HOC_CIRRUS=1&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  elif [ x-device = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    case &amp;quot;$ARG&amp;quot; in&lt;br /&gt;
      (e1000*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-e1000.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (ne2k_pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-ne2k_pci.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (pcnet*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-pcnet.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (rtl8139*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-rtl8139.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (virtio-net-pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-virtio.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (*)&lt;br /&gt;
        append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
    esac&lt;br /&gt;
  elif [ x-bios = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ KRAXEL_RPMS = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    append &amp;quot;$KRAXEL_PATH/bios.bin&amp;quot; -L &amp;quot;$KRAXEL_PATH&amp;quot;&lt;br /&gt;
  elif [ x-name = x&amp;quot;$LAST&amp;quot; ]; then&lt;br /&gt;
    NAME=$ARG&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  LAST=$ARG&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$NAME&amp;quot; ]; then&lt;br /&gt;
  append -debugcon file:/tmp/&amp;quot;$NAME&amp;quot;.debug -global isa-debugcon.iobase=0x402 \&lt;br /&gt;
      -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0&lt;br /&gt;
&lt;br /&gt;
  if [ 0 -ne $SMBIOS_EXTRA ]; then&lt;br /&gt;
    append -smbios file=$AD_HOC_PATH/smbios/type3&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  if [[ x&amp;quot;$NAME&amp;quot; = xovmf.win2k8* ]] &amp;amp;&amp;amp; [ 0 -ne $AD_HOC_CIRRUS ]; then&lt;br /&gt;
    append -global cirrus-vga.romfile=$AD_HOC_PATH/vgabios-cirrus.csm.bin&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;${NEW_ARGS[@]}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This particular script accounts for libvirt invoking the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten, plus other static options are useless. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, the script constructs the logfile&#039;s name from the corresponding option-argument, and adds some extra static options.&lt;br /&gt;
&lt;br /&gt;
In more detail, the script supports three &amp;quot;operating modes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;KRAXEL_RPMS&amp;lt;/code&amp;gt; mode is the recommended one for qemu-1.5+. This mode overrides the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element of the guest XML, and uses the OVMF firmware and any other required files from Gerd&#039;s package. Notably, EFI drivers for the emulated / virtio NICs from the iPXE project will be available in the guest as option ROMs.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC&amp;lt;/code&amp;gt; mode serves development purposes. It disables any iPXE NIC drivers on qemu versions under 1.5 (so that the built-in VirtioNetDxe driver can be tested), lets &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt;  (= custom OVMF build) take effect, and specifies a custom SeaVGABIOS binary for Windows 2008 R2 guests (based on their name). The Windows 2008 R2 guest is discussed below some more.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC_IPXE&amp;lt;/code&amp;gt; mode is the same, a development helper, except it gives priority to custom iPXE NIC drivers. (Consult &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; for networking options.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The static options enable S3/S4 in RHEL-6.4 qemu, and set the location of OVMF&#039;s debug log.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 18&#039;&#039;&#039; (XFCE spin tested). When Fedora 18 was released, it co-operated with, and recognized Secure Boot. However some time later the signature verification algorithm changed in TianoCore, and currently OVMF doesn&#039;t accept the signatures on Fedora 18 shim. (Fedora 18 works fine on top of OVMF otherwise, when Secure Boot is disabled.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 19&#039;&#039;&#039; (XFCE spin tested). It supports Secure Boot on current OVMF. See [https://bugzilla.redhat.com/show_bug.cgi?id=963361#c9 Red Hat Bugzilla 963361 comment 9] and subsequent comments for the setup. In order to transfer certificates from host to guest (for key enrollment), it is recommended to prepare a disk image with a [http://libguestfs.org/ libguestfs] utility, like &amp;lt;code&amp;gt;guestfish&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;guestmount&amp;lt;/code&amp;gt;, and attach it to the virtual machine.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;RHEL-6.3&#039;&#039;&#039; and &#039;&#039;&#039;RHEL-6.4&#039;&#039;&#039;. The &amp;lt;code&amp;gt;grub-efi&amp;lt;/code&amp;gt; releases in these RHEL-6 minor releases don&#039;t support booting from a virtio-blk disk. Virtio-scsi is supported however (see libvirt XML configuration above). Grub-efi in a future RHEL-6 minor release should hopefully support virtio-blk as well, see [https://bugzilla.redhat.com/show_bug.cgi?id=916016 Red Hat Bugzilla 916016].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows 8&#039;&#039;&#039;. In order to test Secure Boot, enroll the keys from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog], [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx start PowerShell as an administrator], then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verify Secure Boot].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2012&#039;&#039;&#039;, reportedly.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2008 R2 SP1&#039;&#039;&#039;. This guest has a bug (it requires VGA BIOS support even when booted by UEFI firmware). Thankfully, David Woodhouse and Kevin O&#039;Connor implemented a Compatibility Support Module (CSM) for SeaBIOS. Some out-of-tree patches (as of now) are needed for OVMF from http://git.infradead.org/users/dwmw2/edk2.git/; they are included in Gerd&#039;s packages and this guest boots fine with them.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4827</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4827"/>
		<updated>2013-06-20T11:33:52Z</updated>

		<summary type="html">&lt;p&gt;Lersek: Gerd&amp;#039;s packages now enable win2k8r2sp1 to work out of the box&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffmann&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; among other things, verbosity of OVMF&#039;s debug log. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== qemu wrapper script under libvirt ===&lt;br /&gt;
&lt;br /&gt;
Libvirt (and its frontends, eg. virsh and virt-manager) provide a convenient way to manage virtual machines. However some qemu command line options are not directly exposed (at least not on a RHEL-6.4 host) that would prove useful otherwise. A script that wraps qemu and plays the emulator role for libvirt allows extra flexibility. On the other side of the coin, it may introduce extra confusion, so use with care.&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator binary. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never use a wrapper script in production.)&lt;br /&gt;
&lt;br /&gt;
An example script follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
# Operating modes:&lt;br /&gt;
# - AD_HOC: use local OVMF &amp;amp; SeaVGABIOS build, ignore iPXE roms,&lt;br /&gt;
# - AD_HOC_IPXE: same, but make use of ad-hoc iPXE roms,&lt;br /&gt;
# - KRAXEL_RPMS: use Kraxel&#039;s RPMs whole-sale&lt;br /&gt;
MODE=KRAXEL_RPMS&lt;br /&gt;
&lt;br /&gt;
# Location of ad-hoc ROMs.&lt;br /&gt;
AD_HOC_PATH=/home/virt-images&lt;br /&gt;
&lt;br /&gt;
# Root installation directory of Kraxel&#039;s RPMs.&lt;br /&gt;
KRAXEL_PATH=/usr/share/edk2.git/ovmf-x64&lt;br /&gt;
&lt;br /&gt;
# Whether to load extra SMBIOS tables.&lt;br /&gt;
SMBIOS_EXTRA=0&lt;br /&gt;
&lt;br /&gt;
# Argument array constructed for qemu-kvm.&lt;br /&gt;
NEW_ARGS=()&lt;br /&gt;
append()&lt;br /&gt;
{&lt;br /&gt;
  for I in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
    NEW_ARGS[${#NEW_ARGS[@]}]=$I&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# -vga cirrus found in AD_HOC* modes&lt;br /&gt;
AD_HOC_CIRRUS=0&lt;br /&gt;
&lt;br /&gt;
# -name XXX found; XXX saved in $NAME&lt;br /&gt;
NAME=&lt;br /&gt;
&lt;br /&gt;
# previous argument processed&lt;br /&gt;
LAST=&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x-vga = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ cirrus = &amp;quot;$ARG&amp;quot; ] \&lt;br /&gt;
      &amp;amp;&amp;amp; ([ AD_HOC = &amp;quot;$MODE&amp;quot; ] || [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]); then&lt;br /&gt;
    AD_HOC_CIRRUS=1&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  elif [ x-device = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    case &amp;quot;$ARG&amp;quot; in&lt;br /&gt;
      (e1000*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-e1000.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (ne2k_pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-ne2k_pci.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (pcnet*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-pcnet.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (rtl8139*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-rtl8139.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (virtio-net-pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-virtio.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (*)&lt;br /&gt;
        append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
    esac&lt;br /&gt;
  elif [ x-bios = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ KRAXEL_RPMS = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    append &amp;quot;$KRAXEL_PATH/bios.bin&amp;quot; -L &amp;quot;$KRAXEL_PATH&amp;quot;&lt;br /&gt;
  elif [ x-name = x&amp;quot;$LAST&amp;quot; ]; then&lt;br /&gt;
    NAME=$ARG&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  LAST=$ARG&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$NAME&amp;quot; ]; then&lt;br /&gt;
  append -debugcon file:/tmp/&amp;quot;$NAME&amp;quot;.debug -global isa-debugcon.iobase=0x402 \&lt;br /&gt;
      -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0&lt;br /&gt;
&lt;br /&gt;
  if [ 0 -ne $SMBIOS_EXTRA ]; then&lt;br /&gt;
    append -smbios file=$AD_HOC_PATH/smbios/type3&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  if [[ x&amp;quot;$NAME&amp;quot; = xovmf.win2k8* ]] &amp;amp;&amp;amp; [ 0 -ne $AD_HOC_CIRRUS ]; then&lt;br /&gt;
    append -global cirrus-vga.romfile=$AD_HOC_PATH/vgabios-cirrus.csm.bin&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;${NEW_ARGS[@]}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This particular script accounts for libvirt invoking the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten, plus other static options are useless. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, the script constructs the logfile&#039;s name from the corresponding option-argument, and adds some extra static options.&lt;br /&gt;
&lt;br /&gt;
In more detail, the script supports three &amp;quot;operating modes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;KRAXEL_RPMS&amp;lt;/code&amp;gt; mode is the recommended one for qemu-1.5+. This mode overrides the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element of the guest XML, and uses the OVMF firmware and any other required files from Gerd&#039;s package. Notably, EFI drivers for the emulated / virtio NICs from the iPXE project will be available in the guest as option ROMs.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC&amp;lt;/code&amp;gt; mode serves development purposes. It disables any iPXE NIC drivers on qemu versions under 1.5 (so that the built-in VirtioNetDxe driver can be tested), lets &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt;  (= custom OVMF build) take effect, and specifies a custom SeaVGABIOS binary for Windows 2008 R2 guests (based on their name). The Windows 2008 R2 guest is discussed below some more.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC_IPXE&amp;lt;/code&amp;gt; mode is the same, a development helper, except it gives priority to custom iPXE NIC drivers. (Consult &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; for networking options.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The static options enable S3/S4 in RHEL-6.4 qemu, and set the location of OVMF&#039;s debug log.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 18&#039;&#039;&#039; (XFCE spin tested). When Fedora 18 was released, it co-operated with, and recognized Secure Boot. However some time later the signature verification algorithm changed in TianoCore, and currently OVMF doesn&#039;t accept the signatures on Fedora 18 shim. (Fedora 18 works fine on top of OVMF otherwise, when Secure Boot is disabled.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 19&#039;&#039;&#039; (XFCE spin tested). It supports Secure Boot on current OVMF. See [https://bugzilla.redhat.com/show_bug.cgi?id=963361#c9 Red Hat Bugzilla 963361 comment 9] and subsequent comments for the setup. In order to transfer certificates from host to guest (for key enrollment), it is recommended to prepare a disk image with a [http://libguestfs.org/ libguestfs] utility, like &amp;lt;code&amp;gt;guestfish&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;guestmount&amp;lt;/code&amp;gt;, and attach it to the virtual machine.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;RHEL-6.3&#039;&#039;&#039; and &#039;&#039;&#039;RHEL-6.4&#039;&#039;&#039;. The &amp;lt;code&amp;gt;grub-efi&amp;lt;/code&amp;gt; releases in these RHEL-6 minor releases don&#039;t support booting from a virtio-blk disk. Virtio-scsi is supported however (see libvirt XML configuration above). Grub-efi in a future RHEL-6 minor release should hopefully support virtio-blk as well, see [https://bugzilla.redhat.com/show_bug.cgi?id=916016 Red Hat Bugzilla 916016].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows 8&#039;&#039;&#039;. In order to test Secure Boot, enroll the keys from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog], [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx start PowerShell as an administrator], then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verify Secure Boot].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2012&#039;&#039;&#039;, reportedly.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2008 R2 SP1&#039;&#039;&#039;. This guest has a bug (it requires VGA BIOS support even when booted by UEFI firmware). Thankfully, David Woodhouse and Kevin O&#039;Connor implemented a Compatibility Support Module (CSM) for SeaBIOS. Some out-of-tree patches (as of now) are needed for OVMF from http://git.infradead.org/users/dwmw2/edk2.git/; they are included in Gerd&#039;s packages and this guest boots fine with them.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4821</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4821"/>
		<updated>2013-06-15T13:44:24Z</updated>

		<summary type="html">&lt;p&gt;Lersek: fix typo in Gerd&amp;#039;s name&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffmann&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; among other things, verbosity of OVMF&#039;s debug log. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== qemu wrapper script under libvirt ===&lt;br /&gt;
&lt;br /&gt;
Libvirt (and its frontends, eg. virsh and virt-manager) provide a convenient way to manage virtual machines. However some qemu command line options are not directly exposed (at least not on a RHEL-6.4 host) that would prove useful otherwise. A script that wraps qemu and plays the emulator role for libvirt allows extra flexibility. On the other side of the coin, it may introduce extra confusion, so use with care.&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator binary. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never use a wrapper script in production.)&lt;br /&gt;
&lt;br /&gt;
An example script follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
# Operating modes:&lt;br /&gt;
# - AD_HOC: use local OVMF &amp;amp; SeaVGABIOS build, ignore iPXE roms,&lt;br /&gt;
# - AD_HOC_IPXE: same, but make use of ad-hoc iPXE roms,&lt;br /&gt;
# - KRAXEL_RPMS: use Kraxel&#039;s RPMs whole-sale&lt;br /&gt;
MODE=KRAXEL_RPMS&lt;br /&gt;
&lt;br /&gt;
# Location of ad-hoc ROMs.&lt;br /&gt;
AD_HOC_PATH=/home/virt-images&lt;br /&gt;
&lt;br /&gt;
# Root installation directory of Kraxel&#039;s RPMs.&lt;br /&gt;
KRAXEL_PATH=/usr/share/edk2.git/ovmf-x64&lt;br /&gt;
&lt;br /&gt;
# Whether to load extra SMBIOS tables.&lt;br /&gt;
SMBIOS_EXTRA=0&lt;br /&gt;
&lt;br /&gt;
# Argument array constructed for qemu-kvm.&lt;br /&gt;
NEW_ARGS=()&lt;br /&gt;
append()&lt;br /&gt;
{&lt;br /&gt;
  for I in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
    NEW_ARGS[${#NEW_ARGS[@]}]=$I&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# -vga cirrus found in AD_HOC* modes&lt;br /&gt;
AD_HOC_CIRRUS=0&lt;br /&gt;
&lt;br /&gt;
# -name XXX found; XXX saved in $NAME&lt;br /&gt;
NAME=&lt;br /&gt;
&lt;br /&gt;
# previous argument processed&lt;br /&gt;
LAST=&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x-vga = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ cirrus = &amp;quot;$ARG&amp;quot; ] \&lt;br /&gt;
      &amp;amp;&amp;amp; ([ AD_HOC = &amp;quot;$MODE&amp;quot; ] || [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]); then&lt;br /&gt;
    AD_HOC_CIRRUS=1&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  elif [ x-device = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    case &amp;quot;$ARG&amp;quot; in&lt;br /&gt;
      (e1000*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-e1000.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (ne2k_pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-ne2k_pci.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (pcnet*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-pcnet.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (rtl8139*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-rtl8139.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (virtio-net-pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-virtio.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (*)&lt;br /&gt;
        append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
    esac&lt;br /&gt;
  elif [ x-bios = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ KRAXEL_RPMS = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    append &amp;quot;$KRAXEL_PATH/bios.bin&amp;quot; -L &amp;quot;$KRAXEL_PATH&amp;quot;&lt;br /&gt;
  elif [ x-name = x&amp;quot;$LAST&amp;quot; ]; then&lt;br /&gt;
    NAME=$ARG&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  LAST=$ARG&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$NAME&amp;quot; ]; then&lt;br /&gt;
  append -debugcon file:/tmp/&amp;quot;$NAME&amp;quot;.debug -global isa-debugcon.iobase=0x402 \&lt;br /&gt;
      -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0&lt;br /&gt;
&lt;br /&gt;
  if [ 0 -ne $SMBIOS_EXTRA ]; then&lt;br /&gt;
    append -smbios file=$AD_HOC_PATH/smbios/type3&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  if [[ x&amp;quot;$NAME&amp;quot; = xovmf.win2k8* ]] &amp;amp;&amp;amp; [ 0 -ne $AD_HOC_CIRRUS ]; then&lt;br /&gt;
    append -global cirrus-vga.romfile=$AD_HOC_PATH/vgabios-cirrus.csm.bin&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;${NEW_ARGS[@]}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This particular script accounts for libvirt invoking the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten, plus other static options are useless. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, the script constructs the logfile&#039;s name from the corresponding option-argument, and adds some extra static options.&lt;br /&gt;
&lt;br /&gt;
In more detail, the script supports three &amp;quot;operating modes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;KRAXEL_RPMS&amp;lt;/code&amp;gt; mode is the recommended one for qemu-1.5+. This mode overrides the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element of the guest XML, and uses the OVMF firmware and any other required files from Gerd&#039;s package. Notably, EFI drivers for the emulated / virtio NICs from the iPXE project will be available in the guest as option ROMs.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC&amp;lt;/code&amp;gt; mode serves development purposes. It disables any iPXE NIC drivers on qemu versions under 1.5 (so that the built-in VirtioNetDxe driver can be tested), lets &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt;  (= custom OVMF build) take effect, and specifies a custom SeaVGABIOS binary for Windows 2008 R2 guests (based on their name). The Windows 2008 R2 guest is discussed below some more.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC_IPXE&amp;lt;/code&amp;gt; mode is the same, a development helper, except it gives priority to custom iPXE NIC drivers. (Consult &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; for networking options.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The static options enable S3/S4 in RHEL-6.4 qemu, and set the location of OVMF&#039;s debug log.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 18&#039;&#039;&#039; (XFCE spin tested). When Fedora 18 was released, it co-operated with, and recognized Secure Boot. However some time later the signature verification algorithm changed in TianoCore, and currently OVMF doesn&#039;t accept the signatures on Fedora 18 shim. (Fedora 18 works fine on top of OVMF otherwise, when Secure Boot is disabled.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 19&#039;&#039;&#039; (XFCE spin tested). It supports Secure Boot on current OVMF. See [https://bugzilla.redhat.com/show_bug.cgi?id=963361#c9 Red Hat Bugzilla 963361 comment 9] and subsequent comments for the setup. In order to transfer certificates from host to guest (for key enrollment), it is recommended to prepare a disk image with a [http://libguestfs.org/ libguestfs] utility, like &amp;lt;code&amp;gt;guestfish&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;guestmount&amp;lt;/code&amp;gt;, and attach it to the virtual machine.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;RHEL-6.3&#039;&#039;&#039; and &#039;&#039;&#039;RHEL-6.4&#039;&#039;&#039;. The &amp;lt;code&amp;gt;grub-efi&amp;lt;/code&amp;gt; releases in these RHEL-6 minor releases don&#039;t support booting from a virtio-blk disk. Virtio-scsi is supported however (see libvirt XML configuration above). Grub-efi in a future RHEL-6 minor release should hopefully support virtio-blk as well, see [https://bugzilla.redhat.com/show_bug.cgi?id=916016 Red Hat Bugzilla 916016].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows 8&#039;&#039;&#039;. In order to test Secure Boot, enroll the keys from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog], [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx start PowerShell as an administrator], then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verify Secure Boot].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2012&#039;&#039;&#039;, reportedly.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2008 R2 SP1&#039;&#039;&#039;. This guest has a bug (it requires VGA BIOS support even when booted by UEFI firmware). Thankfully, David Woodhouse and Kevin O&#039;Connor implemented a Compatibility Support Module (CSM) for SeaBIOS. Some out-of-tree patches (as of now) are needed for OVMF from http://git.infradead.org/users/dwmw2/edk2.git/; with those this guest boots fine.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4820</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4820"/>
		<updated>2013-06-15T13:42:26Z</updated>

		<summary type="html">&lt;p&gt;Lersek: update win2k8r2sp1 guest status&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; among other things, verbosity of OVMF&#039;s debug log. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== qemu wrapper script under libvirt ===&lt;br /&gt;
&lt;br /&gt;
Libvirt (and its frontends, eg. virsh and virt-manager) provide a convenient way to manage virtual machines. However some qemu command line options are not directly exposed (at least not on a RHEL-6.4 host) that would prove useful otherwise. A script that wraps qemu and plays the emulator role for libvirt allows extra flexibility. On the other side of the coin, it may introduce extra confusion, so use with care.&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator binary. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never use a wrapper script in production.)&lt;br /&gt;
&lt;br /&gt;
An example script follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
# Operating modes:&lt;br /&gt;
# - AD_HOC: use local OVMF &amp;amp; SeaVGABIOS build, ignore iPXE roms,&lt;br /&gt;
# - AD_HOC_IPXE: same, but make use of ad-hoc iPXE roms,&lt;br /&gt;
# - KRAXEL_RPMS: use Kraxel&#039;s RPMs whole-sale&lt;br /&gt;
MODE=KRAXEL_RPMS&lt;br /&gt;
&lt;br /&gt;
# Location of ad-hoc ROMs.&lt;br /&gt;
AD_HOC_PATH=/home/virt-images&lt;br /&gt;
&lt;br /&gt;
# Root installation directory of Kraxel&#039;s RPMs.&lt;br /&gt;
KRAXEL_PATH=/usr/share/edk2.git/ovmf-x64&lt;br /&gt;
&lt;br /&gt;
# Whether to load extra SMBIOS tables.&lt;br /&gt;
SMBIOS_EXTRA=0&lt;br /&gt;
&lt;br /&gt;
# Argument array constructed for qemu-kvm.&lt;br /&gt;
NEW_ARGS=()&lt;br /&gt;
append()&lt;br /&gt;
{&lt;br /&gt;
  for I in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
    NEW_ARGS[${#NEW_ARGS[@]}]=$I&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# -vga cirrus found in AD_HOC* modes&lt;br /&gt;
AD_HOC_CIRRUS=0&lt;br /&gt;
&lt;br /&gt;
# -name XXX found; XXX saved in $NAME&lt;br /&gt;
NAME=&lt;br /&gt;
&lt;br /&gt;
# previous argument processed&lt;br /&gt;
LAST=&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x-vga = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ cirrus = &amp;quot;$ARG&amp;quot; ] \&lt;br /&gt;
      &amp;amp;&amp;amp; ([ AD_HOC = &amp;quot;$MODE&amp;quot; ] || [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]); then&lt;br /&gt;
    AD_HOC_CIRRUS=1&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  elif [ x-device = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    case &amp;quot;$ARG&amp;quot; in&lt;br /&gt;
      (e1000*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-e1000.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (ne2k_pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-ne2k_pci.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (pcnet*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-pcnet.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (rtl8139*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-rtl8139.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (virtio-net-pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-virtio.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (*)&lt;br /&gt;
        append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
    esac&lt;br /&gt;
  elif [ x-bios = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ KRAXEL_RPMS = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    append &amp;quot;$KRAXEL_PATH/bios.bin&amp;quot; -L &amp;quot;$KRAXEL_PATH&amp;quot;&lt;br /&gt;
  elif [ x-name = x&amp;quot;$LAST&amp;quot; ]; then&lt;br /&gt;
    NAME=$ARG&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  LAST=$ARG&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$NAME&amp;quot; ]; then&lt;br /&gt;
  append -debugcon file:/tmp/&amp;quot;$NAME&amp;quot;.debug -global isa-debugcon.iobase=0x402 \&lt;br /&gt;
      -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0&lt;br /&gt;
&lt;br /&gt;
  if [ 0 -ne $SMBIOS_EXTRA ]; then&lt;br /&gt;
    append -smbios file=$AD_HOC_PATH/smbios/type3&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  if [[ x&amp;quot;$NAME&amp;quot; = xovmf.win2k8* ]] &amp;amp;&amp;amp; [ 0 -ne $AD_HOC_CIRRUS ]; then&lt;br /&gt;
    append -global cirrus-vga.romfile=$AD_HOC_PATH/vgabios-cirrus.csm.bin&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;${NEW_ARGS[@]}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This particular script accounts for libvirt invoking the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten, plus other static options are useless. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, the script constructs the logfile&#039;s name from the corresponding option-argument, and adds some extra static options.&lt;br /&gt;
&lt;br /&gt;
In more detail, the script supports three &amp;quot;operating modes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;KRAXEL_RPMS&amp;lt;/code&amp;gt; mode is the recommended one for qemu-1.5+. This mode overrides the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element of the guest XML, and uses the OVMF firmware and any other required files from Gerd&#039;s package. Notably, EFI drivers for the emulated / virtio NICs from the iPXE project will be available in the guest as option ROMs.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC&amp;lt;/code&amp;gt; mode serves development purposes. It disables any iPXE NIC drivers on qemu versions under 1.5 (so that the built-in VirtioNetDxe driver can be tested), lets &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt;  (= custom OVMF build) take effect, and specifies a custom SeaVGABIOS binary for Windows 2008 R2 guests (based on their name). The Windows 2008 R2 guest is discussed below some more.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC_IPXE&amp;lt;/code&amp;gt; mode is the same, a development helper, except it gives priority to custom iPXE NIC drivers. (Consult &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; for networking options.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The static options enable S3/S4 in RHEL-6.4 qemu, and set the location of OVMF&#039;s debug log.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 18&#039;&#039;&#039; (XFCE spin tested). When Fedora 18 was released, it co-operated with, and recognized Secure Boot. However some time later the signature verification algorithm changed in TianoCore, and currently OVMF doesn&#039;t accept the signatures on Fedora 18 shim. (Fedora 18 works fine on top of OVMF otherwise, when Secure Boot is disabled.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 19&#039;&#039;&#039; (XFCE spin tested). It supports Secure Boot on current OVMF. See [https://bugzilla.redhat.com/show_bug.cgi?id=963361#c9 Red Hat Bugzilla 963361 comment 9] and subsequent comments for the setup. In order to transfer certificates from host to guest (for key enrollment), it is recommended to prepare a disk image with a [http://libguestfs.org/ libguestfs] utility, like &amp;lt;code&amp;gt;guestfish&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;guestmount&amp;lt;/code&amp;gt;, and attach it to the virtual machine.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;RHEL-6.3&#039;&#039;&#039; and &#039;&#039;&#039;RHEL-6.4&#039;&#039;&#039;. The &amp;lt;code&amp;gt;grub-efi&amp;lt;/code&amp;gt; releases in these RHEL-6 minor releases don&#039;t support booting from a virtio-blk disk. Virtio-scsi is supported however (see libvirt XML configuration above). Grub-efi in a future RHEL-6 minor release should hopefully support virtio-blk as well, see [https://bugzilla.redhat.com/show_bug.cgi?id=916016 Red Hat Bugzilla 916016].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows 8&#039;&#039;&#039;. In order to test Secure Boot, enroll the keys from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog], [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx start PowerShell as an administrator], then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verify Secure Boot].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2012&#039;&#039;&#039;, reportedly.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2008 R2 SP1&#039;&#039;&#039;. This guest has a bug (it requires VGA BIOS support even when booted by UEFI firmware). Thankfully, David Woodhouse and Kevin O&#039;Connor implemented a Compatibility Support Module (CSM) for SeaBIOS. Some out-of-tree patches (as of now) are needed for OVMF from http://git.infradead.org/users/dwmw2/edk2.git/; with those this guest boots fine.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4819</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4819"/>
		<updated>2013-06-15T12:57:51Z</updated>

		<summary type="html">&lt;p&gt;Lersek: Update guest status: F18, F19, RHEL-6.3, RHEL-6.4, Win8, Win2012Server&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; among other things, verbosity of OVMF&#039;s debug log. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== qemu wrapper script under libvirt ===&lt;br /&gt;
&lt;br /&gt;
Libvirt (and its frontends, eg. virsh and virt-manager) provide a convenient way to manage virtual machines. However some qemu command line options are not directly exposed (at least not on a RHEL-6.4 host) that would prove useful otherwise. A script that wraps qemu and plays the emulator role for libvirt allows extra flexibility. On the other side of the coin, it may introduce extra confusion, so use with care.&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator binary. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never use a wrapper script in production.)&lt;br /&gt;
&lt;br /&gt;
An example script follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
# Operating modes:&lt;br /&gt;
# - AD_HOC: use local OVMF &amp;amp; SeaVGABIOS build, ignore iPXE roms,&lt;br /&gt;
# - AD_HOC_IPXE: same, but make use of ad-hoc iPXE roms,&lt;br /&gt;
# - KRAXEL_RPMS: use Kraxel&#039;s RPMs whole-sale&lt;br /&gt;
MODE=KRAXEL_RPMS&lt;br /&gt;
&lt;br /&gt;
# Location of ad-hoc ROMs.&lt;br /&gt;
AD_HOC_PATH=/home/virt-images&lt;br /&gt;
&lt;br /&gt;
# Root installation directory of Kraxel&#039;s RPMs.&lt;br /&gt;
KRAXEL_PATH=/usr/share/edk2.git/ovmf-x64&lt;br /&gt;
&lt;br /&gt;
# Whether to load extra SMBIOS tables.&lt;br /&gt;
SMBIOS_EXTRA=0&lt;br /&gt;
&lt;br /&gt;
# Argument array constructed for qemu-kvm.&lt;br /&gt;
NEW_ARGS=()&lt;br /&gt;
append()&lt;br /&gt;
{&lt;br /&gt;
  for I in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
    NEW_ARGS[${#NEW_ARGS[@]}]=$I&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# -vga cirrus found in AD_HOC* modes&lt;br /&gt;
AD_HOC_CIRRUS=0&lt;br /&gt;
&lt;br /&gt;
# -name XXX found; XXX saved in $NAME&lt;br /&gt;
NAME=&lt;br /&gt;
&lt;br /&gt;
# previous argument processed&lt;br /&gt;
LAST=&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x-vga = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ cirrus = &amp;quot;$ARG&amp;quot; ] \&lt;br /&gt;
      &amp;amp;&amp;amp; ([ AD_HOC = &amp;quot;$MODE&amp;quot; ] || [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]); then&lt;br /&gt;
    AD_HOC_CIRRUS=1&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  elif [ x-device = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    case &amp;quot;$ARG&amp;quot; in&lt;br /&gt;
      (e1000*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-e1000.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (ne2k_pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-ne2k_pci.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (pcnet*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-pcnet.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (rtl8139*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-rtl8139.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (virtio-net-pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-virtio.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (*)&lt;br /&gt;
        append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
    esac&lt;br /&gt;
  elif [ x-bios = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ KRAXEL_RPMS = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    append &amp;quot;$KRAXEL_PATH/bios.bin&amp;quot; -L &amp;quot;$KRAXEL_PATH&amp;quot;&lt;br /&gt;
  elif [ x-name = x&amp;quot;$LAST&amp;quot; ]; then&lt;br /&gt;
    NAME=$ARG&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  LAST=$ARG&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$NAME&amp;quot; ]; then&lt;br /&gt;
  append -debugcon file:/tmp/&amp;quot;$NAME&amp;quot;.debug -global isa-debugcon.iobase=0x402 \&lt;br /&gt;
      -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0&lt;br /&gt;
&lt;br /&gt;
  if [ 0 -ne $SMBIOS_EXTRA ]; then&lt;br /&gt;
    append -smbios file=$AD_HOC_PATH/smbios/type3&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  if [[ x&amp;quot;$NAME&amp;quot; = xovmf.win2k8* ]] &amp;amp;&amp;amp; [ 0 -ne $AD_HOC_CIRRUS ]; then&lt;br /&gt;
    append -global cirrus-vga.romfile=$AD_HOC_PATH/vgabios-cirrus.csm.bin&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;${NEW_ARGS[@]}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This particular script accounts for libvirt invoking the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten, plus other static options are useless. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, the script constructs the logfile&#039;s name from the corresponding option-argument, and adds some extra static options.&lt;br /&gt;
&lt;br /&gt;
In more detail, the script supports three &amp;quot;operating modes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;KRAXEL_RPMS&amp;lt;/code&amp;gt; mode is the recommended one for qemu-1.5+. This mode overrides the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element of the guest XML, and uses the OVMF firmware and any other required files from Gerd&#039;s package. Notably, EFI drivers for the emulated / virtio NICs from the iPXE project will be available in the guest as option ROMs.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC&amp;lt;/code&amp;gt; mode serves development purposes. It disables any iPXE NIC drivers on qemu versions under 1.5 (so that the built-in VirtioNetDxe driver can be tested), lets &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt;  (= custom OVMF build) take effect, and specifies a custom SeaVGABIOS binary for Windows 2008 R2 guests (based on their name). The Windows 2008 R2 guest is discussed below some more.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC_IPXE&amp;lt;/code&amp;gt; mode is the same, a development helper, except it gives priority to custom iPXE NIC drivers. (Consult &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; for networking options.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The static options enable S3/S4 in RHEL-6.4 qemu, and set the location of OVMF&#039;s debug log.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 18&#039;&#039;&#039; (XFCE spin tested). When Fedora 18 was released, it co-operated with, and recognized Secure Boot. However some time later the signature verification algorithm changed in TianoCore, and currently OVMF doesn&#039;t accept the signatures on Fedora 18 shim. (Fedora 18 works fine on top of OVMF otherwise, when Secure Boot is disabled.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Fedora 19&#039;&#039;&#039; (XFCE spin tested). It supports Secure Boot on current OVMF. See [https://bugzilla.redhat.com/show_bug.cgi?id=963361#c9 Red Hat Bugzilla 963361 comment 9] and subsequent comments for the setup. In order to transfer certificates from host to guest (for key enrollment), it is recommended to prepare a disk image with a [http://libguestfs.org/ libguestfs] utility, like &amp;lt;code&amp;gt;guestfish&amp;lt;/code&amp;gt; or &amp;lt;code&amp;gt;guestmount&amp;lt;/code&amp;gt;, and attach it to the virtual machine.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;RHEL-6.3&#039;&#039;&#039; and &#039;&#039;&#039;RHEL-6.4&#039;&#039;&#039;. The &amp;lt;code&amp;gt;grub-efi&amp;lt;/code&amp;gt; releases in these RHEL-6 minor releases don&#039;t support booting from a virtio-blk disk. Virtio-scsi is supported however (see libvirt XML configuration above). Grub-efi in a future RHEL-6 minor release should hopefully support virtio-blk as well, see [https://bugzilla.redhat.com/show_bug.cgi?id=916016 Red Hat Bugzilla 916016].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows 8&#039;&#039;&#039;. In order to test Secure Boot, enroll the keys from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog], [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx start PowerShell as an administrator], then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verify Secure Boot].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;&#039;&#039;&#039;Windows Server 2012&#039;&#039;&#039;, reportedly.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWad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XHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4818</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4818"/>
		<updated>2013-06-15T12:21:28Z</updated>

		<summary type="html">&lt;p&gt;Lersek: add and describe the qemu wrapper script I use on RHEL-6.4 for development&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; among other things, verbosity of OVMF&#039;s debug log. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== qemu wrapper script under libvirt ===&lt;br /&gt;
&lt;br /&gt;
Libvirt (and its frontends, eg. virsh and virt-manager) provide a convenient way to manage virtual machines. However some qemu command line options are not directly exposed (at least not on a RHEL-6.4 host) that would prove useful otherwise. A script that wraps qemu and plays the emulator role for libvirt allows extra flexibility. On the other side of the coin, it may introduce extra confusion, so use with care.&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator binary. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never use a wrapper script in production.)&lt;br /&gt;
&lt;br /&gt;
An example script follows.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
# Operating modes:&lt;br /&gt;
# - AD_HOC: use local OVMF &amp;amp; SeaVGABIOS build, ignore iPXE roms,&lt;br /&gt;
# - AD_HOC_IPXE: same, but make use of ad-hoc iPXE roms,&lt;br /&gt;
# - KRAXEL_RPMS: use Kraxel&#039;s RPMs whole-sale&lt;br /&gt;
MODE=KRAXEL_RPMS&lt;br /&gt;
&lt;br /&gt;
# Location of ad-hoc ROMs.&lt;br /&gt;
AD_HOC_PATH=/home/virt-images&lt;br /&gt;
&lt;br /&gt;
# Root installation directory of Kraxel&#039;s RPMs.&lt;br /&gt;
KRAXEL_PATH=/usr/share/edk2.git/ovmf-x64&lt;br /&gt;
&lt;br /&gt;
# Whether to load extra SMBIOS tables.&lt;br /&gt;
SMBIOS_EXTRA=0&lt;br /&gt;
&lt;br /&gt;
# Argument array constructed for qemu-kvm.&lt;br /&gt;
NEW_ARGS=()&lt;br /&gt;
append()&lt;br /&gt;
{&lt;br /&gt;
  for I in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
    NEW_ARGS[${#NEW_ARGS[@]}]=$I&lt;br /&gt;
  done&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
# -vga cirrus found in AD_HOC* modes&lt;br /&gt;
AD_HOC_CIRRUS=0&lt;br /&gt;
&lt;br /&gt;
# -name XXX found; XXX saved in $NAME&lt;br /&gt;
NAME=&lt;br /&gt;
&lt;br /&gt;
# previous argument processed&lt;br /&gt;
LAST=&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x-vga = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ cirrus = &amp;quot;$ARG&amp;quot; ] \&lt;br /&gt;
      &amp;amp;&amp;amp; ([ AD_HOC = &amp;quot;$MODE&amp;quot; ] || [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]); then&lt;br /&gt;
    AD_HOC_CIRRUS=1&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  elif [ x-device = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ AD_HOC_IPXE = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    case &amp;quot;$ARG&amp;quot; in&lt;br /&gt;
      (e1000*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-e1000.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (ne2k_pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-ne2k_pci.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (pcnet*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-pcnet.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (rtl8139*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-rtl8139.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (virtio-net-pci*)&lt;br /&gt;
        append &amp;quot;$ARG,romfile=$AD_HOC_PATH/efi-roms/efi-virtio.rom&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
      (*)&lt;br /&gt;
        append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
        ;;&lt;br /&gt;
    esac&lt;br /&gt;
  elif [ x-bios = x&amp;quot;$LAST&amp;quot; ] &amp;amp;&amp;amp; [ KRAXEL_RPMS = &amp;quot;$MODE&amp;quot; ]; then&lt;br /&gt;
    append &amp;quot;$KRAXEL_PATH/bios.bin&amp;quot; -L &amp;quot;$KRAXEL_PATH&amp;quot;&lt;br /&gt;
  elif [ x-name = x&amp;quot;$LAST&amp;quot; ]; then&lt;br /&gt;
    NAME=$ARG&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  else&lt;br /&gt;
    append &amp;quot;$ARG&amp;quot;&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  LAST=$ARG&lt;br /&gt;
done&lt;br /&gt;
&lt;br /&gt;
if [ -n &amp;quot;$NAME&amp;quot; ]; then&lt;br /&gt;
  append -debugcon file:/tmp/&amp;quot;$NAME&amp;quot;.debug -global isa-debugcon.iobase=0x402 \&lt;br /&gt;
      -global PIIX4_PM.disable_s3=0 -global PIIX4_PM.disable_s4=0&lt;br /&gt;
&lt;br /&gt;
  if [ 0 -ne $SMBIOS_EXTRA ]; then&lt;br /&gt;
    append -smbios file=$AD_HOC_PATH/smbios/type3&lt;br /&gt;
  fi&lt;br /&gt;
&lt;br /&gt;
  if [[ x&amp;quot;$NAME&amp;quot; = xovmf.win2k8* ]] &amp;amp;&amp;amp; [ 0 -ne $AD_HOC_CIRRUS ]; then&lt;br /&gt;
    append -global cirrus-vga.romfile=$AD_HOC_PATH/vgabios-cirrus.csm.bin&lt;br /&gt;
  fi&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;${NEW_ARGS[@]}&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This particular script accounts for libvirt invoking the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten, plus other static options are useless. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, the script constructs the logfile&#039;s name from the corresponding option-argument, and adds some extra static options.&lt;br /&gt;
&lt;br /&gt;
In more detail, the script supports three &amp;quot;operating modes&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;KRAXEL_RPMS&amp;lt;/code&amp;gt; mode is the recommended one for qemu-1.5+. This mode overrides the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element of the guest XML, and uses the OVMF firmware and any other required files from Gerd&#039;s package. Notably, EFI drivers for the emulated / virtio NICs from the iPXE project will be available in the guest as option ROMs.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC&amp;lt;/code&amp;gt; mode serves development purposes. It disables any iPXE NIC drivers on qemu versions under 1.5 (so that the built-in VirtioNetDxe driver can be tested), lets &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt;  (= custom OVMF build) take effect, and specifies a custom SeaVGABIOS binary for Windows 2008 R2 guests (based on their name). The Windows 2008 R2 guest is discussed below some more.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;The &amp;lt;code&amp;gt;AD_HOC_IPXE&amp;lt;/code&amp;gt; mode is the same, a development helper, except it gives priority to custom iPXE NIC drivers. (Consult &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; for networking options.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The static options enable S3/S4 in RHEL-6.4 qemu, and set the location of OVMF&#039;s debug log.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsmn6A7wTzX58yeo5aiMwKLbvjDuEZEXQFM&lt;br /&gt;
3+OXEHPCO/4nQZjyIYNkfnXD8oBKVs+9/wxtQNkvRNw2+guySBPjCX5n3+uR&lt;br /&gt;
S2ThSwxwE0y8vRdtggwQK/MfkHL18/IuSJiqSzw0mdoRlwMmpPtgCyI+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2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4817</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4817"/>
		<updated>2013-06-15T11:35:27Z</updated>

		<summary type="html">&lt;p&gt;Lersek: remove debug log discussion (configuration, capturing); the README deals with them&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; among other things, verbosity of OVMF&#039;s debug log. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== qemu wrapper script under libvirt ===&lt;br /&gt;
&lt;br /&gt;
Libvirt (and its frontends, eg. virsh and virt-manager) provide a convenient way to manage virtual machines. However some qemu command line options are not directly exposed (at least not on a RHEL-6.4 host) that would prove useful otherwise. A script that wraps qemu and plays the emulator role for libvirt allows extra flexibility. (On the other side of the coin, it may introduce extra confusion, so use with care).&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeAB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6F1dib&lt;br /&gt;
ZjFua4YDUTOWF/4Tt3qg67wTWKsKUObciAKLrreL9u/lxpEHarAXZMiz2oHw&lt;br /&gt;
7vZJYLRWyuoJcIm3v4tptkIYk66iMY1oXfM+AmYMtg71XLFyOIiqR0HLj7m3&lt;br /&gt;
UW3ANa7RaJG0xaabvpcx5syoeudWOKy1geJurk645d6JTB9pvb71Kcy7kvlx&lt;br /&gt;
bwTgR3ITDGb+A9ZByqofoEojQN7fBk0LI0ucHiNGyHDBCXHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4816</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4816"/>
		<updated>2013-06-15T11:24:25Z</updated>

		<summary type="html">&lt;p&gt;Lersek: refresh libvirt intro&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Using the firmware image with libvirt ==&lt;br /&gt;
&lt;br /&gt;
The boot firmware is set in the domain XML file under the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to expose this XML node on RHEL-6.4. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is discussed later -- it is useful to have a wrapper script in place, between libvirt and qemu, to add custom options.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.4.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsmn6A7wTzX58yeo5aiMwKLbvjDuEZEXQFM&lt;br /&gt;
3+OXEHPCO/4nQZjyIYNkfnXD8oBKVs+9/wxtQNkvRNw2+guySBPjCX5n3+uR&lt;br /&gt;
S2ThSwxwE0y8vRdtggwQK/MfkHL18/IuSJiqSzw0mdoRlwMmp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&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4815</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4815"/>
		<updated>2013-06-15T11:15:27Z</updated>

		<summary type="html">&lt;p&gt;Lersek: state that Gerd&amp;#039;s binaries support Secure Boot (OpenSSL patch etc)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.)&lt;br /&gt;
&lt;br /&gt;
The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter. Both images support Secure Boot.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/S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Yh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4814</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4814"/>
		<updated>2013-06-15T11:14:09Z</updated>

		<summary type="html">&lt;p&gt;Lersek: update TianoCore wiki link describing build config&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.) The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=How_to_build_OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar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L4/d+NZYUsPzqYN2RfOOBLMv4E7lkOIPiMIShD5/cyUEoc2nRT7dr6F1dib&lt;br /&gt;
ZjFua4YDUTOWF/4Tt3qg67wTWKsKUObciAKLrreL9u/lxpEHarAXZMiz2oHw&lt;br /&gt;
7vZJYLRWyuoJcIm3v4tptkIYk66iMY1oXfM+AmYMtg71XLFyOIiqR0HLj7m3&lt;br /&gt;
UW3ANa7RaJG0xaabvpcx5syoeudWOKy1geJurk645d6JTB9pvb71Kcy7kvlx&lt;br /&gt;
bwTgR3ITDGb+A9ZByqofoEojQN7fBk0LI0ucHiNGyHDBCXHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4813</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4813"/>
		<updated>2013-06-15T11:10:41Z</updated>

		<summary type="html">&lt;p&gt;Lersek: Reword build instructions, recommend to check the SRPMs&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.) The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter.&lt;br /&gt;
&lt;br /&gt;
== Building from source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF here] in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase --use-log-author&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects. Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt;, &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;, the &amp;lt;code&amp;gt;OvmfPkg/*.dsc&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/*.fdf&amp;lt;/code&amp;gt; files, and Gerd&#039;s SRPMs.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsm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8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4812</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4812"/>
		<updated>2013-06-15T11:04:21Z</updated>

		<summary type="html">&lt;p&gt;Lersek: add intro heading&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;== Intro ==&lt;br /&gt;
&lt;br /&gt;
OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.) The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRv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MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4811</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4811"/>
		<updated>2013-06-15T11:02:39Z</updated>

		<summary type="html">&lt;p&gt;Lersek: update intro text to svn r14423, plus recommend Gerd&amp;#039;s packaging primarily&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 14423 (virtio-blk, virtio-scsi and virtio-net are supported, and several guests can be booted with, and recognize secure boot). For using OVMF directly with the qemu command line, refer to the [https://github.com/tianocore/edk2/blob/master/OvmfPkg/README README]; this page tries to detail OVMF usage under (RHEL-6.4) libvirt.&lt;br /&gt;
&lt;br /&gt;
The recommended way for testing OVMF is installing Gerd Hoffman&#039;s RPM packages from his repo at http://www.kraxel.org/repos/, using yum. (The package to install is &amp;lt;code&amp;gt;edk2.git-ovmf-x64&amp;lt;/code&amp;gt;; yum will pull in several dependencies from the repo.) The firmware images are located in the &amp;lt;code&amp;gt;/usr/share/edk2.git/ovmf-x64&amp;lt;/code&amp;gt; directory. &amp;lt;code&amp;gt;OVMF-pure-efi.fd&amp;lt;/code&amp;gt; is a &amp;quot;pure UEFI&amp;quot; image, while &amp;lt;code&amp;gt;OVMF-with-csm.fd&amp;lt;/code&amp;gt; includes the Compatibility Support Module (CSM) build of SeaBIOS. &amp;lt;code&amp;gt;bios.bin&amp;lt;/code&amp;gt; is a symlink to the latter.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/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gt;
ZjFua4YDUTOWF/4Tt3qg67wTWKsKUObciAKLrreL9u/lxpEHarAXZMiz2oHw&lt;br /&gt;
7vZJYLRWyuoJcIm3v4tptkIYk66iMY1oXfM+AmYMtg71XLFyOIiqR0HLj7m3&lt;br /&gt;
UW3ANa7RaJG0xaabvpcx5syoeudWOKy1geJurk645d6JTB9pvb71Kcy7kvlx&lt;br /&gt;
bwTgR3ITDGb+A9ZByqofoEojQN7fBk0LI0ucHiNGyHDBCXHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4617</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4617"/>
		<updated>2012-12-31T09:29:18Z</updated>

		<summary type="html">&lt;p&gt;Lersek: add link to kraxel&amp;#039;s qemu firmware repo&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
The yum repository at http://www.kraxel.org/repos/ provides automatically updated OVMF RPMs (among other qemu firmware binaries).&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsmn6A7wTzX58yeo5aiMwKLbvjDuEZEXQFM&lt;br /&gt;
3+OXEHPCO/4nQZjyIYNkfnXD8oBKVs+9/wxtQNkvRNw2+guySBPjCX5n3+uR&lt;br /&gt;
S2ThSwxwE0y8vRdtggwQK/MfkHL18/IuSJiqSzw0mdoRlwMmpPtgCyI+iryK&lt;br /&gt;
rrSsO1qckmHCah6t3FKss86wE0ODbC9WoOVUGxnjE7cjbHg/rh+j4dvFm4Z8&lt;br /&gt;
+D6gWK/GXyEI3mbBnp4UqOWEWj6gZm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gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4594</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4594"/>
		<updated>2012-10-31T14:05:08Z</updated>

		<summary type="html">&lt;p&gt;Lersek: formatting fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsmn6A7wTzX58yeo5aiMwKLbvjDuEZEXQFM&lt;br /&gt;
3+OXEHPCO/4nQZjyIYNkfnXD8oBKVs+9/wxtQNkvRNw2+guySBPjCX5n3+uR&lt;br /&gt;
S2ThSwxwE0y8vRdtggwQK/MfkHL18/IuSJiqSzw0mdoRlwMmpPtgCyI+iryK&lt;br /&gt;
rrSsO1qckmHCah6t3FKss86wE0ODb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Z/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up &amp;lt;code&amp;gt;/dev/loop1&amp;lt;/code&amp;gt; on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran &amp;lt;code&amp;gt;kpartx -a /dev/loop1&amp;lt;/code&amp;gt;,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted &amp;lt;code&amp;gt;/dev/mapper/loop1p1&amp;lt;/code&amp;gt; as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;lt;code&amp;gt;Red Hat Secure Boot Keys&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4593</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4593"/>
		<updated>2012-10-31T13:46:50Z</updated>

		<summary type="html">&lt;p&gt;Lersek: add intra-page secure boot testing links&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). [[#Confirmation of secure boot in Fedora 18|Secure boot tested]] as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. [[#Confirmation of secure boot in Windows 8 Consumer Preview Build 8250|Secure boot tested]] as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsmn6A7wTzX58yeo5aiMwKLbvjDuEZEXQFM&lt;br /&gt;
3+OXEHPCO/4nQZjyIYNkfnXD8oBKVs+9/wxtQNkvRNw2+guySBPjCX5n3+uR&lt;br /&gt;
S2ThSwxwE0y8v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GEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up /dev/loop1 on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran kpartx -a /dev/loop1,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted /dev/mapper/loop1p1 as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;quot;Red Hat Secure Boot Keys&amp;quot;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 8 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4592</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4592"/>
		<updated>2012-10-31T13:40:27Z</updated>

		<summary type="html">&lt;p&gt;Lersek: add &amp;#039;set -u&amp;#039; to wrapper script&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C -u&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). Secure boot tested as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. Secure boot tested as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsmn6A7wTzX58yeo5aiMwKLbvjDuEZEXQFM&lt;br /&gt;
3+OXEHPCO/4nQZjyIYNkfnXD8oBKVs+9/wxtQNkvRNw2+guySBPjCX5n3+uR&lt;br /&gt;
S2ThSwxwE0y8vRdtggwQK/MfkHL18/IuSJiqSzw0mdoRlwMmpPtgCyI+iryK&lt;br /&gt;
rrSsO1qckmHCah6t3FKss86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ut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up /dev/loop1 on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran kpartx -a /dev/loop1,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted /dev/mapper/loop1p1 as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;quot;Red Hat Secure Boot Keys&amp;quot;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 2008 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4591</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4591"/>
		<updated>2012-10-31T13:36:53Z</updated>

		<summary type="html">&lt;p&gt;Lersek: grammar fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template to libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). Secure boot tested as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. Secure boot tested as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4v22sO46I2MWFU73vaGh4O&lt;br /&gt;
GjeLF6R3VInHrsdMGiZWBcuJBtuLjfCw1fL34okX9kyOayKqAhX6Apf7hTDV&lt;br /&gt;
nG9aCmkmSlXL8JXEnbfni0kCGWadOF1U8hKOHlwoO+RHqsjV6UHjj+ODN654&lt;br /&gt;
XEvjRvNNBWqx1xwiN+wfseijss/SEsWHBAuDENkfTDNcButwZSjtMGFAGZYa&lt;br /&gt;
V8hb+emUu9dc+FG0KcnF6uuEpsf75afmB5PZbVt97SanoylqMGXT6etzXqfE&lt;br /&gt;
vvf6XsFC/Xlg3pZ7wgKkZuPNuR7eBcSLatQ9ZLHfndTFlUjcFJT2WyBfZXPV&lt;br /&gt;
ahyxItkAjzdi8s0EjfxXqYXgvdWYHqXzZ427QvEo4InkCU6E1TuE7vnMxy7X&lt;br /&gt;
1AEIHKU6V+LxEL6X7jTZL/JRFBsmn6A7wTzX58yeo5aiMwKLbvjDuEZEXQFM&lt;br /&gt;
3+OXEHPCO/4nQZjyIYNkfnXD8oBKVs+9/wxtQNkvRNw2+guySBPjCX5n3+uR&lt;br /&gt;
S2ThSwxwE0y8vRdtggwQK/MfkHL18/IuSJiqSzw0mdoRlwMmpPtgCyI+iryK&lt;br /&gt;
rrSsO1qckmHCah6t3FKss86wE0ODbC9WoOVUGxnjE7cjbHg/rh+j4dvFm4Z8&lt;br /&gt;
+D6gWK/GXyEI3mbBnp4UqOWEWj6gZmO2QpvHxY9AFaiiS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nbWH&lt;br /&gt;
VY9VFrtC84a4npJ29LurGCXQEMUfDyGqEayJa4iL3u3i7VA1+NgHdtMFZN5o&lt;br /&gt;
rL4/d+NZYUsPzqYN2RfOOBLMv4E7lkOIPiMIShD5/cyUEoc2nRT7dr6F1dib&lt;br /&gt;
ZjFua4YDUTOWF/4Tt3qg67wTWKsKUObciAKLrreL9u/lxpEHarAXZMiz2oHw&lt;br /&gt;
7vZJYLRWyuoJcIm3v4tptkIYk66iMY1oXfM+AmYMtg71XLFyOIiqR0HLj7m3&lt;br /&gt;
UW3ANa7RaJG0xaabvpcx5syoeudWOKy1geJurk645d6JTB9pvb71Kcy7kvlx&lt;br /&gt;
bwTgR3ITDGb+A9ZByqofoEojQN7fBk0LI0ucHiNGyHDBCXHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up /dev/loop1 on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran kpartx -a /dev/loop1,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted /dev/mapper/loop1p1 as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;quot;Red Hat Secure Boot Keys&amp;quot;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 2008 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4590</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4590"/>
		<updated>2012-10-31T13:33:14Z</updated>

		<summary type="html">&lt;p&gt;Lersek: style fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One potentially useful option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template into libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). Secure boot tested as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. Secure boot tested as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;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YN2RfOOBLMv4E7lkOIPiMIShD5/cyUEoc2nRT7dr6F1dib&lt;br /&gt;
ZjFua4YDUTOWF/4Tt3qg67wTWKsKUObciAKLrreL9u/lxpEHarAXZMiz2oHw&lt;br /&gt;
7vZJYLRWyuoJcIm3v4tptkIYk66iMY1oXfM+AmYMtg71XLFyOIiqR0HLj7m3&lt;br /&gt;
UW3ANa7RaJG0xaabvpcx5syoeudWOKy1geJurk645d6JTB9pvb71Kcy7kvlx&lt;br /&gt;
bwTgR3ITDGb+A9ZByqofoEojQN7fBk0LI0ucHiNGyHDBCXHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up /dev/loop1 on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran kpartx -a /dev/loop1,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted /dev/mapper/loop1p1 as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;quot;Red Hat Secure Boot Keys&amp;quot;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 2008 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4589</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4589"/>
		<updated>2012-10-31T13:30:49Z</updated>

		<summary type="html">&lt;p&gt;Lersek: small style fix&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured accordingly. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One important option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template into libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). Secure boot tested as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. Secure boot tested as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx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HarAXZMiz2oHw&lt;br /&gt;
7vZJYLRWyuoJcIm3v4tptkIYk66iMY1oXfM+AmYMtg71XLFyOIiqR0HLj7m3&lt;br /&gt;
UW3ANa7RaJG0xaabvpcx5syoeudWOKy1geJurk645d6JTB9pvb71Kcy7kvlx&lt;br /&gt;
bwTgR3ITDGb+A9ZByqofoEojQN7fBk0LI0ucHiNGyHDBCXHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up /dev/loop1 on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran kpartx -a /dev/loop1,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted /dev/mapper/loop1p1 as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;quot;Red Hat Secure Boot Keys&amp;quot;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 2008 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
	<entry>
		<id>https://linux-kvm.org/index.php?title=OVMF&amp;diff=4588</id>
		<title>OVMF</title>
		<link rel="alternate" type="text/html" href="https://linux-kvm.org/index.php?title=OVMF&amp;diff=4588"/>
		<updated>2012-10-31T13:19:27Z</updated>

		<summary type="html">&lt;p&gt;Lersek: OVMF: UEFI boot firmware in qemu-kvm&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;OVMF &amp;quot;is a project to enable UEFI support for Virtual Machines&amp;quot;. This page tries to give yet another mini-howto about playing with OVMF boot firmware in qemu-kvm virtual machines plus libvirt, deferring heavily to the TianoCore upstream wiki. &amp;lt;em&amp;gt;Do&amp;lt;/em&amp;gt; mercilessly edit any inaccuracies or wrong statements.&lt;br /&gt;
&lt;br /&gt;
This page is written as of edk2 svn rev 13886 (virtio-blk and virtio-scsi are supported), with a RHEL-6.3 host and only x86_64 in mind. &lt;br /&gt;
&lt;br /&gt;
If you want to skip downloading &amp;amp; building the SVN tree, you could try one of the prebuilt images, or rebuilding one of the SRPMs. For such packages, check out the TianoCore wiki links below, and/or http://people.redhat.com/~lersek/ovmf_pkg/. (The latter SRPM utilizes the &amp;lt;code&amp;gt;%jobs&amp;lt;/code&amp;gt; RPM macro for parallel builds; don&#039;t forget to set it in your &amp;lt;code&amp;gt;~/.rpmmacros&amp;lt;/code&amp;gt;.)&lt;br /&gt;
&lt;br /&gt;
If you opt for RPM installation, continue at [[#Making guests use it]] afterwards.&lt;br /&gt;
&lt;br /&gt;
== Downloading the source ==&lt;br /&gt;
&lt;br /&gt;
Clone either the main SVN repository (git svn recommended) or one of the git mirrors listed in the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=Source_Control TianoCore wiki].&lt;br /&gt;
&lt;br /&gt;
== Building it ==&lt;br /&gt;
&lt;br /&gt;
The EDK2 (EFI Development Kit 2) tree has a complex, but very portable and flexible build system, called BaseTools. OVMF is one of the sub-projects inside the EDK2 tree (located in the OvmfPkg subdirectory), relying on other modules inside the tree.&lt;br /&gt;
&lt;br /&gt;
When building OVMF, the build system must be configured to build OvmfPkg. Inter-module and intra-module dependencies are then handled automatically.&lt;br /&gt;
&lt;br /&gt;
The build system&#039;s configuration is described in detail, rooted in [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF this] TianoCore wiki page.&lt;br /&gt;
&lt;br /&gt;
=== Frequent rebuilds ===&lt;br /&gt;
&lt;br /&gt;
For developers it is recommended to create a branch called &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; or something similar off the master branch (in the git svn or plain git clone), capture the config steps described under the above edk2 upstream link in commits (including setting up a reasonable &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file), and keep rebasing &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt; after &amp;lt;code&amp;gt;git svn rebase&amp;lt;/code&amp;gt; / &amp;lt;code&amp;gt;git pull&amp;lt;/code&amp;gt; commands. Fork/rebase your own development branches off/to &amp;lt;code&amp;gt;base_config&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
One possible &amp;lt;code&amp;gt;.gitignore&amp;lt;/code&amp;gt; file is&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
*.d&lt;br /&gt;
*.o&lt;br /&gt;
*.pyc&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/EfiVfrParser.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/antlr/antlr&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/Pccts/dlg/dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrLexer.h&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrParser.dlg&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrSyntax.cpp&lt;br /&gt;
/BaseTools/Source/C/VfrCompile/VfrTokens.h&lt;br /&gt;
/BaseTools/Source/C/bin/&lt;br /&gt;
/BaseTools/Source/C/libs/&lt;br /&gt;
/Build/&lt;br /&gt;
/Conf/.cache/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The very first time you build the tree, and after &amp;lt;code&amp;gt;git clean -fdx&amp;lt;/code&amp;gt; commands, you must (re)build BaseTools with &amp;lt;code&amp;gt;make -C &amp;quot;$EDK_TOOLS_PATH&amp;quot;&amp;lt;/code&amp;gt;. (You&#039;re going to have that variable set in your environment after sourcing &amp;lt;code&amp;gt;edksetup.sh&amp;lt;/code&amp;gt; in the root project dir; see the [http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=OVMF TianoCore Wiki] again.) &lt;br /&gt;
&lt;br /&gt;
=== One-off builds ===&lt;br /&gt;
&lt;br /&gt;
Consult &amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/build.sh&amp;lt;/code&amp;gt; takes care of BaseTools, configuration (according to command line options) and the main build. One important option is &amp;lt;code&amp;gt;-n THREADNUMBER&amp;lt;/code&amp;gt;, which enables parallel make. &amp;lt;code&amp;gt;-D FLAG&amp;lt;/code&amp;gt; options control optional build features/aspects; one place to look up the more common ones could be the SRPM / spec file [http://people.redhat.com/~lersek/ovmf_pkg/ here].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;OvmfPkg/README&amp;lt;/code&amp;gt; is slightly outdated; for example no separate &amp;lt;code&amp;gt;OvmfVideo.rom&amp;lt;/code&amp;gt; file is produced any longer.&lt;br /&gt;
&lt;br /&gt;
== Making guests use it ==&lt;br /&gt;
&lt;br /&gt;
So now you have either downloaded a prebuilt binary, or installed the noarch RPM in the host, or built &amp;lt;code&amp;gt;OVMF.fd&amp;lt;/code&amp;gt; yourself. This &amp;quot;Flash Device&amp;quot; file is passed to qemu-kvm with the &amp;lt;code&amp;gt;-bios&amp;lt;/code&amp;gt; option (with full pathname), which is accessible in the libvirt domain XML as the &amp;lt;code&amp;gt;/domain/os/loader&amp;lt;/code&amp;gt; element.&lt;br /&gt;
&lt;br /&gt;
Neither &amp;lt;code&amp;gt;virt-manager&amp;lt;/code&amp;gt; nor &amp;lt;code&amp;gt;virt-install&amp;lt;/code&amp;gt; seem to make this option readily configurable at guest installation time in RHEL-6.3. The following list of commands is one workaround. The &amp;lt;code&amp;gt;EMULATOR&amp;lt;/code&amp;gt; bit is elaborated upon under [[#qemu debug port]].&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# &amp;quot;configuration&amp;quot;&lt;br /&gt;
NAME=set_guest_name_here&lt;br /&gt;
INSTALL_ISO=/full/path/to/install/iso&lt;br /&gt;
DRIVER_ISO=/full/path/to/virtio/driver/iso&lt;br /&gt;
EMULATOR=/full/path/to/emulator&lt;br /&gt;
LOADER=/full/path/to/OVMF.fd&lt;br /&gt;
&lt;br /&gt;
# create a domain XML template for guest installation:&lt;br /&gt;
# - 4 VCPUs, 4G RAM&lt;br /&gt;
# - virtio target disk, 25 GB in size&lt;br /&gt;
# - first IDE CD-ROM has install disk&lt;br /&gt;
# - second IDE CD-ROM has virtio driver disk&lt;br /&gt;
#   (should only be necessary for proprietary guests without built-in drivers)&lt;br /&gt;
TARGET_DISK=/var/lib/libvirt/images/&amp;quot;$NAME&amp;quot;.img&lt;br /&gt;
virt-install                                                                 \&lt;br /&gt;
    --connect=qemu:///system                                                 \&lt;br /&gt;
    --name=$NAME                                                             \&lt;br /&gt;
    --ram=4096                                                               \&lt;br /&gt;
    --arch=x86_64                                                            \&lt;br /&gt;
    --machine=rhel6.3.0                                                      \&lt;br /&gt;
    --vcpus=4                                                                \&lt;br /&gt;
    --boot=cdrom,hd                                                          \&lt;br /&gt;
    --disk=path=$TARGET_DISK,size=25,bus=virtio,format=qcow2                 \&lt;br /&gt;
    --disk=path=$DRIVER_ISO,device=cdrom,bus=ide,perms=ro,format=raw         \&lt;br /&gt;
    --disk=path=$INSTALL_ISO,device=cdrom,bus=ide,perms=ro,format=raw        \&lt;br /&gt;
    --print-step=1                                                           \&lt;br /&gt;
| xmlstarlet ed -u /domain/devices/emulator                     -v $EMULATOR \&lt;br /&gt;
                -s /domain/os                 -t elem -n loader -v $LOADER   \&lt;br /&gt;
    &amp;gt;template.xml&lt;br /&gt;
&lt;br /&gt;
# Import the template into libvirt&lt;br /&gt;
virsh define template.xml&lt;br /&gt;
&lt;br /&gt;
# Now customize the guest further with &amp;quot;virsh edit&amp;quot; or inside virt-manager,&lt;br /&gt;
# then start the installation.&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For a virtio-scsi disk, apply the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;in the &amp;lt;code&amp;gt;TARGET_DISK&amp;lt;/code&amp;gt; specification, replace &amp;lt;code&amp;gt;bus=virtio&amp;lt;/code&amp;gt; with &amp;lt;code&amp;gt;bus=scsi&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;append the following options to the &amp;lt;code&amp;gt;xmlstarlet&amp;lt;/code&amp;gt; command line:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
                -s /domain/devices            -t elem -n controller -v &#039;&#039;          \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n type       -v scsi        \&lt;br /&gt;
                -s /domain/devices/controller -t attr -n model      -v virtio-scsi \&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Saving OVMF debug messages ==&lt;br /&gt;
&lt;br /&gt;
Debug log verbosity is controlled at build time. See the &amp;lt;code&amp;gt;gEfiMdePkgTokenSpaceGuid.PcdDebugPrintErrorLevel&amp;lt;/code&amp;gt; bitmask in &amp;lt;code&amp;gt;OvmfPkg/OvmfPkgX64.dsc&amp;lt;/code&amp;gt;. The individual bits (&amp;lt;code&amp;gt;DEBUG_*&amp;lt;/code&amp;gt; macros) are explained in &amp;lt;code&amp;gt;MdePkg/Include/Library/DebugLib.h&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
=== serial console ===&lt;br /&gt;
&lt;br /&gt;
Debug messages are written to the qemu debug port per default (see below), but they can be redirected to the (virtual) serial console with the &amp;lt;code&amp;gt;-D DEBUG_ON_SERIAL_PORT&amp;lt;/code&amp;gt; option at build time. In this case however the serial console will intermix framework debug messages with the TUI of the (U)EFI shell and other UEFI applications.&lt;br /&gt;
&lt;br /&gt;
=== qemu debug port ===&lt;br /&gt;
&lt;br /&gt;
This is where the debug messages are written by default, but capturing them on the host requires the &amp;lt;code&amp;gt;-debugcon DEV -global isa-debugcon.iobase=0x402&amp;lt;/code&amp;gt; qemu-kvm command line switches. These can be set on a guest-by-guest basis in the libvirt VM config XML files, using [http://libvirt.org/drvqemu.html#qemucommand qemu:arg].&lt;br /&gt;
&lt;br /&gt;
Alternatively, one might contemplate a qemu-kvm wrapper script like the following:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/bash&lt;br /&gt;
set -e -C&lt;br /&gt;
&lt;br /&gt;
NAME=0&lt;br /&gt;
for ARG in &amp;quot;$@&amp;quot;; do&lt;br /&gt;
  if [ x&amp;quot;$ARG&amp;quot; = x-name ]; then&lt;br /&gt;
    NAME=1&lt;br /&gt;
  elif [ $NAME -ne 0 ]; then&lt;br /&gt;
    FNAME=&amp;quot;${TMPDIR:-/tmp}/$ARG&amp;quot;.debug&lt;br /&gt;
    exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot; \&lt;br /&gt;
        -debugcon file:&amp;quot;$FNAME&amp;quot; -global isa-debugcon.iobase=0x402&lt;br /&gt;
  fi&lt;br /&gt;
done&lt;br /&gt;
exec /usr/libexec/qemu-kvm &amp;quot;$@&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The full path to the wrapper script is specified in the &amp;lt;code&amp;gt;/domain/devices/emulator&amp;lt;/code&amp;gt; element of the libvirt guest XML.&lt;br /&gt;
&lt;br /&gt;
The script is adapted to the fact that libvirt invokes the emulator in two forms. XML validation after &amp;lt;code&amp;gt;virsh edit&amp;lt;/code&amp;gt; seems to invoke the emulator for verification purposes only, without the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option. In this case no debug file should be created / rewritten. When libvirt starts the guest, the &amp;lt;code&amp;gt;-name&amp;lt;/code&amp;gt; option is present, and the script constructs the logfile&#039;s name from the corresponding option-argument.&lt;br /&gt;
&lt;br /&gt;
On an SELinux enabled system, the script&#039;s context should be set to that of the wrapped emulator, qemu-kvm. See &amp;lt;code&amp;gt;chcon --reference&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Furthermore, on an SELinux enabled system, a new instance of the same guest will be seclabelled differently from the previous instance, and will fail to overwrite the debug log produced by the previous instance. This could be worked around perhaps by reconfiguring libvirt&#039;s labelling practices for the guest, or changing the SELinux profile, or (horribile dictu) flipping SELinux to permissive. Removing the debug file manually before starting the next instance of the guest is simplest.&lt;br /&gt;
&lt;br /&gt;
(Needless to say, never do any of this in production.)&lt;br /&gt;
&lt;br /&gt;
== Tested guest OS&#039;en ==&lt;br /&gt;
&lt;br /&gt;
=== Apparently working nicely ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Fedora 18 Alpha (XFCE edition). Secure boot tested as well.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;RHEL-6.3. (Its grub does not support booting from a virtio-blk disk. See [[#Making guests use it]] how to specify a virtio-scsi boot disk.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Windows 8 Consumer Preview Build 8250. Secure boot tested as well. The fix for qemu-kvm [https://bugzilla.redhat.com/show_bug.cgi?id=854304 RHBZ#854304] may be necessary to run this guest. (Upstream qemu contains the [http://git.qemu.org/?p=qemu.git;a=commitdiff;h=4d09d37c6aa9a02b44b1fdb6268820fab92499bd fix] of course.)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Reportedly, Windows Server 2012.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Windows Server 2008 R2 SP1 ===&lt;br /&gt;
&lt;br /&gt;
This guest does not work correctly. Its UEFI installer is composed of several programs, some being UEFI applications, and the last layer being the Windows Pre-Installation Environment, running on the Windows 2008 R2 kernel.&lt;br /&gt;
&lt;br /&gt;
The UEFI applications before the last layer correctly use the OVMF GOP (graphics output protocol), which drives the emulated Cirrus 5446 video card. Unfortunately, the last layer (WinPE) has a hard dependency on VGA BIOS interrupt 0x10, which is not provided by any OVMF CSM (compatibility support module) as of now.&lt;br /&gt;
&lt;br /&gt;
This &amp;lt;em&amp;gt;hard&amp;lt;/em&amp;gt; dependency is a Windows 2008 R2 bug; the WinPE layer should (actively) inherit the linear framebuffer characteristics from the GOP (UEFI boot phase), and use that until the kernel-level graphics drivers are loaded.&lt;br /&gt;
&lt;br /&gt;
One (quite shabby) workaround for the time being is automated installation of this OS on top of OVMF, and then connecting to it with &amp;lt;code&amp;gt;rdesktop&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
During most of the installation (ie. in the WinPE phase), nothing can be seen in the VNC window. The VM reboots several times, at which points &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; shortly displays a (visible) message, &amp;quot;press a key to continue booting from the installation CD&amp;quot;. No key should be pressed, as expected, but after the timeout, &amp;lt;code&amp;gt;cdboot.efi&amp;lt;/code&amp;gt; tends to crash, violating an edk2 framework ASSERT and falling into an infinite loop (watch the debug log).&lt;br /&gt;
&lt;br /&gt;
If this happens, force off the VM, restart it, enter the OVMF setup utility, and manually set the on-hdd boot loader. The installation should resume then.&lt;br /&gt;
&lt;br /&gt;
For the remote desktop connection, the IP address of the running guest can be fetched by searching &amp;lt;code&amp;gt;/var/lib/libvirt/dnsmasq/default.leases&amp;lt;/code&amp;gt; for the guest&#039;s MAC address (which is present in its libvirt XML file).&lt;br /&gt;
&lt;br /&gt;
An example &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file, and a corresponding guest XML template (to be used with &amp;lt;code&amp;gt;virsh define&amp;lt;/code&amp;gt;) are inserted below as a base-64 encoded, xz-compressed tarball. (Unfortunately, File Upload refuses xml and xml.gz files.) The install ISO that was augmented with the &amp;lt;code&amp;gt;AutoUnattend.xml&amp;lt;/code&amp;gt; file is named &amp;lt;code&amp;gt;en_windows_server_2008_r2_with_sp1_x64_dvd_617601.iso&amp;lt;/code&amp;gt;, its SHA1 is &amp;lt;code&amp;gt;D3FD7BF85EE1D5BDD72DE5B2C69A7B470733CD0A&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Note: the first &amp;lt;code&amp;gt;ProductKey&amp;lt;/code&amp;gt; element in the XML is a default key from&lt;br /&gt;
&amp;lt;code&amp;gt;\SOURCES\PRODUCT.INI&amp;lt;/code&amp;gt;. It does not participate in product&lt;br /&gt;
activation, it contributes to product &amp;lt;em&amp;gt;selection&amp;lt;/em&amp;gt; at installation time. &lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
begin-base64 600 example.tar.xz&lt;br /&gt;
/Td6WFoAAATm1rRGAgAhARwAAAAQz1jM4E//CfBeABcLxoeSWjrZw/K8YRQW&lt;br /&gt;
idsezUdpMAqJW5IviTmcQju7k4hzXixJbgHx/lAbmsS4smaCA12Xj2lLrVcL&lt;br /&gt;
E1Z9mz09+Ij1Kt0XX+FZ71T3wbLjFAtmMqv2ZX4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j7m3&lt;br /&gt;
UW3ANa7RaJG0xaabvpcx5syoeudWOKy1geJurk645d6JTB9pvb71Kcy7kvlx&lt;br /&gt;
bwTgR3ITDGb+A9ZByqofoEojQN7fBk0LI0ucHiNGyHDBCXHPOIhHypWRJvyA&lt;br /&gt;
bmhY0YIY6ul9RaBhPJnJ2MzVY58NS9s39yolC7cq/ONYh43yyyiECg41wD4K&lt;br /&gt;
fN+c0PQ1HXhgm1JMxAYK02GJP5sOHfaW2e/9U54Y+Cnn2Nw33Fbk5a85Vmrq&lt;br /&gt;
A0g6s2tJpo1uiawxK4cQKbV4YO8O9+Km0ICk1YkpBWd4szLBeFjk/73Bu618&lt;br /&gt;
rAWez/0z41lEaJpEbqDr3ww4YSZiI6BSOwuEbvEuhAkXjA9WvnFQZsys6CFR&lt;br /&gt;
mYYT0RT/kvaMvCvH7gJSgjRKnvheUiXB1jd+nlYQ8Ag4qk/8SAfee1r8mZee&lt;br /&gt;
NBH0Lr0llRnfnIXBQskmSaBAoQDubDsR1wzgVZKvnCEzFow2colupVMcAdx6&lt;br /&gt;
djzC/XgCOPqyX6RtHNrZ/DvTjNhQtGEp9TFLmdoYgvPOqizHGRm28yr5Te07&lt;br /&gt;
rr2OzQuw7nLDAACI8Ak60A6nlgABjBSAoAEAJut9ErHEZ/sCAAAAAARZWg==&lt;br /&gt;
====&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Fedora 18 ===&lt;br /&gt;
&lt;br /&gt;
(This is a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ol&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I rebuilt OVMF with secure boot support.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the x86_64 binary RPM for [http://koji.fedoraproject.org/koji/buildinfo?buildID=357608 pesign-0.10-5.fc18] and extracted the &amp;lt;code&amp;gt;/etc/pki/pesign&amp;lt;/code&amp;gt; directory to &amp;lt;code&amp;gt;$HOME/tmp/f18-keys&amp;lt;/code&amp;gt;.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I extracted two certificates in DER format, standing in &amp;lt;code&amp;gt;$HOME/tmp&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test Certificate&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCertificate.der&lt;br /&gt;
&lt;br /&gt;
certutil -L -d f18-keys -n &#039;Red Hat Test CA&#039; -r \&lt;br /&gt;
    &amp;gt;RedHatTestCA.der&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I created a 64MB zero file,&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;set up /dev/loop1 on it,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;created an MBR partition table with one 0x0c partition (cfdisk),&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;(maybe ran kpartx -a /dev/loop1,)&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;formatted /dev/mapper/loop1p1 as FAT32 with mkdosfs,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;mounted it, created a directory called &amp;quot;Red Hat Secure Boot Keys&amp;quot;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;copied the output files from the previous step there.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;NOTE: libguestfs / guestfish is a &amp;lt;em&amp;gt;much&amp;lt;/em&amp;gt; better way to do the same.&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I attached the above image file as second disk to my preexistent&lt;br /&gt;
guest while it was shut down.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;I started the guest.&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;As soon as the TianoCore splash screen showed, I entered the setup&lt;br /&gt;
menu and selected &amp;lt;code&amp;gt;Device Manager | Secure Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCA.der&amp;lt;/code&amp;gt; as PK.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;enrolled &amp;lt;code&amp;gt;RedHatTestCertificate.der&amp;lt;/code&amp;gt; as one KEK and one DB entry,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;made sure &amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; from the first disk was the first boot option in &amp;lt;code&amp;gt;Boot Maintenance Manager | Boot Options&amp;lt;/code&amp;gt;,&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;allowed the boot to continue.&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
&amp;lt;code&amp;gt;shim.efi&amp;lt;/code&amp;gt; printed &amp;lt;code&amp;gt;Binary is whitelisted&amp;lt;/code&amp;gt;. grub2 printed &amp;lt;code&amp;gt;secure boot forbids insmod&amp;lt;/code&amp;gt; four times. The F18 XFCE GUI started. The guest dmesg contains&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
[    0.000000] Secure boot enabled&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;li&amp;gt;&lt;br /&gt;
OVMF secure boot configuration (enrolled keys etc) don&#039;t persist&lt;br /&gt;
across guest shutdown (maybe not even across in-guest reboot); OVMF&lt;br /&gt;
reverts to non-secure boot. Copying the certificates to the F18 boot&lt;br /&gt;
partition didn&#039;t change this. What&#039;s more, when OVMF is built with&lt;br /&gt;
Secure Boot support, even the boot order saved from last time is&lt;br /&gt;
forgotten and default options are regenerated (even with no keys enrolled).&lt;br /&gt;
&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ol&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Confirmation of secure boot in Windows 2008 Consumer Preview Build 8250 ===&lt;br /&gt;
&lt;br /&gt;
(This is also a write-up of an earlier test.)&lt;br /&gt;
&lt;br /&gt;
Basically re-executed [[#Confirmation of secure boot in Fedora 18]], with the following changes:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;ul&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;I downloaded the platform key, the key exchange key, and three DB entries from [http://blog.hansenpartnership.com/the-microsoft-keys/ James Bottomley&#039;s blog].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;li&amp;gt;Once inside the guest, I [http://msdn.microsoft.com/en-us/library/windows/desktop/hh847889.aspx started PowerShell as an administrator] and&lt;br /&gt;
then [http://communities.intel.com/community/vproexpert/blog/2012/06/26/microsoft-windows-8--enabling-secure-boot verified that Secure Boot was enabled].&amp;lt;/li&amp;gt;&lt;br /&gt;
&amp;lt;/ul&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lersek</name></author>
	</entry>
</feed>