安装环境:
https://ubuntu.com/server/docs/boot-arm64-virtual-machines-on-qemu
sudo apt install qemu-system-arm
下载:
debian12:Index of /images/cloud/bookworm/latest
https://get.debian.org/images/cloud/bookworm/latest/debian-12-nocloud-arm64.qcow2
ubuntu版:Ubuntu 22.04 LTS (Jammy Jellyfish) daily [20240601]
联网
通过brd联网
sudo mkdir -p /etc/qemu
sudo vim /etc/qemu/bridge.conf
添加上
allow virbr0
sudo chmod u+s /usr/lib/qemu/qemu-bridge-helper
brctl show
查看桥接状态
sudo qemu-system-aarch64 \
-m 8196\
-cpu cortex-a57 \
-M virt \
-nographic \
-smp 8 \
-drive if=pflash,format=raw,file=efi.img,readonly=on \
-drive if=pflash,format=raw,file=varstore.img \
-drive if=none,file=debian-12-nocloud-arm64.qcow2,id=hd0 \
-device virtio-blk-device,drive=hd0 \
-netdev bridge,id=net0,br=virbr0 \
-device virtio-net-device,netdev=net0
扩容
qemu-img resize your-image.img +10G
sudo fdisk /dev/vda
按 p输出当前分区,按d删除需要扩容的分区,按n新建,按w保存,按q退出
刷新分区大小
sudo resize2fs /dev/vda1