我想编写一些代码来监控由libvirt管理的QEMU下运行的域的事件.但是,尝试注册事件处理程序会产生以下错误:
>>> import libvirt
>>> conn = libvirt.openReadOnly('qemu:///system')
>>> conn.domainEventRegister(callback, None)
libvir: Remote error : this function is not supported by the connection driver: no event support
Run Code Online (Sandbox Code Playgroud)
(在这种情况下,"回调"是一个简单打印其参数的存根函数.)
我能够找到关于libvirt事件处理的示例似乎并不具体说明哪些后端虚拟机管理程序支持哪些功能.这预计适用于QEMU后端吗?
我正在运行Fedora 16系统,其中包括libvirt 0.9.6和qemu-kvm 0.15.1.
对于那些通过<searchengine>找到自己的人:
更新2013-10-04
许多月和一些Fedora版本之后,libvirt git存储库中的event-test.py代码在Fedora 19上正确运行.
关于qcow2的格式qcow2支持copy-on-write.detail 在这里.libvirt是否支持使用copy-on-write克隆qcow2 VM映像.我找不到任何选项:
VIRT克隆
到目前为止,使用gdb + qemu,我可以进入/超过linux内核源代码.是否可以同时调试用户空间程序?例如,从用户空间到内核空间单步执行一个程序,这样我可以通过发出来观察qemu监视器上寄存器的变化info registers?
我想模仿BeagleBone Black.似乎QEMU是唯一支持ARM的Linux仿真的仿真器.但是我很难获得正确的模拟器.
我尝试使用qemu.org中的QEMU构建但似乎不支持机器"beagle"(也来自"qemu-system-arm -machine help"的输出并不是最小的beagle作为支持的机器).我发现一些帖子说Linaro有一个支持BeagleBone的qemu版本,并且可以在Ubuntu上使用apt-get安装它.还有一个youtube视频,其中包含说明:
https://www.youtube.com/watch?v=__6XmxOrL3o
然而,似乎指令不再有效.我有Ubuntu 14.04.我尝试了以下方法:
1)sudo add-apt-repository ppa:linaro-maintainers/tools
这超时并报告错误的PPA格式错误.
2)然后我按照这里的说明:
https://wiki.linaro.org/Platform/Systems/Repository
但是,添加这些存储库后,没有添加qemu,所以在我的apt存储库中,我只有来自qemu.org的qemu(不支持beaglebone)
3)然后我找到了这个页面:
https://launchpad.net/~linaro-maintainers/+archive/ubuntu/tools
所以我尝试了以下内容:
sudo add-apt-repository http://ppa.launchpad.net/linaro-maintainers/tools/ubuntu
然后还使用"sudo apt-key add"命令下载并添加了公钥.
这似乎是在做了"sudo apt-get update"和"apt-cache show qemu-system"之后我看到了以下内容:
包:qemu-system来源:qemu-linaro版本:2.2.0~rc3 + git8 + gdb12451-63linaro + trusty架构:amd64维护者:Ubuntu开发人员安装大小:133812取决于:qemu-linaro-keymaps,libasound2(> = 1.0 .16),libbluetooth3(> = 4.91),libbrlapi0.6,libc6(> = 2.15),libcurl3-gnutls(> = 7.16.3),libfdt1,libgcc1(> = 1:4.7),libgl1-mesa-glx | libgl1,libglib2.0-0(> = 2.24.0),libgnutls26(> = 2.12.17-0),libncurses5(> = 5.5-5~),libpixman-1-0(> = 0.15.16),libpng12 -0(> = 1.2.13-4),libpulse0(> = 1:0.99.1),libsasl2-2(> = 2.1.24),libsdl1.2debian(> = 1.2.11),libstdc ++ 6( > = 4.6),libtinfo5,libuuid1(> = 2.16),libvdeplug2,libx11-6,zlib1g(> = 1:1.2.0)建议:samba Breaks:qemu(<< 0.11.0-2),qemu-kvm-临时演员(<< 0.13.50-2011.02-0~rc1-0ubuntu1)取代:qemu(<< 0.11.0-2),qemu-kvm-extras(<< 0.13.50-2011.02-0~rc1-0ubuntu1) …
我想到了两种可能的机制:
所需的功能(当然都可以通过 C API,但不一定是 IPC API):
为什么我想要这个:
我知道树内设备,如下所述:如何在 QEMU 源代码中添加新设备?这是传统的做事方式。
到目前为止我发现了什么:
nmimonitor 命令找到 NMI 生成i和o监控命令,所以我没事有x和xp监控命令读取内存我能找到的最接近的工作代码是:https : //github.com/texane/vpcie,它在两侧序列化 PCI,并通过 QEMU 的 TCP API 发送它。但这更加低效且更具侵入性,因为它需要在来宾和主机上进行额外设置。
我正在尝试使用 qemu 模拟器加载一个简单的内核,但是 qemu 卡在“从硬盘启动”。

内核的源代码可以在以下链接中找到:https : //ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-828-operating-system-engineering-fall-2012/,在lab 1作业目录中obj/kern/kernel.img。lab1中的的PDF阅读器,lab1中的tar.gz的的,pointers1.c。任务是:
第一部分专注于熟悉 x86 汇编语言、QEMU x86 仿真器和 PC 的开机引导程序。第二部分检查我们 6.828 内核的引导加载程序,它位于实验室树的引导目录中......
Run Code Online (Sandbox Code Playgroud)% cd lab % make ... + mk obj/kern/kernel.img.. 现在您已准备好运行 QEMU,提供上面创建的文件 obj/kern/kernel.img 作为模拟 PC 的“虚拟硬盘”的内容。这个硬盘映像包含我们的引导加载程序(obj/boot/boot)和我们的内核(obj/kernel)。
Run Code Online (Sandbox Code Playgroud)% make qemu
从VM qemu日志中发现了很多警告,这个警告是否影响虚拟机性能或使用?, 是我的 libvirt.xml 文件有问题吗?或者支持热插拔会有这些警告
这是我的 libvirt xml 配置:
<domain type='kvm' id='315'>
<name>instance-000005b2</name>
<uuid>793fe065-36a6-4840-80cf-840ebed41d3e</uuid>
<maxMemory slots='32' unit='KiB'>68719476736</maxMemory>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='auto'>8</vcpu>
<vcpus>
<vcpu id='0' enabled='yes' hotpluggable='no' order='1'/>
<vcpu id='1' enabled='yes' hotpluggable='yes' order='2'/>
<vcpu id='2' enabled='yes' hotpluggable='yes' order='3'/>
<vcpu id='3' enabled='yes' hotpluggable='yes' order='4'/>
<vcpu id='4' enabled='yes' hotpluggable='yes' order='5'/>
<vcpu id='5' enabled='yes' hotpluggable='yes' order='6'/>
<vcpu id='6' enabled='yes' hotpluggable='yes' order='7'/>
<vcpu id='7' enabled='yes' hotpluggable='yes' order='8'/>
</vcpus>
<cputune>
<shares>2048</shares>
<vcpupin vcpu='0' cpuset='0-9,20-29'/>
<vcpupin vcpu='1' cpuset='0-9,20-29'/>
<emulatorpin cpuset='0-9,20-29'/>
</cputune>
<numatune>
<memory mode='strict' nodeset='0'/> …Run Code Online (Sandbox Code Playgroud) 我想在 QEMU 中模拟 SATA 磁盘驱动器以检查我正在尝试开发的设备驱动程序。如何才能做到这一点?非常感谢您的帮助。
我刚刚开始了解内核的工作原理和内部结构,首先,我正在尝试构建内核并启动它。
我使用 qemu 作为 x86 架构的模拟器。
我正在关注这篇文章(虽然是针对手臂的):http : //www.kaizou.org/2016/09/boot-minimal-linux-qemu/
我使用以下命令构建了内核:
cd kernel_4.9
make x86_64-defconfig
make -j8
Run Code Online (Sandbox Code Playgroud)
这给了我 bzImage。现在我开发了一个initramfshello world 作为可执行文件的虚拟对象。这是init.c:
#include <stdio.h>
void main()
{
printf("Tiny init - Hello World...\n");
while(1);
}
Run Code Online (Sandbox Code Playgroud)
打包 initramfs
gcc -static init.c -o init
chmod +x init
echo init | cpio -o --format=newc > initramfs
Run Code Online (Sandbox Code Playgroud)
现在运行 qemu :
qemu-system-x86_64 -kernel ~/data/linux/arch/x86/boot/bzImage -append 'console=ttyS0' -serial stdio -initrd ~/data/linux/arch/x86/boot/initramfs
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
[ 1.158556] Write protecting the kernel text: 8528k
[ 1.158842] Write protecting …Run Code Online (Sandbox Code Playgroud) 我正在尝试在 QEMU 上使用 Cortex M4 处理器模拟 STM32F407XX 控制器。我编写了 .ld 文件,如下所示:
ENTRY(_Reset)
MEMORY
{
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 512K
RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
PERIPHERALS(rw) : ORIGIN = 0x40000000, LENGTH = 128K
}
SECTIONS
{
.startup . : { stm32.o(.text) } >FLASH
.text : { *(.text) }
.data : { *(.data) } >RAM AT> FLASH
.bss : { *(.bss COMMON) } >RAM
. = …Run Code Online (Sandbox Code Playgroud)