Skip to content

qemu commandline example

Hello,

I read the docs and I got my image build, if I flash the image into an sd: the image boots from the rpi, every think work perfectly.

Now, suppose I want to test the image using qemu, I found around over the internet some examples, but I am not able to make it running correctly.

most of them are something like:

qemu-system-arm \
  -M versatilepb \
  -cpu arm1176 \
  -m 256 \
  -drive "file=raspbian_backup-2.img,if=none,index=0,media=disk,format=raw,id=disk0" \
  -device "virtio-blk-pci,drive=disk0,disable-modern=on,disable-legacy=off" \
  -net "user,hostfwd=tcp::5022-:22" \
  -dtb versatile-pb-buster-5.4.51.dtb \
  -kernel kernel-qemu-5.4.51-buster \
  -append 'root=/dev/vda2 panic=1' \
  -no-reboot

or:

qemu-system-arm \
    -nographic \
    -machine virt \
    -cpu cortex-a7 \
    -m 2G -smp 4 \
    -drive file=/rpi/root.img,format=raw,id=hd,if=none,media=disk \
    -device virtio-scsi-device -device scsi-hd,drive=hd \
    -device virtio-net-device,netdev=net0 \
    -netdev tap,id=net0,ifname=tap0,script=no,downscript=no \
    -kernel /rpi/vmlinuz-5.10.0-21-armmp-lpae \
    -initrd /rpi/initrd.img-5.10.0-21-armmp-lpae \
    -append 'root=/dev/sda1 panic=1 console=ttyAMA0,115200'

of course I extracted the kernel, the dtb and the init image, set the right paths, but they don't work ...

NB: this is not a defect but a question, in my opinion having those examples on the readme as starting point for running the created images using qemu could be useful in general, not only to speedup tests : )

Let me know If I can post this question In a more suitable channel.

Thanks in advance

Stefano