Skip to content

Instantly share code, notes, and snippets.

@larsks
Created September 6, 2022 02:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save larsks/738518a0d14d95aea3b4eb1fb061c969 to your computer and use it in GitHub Desktop.
Save larsks/738518a0d14d95aea3b4eb1fb061c969 to your computer and use it in GitHub Desktop.
Booting raspberry pi 64 bit using qemu
#!/bin/sh
SERIAL1=( -chardev stdio,id=uart1 -serial chardev:uart1 -monitor none )
SERIAL2=( -serial vc -serial vc )
SERIAL3=( -nographic -serial mon:stdio )
EMU_RASPI=( -M raspi3 )
EMU_VIRT=( -M virt -cpu cortex-a72 )
NET_TAP=(
-netdev tap,id=net0,script=no,downscript=no,ifname=rpi0
-device usb-net,netdev=net0
)
NET_USER=(
-device usb-net,netdev=net0
-netdev user,id=net0,hostfwd=tcp::2222-:22
)
KERNEL=(
-kernel kernel8.img
-append "root=/dev/mmcblk0p2 rw rootwait rootfstype=ext4 console=ttyAMA0,115200"
-dtb bcm2710-rpi-3-b-plus.dtb
)
echo qemu-system-aarch64 \
"${EMU_RASPI[@]}" \
"${KERNEL[@]}" \
-m 1024 \
-drive file=/var/lib/libvirt/images/raspios-work.img,format=raw \
"${NET_TAP[@]}" \
"${SERIAL3[@]}"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment