QEMU for Windows使用
下载安装QEMU for Windows
双击下载后的exe文件完成安装。
qemu常用命令
- 直接启动QEMU
qemu-system-i386
- 加载光盘镜像
qemu-system-i386 -cdrom image.iso
- 创建磁盘镜像
qemu-img create disk.img 100M
- 加载磁盘镜像
qemu-system-i386 -hdd disk.img
- 指定内存大小与CPU数
qemu-system-i386 -m 256M -smp 2 -hdd disk.img
- 同时加载磁盘镜像与光盘镜像,并且从光盘镜像启动
qemu-system-i386 -cdrom image.iso -hdd disk.img -boot d
其中-boot后面的d代表从光盘启动,可用引导项:a, b (软驱 1,2), c (第一块硬盘), d (第一个CD-ROM), n-p (从网络启动), 默认为第一块硬盘。
qemu安装tinycore实例
首先使用qemu-img
创建磁盘 tc.qcow2,格式为qcow2
大小5G。
$ qemu-img.exe create -f qcow2 tc.qcow2 5G
Formatting 'tc.qcow2', fmt=qcow2 cluster_size=65536 extended_l2=off compression_type=zlib size=5368709120
lazy_refcounts=off refcount_bits=16
从官网下载好tinycore系统镜像CorePlus-current.iso
,使用以下命令从镜像启动。
$ qemu-system-x86_64.exe -hda tc.qcow2 -cdrom /d/setups/CorePlus-current.iso -boot d -m 512
参数说明:
- -hda tc.qcow2 以创建的磁盘文件为第一硬盘
- -cdrom 系统镜像
- -boot d 从镜像文件启动
- -m 512 内存设为512MB
启动后即可进入tinycore,接着安装到系统。
启动后选择 Boot Core with X/GUI (TinyCore) + Installation Extension.
启动成功后桌面如下:
点击下方最后一个图标,启动tinycore安装程序。
勾选 Whole Disk,然后再下方选择sda
硬盘,点击继续安装
下来选择磁盘格式化类型,这里选择ext4
下一步设置引导选项,这里可以参考说明自定义启动选项,如vga=773
然后选择安装类型,为了后期使用方便,我这里全选了所有组件。
然后就是检查安装配置,这里可以看到以上所有选择的配置,确认无误后点击 Proceed开始安装。
安装完成后,桌面点击鼠标选择Exit
退出即可。
后续使用如下命令启动安装好的磁盘文件,不需要挂载ISO镜像文件了。
$ qemu-system-x86_64.exe -hda tc.qcow2 -m 1024
qemu for windows可用命令列表
以上qemu-system-i386命令,为启动i386虚拟环境命令,同样qemu可以模拟其他环境,可使用命令如下:
qemu-system-aarch64.exe
qemu-system-aarch64w.exe
qemu-system-alpha.exe
qemu-system-alphaw.exe
qemu-system-arm.exe
qemu-system-armw.exe
qemu-system-cris.exe
qemu-system-crisw.exe
qemu-system-i386.exe
qemu-system-i386w.exe
qemu-system-lm32.exe
qemu-system-lm32w.exe
qemu-system-m68k.exe
qemu-system-m68kw.exe
qemu-system-microblaze.exe
qemu-system-microblazeel.exe
qemu-system-microblazeelw.exe
qemu-system-microblazew.exe
qemu-system-mips.exe
qemu-system-mips64.exe
qemu-system-mips64el.exe
qemu-system-mips64elw.exe
qemu-system-mips64w.exe
qemu-system-mipsel.exe
qemu-system-mipselw.exe
qemu-system-mipsw.exe
qemu-system-moxie.exe
qemu-system-moxiew.exe
qemu-system-or32.exe
qemu-system-or32w.exe
qemu-system-ppc.exe
qemu-system-ppc64.exe
qemu-system-ppc64w.exe
qemu-system-ppcemb.exe
qemu-system-ppcembw.exe
qemu-system-ppcw.exe
qemu-system-s390x.exe
qemu-system-s390xw.exe
qemu-system-sh4.exe
qemu-system-sh4eb.exe
qemu-system-sh4ebw.exe
qemu-system-sh4w.exe
qemu-system-sparc.exe
qemu-system-sparc64.exe
qemu-system-sparc64w.exe
qemu-system-sparcw.exe
qemu-system-unicore32.exe
qemu-system-unicore32w.exe
qemu-system-x86_64.exe
qemu-system-x86_64w.exe
qemu-system-xtensa.exe
qemu-system-xtensaeb.exe
qemu-system-xtensaebw.exe
qemu-system-xtensaw.exe
```