OVMF: Difference between revisions

From Xen
Jump to navigationJump to search
(Note on debug port)
(Simplify guest config file example, replace xvda by hda. Also OVMF now have pv-disk drivers.)
 
(6 intermediate revisions by 3 users not shown)
Line 1: Line 1:
Tianocore / OVMF is integrated into Xen 4.4 release with essential patches upstreamed. However in 4.4 it is not built by default.
Tianocore / [http://www.tianocore.org/ovmf/ OVMF] the Open-source community's project to enable EFI / UEFI for virtual machines. OVMF is integrated into Xen 4.4 release with essential patches upstreamed. However in 4.4 it is not built by default.


To build Xen with OVMF support, you would need to have '''--enable-ovmf''' when running '''configure'''. If you would like to have hypervisor log output you will need to manually edit '''OvmfPkg.dec''', change '''PcdDebugIoPort''' to '''0xe9''' (which is the IO port used by Xen hypervisor logging facility) before building OVMF.
To build Xen with OVMF support, you would need to have <code>--enable-ovmf</code> when running <code>configure</code>.

Then enable EFI for your Xen guest by adding <code>bios='ovmf'</code> to your <code>xl.cfg</code> file. See the example below for more information.


One thing to have in mind is Xen supports both its own QEMU fork called qemu-traditional and upstream QEMU called qemu-xen. OVMF only supports the latter. Xen 4.4 has upstream QEMU configured for all HVM guests by default, so it is fine to not specify which QEMU to use in guest config file. But if you have already configured qemu-traditional for your guest you would need to delete / comment out that line.
One thing to have in mind is Xen supports both its own QEMU fork called qemu-traditional and upstream QEMU called qemu-xen. OVMF only supports the latter. Xen 4.4 has upstream QEMU configured for all HVM guests by default, so it is fine to not specify which QEMU to use in guest config file. But if you have already configured qemu-traditional for your guest you would need to delete / comment out that line.


A typical guest config file looks like below. Nothing fancy, just the "bios=" option is important.
A typical guest config file looks like below. Nothing fancy, just the "bios=" option is important. Also read the comment in the example for disk specification.


<pre>
<pre>
Line 19: Line 21:


# This is a disk image with EFI guest installed, you can also use live CD if you prefer.
# This is a disk image with EFI guest installed, you can also use live CD if you prefer.
disk = [ '/data/s0-efi.qcow2,qcow2,hda,w' ]
# You can either specify xvda or hda, QEMU will start with emulated IDE drive in both cases.
# But if you speficy sda then it might not boot as OVMF doesn't have the driver at the moment.
disk = [ '/data/s0-efi.qcow2,qcow2,xvda,w' ]


on_crash = 'preserve'
on_crash = 'preserve'
Line 31: Line 31:
bios='ovmf' # if you don't have this line, seabios will be used
bios='ovmf' # if you don't have this line, seabios will be used
</pre>
</pre>

== Debuging OVMF ==

Here we will describe the different ways one can enable the debug output of OVMF.

=== Log into a file ===

Simply add the following to your guest config file:

<pre>
device_model_args_hvm = [
# Debug OVMF
'-chardev', 'file,id=debugcon,path=/var/log/xen/ovmf.log,',
'-device', 'isa-debugcon,iobase=0x402,chardev=debugcon',
]
</pre>

This will tell QEMU to save OVMF's debug output to <code>/var/log/xen/ovmf.log</code>.

(Checkout QEMU's help of -chardev for more options.)

=== Log via the guest console ===

The alternative is to recompile OVMF so that it would log its debug via the guest console.

Recompile OVMF with <code>-D DEBUG_ON_SERIAL_PORT</code> to enable the use of the console.

To recompile OVMF,
you can edit <code>xen.git:tools/firmware/ovmf-makefile</code>
and add <code>-D DEBUG_ON_SERIAL_PORT</code> to the <code>OvmfPkg/build.sh</code> command line
before building OVMF via Xen build system.
Or you can execute <code>OvmfPkg/build.sh -a X64 -b DEBUG -n $(nproc) -D DEBUG_ON_SERIAL_PORT</code>
within the ovmf directory.

Latest revision as of 18:27, 9 January 2019

Tianocore / OVMF the Open-source community's project to enable EFI / UEFI for virtual machines. OVMF is integrated into Xen 4.4 release with essential patches upstreamed. However in 4.4 it is not built by default.

To build Xen with OVMF support, you would need to have --enable-ovmf when running configure.

Then enable EFI for your Xen guest by adding bios='ovmf' to your xl.cfg file. See the example below for more information.

One thing to have in mind is Xen supports both its own QEMU fork called qemu-traditional and upstream QEMU called qemu-xen. OVMF only supports the latter. Xen 4.4 has upstream QEMU configured for all HVM guests by default, so it is fine to not specify which QEMU to use in guest config file. But if you have already configured qemu-traditional for your guest you would need to delete / comment out that line.

A typical guest config file looks like below. Nothing fancy, just the "bios=" option is important. Also read the comment in the example for disk specification.

builder = 'hvm'
name = 's0-efi'

vcpus = 2

memory = 1024
# memory = 6000

vif = ['bridge=xenbr0']

# This is a disk image with EFI guest installed, you can also use live CD if you prefer.
disk = [ '/data/s0-efi.qcow2,qcow2,hda,w' ]

on_crash = 'preserve'

vnc=1
vnclisten='0.0.0.0'

serial='pty'
bios='ovmf' # if you don't have this line, seabios will be used

Debuging OVMF

Here we will describe the different ways one can enable the debug output of OVMF.

Log into a file

Simply add the following to your guest config file:

device_model_args_hvm = [
  # Debug OVMF
  '-chardev', 'file,id=debugcon,path=/var/log/xen/ovmf.log,',
  '-device', 'isa-debugcon,iobase=0x402,chardev=debugcon',
]

This will tell QEMU to save OVMF's debug output to /var/log/xen/ovmf.log.

(Checkout QEMU's help of -chardev for more options.)

Log via the guest console

The alternative is to recompile OVMF so that it would log its debug via the guest console.

Recompile OVMF with -D DEBUG_ON_SERIAL_PORT to enable the use of the console.

To recompile OVMF, you can edit xen.git:tools/firmware/ovmf-makefile and add -D DEBUG_ON_SERIAL_PORT to the OvmfPkg/build.sh command line before building OVMF via Xen build system. Or you can execute OvmfPkg/build.sh -a X64 -b DEBUG -n $(nproc) -D DEBUG_ON_SERIAL_PORT within the ovmf directory.