wget http://www.kraxel.org/repos/firmware.repo -O /etc/yum.repos.d/firmware.repo
二.安装ovmf
yum install edk2.git-ovmf-x64
提示:不翻墙,yum无法安装,这里给出另一种解决方案,直接下载社区已经编译好的OVMF.fd文件,或者花点时间直接从源码编译
http://sourceforge.net/projects/edk2/files/OVMF/
到以上站点下载最新的对应版本OVMF-X64-r15214.zip
解压后会看到如下几个文件,其中OVMF.fd就是我们要加载的UEFI rom,README也提供了非常详细的参数解释,有时间可以看看
BUILD_INFO LICENSE
README中就提到了UEFI变量的支持情况
* QEMU 0.12.2 or later is required.
* Be sure to use qemu-system-x86_64, if you are using and X64 firmware.
* Use OVMF for QEMU firmware (3 options available)
对于CentOS7.1,可以直接把OVMF.fd拷贝到/usr/share/qemu-kvm下,该目录存放的是centos发行版qemu目录所有的启动rom
三.配置 libvirtd以启用UEFI
Configure libvirtd to advertise UEFI support
Libvirt needs to know about UEFI->NVRAM config file mapping, so it can advertise it to tools like virt-manager/virt-install.
As root, edit /etc/libvirt/qemu.conf, and add this section at the top of the file:
具体的目录以实际OVMF.fd存放的目录为准,我这里指定的是
四.重启libvirtd
systemctl restart libvirtd
五.创建虚拟机
virt-manager
Create a new VM in virt-manager. When you get to the final page of the 'New VM' wizard, do the following:
- Click 'Customize before install', then select 'Finish'
- On the 'Overview' screen, Change the 'Firmware' field to select the 'UEFI x86_64' option.
- Click 'Begin Installation'
- The boot screen you'll see should use linuxefi commands to boot the installer, and you should be able to run efibootmgr inside that system, to verify that you're running an UEFI OS.
更精细的参数控制就需要个性VM对应的配置文件,如uefi变量的支持情况况及模板位置等就需要在os段加入如下内容来精细控制
virsh edit rhel7.0
virt-install
Add --boot uefi to your virt-install command. Example: