QEMU 세팅

공통

Preparing Disk

qemu-img create -f qcow2 disk.img 16G

GDB

QEMU Option for attaching GDB:  -S -s

gdb-multiarch
 
(gdb) target remote :1234

Device Tree

  • QEMU Option for dumping DTB: -machine dumpdtb=${DTB_FILE}
  • DTB to DTS Conversion: dtc -I dtb -O dts ${DTB_FILE} -o {DTS_FILE}

UEFI

Preparing UEFI firmware..

sudo apt-get install qemu-efi-aarch64
truncate -s 64m varstore.img
truncate -s 64m efi.img
dd if=/usr/share/qemu-efi-aarch64/QEMU_EFI.fd of=efi.img conv=notrunc

Launch QEMU

qemu-system-aarch64 -M virt  \
      -machine virtualization=true -machine virt,gic-version=3  \
      -cpu max,pauth-impdef=on -smp 2 -m 4096           \
      -drive if=pflash,format=raw,file=efi.img,readonly=on      \
      -drive if=pflash,format=raw,file=varstore.img         \
      -drive if=virtio,format=qcow2,file=disk.img           \
      -device virtio-scsi-pci,id=scsi0              \
      -object rng-random,filename=/dev/urandom,id=rng0      \
      -device virtio-rng-pci,rng=rng0               \
      -device virtio-net-pci,netdev=net0                \
      -netdev user,id=net0,hostfwd=tcp::8022-:22            \
      -nographic                            \
      -drive if=none,id=cd,file=debian-12.2.0-arm64-netinst.iso \
      -device scsi-cd,drive=cd

BIOS

Launch QEMU

qemu-system-aarch64 \
	-machine virt,gic-version=3,virtualization=true  \
    -cpu ${CPU} -smp ${CPU_CORE} -m ${RAM_SIZE}           \
    -semihosting \
    -kernel ${KERNEL} \
    -drive if=virtio,format=${DISK_FORMAT},file=${DISK_IMG}          \
	-nographic -serial mon:stdio

Reference