运行代码:
qemu-system-x86_64 -pflash bios.bin -hda fat:rw:hda-contents -net none
报错:
vvfat hda-contents chs 1024,16,63
WARNING: Image format was not specified for 'json:{"fat-type": 0, "dir": "hda-contents", "driver": "vvfat", "floppy": false, "rw": true}' and probing guessed raw.
Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
qemu-system-x86_64: warning: TCG doesn't support requested feature: CPUID.01H:ECX.vmx [bit 5]
Could not initialize SDL(No available video device) - exiting
原因:
由于 QEMU 需要一个视频设备来显示其图形输出,而在一个没有图形界面的服务器上(如大多数 Ubuntu 服务器),这个需求无法满足。
解决办法:
解决这个问题的一个方法是使用 QEMU 的无头模式(headless mode),这意味着 QEMU 将运行在没有图形输出的模式下。可以通过添加 -nographic
选项来启用这个模式。
qemu-system-x86_64 -pflash bios.bin -hda fat:rw:hda-contents -net none -nographic