MacOS qemu运行loongarch linux
本文章参考了
https://github.com/LeisureLinux/bilibili/blob/master/scripts/qemu-busybox.sh#L205
windows qemu安装飞腾Aarch64 Loongarch64 操作系统 亲测_qemu安装arm系统-CSDN博客
https://www.cnblogs.com/missed-forest/p/17667862.html
1. 安装qemu
brew install qemu
qemu-system-loongarch64 -version
2. 下载bios文件和archlinux镜像
bios: http://mirror.nju.edu.cn/loongarch/archlinux/images/QEMU_EFI_8.1.fd
archlinux: http://mirror.nju.edu.cn/loongarch/archlinux/images/archlinux-mate-2023.05.10-loong64.qcow2.zst
注:bios和镜像可根据需要使用其它版本。
3. 解压镜像
zstd -d -o archlinux-mate-2023.05.10-loong64.qcow2 archlinux-mate-2023.05.10-loong64.qcow2.zst
4. 启动镜像
#!/usr/bin/env bash
set -e
currentDir=$(cd $(dirname "$0") && pwd)
qemu=qemu-system-loongarch64
bios=${currentDir}/QEMU_EFI_8.1.fd
disk=${currentDir}/archlinux-mate-2023.05.10-loong64.qcow2
"${qemu}" -machine virt -m 8G \
-smp 4,sockets=4,cores=1,threads=1 \
-cpu la464-loongarch-cpu \
-accel tcg,thread=multi \
-bios "${bios}" \
-serial stdio \
-device virtio-gpu-pci \
-nic user,hostfwd=tcp::2222-:22 \
-device nec-usb-xhci,id=xhci,addr=0x1b \
-device usb-tablet,id=tablet,bus=xhci.0,port=1 \
-device usb-kbd,id=keyboard,bus=xhci.0,port=2 \
-display default,show-cursor=on \
-hda "${disk}"
输入口令:loongarch