simple way to mount sdcard on emulated device

2,167 views
Skip to first unread message

Румен Петров

unread,
Mar 6, 2019, 12:05:35 PM3/6/19
to Android-x86
Project "Sdcard HowTo" describes a number of ways to add "sdcard" (1).
It is fine with QEMU and showod work with VirtualBox. Unfortunately on each start I must edit boot line and to add SDCARD parameter.
Is there a way to store boot command permanently?


Another try was to use QEMU argument -sd FILE (2).
This fail with error message: "machine type does not support if=sd,bus=0,unit=0".
I wonder what could be reason for failure - QEMU limitation or is not supported by AOSP?


Third way is most technical - to start QEMU with arguments like following long argument sequence (3):
...
 -device qemu-xhci,id=xhci \
 -device usb-storage,bus=xhci.0,drive=sdcard \
 -drive if=none,id=sdcard,format=raw,file=$SDCARD \
...
It work but I prefer to avoid very long command line. The main reason is that 
between releases qemu changes some options so simple command is preferred.


Is there another simple way to start with emulated SDCARD?
For instance vendor emulator has option command option -sdcard


Regards,
Roumen Petrov


Remark: tested with installed Android X86 8.1rc2 32-bit on Linux with QEMU 3.1.0.

Chih-Wei Huang

unread,
Mar 7, 2019, 8:49:47 AM3/7/19
to Android-x86
Румен Петров <rpetr...@gmail.com> 於 2019年3月7日 週四 上午1:05寫道:
The simplest way is to add QEMU options like:

-usbdevice disk:format=raw:sdcard.img

where sdcard.img is a raw disk image.


--
Chih-Wei
Android-x86 project
http://www.android-x86.org

Румен Петров

unread,
Mar 7, 2019, 2:33:30 PM3/7/19
to Android-x86
[SNIP]

The simplest way is to add QEMU options like:

        -usbdevice disk:format=raw:sdcard.img

where sdcard.img is a raw disk image.


Thanks.
Perhaps -usbdevice .. could be used until it support is removed.
According documentation "...this option is deprecated, please use -device usb-...".

Румен Петров

unread,
Mar 13, 2019, 3:53:09 PM3/13/19
to Android-x86

Just tested  "-usbdevice disk:format=raw:$SDCARD", where $SDCARD is absolute path to SDCARD image.
With such argument QEMU 3.1.0 fail to start and outputs:
....
qemu-system-x86_64: -usbdevice disk:/work/qemu/os-android81rc2-x86.sdcard: '-usbdevice' is deprecated, please use '-device usb-...' instead
qemu-system-x86_64: -usbdevice disk:/work/qemu/os-android81rc2-x86.sdcard: could not add USB device 'disk:...'
....


Chih-Wei Huang

unread,
Mar 13, 2019, 10:36:06 PM3/13/19
to Android-x86
Румен Петров <rpetr...@gmail.com> 於 2019年3月14日 週四 上午3:53寫道:
OK, '-usbdevice' is deprecated. (I'm still using old 2.9)

Refer to the doc for new options:
https://github.com/qemu/qemu/blob/master/docs/usb-storage.txt
Reply all
Reply to author
Forward
0 new messages