Skip to content

Instantly share code, notes, and snippets.

@Arnie97
Last active October 11, 2022 09:45
Show Gist options
  • Save Arnie97/3a18ed774c3ab63f33faebb3272cec4b to your computer and use it in GitHub Desktop.
Save Arnie97/3a18ed774c3ab63f33faebb3272cec4b to your computer and use it in GitHub Desktop.
Boot Raspberry Pi 2B image in QEMU
# run the kernel in qemu
sudo qemu-img resize 2022-09-22-raspios-bullseye-armhf-lite.img 2G
sudo losetup --show -Pf 2022-09-22-raspios-bullseye-armhf-lite.img
sudo mkdir /media/loop0p1
sudo mount -v /dev/loop0p1 /media/loop0p1
sudo qemu-system-arm -M raspi2b -append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 panic=1 rootwait" -serial stdio -vnc "[::]:0" -kernel /media/loop0p1/kernel7.img -dtb /media/loop0p1/bcm2709-rpi-2-b.dtb -sd 2022-09-22-raspios-bullseye-armhf-lite.img
# userspace only
sudo losetup --show -Pf 2022-09-22-raspios-bullseye-armhf-lite.img
sudo mkdir /media/loop0p1 /media/loop0p2
sudo mount -v /dev/loop0p1 /media/loop0p1
sudo mount -v /dev/loop0p2 /media/loop0p2
sudo proot -q qemu-arm -b /media/loop0p1:/boot -S /media/loop0p2 bash
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment