libvirt qemu-system-arm,错误:XML错误:没有可用的PCI总线

问题描述 投票:1回答:1

我正在尝试使用libvirt运行使用buildroot创建的linux映像。

如果我直接使用qemu-system-arm,一切都按预期工作:

/usr/bin/qemu-system-arm \
-M versatilepb \
-kernel output/images/zImage \
-dtb output/images/versatile-pb.dtb \
-drive index=0,file=output/images/rootfs.ext2,if=scsi,format=raw \
-append "root=/dev/sda console=ttyAMA0,115200" \
-net nic,model=rtl8139 \
-net user \
-nographic

但是,当我尝试从qemu cmdline创建xml时,它会失败:

$ virsh domxml-from-native qemu-argv qemu.args                                                                     
error: XML error: No PCI buses available

我还试图手工创建一个基本的XML:

<?xml version='1.0'?>
<domain type='qemu'>
        <name>Linux ARM</name>
        <uuid>ce1326f0-a9a0-11e3-a5e2-0800200c9a66</uuid>
        <memory>131072</memory>
        <currentMemory>131072</currentMemory>
        <vcpu>1</vcpu>
        <os>
                <type machine='versatilepb'>hvm</type>
                <kernel>zImage</kernel>
                <cmdline>root=/dev/sda console=ttyAMA0,115200</cmdline>
                <dtb>versatile-pb.dtb</dtb>
        </os>
        <devices>
                <disk type='file' device='disk'>
                        <source file='rootfs.ext2'/>
                        <target dev="sda" bus="scsi"/>
                </disk>
                <interface type='network'>
                        <source network='default'/>
                </interface>
        </devices>
</domain>

失败并出现同样的错误:

$ virsh create guest-test.xml 
error: Failed to create domain from guest-test.xml
error: XML error: No PCI buses available

我已经尝试使用全新的和最新的libvirt-3.0.0,但没有任何成功

我的cmdline / xml需要更改什么?

arm qemu libvirt
1个回答
1
投票

virsh domxml-from-native issue

domxml-from-native命令不起作用的原因是因为libvirt中进行解析的底层代码需要qemu-system-的后缀为canonical architecture name,而arm则不是。在你的情况下,你似乎希望arm映射到armv7l这是一个建筑名称。你可以通过创建一个软链接qemu-system-armv7l来指出你的系统的qemu-system-arm,然后使用你的qemu.args中的软链接的位置

代码参考

xml issues

由于多个不相关的原因,您的xml会给出相同的错误。在type下的os元素中,您需要指定arch="armv7l"(或其他一些规范的臂拱名称)。另请注意,kerneldtb引用必须是绝对路径或以.为前缀。最后,您需要的某些设备需要PCI总线,并且无法使用您要使用的机器。考虑以下替代方案。

<domain type='qemu'>
  <name>Linux ARM</name>
  <uuid>ce1326f0-a9a0-11e3-a5e2-0800200c9a66</uuid>
  <memory>131072</memory>
  <currentMemory>131072</currentMemory>
  <vcpu>1</vcpu>
  <os>
    <type arch="armv7l" machine='versatilepb'>hvm</type>
    <kernel>/path/to/zImage</kernel>
    <cmdline>root=/dev/sda console=ttyAMA0,115200</cmdline>
    <dtb>/path/to/versatile-pb.dtb</dtb>
  </os>
  <devices>
    <disk type="file" device="disk">
      <driver name="qemu" type="qcow2"></driver>
      <source file="/path/to/root.qcow2"></source>
      <target dev="sda" bus="sd"></target>
    </disk>
    <serial type="tcp">
      <source mode="bind" host="localhost" service="4000"></source>
      <protocol type="telnet"></protocol>
    </serial>
  </devices>
</domain>
© www.soinside.com 2019 - 2024. All rights reserved.