qemu-rpi-kernel icon indicating copy to clipboard operation
qemu-rpi-kernel copied to clipboard

How to use it with the latest RaspiOS Lite (2020-12-02)?

Open josephernest opened this issue 4 years ago • 4 comments

I'm using:

  • qemu-5.0.0
  • kernel-qemu-5.4.51-buster
  • versatile-pb-buster-5.4.51.dtb
  • RaspiOS Lite (Kernel version: 5.4) 2020-12-02-raspios-buster-armhf-lite.img from https://www.raspberrypi.org/software/operating-systems/

Then

qemu-system-arm.exe -kernel kernel-qemu-5.4.51-buster -cpu arm1176 -m 256 -M versatilepb -serial stdio 
          -append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" 
          -drive "file=2020-12-02-raspios-buster-armhf-lite.img,index=0,media=disk,format=raw" 
          -dtb versatile-pb-buster-5.4.51.dtb

gives an endless reboot:

image

Any idea?


PS: is it also possible to test RPi4 specific distributions? Or is only Raspi 2 / 3 supported in this repo?

josephernest avatar Dec 13 '20 20:12 josephernest

Try native emulation as this guide --> (Wiki link) You may need qemu 5.1.0+ for it though for functioning keyboard and mouse.

dhruvvyas90 avatar Dec 14 '20 01:12 dhruvvyas90

@dhruvvyas90 This worked indeed:

qemu-5.2.0\qemu-img.exe resize 2020-12-02-raspios-buster-armhf-lite.img 4G
qemu-5.2.0\qemu-system-aarch64.exe -M raspi3 -append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" -dtb bcm2710-rpi-3-b.dtb -sd 2020-12-02-raspios-buster-armhf-lite.img -kernel kernel8.img -m 1G -smp 4 -serial stdio -usb -device usb-mouse -device usb-kbd

Thank you very much :)

Little questions:

  • Is there a way to make it work with Rpi4 emulation? -M raspi4 does not work, it is not listed in qemu-system-aarch64.exe -machine help anyway. As my goal was to test custom built distribution for Rpi4, is there a way to have something close to a RPi4 with a -cpu parameter maybe? Or do we have to wait for a qemu-system-aarch64.exe that supports machine raspi4?

  • IIRC, this RaspiOS Lite version is armhf and 32-bit. Is it normal that it works with qemu-system-aarch64.exe (working) and not qemu-system-arm.exe (I tried, non working)?

  • what is the difference between using "native emulation" and your repo's kernels?

josephernest avatar Dec 14 '20 08:12 josephernest

i think native emulation is emulation of the actual raspberry pi and the other is just emulation of a generic board to run raspberry pi os

MrDiagnose avatar Jan 16 '21 15:01 MrDiagnose

@josephernest Try this for non-native emulation: qemu-system-arm.exe -M versatilepb -cpu arm1176 -m 256 -drive "file=2021-01-11-raspios-buster-armhf.img,if=none,index=0,media=disk,format=raw,id=disk0" -device "virtio-blk-pci,drive=disk0,disable-modern=on,disable-legacy=off" -net nic -net "user,hostfwd=tcp::5022-:22" -kernel kernel-qemu-5.4.51-buster -dtb versatile-pb-buster-5.4.51.dtb -append "root=/dev/vda2 panic=1"

MrDiagnose avatar Jan 16 '21 18:01 MrDiagnose