我从这里有一个磁盘映像文件;该页面显示我可以使用QEMU和以下命令引导该映像:
$ qemu-system-x86_64 -m 4096 -ctrl-grab -no-reboot x86-64.img
这给出了一条信息:
WARNING: Image format was not specified for 'x86-64.img' 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.
模拟器已加载,但PilOS崩溃,这意味着我做错了什么:
(可能是因为PilOS想要写入块0,但不能写入)
该raw
命令行参数,据我所知,这意味着这样传递:
$ qemu-system-x86_64 -drive format=raw file=x86-64.img
qemu-system-x86_64: -drive format=raw: drive with bus=0, unit=0 (index=0) exists
这失败了(我认为),因为我的引导设备是打开的/dev/sda
,总线0,所以以下之一应根据QEMU的手册页工作(但不能):
$ qemu-system-x86_64 -drive bus=9 format=raw file=x86-64.img
qemu-system-x86_64: -drive bus=9: Could not open 'format=raw': No such file or directory
$ qemu-system-x86_64 -drive format=raw file=x86-64.img bus=9
qemu-system-x86_64: -drive format=raw: drive with bus=0, unit=0 (index=0) exists
应该接受的bus=9
参数-drive
被解释为文件名,或者被完全忽略。
如何在QEMU中正确启动这样的原始映像?
这是Ubuntu 15.10,正在运行:
QEMU emulator version 2.3.0 (Debian 1:2.3+dfsg-5ubuntu9.3), Copyright (c) 2003-2008 Fabrice Bellard
有关图片的数据:
$ file x86-64.img
x86-64.img: DOS/MBR boot sector; partition 1 : ID=0x83, active, start-CHS (0x0,1,1), end-CHS (0x82,246,62), startsector 62, 2006072 sectors; partition 2 : ID=0x82, start-CHS (0x83,0,1), end-CHS (0x15,246,62), startsector 2006134, 2006134 sectors
$ fdisk -lu x86-64.img
Disk x86-64.img: 670 KiB, 686080 bytes, 1340 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000
Device Boot Start End Sectors Size Id Type
x86-64.img1 * 62 2006133 2006072 979.5M 83 Linux
x86-64.img2 2006134 4012267 2006134 979.6M 82 Linux swap / Solaris
qemu-system-x86_64 -fda os.flp
以摆脱警告?