winx86系统上安装arm虚拟机

以centos8arm64为例

准备

CentOS-8.5.2111-aarch64-dvd1.iso 镜像包

qemu-w64-setup-20250422.exe qemu程序包

QEMU_EFI.fd 引导固件

下载地址:

https://releases.linaro.org/components/kernel/uefi-linaro/latest/release/qemu64/QEMU_EFI.fd

https://qemu.weilnetz.de/w64/

操作步骤

1、创建qcow2虚拟磁盘

安装qemu-w64-setup-20250422.exe,进入到安装目录,空白处shift+右键,打开cmd终端

qemu-img create -f qcow2 D:\qemu-armcs\cnetos8.qcow2 50G

参数说明:create qemu-img子命令,创建磁盘

-f qcow2 指定磁盘格式qcow2

D:\qemu-armcs\centos8.qcow2 指定磁盘位置

50G 指定磁盘大小

2、启动虚拟机,安装系统

qemu-system-aarch64.exe -m 4096 -cpu cortex-a72 -smp 2,sockets=1,cores=2 -M virt -bios D:\qemu-armcs\QEMU_EFI.fd -device VGA -device nec-usb-xhci -device usb-mouse -device usb-kbd -drive if=none,file=D:\qemu-armcs\cnetos8.qcow2,id=hd0 -device virtio-blk-device,drive=hd0 -drive if=none,file=D:\qemu-armcs\CentOS-8.5.2111-aarch64-dvd1.iso,id=cdrom,media=cdrom -device virtio-scsi-device -device scsi-cd,drive=cdrom -net nic -net user,hostfwd=tcp::2222-:22

参数说明:

-m 4096 虚拟机内存4G

-cpu cortex-a72 -smp 2,sockets=1,cores=2 虚拟机cpu2个

-drive if=none,file=D:\qemu-armcs\cnetos8.qcow2,id=hd0 指定虚拟机磁盘

-drive if=none,file=D:\qemu-armcs\CentOS-8.5.2111-aarch64-dvd1.iso,id=cdrom,media=cdrom 指定光盘路径

-net nic -net user,hostfwd=tcp::2222-:22 端口映射,本地2222映射到虚拟机22端口

执行后,打开一个窗口,按步骤安装完毕后关机

3、启动虚拟机

qemu-system-aarch64.exe -m 4096 -cpu cortex-a72 -smp 2,sockets=1,cores=2 -M virt -bios D:\qemu-armcs\QEMU_EFI.fd -device VGA -device nec-usb-xhci -device usb-mouse -device usb-kbd -drive if=none,file=D:\qemu-armcs\cnetos8.qcow2,id=hd0 -device virtio-blk-device,drive=hd0 -drive if=none,file=,id=cdrom,media=cdrom -device virtio-scsi-device -device scsi-cd,drive=cdrom -net nic -net user,hostfwd=tcp::2222-:22

执行后,待系统启动后,可操作

4、远程工具连接

ssh 127.0.0.1:2222

#连接卡住,可能是由于虚拟机没有配置ip,配置一个ip后再连接

5、补充

qemu-system-aarch64.exe ^
-m 4G ^
-cpu cortex-a72 ^
-smp 4 -M virt ^
-bios E:\databackup\xyz\QEMU_EFI.fd ^
-device VGA ^
-device nec-usb-xhci ^
-device usb-mouse -device usb-kbd ^
-drive if=none,file=E:\databackup\xyz\disk.qcow2,id=hd0 ^
-device virtio-blk-device,drive=hd0 ^
-drive if=none,file=D:\linxos-6.0.99-el20.03-sp3-20240813-arm64-DVD.iso,id=cdrom,media=cdrom ^
-device virtio-scsi-device ^
-device scsi-cd,drive=cdrom ^
-net user,hostfwd=tcp::2222-:22 -net nic

qemu-system-aarch64.exe ^
-m 4G ^
-cpu cortex-a72 ^
-smp 4 -M virt ^
-bios E:\databackup\xyz\QEMU_EFI.fd ^
-device VGA ^
-device nec-usb-xhci ^
-device usb-mouse -device usb-kbd ^
-drive if=none,file=E:\databackup\xyz\disk.qcow2,id=hd0 ^
-device virtio-blk-device,drive=hd0 ^
-drive if=none,file=,id=cdrom,media=cdrom ^
-device virtio-scsi-device ^
-device scsi-cd,drive=cdrom ^
-net user,hostfwd=tcp::2222-:22 -net nic

启动

x86 bios配置
./qemu-system-x86_64 -m 2024 -boot menu=on D:\centos8x86.qcow2 -net nic -net user,hostfwd=tcp::2222-:22

参考资料:

https://qemu.weilnetz.de/doc/latest

https://www.qemu.org/download/

https://gitlab.com/qemu-project/qemu

posted on 2025-07-01 10:47  赛博狗尾草  阅读(656)  评论(0)    收藏  举报

导航