# Emulating a Raspberry Pi in QEMU | Interrupt

**URL:** <https://community.memfault.com/t/emulating-a-raspberry-pi-in-qemu-interrupt/684>\
**Category:** Blog\
**Created:** [June 21, 2023, 8:45pm UTC](https://community.memfault.com/t/emulating-a-raspberry-pi-in-qemu-interrupt/684 "2023-06-21T20:45:09Z")\
**Posts on this page:** 1\
**Showing post:** 10

<div class="post-metadata">

**Author:** ![TrinitronX](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.memfault.com/trinitronx/32/289_2.png) [@TrinitronX](https://community.memfault.com/u/TrinitronX)\
**Post date:** [July 20, 2025, 1:46pm UTC](https://community.memfault.com/t/emulating-a-raspberry-pi-in-qemu-interrupt/684/10 "2025-07-20T13:46:31Z")

</div>

> [@SANJITHAA](#):
>
> I have modified this command according to my system and application as
> 
> ```auto
> qemu-system-aarch64 -machine raspi3 -cpu cortex-a72 -nographic \
> -dtb /home/sanjithaa/bcm2711-rpi-4-b.dtb \
> -m 1G -smp 4 -kernel /home/sanjithaa/kernel8.img \
> -drive file=core-image-minimal-raspberrypi4-64.rpi-sdimg,format=raw \
> -append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2 rootdelay=1" \
> -device usb-ehci \
> -device usb-net,netdev=net0 \
> -netdev user,id=net0,hostfwd=tcp::2222-:22
> 
> ```
> 
> but I received the error as
> 
> ```auto
> qemu-system-aarch64: -device usb-ehci: No 'PCI' bus found for device 'usb-ehci'
> 
> ```
> 
> and I keep on changing the networking handler as `usb-net`, `usb-echi` and `virt-net` where I’m getting the same error. How to resolve this, kindly assist me
> 
> ```auto
> 
> ```

I notice two things with this command:

1. `usb-ehci` device is used, which attaches to a PCI bus.

- The `raspi4` emulated QEMU machine [does not support PCI](https://www.qemu.org/docs/master/system/arm/raspi.html)

1. `bcm2711-rpi-4-b.dtb` devicetree is passed, but the emulated machine is `raspi3`, rather than `raspi4`

- You should match the `dtb` file passed to the emulated hardware machine
- In this case, the `raspi3` machine would need the `bcm2710-rpi-3-b.dtb`

Note that for `raspi4`, the `bcm2711-rpi-4-b.dtb` devicetree file has disabled the USB controller. So, to enable USB keyboard & mouse, the `.dtb` file must be decompiled to `.dts`, patched, and recompiled back to `.dtb`. I have created a `Makefile`-based [`qemu-raspbian` project here](https://github.com/trinitronx/qemu-raspbian) to assist with this.

Whichever machine you choose to emulate, use the corresponding `.dtb` devicetree file that matches that machine. Also, keep in mind that some of the `raspi*` machines don’t support a PCI bus. Therefore, avoid using PCI devices on those QEMU machine types and opt for the `usb-*` devices instead.

For the Raspbian USB driver, you may choose between using the `usb_otg` and the `dwc2` drivers. For example, my project disabled `usb_otg` and used `dwc2`, configuring these in `/boot/config.txt`. If you choose `usb_otg`, nothing else needs to be done, because the current Raspbian `bookworm` image already has this enabled by default.

---

_[View the full topic](https://community.memfault.com/t/emulating-a-raspberry-pi-in-qemu-interrupt/684)._
