[vbox-dev] How add device or driver (PDM) to VirtualBox

Steve lordgrape at hotmail.com
Thu Jul 23 17:51:44 GMT 2015


Marcin K <sofcik.kiss at ...> writes:

> 
> Hi,
> I ask about this before but don't get any answer...
> 
> How add new device/driver to Virtualbox?
> Is there a someone who understand how PDM works?
> 
> 
> I compile VBoxSampleDevice.cpp and add it to VirtualBox but system
(ubunutu 14) don't show any new device.
> To add dll to Virtualbox I use:
> VBoxManage setextradata global VBoxInternal/PDM/Devices/[[1]]/Path 
g:\VirtualBox\out\win.amd64\release\obj\testingDevice\VBoxSampleDevice.dll
> 
> 
> Also I try to add device using copy of Virtio device. I copy code 
of DevVirtioNet.cpp modify it (change some names), build dll and add to 
VirtualBox:
> VBoxManage setextradata global VBoxInternal/PDM/Devices/[[3]]/Path 
g:\VirtualBox\out\win.amd64\release\obj\testingDevice\testingDevice.dll
> 
> 
> But still nothing change in guest system.
> 
> In DevVirtioNet.cpp I found a lot of code which set a lot of parameters 
connected with PCI. I try understand this code but this take, a lot of 
time.
> 
> I also found that I have to set which driver will be use in system also 
in configuration of virtual machine. 
> I try to set net ethernet cart type but in VBoxManage I found code which 
allow using only build in drivers so I can't set "My" modified Virtio 
driver.
> 
> There is really no instruction or documentation how it's works?
> 
> I will be really gratefull for any help or instruction how add new 
device to VirtualBox.
> 
> 
> Best regards,
> Marcin
> 
> 
> <div><div dir="ltr">Hi,<div><br></div>
> <div>I ask about this before but don't get any answer...</div>
> <div><br></div>
> <div>How add new device/driver to Virtualbox?</div>
> <div>Is there a someone who understand how PDM works?<br>
> </div>
> <div><br></div>
> <div>I compile VBoxSampleDevice.cpp and add it to VirtualBox but system
(ubunutu 14) don't show any new device.</div>
> <div>To add dll to Virtualbox I use:</div>
> <div>VBoxManage setextradata global VBoxInternal/PDM/Devices/[[1]]/Path 
g:\VirtualBox\out\win.amd64
\release\obj\testingDevice\VBoxSampleDevice.dll<br>
> </div>
> <div><br></div>
> <div>Also I try to add device using copy of Virtio device. I copy code 
of DevVirtioNet.cpp modify it (change some names), build dll and add 
to VirtualBox:</div>
> <div>VBoxManage setextradata global VBoxInternal/PDM/Devices/[[3]]/Path 
g:\VirtualBox\out\win.amd64\release\obj\testingDevice\testingDevice.dll<br>
> </div>
> <div><br></div>
> <div><div>But still nothing change in guest system.</div></div>
> <div><br></div>
> <div>In DevVirtioNet.cpp I found a lot of code which set a lot 
of parameters connected with PCI. I try understand this code but this 
take, a lot of time.</div>
> <div><br></div>
> <div>I also found that I have to set which driver will be use in system 
also in configuration of virtual machine. </div>
> <div>I try to set net ethernet cart type but in VBoxManage I found code 
which allow using only build in drivers so I can't set "My" modified 
Virtio driver.</div>
> <div><br></div>
> <div><div>There is really no instruction or documentation how it's works?
</div></div>
> <div><br></div>
> <div>I will be really gratefull for any help or instruction how add new 
device to VirtualBox.</div>
> <div><br></div>
> <div><br></div>
> <div>Best regards,</div>
> <div>Marcin</div>
> </div></div>
> 

What I found was you still need to tell VirtualBox to instantiate the 
device. By giving it the path, you told VirtualBox that it has a new 
device 
that it can use in VMs, but didn't actually tell it to create the hardware 
and attach it to the VM.

That bit is done with these keys like:
VBoxManage setextradata "your_vm_name" 
"VBoxInternal/Devices/[your_device_library]/0/Priority" 1
VBoxManage setextradata "your_vm_name" 
"VBoxInternal/Devices/[your_device_library]/0/Trusted" 1

The 0 is the instance number you want to have VBox create for you. I'm not 
sure if Priority is needed or what. Trusted just says that the device can 
access all of the VM APIs. (Untrusted devices have a more limited set of 
APIs they can call)

I also suggest building a debug version of VirtualBox. A lot more logging 
and error messages are turned on so you can see the internal workings.

-Steve






More information about the vbox-dev mailing list