[virt-tools-list] Emulating raspberry pi (arm1136-r2) in virt-manager?

Simon Lambourn simon.lambourn at gmail.com
Fri Feb 15 10:46:39 UTC 2013


On 15/02/13 09:11, Martin Kletzander wrote:
> On 02/14/2013 09:01 PM, Cole Robinson wrote:
>> On 02/14/2013 09:26 AM, Simon Lambourn wrote:
>>> Hi,  I'm sure I am not the only person to want to do this:
>>>
>>> I can emulate raspberry pi using their disk image using raw qemu-system-arm,
>>> but I cannot find the right CPU machine type in virt-manager.  Has anyone
>>> found how to do this, or can someone offer advice please?
>>>
>>> The command I have used to start the raspberry pi emulation (on Ubuntu 12.10) is
>>>
>>> qemu-system-arm -kernel kernel-qemu -cpu arm1136-r2 -m 192 -M versatilepb
>>> -no-reboot -serial stdio -append "root=/dev/sda2 panic=1" -hda
>>> debian6-17-02-2012.img
>>>
>>> I downloaded the debian6...img file from the raspberry pi site. This all works
>>> fine but I would like to set up a VM definition in virt-manager if possible.
>>> In the dialog to create a new virtual machine I selected "import existing OS
>>> image" and then on screen 4 "customise configuration before install", virt
>>> type=qemu and architecture = arm.   Then I press Finish to customise the
>>> configuration.    In Overview I select Machine type = versatilepb (and in Disk
>>> type I select disk bus=IDE and storage format=Raw, but I'm not sure this is
>>> important).
>>>
>>> However I can't find where or how to enter the cpu type - on the processor
>>> page I have tried setting Model (under configuration) to arm1136, 1136,
>>> arm1136-r2 and none of these are accepted by qemu. If I leave the Model type
>>> blank I get a different error (HDA full duplex not supported by this binary).
>>>
>> libvirt + qemu-system-arm don't play together too well at the moment. I don't
>> think you will be able to do what you want to do without some qemu wrapper
>> script. There's some hints here:
>>
>> https://fedoraproject.org/wiki/Architectures/ARM/HowToQemu#Using_QEMU_with_libvirt
>>
>> The plan is to make this all 'just work' in libvirt + virt-manager, but no
>> time table yet.
>>
>> - Cole
>>
> Just confirming what Cole said; we tried to achieve something similar
> few days ago.  The thing is, though, that libvirt supports mainly
> emulating PCs in QEMU.  There are many things that aren't very easily
> fixable.  Completely different devices must be specified in some
> scenarios and some QEMU versions even expect different parameters when
> running arm emulation (for the same options as the PC emulation).
> Controllers are different, there is no PCI bus, but libvirt
> automatically adds that and many many more things.
>
> As suggested, the best way to make it work is try to make it "just work"
> and don't expect too much.  There are many wrappers on the interwebz you
> can use, two of them are in the link above.
>
> Either you know that already or you'll learn that when reading the first
> howto, but to briefly explain how that works; there is '<emulator>'
> element in libvirt's domain XML and that says what binary (script)
> should be used to run that particular machines.  You can create your
> script, put it there and just make sure in the script that you mangle
> the command-line enough so QEMU will start when you exec() it at the
> end.  The less you change it, the more you may get out of it (networking
> and such).
>
> My 0.02$,
> Martin
>
Martin & Cole - thank you for the advice and pointers.    I have made 
some progress but I'm now stuck again.

 From what you say above, it seems that virt-manager is unlikely to 
allow definition of a raspberry pi in the near future, but it may be 
possible using libvirt/virsh.

Following the link above led me to an xml definition for an arm machine, 
which I copied and changed to match the qemu-system-arm command string 
(above) that worked for me.   When I try and start this VM I get an 
error:  "error: unsupported configuration: CPU specification not 
supported by hypervisor".  The CPU element I'm using is

   <cpu match='exact'> <model>arm1136-r2</model>   </cpu>

The guidance says that valid CPU models are in the cpu_map.xml file, but 
this only seems to cover the X86 architecture.   So is there another way 
of specifying the model in the XML file?    I'm looking to replicate the 
qemu-system-arm parameter -cpu arm1136-r2.

Any ideas would be welcome.
Simon





More information about the virt-tools-list mailing list