Short version
I am trying to emulate a RaspberryPi directly from the SD card (using the same commands as presented here from MacOSX. I am using QEMU.
However, the partitions on my SD card are not recognized properly: when I use the *.img file, QEMU detects the partitions. It does not when I use the SD card, though. Since MacOSX cannot mount ext4 natively, I tried to install osxfuse and fuse-ext2. Now I can mount my ext4 filesystem without problems using:
$ mount -t fuse-ext2 /dev/disk2s5 /mnt/sda5
Running QEMU, I try to specify the filesystem with rootfstype=fuse-ext2
, but QEMU still does not detect the partitions. Actually, whatever I put in this rootfstype
field, I get the same error:
VFS: Cannot open root device "sda5" or unknown-block(8,5): error -6
Please append a correct "root=" boot option; here are the available partitions:
0b00 1048575 sr0 driver: sr
1f00 65536 mtdblock0 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(8,5)
CPU: 0 PID: 1 Comm: swapper Not tainted 3.10.26+ #2
More details
Using the following command, I can emulate my Pi image (*.img
) successfully (both from Arch Linux and from MacOSX:
$ qemu-system-arm -kernel path/to/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "console=ttyAMA0 root=/dev/sda5 rootfstype=ext4 rw" -hda /path/to/ArchLinuxARM-2014.06-rpi.img
I can emulate my Pi system from the SD card when I run QEMU from Arch Linux (as described in this link):
$ qemu-system-arm -kernel /path/to/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "console=ttyAMA0 root=/dev/sda5 rootfstype=ext4 rw" -hda /dev/sdd
Where /dev/sdd is my SD card as recognized by Arch Linux. Then I try to run the same from MacOSX, as follows:
$ qemu-system-arm -kernel path/to/kernel-qemu -cpu arm1176 -m 256 -M versatilepb -no-reboot -serial stdio -append "console=ttyAMA0 root=/dev/sda5 rootfstype=fuse-ext2 rw" -hda /dev/disk2
(Notice that I used "fuse-ext2" which is a third-party on MacOSX).
This time partitions are not detected and I get the error copied above.
Running the *.img
file instead of the SD card, three partitions are detected: sda1
, sda2
, sda5
.
...
parts? Maybe instead of flashing it onto the card, you flashed it onto the first partition?if=/path/to/.img of=/dev/disk2
, withdisk2
being the SD card. Then the SD card works on the Pi, but cannot be read from QEMU.