- r - 以节省内存的方式增长 data.frame
- ruby-on-rails - ruby/ruby on rails 内存泄漏检测
- android - 无法解析导入android.support.v7.app
- UNIX 域套接字与共享内存(映射文件)
前段时间我在 this article 之后模拟了 Raspberry Pi , 但这种方法有几个问题:
此外,Qemu 中没有针对新 Broadcom BCM2836 或任何其他基于 arm7 的 cpu 的仿真。 .但是,有几个原因可以说明为什么模拟 Raspberry Pi 会很有趣。因此,我对任何提示都感兴趣,这些提示可以将我推向正确的方向,以便使用 Qemu 或 Linux 下的任何其他仿真软件获得工作的 Raspberry Pi 2 仿真。
最佳答案
Ubuntu 16.04、QEMU 2.9.0 -M raspi2、Raspbian 2016-05-27、 Vanilla 内核
从源代码编译 QEMU 2.9.0:
sudo apt-get build-dep qemu-system-arm
git clone --recursive git://git.qemu-project.org/qemu.git
cd qemu
git checkout v2.9.0
./configure
make `nproc`
下载镜像并从中提取内核和dts:
下载图片并解压:
wget http://downloads.raspberrypi.org/raspbian/images/raspbian-2016-05-31/2016-05-27-raspbian-jessie.zip
unzip 2016-05-27-raspbian-jessie.zip
挂载分区的第二个镜像。最简单的方法是:
sudo losetup -f --show -P 2016-05-27-raspbian-jessie.img
这仅适用于 Ubuntu 16.04 上的最新 losetup
,其他方法位于:https://askubuntu.com/questions/69363/mount-single-partition-from-image-of-entire-disk-device/496576#496576
这会打印一个循环设备,例如:
/dev/loop0
我们这样做:
sudo mkdir /mnt/rpi
sudo mount /dev/loop0p1 /mnt/rpi
cp /mnt/rpi/kernel7.img .
cp /mnt/rpi/bcm2709-rpi-2-b.dtb .
sudo umount /mnt/rpi
sudo losetup -d /dev/loop0
运行:
./arm-softmmu/qemu-system-arm \
-M raspi2 \
-append "rw earlyprintk loglevel=8 console=ttyAMA0,115200 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2" \
-cpu arm1176 \
-dtb bcm2709-rpi-2-b.dtb \
-sd 2016-05-27-raspbian-jessie.img \
-kernel kernel7.img \
-m 1G \
-smp 4 \
-serial stdio \
;
然后您可以在主机终端上显示的终端上登录。
当前限制:
-M raspi2
是QEMU 2.6.0加入的,而Ubuntu 16.04只有QEMU 2.5.0,所以我们要从源码编译QEMU。但这并不难。Ubuntu 16.04、QEMU 2.5.0、Raspbian 2016-05-27、修改内核
此方法使用 Ubuntu 16.04 的 QEMU 2.5.0 上的 -M versatilepb
。
缺点是您必须下载修改后的内核(参见 https://raspberrypi.stackexchange.com/questions/47124/emulating-with-qemu-why-the-extra-kernel ),并修改镜像,因此它不太能代表真实系统。
我们选择 4.4.12
,因为这是 Raspbian 镜像中的内核版本。
生成该内核 blob 的过程在存储库中有描述:https://github.com/dhruvvyas90/qemu-rpi-kernel/tree/36ede073f4ccb64f60200ede36c231afe9502070/tools
为什么需要这个额外的内核镜像:https://raspberrypi.stackexchange.com/questions/47124/emulating-with-qemu-why-the-extra-kernel
按照以下位置修改 Raspbian 镜像:https://github.com/dhruvvyas90/qemu-rpi-kernel/wiki/Emulating-Jessie-image-with-4.x.xx-kernel/0068f0c21d942b0f331e18014ff8e22c20cada5c
总结:
像我们为 -M raspi2
一样安装镜像,但使用第二个分区而不是第一个分区:
sudo mount /dev/loop0p2 /mnt/rpi
编辑图片:
# Comment out the line present there with #
sudo vim /mnt/rpi/etc/ld.so.preload
# Comment out the lines of type: "/dev/mmcblk*"
sudo vim /mnt/rpi/etc/fstab
运行:
sudo apt-get install qemu-system-arm
qemu-system-arm \
-kernel kernel-qemu-4.4.12-jessie \
-cpu arm1176 \
-m 256 \
-M versatilepb \
-no-reboot \
-serial stdio \
-append "root=/dev/sda2 panic=1 rootfstype=ext4 rw" \
-hda 2016-05-27-raspbian-jessie.img
[失败] Ubuntu 17.04、QEMU 2.8.0 -M raspi2、Raspbian 2016-05-27、 Vanilla 内核
在这个较新的 Ubuntu 上,QEMU 2.8.0 是默认的,因此我们不需要为 -M raspi2
从源代码编译 QEMU。但是,2.8.0 在出现以下消息后在启动时挂起:
Console: switching to colour frame buffer device 100x30
这表明 -M raspi2
仍然不稳定。
[失败] Ubuntu 16.04,QEMU 2.9.0 -M raspi2,Raspbian 2017-08-16, Vanilla 内核
在这个较新的图像上,使用与 2016-05-27 相同的方法,内核在启动时出现 panic :
Please append a correct "root=" boot option; here are the available partitions:
...
[ 4.138114] ---[ end Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
待办事项:sschoof mentions rootdelay=1
解决了这个问题,我必须尝试一下。
bztsrc/raspi3-tutorial
QEMU 上的 RPI3 裸机
https://github.com/bztsrc/raspi3-tutorial是一组很好的例子,只适用于 QEMU,超快速入门:https://raspberrypi.stackexchange.com/questions/34733/how-to-do-qemu-emulation-for-bare-metal-raspberry-pi-images/85135#85135
关于linux - 如何在 QEMU 上模拟 Raspberry Pi 2?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28880833/
我正在为 aarch64 使用 qemu 模拟器,并且想要创建一个外部检查点(或快速转发)以保存我需要从创建检查点时重新启动系统的所有内容。 (其实我是想跳过开机这一步)我只在qemu VM快照和快进
我想了解这两个包之间的关系,因为更改“qemu”的源 uri 似乎会导致 qemu-native 的构建损坏。 我不是 Yocot/Bitbake 专家,所以稍微澄清一下会大有帮助。 谢谢。 最佳答案
如何写入在 QEMU 中运行的虚拟系统的处理器寄存器和特定内存地址? 我的愿望是通过在 QEMU 之外运行的用户空间程序来完成此操作。这将引起中断并精细地控制处理器和虚拟硬件的执行。 QEMU Mon
我有一个表单,用户可以在其中上传图像(不同操作系统的图像)。 如何检测图像是否为“qcow2”类型的 QEMU 图像? 最佳答案 您可以使用 qemu-img info检查图像格式。 qemu-img
我想知道是否可以编写 qemu 脚本,以便您可以启动它并自动让它在 guest 操作系统中运行程序?就我而言,那就是 Linux。基本上,我想避免与客人互动,以便我可以用秃鹰或类似的东西进行一批实验。
我想到了两种可能的机制: IPC 类似于现有的 QMP 和 QAPI QEMU 加载一个包含模型 的共享库插件 所需的能力(当然所有可能通过 C API,但不一定是 IPC API): 注入(inje
是否有选项? qemu-nbd 命令获得下一个空闲,即未使用的 NBD,如 lossup -f 做? 0.0.1 的联机帮助页(这是 qemu 当前稳定版 1.7.0 的版本)没有提及任何内容。 最佳
qemu-system-armw.exe 和 qemu-system-arm.exe 有什么区别?我在任何地方都找不到它。 最佳答案 带有 w 的可执行文件不会打开控制台窗口,而没有 w 的可执行文件
我正在尝试了解 QEMU 的区 block 链。我对每个执行的 TB 的分支方向有疑问。假设 TB#1 现在已经执行,并找到 next_tb (TB#2)。然后我们知道方向是 TB#1--->TB#2
我有一个使用 KVM 的 Windows 10 专业版虚拟机。它是通过 virt-manager 使用最新版本的 libvirt 和 QEMU 设置的。所有这些都在 Manjaro Linux 20
我开始学习 riscv。我得到了 qemu-riscv、riscv-gcc 并编译了下一个 hello world asm 程序: .section .text .globl _start _star
我有一个运行 kvm/qemu 的 Windows VM,它正在经历时间漂移。Windows 客户机的最佳 libvirt 设置是什么? 目前我正在使用这个,但它没有帮助:
我有一个运行 kvm/qemu 的 Windows VM,它正在经历时间漂移。Windows 客户机的最佳 libvirt 设置是什么? 目前我正在使用这个,但它没有帮助:
我是 qemu 开发新手。我正在尝试修改 qemu 以使用 QEMU 模拟器在 x86 机器上模拟 SGX 处理器的某些功能。这是我想要做的。 我想将以下内容添加到 qemu。我想用一个新参数 EEC
我目前正在尝试构建一个配置来测试 Big-Endian 系统上的一些代码。 通过聊天和研究,我确信这些测试的一个很好的目标是 PowerPC 架构。由于我没有一个,并且不希望在短期内直接访问一个,我正
我正在制作一个操作系统,我正在使用 Qemu 调试它。我想要一种方法来在一些指令的末尾读取一些大块的 ram。怎么做?可以对 Qemu 说将 ram 复制到文件中吗?如果不是我能做什么? 最佳答案 q
qemu/kvm 支持 ovf 吗?它能够启动现有的 ovf 软件包吗?我在 ovf 标准和 qemu/kvm 网站上找不到任何相关信息。对此有任何有用的链接吗?谢谢。 最佳答案 您正在寻找virt-
我想知道如何从 ubuntu 中的源代码构建 grub 2 引导加载程序并使用 qemu 模拟器对其进行测试。 我还想在新版本中更改 grub2 引导加载程序的默认背景图像吗? 这可能吗?如果是,怎么
我的环境是Ubuntu15.10。我写了下面的源代码。 #include "efi.h" #include "efilib.h" EFI_STATUS EFIAPI efi_main(EFI_HAND
我正在尝试使用 qemu 调试 linux 内核的启动顺序,我正在运行的命令是: qemu -serial stdio -kernel -hda -append "root=/dev/sda
我是一名优秀的程序员,十分优秀!