我试图在qemu-system-arm
上运行Yocto Raspberry Pi 2版本。
我到目前为止:
$ qemu-system-arm -version
QEMU emulator version 2.10.1(Debian 1:2.10+dfsg-0ubuntu3.5)
Copyright (c) 2003-2017 Fabrice Bellard and the QEMU Project developers
$ qemu-system-arm \
-M raspi2 \
-cpu arm1176 \
-dtb ./tmp/deploy/images/raspberrypi2/bcm2709-rpi-2-b.dtb \
-sd ./tmp/deploy/images/raspberrypi2/berrynux-image-raspberrypi2.rootfs.rpi-sdimg \
-m 1G \
-smp 1 \
-nographic \
-kernel ./kernel-qemu \
-append "rw earlyprintk loglevel=8 console=ttyS0 dwc_otg.lpm_enable=0 root=/dev/mmcblk0p2" \
-serial mon:stdio
执行挂起:
WARNING:
Image format was not specified for
'./tmp/deploy/images/raspberrypi2/berrynux-image-raspberrypi2.rootfs.rpi-sdimg' and probing guessed raw.
Automatically detecting the format is dangerous for
raw images, write operations on block 0 will be restricted.
Specify the 'raw' format explicitly to remove the restrictions.
meta-raspberrypi(kernel7.img)生成的内核会立即打破qemu:
qemu-system-arm: Trying to execute code outside RAM or ROM at 0xe0833006
所以我使用kernel-qemu-4.4.34-jessie
代替(尝试拉伸和 wheezy ,同样的结果 - 挂起)
不确定从哪里开始调试,这是否尝试启动?我可以锤击它给我一些有用的输出吗?我需要一个特别烘焙的内核,如果是这样,我从哪里获得它?
strace
没有让我到任何地方(或者我不知道如何解释输出):
...
openat(AT_FDCWD, "./kernel-qemu-4.4.34-jessie", O_RDONLY) = 11
lseek(11, 0, SEEK_END) = 3024048
mmap(NULL, 3026944, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f4ed8106000
lseek(11, 0, SEEK_SET) = 0
read(11, "\0\0\240\341\0\0\240\341\0\0\240\341\0\0\240\341\0\0\240\341\0\0\240\341\0\0\240\341\0\0\240\341"..., 3024048) = 3024048
close(11) = 0
access("./tmp/deploy/images/raspberrypi2/bcm2709-rpi-2-b.dtb", R_OK) = 0
openat(AT_FDCWD, "./tmp/deploy/images/raspberrypi2/bcm2709-rpi-2-b.dtb", O_RDONLY) = 11
lseek(11, 0, SEEK_END) = 16693
close(11) = 0
openat(AT_FDCWD, "./tmp/deploy/images/raspberrypi2/bcm2709-rpi-2-b.dtb", O_RDONLY) = 11
lseek(11, 0, SEEK_END) = 16693
lseek(11, 0, SEEK_SET) = 0
read(11, "\320\r\376\355\0\0A5\0\0\0H\0\0;0\0\0\0(\0\0\0\21\0\0\0\20\0\0\0\0"..., 16693) = 16693
close(11) = 0
futex(0x563f38608c3c, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x563f383d040c, FUTEX_WAKE_PRIVATE, 2147483647) = 1
futex(0x563f384305cc, FUTEX_WAKE_PRIVATE, 2147483647) = 1
ppoll([{fd=0, events=POLLIN}, {fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 5, {tv_sec=0, tv_nsec=0}, NULL, 8) = 0 (Timeout)
futex(0x563f372cac00, FUTEX_WAKE_PRIVATE, 1) = 1
ppoll([{fd=0, events=POLLIN}, {fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 5, {tv_sec=1, tv_nsec=0}, NULL, 8) = 0 (Timeout)
ppoll([{fd=0, events=POLLIN}, {fd=3, events=POLLIN}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 5, {tv_sec=1, tv_nsec=0}, NULL, 8) = 0 (Timeout)
POLLIN
事件每秒都无限重复。
SD卡图像在真实硬件Pi2上启动很好。
我从最新的Raspbian Stretch图像中复制了kernel7.img
和bcm2709-rpi-2-b.dtb
,并且我仍然得到了相同的挂起。我开始认为我的QEMU构建有些麻烦 - 它是Ubuntu 17.10 .deb包的库存。
从源代码编译qemu-2.12.0-rc2
,同样的交易。我一定是做错了。
答案 0 :(得分:3)
"什么都没发生"并且"试图从虚假地址执行#34;通常是以下两者的结果:
对于后者,假设这确实是一个raspi2内核,您可以尝试使用 earlycon = pl011,0x3f201000 在你的内核附加参数。 (Linux内核可以为PL011 UART产生earlycon输出,但不能用于特定于raspi的迷你UART&#39 ;.
我建议也放弃" -nographic"和" -serial mon:stdio"暂时。然后,您可以使用图形UI检查两个UART输出。 (您可以通过使用两个-serial命令行选项正确地重定向它们而不使用GUI来执行此操作,但是您必须找出合理的位置来发送它们; GUI更简单。)第一个串行端口将是PL011,第二个是迷你UART,所以如果你只告诉QEMU在哪里发送第一个串口输出而客人写到第二个,你就永远不会看到它。
答案 1 :(得分:0)
您可能会尝试使用多功能机器仿真
-M versatilepb -m256