'QEMU Raspberry Pi emulation, no video
I compiled qemu version 6.1.50 on Ubuntu 20.04.
I have tried both raspi2 and raspi3, but I'm not getting video output. The console is showing the startup messages in the terminal I'm starting qemu from, and in both cases, I'm able to log into the pi from there. However, the video output screen doesn't really show anything, except in raspi2 mode, where it only shows four raspberry pi logos. (To be clear, when I say I'm able to log in, I mean from my computer's terminal as QEMU is redirecting the serial port there. This works too, just not the video output tied to the emulated pi's framebuffer.)
Is there an option I need to specify to make this work?
Here are the command lines I am running, first the raspberry pi 2 command line:
qemu-system-arm -M raspi2b -append \
"rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
-dtb ./dtbs/bcm2709-rpi-2-b.dtb \
-sd 2021-10-30-raspios-bullseye-armhf-full.img \
-kernel kernel7.img -m 1G -smp 4 -serial stdio -usb -device usb-mouse -device usb-kbd \
-device usb-net,netdev=net0 -netdev user,id=net0,hostfwd=tcp::5555-:22
And the raspi3b command line:
qemu-system-aarch64 -M raspi3b \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
-dtb ./dtbs/bcm2710-rpi-3-b-plus.dtb \
-sd 2021-10-30-raspios-bullseye-armhf-full.img \
-kernel kernel8.img \
-m 1G \
-smp 4 \
-serial stdio \
-usb -device usb-mouse -device usb-kbd \
-device usb-net,netdev=net0 -netdev user,id=net0,hostfwd=tcp::5555-:22
For what it's worth, I do have networking working with the pi3 emulation, so that's nice.
Thanks in advance!
Solution 1:[1]
This isn't a full answer, but hopefully it at least narrows down where you want to be looking for the problem...
If you see the 4 raspberry logos then your commandline is telling QEMU to emulate the video device, and the guest kernel is using the video device to display at least some things. Anything else that doesn't use the video when you expect it to is almost certainly a guest OS configuration issue.
Solution 2:[2]
- Check whether you got /dev/fb0 from the terminal. If you don't get /dev/fb0, surely no video.
- rasp machine type is different from standard pc architecture which can use like vga device. So, to get video, try machine type virt. Below is the command that works when running raspi os and rootfs.
qemu-system-aarch64
-M virt,highmem=off
-smp 8
-m 2G
-cpu cortex-a72
-kernel $HOST_SHARE_DIR/linux-stable/arch/arm64/boot/Image
-append "root=PARTUUID=d97f5830-02 rw console=ttyAMA0"
-serial telnet:localhost:4321,server,nowait
-monitor telnet:localhost:4322,server,nowait
-device VGA,id=vga1
-device secondary-vga,id=vga2
-device virtio-keyboard-pci
-device virtio-mouse-pci
-hda $HOST_SHARE_DIR/data/images/2022-01-28-raspios-bullseye-arm64.img
- If you really want to use Machine type raspx, you need study the framebuffer device of that machine type, or soc. Then redirect it to the qemu video.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter Maydell |
| Solution 2 | Jiang |
