我有一个Raspberry Pi出现故障,我想在我的OSX笔记本电脑上尝试调试它,以确定问题是否与硬件、SD卡或软件有关。
我已经从pi中取出SD卡并将其安装在我的OSX机器上,并将kernel7.img和bcm2709-rip-2-b.dtb文件从/boot分区复制到OSX硬盘驱动器。
然后我卸载了boot和RECOVERY分区,然后尝试用启动模拟器
sudo qemu-system-arm
-machine raspi2
-no-reboot
-dtb ./bcm2709-rpi-2-b.dtb
-kernel ./kernel7.img
-drive file=/dev/disk2,format=raw
这给了我输出:
**qemu-system-arm: Invalid SD card size: 29.7 GiB SD card size has to be a power of 2, e.g. 32 GiB. You can resize disk images with 'qemu-img resize <imagefile> <new-size>' (note that this will lose data if you make the image smaller than it currently is).**
我有什么办法绕过这件事吗?
不要试图像那样直接将原始磁盘设备传递给QEMU。相反,将磁盘上的内容复制到一个普通文件上(例如,使用dd(,然后确保该文件的大小正确,并告诉QEMU使用它。
(将SD卡的内容复制到硬盘上也可以检查SD卡是否仍然可读并且没有错误…(
tryqemu-img resize /dev/disk2