https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-32-bit
Resizing could be somewhat optional, but check the current size and go bigger.
xz --decompress 2024-11-19-raspios-bookworm-armhf-lite.img.xz
qemu-img resize 2024-11-19-raspios-bookworm-armhf-lite.img 4G
(Your devmappings may vary)
sudo kpartx -a 2024-11-19-raspios-bookworm-armhf-lite.img
sudo mkdir /mnt/raspbian-boot
sudo mount -o loop /dev/dm-0 /mnt/raspbian-boot
sudo dnf install -y qemu-system-arm qemu-system-aarch64
qemu-system-arm -machine raspi2b -cpu cortex-a7 -m 1G -serial stdio \
-dtb /mnt/raspbian-boot/bcm2709-rpi-2-b.dtb \
-kernel /mnt/raspbian-boot/kernel7.img \
-append "root=/dev/mmcblk0p2 rootwait dwc_otg.fiq_fsm_enable=0" \
-device usb-kbd \
-device usb-tablet \
-netdev bridge,br=virbr0,id=network0 -device usb-net,netdev=network0 \
-drive if=sd,file=2024-11-19-raspios-bookworm-armhf-lite.img,format=raw
qemu-system-aarch64 -machine raspi3b -cpu cortex-a72 -m 1G -serial stdio \
-dtb /mnt/raspbian-boot/bcm2710-rpi-3-b-plus.dtb \
-kernel /mnt/raspbian-boot/kernel8.img \
-append "root=/dev/mmcblk0p2 rootwait" \
-device usb-kbd \
-device usb-tablet \
-netdev bridge,br=virbr0,id=network0 -device usb-net,netdev=network0 \
-drive if=sd,file=2024-11-19-raspios-bookworm-armhf-lite.img,format=raw
From a shell on the pi
sudo parted /dev/mmcblk0 resizepart 2 100%
sudo resize2fs /dev/mmcblk0p2