Re: How to Faking a PCI or USB device.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Pranay Kumar Srivastava <Pranay.Shrivastava@xxxxxxx> writes:

>> maybe if you're lucky, QEMU can emulate that for you...e.g: network
>> adapter...
>
> Well let's just say it emulates network adapter (PCI right?) so
> wouldn't a default driver exist for that? So I should just remove that
> driver and use my driver instead?

well, you can always create your own completely new device in QEMU.
It's not that hard.  Just take one of the existing ones and modify it
as you want.  You'll find the device emulating drivers in qemu/hw/

I actually did this a few weeks ago. And I started out thinking like
you. I had a new USB driver I wanted to test with a special device
configuration variant, and I could not get hold of an actual device with
such a configuration.  But I did have some old and abandoned
microcontroller project laying around.  So I dug that out, including
semi-working firmware source and old toolchain. Still took me several
hours to just get the damn thing to run and enumerate as any USB device
at all.  And modifying the firmware, building and flashing it took
forever.  For each round.  And I realized there would be many of
them....

So I quickly gave up (there was a reason this project was abandoned :-),
and gave QEMU (well, kvm-qemu really) a shot instead.  Copying an
existing usb device there and modifying the descriptors to suit my need
took no time at all.

Additional benefit of the QEMU route: If you are writing a driver and
crash the host (not me, I never do anything wrong of course) , then you
only crash a virtual machine.

There is one drawback: QEMU device drivers are not modular, so you will
have to restart your virtual test machine every time you modify the
device.  Still is a lot faster than flashing a microcontroller.


Bjørn

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux