我试图使用QEMU (Kmv)来模拟EFI环境;virtualbox使用archboot在EFI模式下引导需要15分钟。
使用旧的BIOS模式,我可以使用以下命令启动:
root@citsnmaiko-deb:/home/maiko/uefi/ovmf# qemu-system-x86_64 -kernel ../bzImage -initrd ../rootfs.gz -append "rw root=/dev/ram0 ramdisk_size=40960"它适用于我的自定义内核和文件系统。
file ../bzImage
../bzImage: Linux kernel x86 boot executable bzImage, version 3.6.1 (root@citsnmaiko-deb) #4 , RO-rootFS, swap_dev 0x3, Normal VGA它也得到EFI的支持。
我试着用我从这里下载的EFI文件做同样的事情
wget http://ufpr.dl.sourceforge.net/project/edk2/OVMF/OVMF-X64-r11337-alpha.zip -P ovmf
cd ovmf/
unzip -x OVMF-X64-r11337-alpha.zip
# rename the files for QEMU find them
mv OVMF.fd bios.bin
mv CirrusLogic5446.rom vgabios-cirrus.bin
# start QEMU
root@citsnmaiko-deb:/home/maiko/uefi/ovmf# qemu-system-x86_64 -L . -kernel ../bzImage -initrd ../rootfs.gz -append "rw root=/dev/ram0 ramdisk_size=40960"
Could not open option rom 'linuxboot.bin': No such file or directory
pci_add_option_rom: failed to find romfile "pxe-e1000.bin"我掉进了一个EFI外壳,不能启动。

如果我使用相同的EFI环境来使用最新的Ubuntu版本
root@citsnmaiko-deb:/home/maiko/uefi/ovmf# qemu-system-x86_64 -L . -boot d -cdrom ../ubuntu-12.10-desktop-amd64.iso
pci_add_option_rom: failed to find romfile "pxe-e1000.bin"..。引导过程运行良好。

我尝试用我的Ubuntu引导文件来替换它,但是我可能并不完全理解它的功能。当我只是在安装ISO之后替换这些文件时:
mkdir tmp
bsdtar xf ubuntu-12.10-desktop-amd64.iso -C tmp
cp bzImage tmp/casper/vmlinuz
cp rootfs.gz tmp/casper/initrd.lz
genisoimage -o customUbuntu.iso tmp/
qemu-system-x86_64 -L . -boot d -cdrom customUbuntu.iso 同样的EFI也出现了。可以吗?initrd.lz和rootfs.gz是可互换的,对吗?bzImage和vmlinuz怎么样?
我遗漏了什么?
发布于 2021-01-14 20:47:13
最新的Ubuntu 20.04:
sudo qemu-system-x86_64 -enable-kvm -bios /usr/share/ovmf/OVMF.fd -hda myimage.raw 在早期的Ubuntu和其他Linuxes上:
cd ~
git clone git://github.com/tianocore/edk2.git
cd edk2
git submodule init
git submodule update --depth=1
make -C BaseTools
. edksetup.sh
vi Conf/target.txt
ACTIVE_PLATFORM = MdeModulePkg/MdeModulePkg.dsc
TOOL_CHAIN_TAG = GCC5 # or GCC49 GCC48 ... check ./Conf/tools_def.txt
TARGET_ARCH = X64
build
vi Conf/target.txt
ACTIVE_PLATFORM = OvmfPkg/OvmfPkgX64.dsc
build
sudo qemu-system-x86_64 -enable-kvm -bios ./Build/OvmfX64/RELEASE_GCC5/FV/OVMF.fd -hda myimage.raw 指令改编自https://wiki.ubuntu.com/UEFI/OVMF和https://wiki.ubuntu.com/UEFI/EDK2,并在Ubuntu20.04上进行了测试。
发布于 2012-11-09 18:37:35
不是一个直截了当的回答,但你可能对这个xorriso bugreport没有兴趣--我也会在这里发表评论,但简而言之,上游修订1044的xorriso-1.2.4对我很好,我的硬件站与这个剧本完全一样(这是一个俄语语音wiki,但脚本部分应该足够清晰;请注意efiboot.img)。
请注意,/usr/lib/syslinux/isohdpfx.bin来自syslinux,最近的4.06似乎在EFI部门有了相关的变化。
下面是关于(U)EFI的有用知识的另一个井口,并感谢您在问题中提供的脚本:)
发布于 2015-09-07 13:16:45
在内核源代码树中使用这个剧本,cd并运行:
runlinux -- -bios ~/path/to/OVMF.fd从OVMF.fd中提取https://sourceforge.net/projects/edk2/files/OVMF/OVMF-X64-r15214.zip/download
脚本使用BusyBox生成一个最小的文件系统,编译内核并在QEMU中运行它:
qemu-system-x86_64 -enable-kvm -kernel bzImage \
-initrd ../rootfs.gz -bios ~/path/to/OVMF.fd现在我们可以验证UEFI是从QEMU 正如这篇文章中提到的内部使用的:
ls /sys/firmware/efihttps://unix.stackexchange.com/questions/52996
复制相似问题