1

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.

  • Why are you using QEMU? You can directly partition the SD card on RaspPi. I tried doing that on a USB stick then later I found out you can only run it on SD card. Are you doing a Raspberian install? – unixmiah Oct 1 '14 at 23:42
  • I am trying to emulate a Raspberry Pi from an SD card instead of an image file. The SD card works perfectly well when I start it directly from the Pi. – JonesV Oct 2 '14 at 5:29
  • What did you use in the ... parts? Maybe instead of flashing it onto the card, you flashed it onto the first partition? – celtschk Oct 2 '14 at 11:07
  • if=/path/to/.img of=/dev/disk2, with disk2 being the SD card. Then the SD card works on the Pi, but cannot be read from QEMU. – JonesV Oct 2 '14 at 11:41
  • 1
    While using sd card you may need to run qemu with sudo. – totti Oct 4 '14 at 7:07
1

The error is saying that your sd card is not being seen at all, or incorrectly being presented, so this is not a partition issue.

Check your QEMU command for the sdcard instance and try again.

1

I have the same plan as you to use QEMU to emulate system from SD card under OS X. Also, I encountered the same issue with you and get stuck with same situation.

Until I found this doc. At 3.6.6.3 Mac OS X, no options for hard disks.

‘/dev/cdrom’ is an alias to the first CDROM.

Currently there is no specific code to handle removable media, so it is better to use the change or eject monitor commands to change or eject media.

I guess this is why we always failed emulate system from SD card.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.