aboutsummaryrefslogtreecommitdiffstats
path: root/vl-android.c
diff options
context:
space:
mode:
authorDavid 'Digit' Turner <digit@android.com>2011-03-01 14:03:20 +0100
committerDavid 'Digit' Turner <digit@android.com>2011-03-01 15:31:11 +0100
commit48a3c66361158678f476fc7c2eca2bef025eae62 (patch)
tree276dd2b4c0c0dd5c64d8d32423ebc5884ba239fa /vl-android.c
parentc480cca8d2007f5df62a7431beda310911b963e6 (diff)
downloadexternal_qemu-48a3c66361158678f476fc7c2eca2bef025eae62.zip
external_qemu-48a3c66361158678f476fc7c2eca2bef025eae62.tar.gz
external_qemu-48a3c66361158678f476fc7c2eca2bef025eae62.tar.bz2
Move the SD Card initialization to the core.
Change-Id: I2c8fa2a7df3d79ed4222296a93b787994a8ee11d
Diffstat (limited to 'vl-android.c')
-rw-r--r--vl-android.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/vl-android.c b/vl-android.c
index 379741b..d07b6c0 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -57,6 +57,8 @@
#include "android/globals.h"
#include "android/utils/bufprint.h"
#include "android/utils/debug.h"
+#include "android/utils/filelock.h"
+#include "android/utils/path.h"
#include "android/utils/stralloc.h"
#include "android/display-core.h"
#include "android/utils/timezone.h"
@@ -4835,6 +4837,22 @@ int main(int argc, char **argv, char **envp)
}
#endif // CONFIG_NAND_LIMITS
+ /* Init SD-Card stuff. For Android, it is always hda */
+ /* If the -hda option was used, ignore the Android-provided one */
+ if (hda_opts == NULL) {
+ const char* sdPath = android_hw->hw_sdCard_path;
+ if (sdPath && *sdPath) {
+ if (!path_exists(sdPath)) {
+ fprintf(stderr, "WARNING: SD Card image is missing: %s\n", sdPath);
+ } else if (filelock_create(sdPath) == NULL) {
+ fprintf(stderr, "WARNING: SD Card image already in use: %s\n", sdPath);
+ } else {
+ /* Successful locking */
+ hda_opts = drive_add(sdPath, HD_ALIAS, 0);
+ }
+ }
+ }
+
/* Set the VM's max heap size, passed as a boot property */
if (android_hw->vm_heapSize > 0) {
char tmp[64];