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: