QEMU默认将会采用seabios的启动方式,本文将介绍如何以UEFI模式启动
1. 下载所需要的安装文件
2. 创建UEFI固件文件
$ dd if=/dev/zero of=flash0.img bs=1M count=64 $ LINARO_EDK2_URL=http://releases.linaro.org/15.01/components/kernel/uefi-linaro/ $ wget $LINARO_EDK2_URL/release/qemu64-intelbds/QEMU_EFI.fd $ dd if=QEMU_EFI.fd of=flash0.img conv=notrunc $ dd if=/dev/zero of=flash1.img bs=1M count=64 $ dd if=/dev/zero of=hda.img bs=1M count=8192
3. 创建块设备
4. QEMU 命令行设置,我在这里实现了一个脚本文件install.sh :
#!/bin/sh CDROM_IMG=debian-8.1.0-arm64-CD-1.iso HDA_IMG=hda.img make_cdrom_arg() { echo "-drive file=$1,id=cdrom,if=none,media=cdrom" \ "-device virtio-scsi-device -device scsi-cd,drive=cdrom" } make_hda_arg() { echo "-drive if=none,file=$1,id=hd0" \ "-device virtio-blk-device,drive=hd0" } HDA_ARGS=`make_hda_arg $HDA_IMG` if [ $# -eq 1 ]; then case $1 in install) CDROM_ARGS=`make_cdrom_arg $CDROM_IMG` ;; *) CDROM_ARGS="" ;; esac fi qemu-system-aarch64 -m 1024 -cpu cortex-a57 -M virt -nographic \ -pflash flash0.img \ $CDROM_ARGS \ $HDA_ARGS \ -netdev user,id=eth0 \ -device virtio-net-device,netdev=eth0
4. 更改文件执行权限 并执行:
到此,你就实现了一个UEFI启动的AARCH64虚拟机.
Enjoy, and have a lot of fun!