Qemu 启动 arm64 虚拟机
文章目录
安装 qemu
-
安装依赖
1 2 3 4 5 6
dnf install \ gcc make cmake ninja-build \ xz bzip2 \ python3 perl-interpreter \ glib2-devel pixman-devel zlib-devel \ diffutils findutils
-
编译 qemu
1 2 3 4 5 6 7
curl -LO https://download.qemu.org/qemu-6.2.0.tar.xz tar xf qemu-6.2.0.tar.xz cd qemu-6.2.0 mkdir /opt/qemu-aarch64 ./configure --prefix=/opt/qemu-aarch64/ –-target-list=aarch64-softmmu make make install
-
下载 efi 固件
1
curl -LO https://releases.linaro.org/components/kernel/uefi-linaro/16.02/release/qemu64/QEMU_EFI.fd
创建 arm64 虚拟机
-
下载 Rocky Linux 8 iso 镜像文件
1
curl -LO https://mirrors.nju.edu.cn/rocky/8.10/isos/aarch64/Rocky-8.10-aarch64-minimal.iso
-
创建虚拟硬盘
1 2
mkdir /data/qemu /opt/qemu-aarch64/bin/qemu-img create rocky8-aarch64.img 6G
-
创建虚拟机
1 2 3 4 5 6 7 8 9 10 11 12
/opt/qemu-aarch64/bin/qemu-system-aarch64 \ -m 2048 \ -cpu cortex-a57 \ -smp 2 \ -M virt \ -bios QEMU_EFI.fd \ -nographic \ -drive if=none,file=Rocky-8.10-aarch64-minimal.iso,id=cdrom,media=cdrom \ -device virtio-scsi-device \ -device scsi-cd,drive=cdrom \ -drive if=none,format=raw,file=/data/qemu/rocky8-aarch64.img,id=hd0 \ -device virtio-blk-device,drive=hd0
-
前台启动虚拟机,可以调整处理器核数和内存大小
1 2 3 4 5 6 7 8 9
/opt/qemu-aarch64/bin/qemu-system-aarch64 \ -m 4096 \ -cpu cortex-a57 \ -smp 4 \ -M virt -bios /opt/qemu-aarch64/utils/QEMU_EFI.fd \ -drive if=none,format=raw,file=/data/qemu/rocky8-aarch64.img,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -nographic \ -display none
-
后台启动虚拟机,可以调整处理器核数和内存大小
1 2 3 4 5 6 7 8 9 10 11
/opt/qemu-aarch64/bin/qemu-system-aarch64 \ -m 4096 \ -cpu cortex-a57 \ -smp 4 \ -M virt -bios /opt/qemu-aarch64/utils/QEMU_EFI.fd \ -drive if=none,format=raw,file=/data/qemu/rocky8-aarch64.img,id=hd0 \ -device virtio-blk-device,drive=hd0 \ -net user,hostfwd=tcp::10022-:22 \ -net nic \ -display none \ -daemonize
参考
文章作者 Colben
上次更新 2025-04-24