From 8e090360d3c50dc4e588a7426a01cb1f8ee942b4 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Fri, 5 Feb 2010 13:36:50 -0800 Subject: Revert previous patch to fix SD Card emulation - DO NOT MERGE The previous patch modifies SD Card hardware emulation in a way that is not backwards compatible with previous SDK platform releases. This has the unfortunate effect of making SD Card emulation not work properly when running existing AVDs. Reverting the patch until we get a better one. This change is intended for the eclair branch only. --- CHANGES.TXT | 3 - Makefile.android | 4 - android-configure.sh | 11 -- android/avd/info.c | 62 ++++------ android/avd/info.h | 1 - android/build/common.sh | 6 - android/cmdline-options.h | 1 - android/config/freebsd-x86/config-host.h | 13 -- android/console.c | 135 --------------------- android/help.c | 22 +--- android/main.c | 36 +----- android/utils/timezone.c | 4 +- .../android/build/freebsd-x86/SDL_config.h | 126 ------------------- hw/android_arm.c | 21 +--- hw/goldfish_device.h | 7 +- hw/goldfish_mmc.c | 85 ++----------- sysemu.h | 3 - vl-android.c | 45 +------ 18 files changed, 47 insertions(+), 538 deletions(-) delete mode 100644 android/config/freebsd-x86/config-host.h delete mode 100644 distrib/sdl-1.2.12/android/build/freebsd-x86/SDL_config.h diff --git a/CHANGES.TXT b/CHANGES.TXT index 08099f0..35a519b 100644 --- a/CHANGES.TXT +++ b/CHANGES.TXT @@ -31,9 +31,6 @@ IMPORTANT CHANGES: The minor number will now be stuck to 0 since each official emulator release is supposed to match a corresponding SDK Tools release. -- Added a new option -sdcard2 to be able to use two SD Card images - at once. Note that this requires an updated emulator-specific kernel - and system image. It will thus be ignored by older emulated platforms. OTHER: diff --git a/Makefile.android b/Makefile.android index a9939c1..da06cc6 100644 --- a/Makefile.android +++ b/Makefile.android @@ -567,10 +567,6 @@ ifeq ($(HOST_OS),windows) LOCAL_LDLIBS += -mno-cygwin -mwindows -mconsole endif -ifeq ($(HOST_OS),freebsd) - LOCAL_LDLIBS += -L/usr/local/lib -lpthread -lX11 -lutil -endif - LOCAL_SRC_FILES += $(VL_SOURCES) ifeq ($(HOST_OS),linux) diff --git a/android-configure.sh b/android-configure.sh index 742fe21..26ea251 100755 --- a/android-configure.sh +++ b/android-configure.sh @@ -212,12 +212,6 @@ log "SDL-probe : SDL_LIBS = $SDL_LIBS" EXTRA_CFLAGS="$SDL_CFLAGS" EXTRA_LDFLAGS="$SDL_LIBS" -case "$OS" in - freebsd-*) - EXTRA_LDFLAGS="$EXTRA_LDFLAGS -lm -lpthread" - ;; -esac - cat > $TMPC << EOF #include #undef main @@ -284,8 +278,6 @@ case "$OS" in ;; linux-*) PROBE_ALSA=yes; PROBE_OSS=yes; PROBE_ESD=yes; ;; - freebsd-*) PROBE_OSS=yes; - ;; windows) PROBE_WINAUDIO=yes ;; esac @@ -435,9 +427,6 @@ case "$OS" in darwin-*) CONFIG_OS=DARWIN BSD=1 ;; - freebsd-*) CONFIG_OS=FREEBSD - BSD=1 - ;; windows*) CONFIG_OS=WIN32 ;; *) CONFIG_OS=$OS diff --git a/android/avd/info.c b/android/avd/info.c index 6766c96..e738065 100644 --- a/android/avd/info.c +++ b/android/avd/info.c @@ -92,12 +92,6 @@ AvdInfo* android_avdInfo; */ #define SDCARD_PATH "sdcard.path" -/* the config.ini key that is used to indicate the absolute path - * to the second SD Card image file, if you don't want to place it in - * the content directory. - */ -#define SDCARD2_PATH "sdcard2.path" - /* certain disk image files are mounted read/write by the emulator * to ensure that several emulators referencing the same files * do not corrupt these files, we need to lock them and respond @@ -681,26 +675,7 @@ EXIT: return l->pPath[0]; } -static void _sdcardLoadImages(ImageLoader* l, AvdInfo* i, AvdInfoParams* params, AvdImageType sdcardImage) -{ - imageLoader_set(l, sdcardImage); - imageLoader_load(l, IMAGE_OPTIONAL | - IMAGE_IGNORE_IF_LOCKED); - /* if the file was not found, ignore it */ - if (l->pPath[0] && !path_exists(l->pPath[0])) - { - D("ignoring non-existing %s at %s: %s", - l->imageText, l->pPath[0], strerror(errno)); - - /* if the user provided the SD Card path by hand, - * warn him. */ - if (params->forcePaths[sdcardImage] != NULL) - dwarning("ignoring non-existing SD Card image"); - - imageLoader_setPath(l, NULL); - } -} /* find the correct path of all image files we're going to need * and lock the files that need it. @@ -797,8 +772,23 @@ _getImagePaths(AvdInfo* i, AvdInfoParams* params ) * already used, we must ignore it. */ if (!noSdCard) { - _sdcardLoadImages(l, i, params, AVD_IMAGE_SDCARD); - _sdcardLoadImages(l, i, params, AVD_IMAGE_SDCARD2); + imageLoader_set (l, AVD_IMAGE_SDCARD); + imageLoader_load(l, IMAGE_OPTIONAL | + IMAGE_IGNORE_IF_LOCKED); + + /* if the file was not found, ignore it */ + if (l->pPath[0] && !path_exists(l->pPath[0])) + { + D("ignoring non-existing %s at %s: %s", + l->imageText, l->pPath[0], strerror(errno)); + + /* if the user provided the SD Card path by hand, + * warn him. */ + if (params->forcePaths[AVD_IMAGE_SDCARD] != NULL) + dwarning("ignoring non-existing SD Card image"); + + imageLoader_setPath(l, NULL); + } } return 0; @@ -1053,24 +1043,22 @@ _getSkin( AvdInfo* i, AvdInfoParams* params ) } /* If the user didn't explicitely provide an SD Card path, - * check the specfied key in config.ini and use that if + * check the SDCARD_PATH key in config.ini and use that if * available. */ static void -_getSDCardPath(AvdInfo* i, AvdInfoParams* params, AvdImageType sdcardImage, - const char* iniKey ) +_getSDCardPath( AvdInfo* i, AvdInfoParams* params ) { const char* path; - if (params->forcePaths[sdcardImage] != NULL) { + if (params->forcePaths[AVD_IMAGE_SDCARD] != NULL) return; - } - path = iniFile_getString(i->configIni, iniKey); + path = iniFile_getString(i->configIni, SDCARD_PATH); if (path == NULL) return; - params->forcePaths[sdcardImage] = path; + params->forcePaths[AVD_IMAGE_SDCARD] = path; } AvdInfo* @@ -1099,8 +1087,7 @@ avdInfo_new( const char* name, AvdInfoParams* params ) * obsolete SDKs. */ _getSearchPaths(i); - _getSDCardPath(i, params, AVD_IMAGE_SDCARD, SDCARD_PATH); - _getSDCardPath(i, params, AVD_IMAGE_SDCARD2, SDCARD2_PATH); + _getSDCardPath(i, params); /* don't need this anymore */ iniFile_free(i->rootIni); @@ -1268,9 +1255,6 @@ _getBuildImagePaths( AvdInfo* i, AvdInfoParams* params ) if (!noSdCard) { imageLoader_set (l, AVD_IMAGE_SDCARD); imageLoader_load(l, IMAGE_OPTIONAL | IMAGE_IGNORE_IF_LOCKED); - - imageLoader_set (l, AVD_IMAGE_SDCARD2); - imageLoader_load(l, IMAGE_OPTIONAL | IMAGE_IGNORE_IF_LOCKED); } return 0; diff --git a/android/avd/info.h b/android/avd/info.h index 75dab89..19df807 100644 --- a/android/avd/info.h +++ b/android/avd/info.h @@ -58,7 +58,6 @@ _AVD_IMG(USERDATA,"userdata-qemu.img", "user data") \ _AVD_IMG(CACHE,"cache.img","cache") \ _AVD_IMG(SDCARD,"sdcard.img","SD Card") \ - _AVD_IMG(SDCARD2,"sdcard2.img","SD Card 2") \ /* define the enumared values corresponding to each AVD image type * examples are: AVD_IMAGE_KERNEL, AVD_IMAGE_SYSTEM, etc.. diff --git a/android/build/common.sh b/android/build/common.sh index 93ffba7..3f2c642 100644 --- a/android/build/common.sh +++ b/android/build/common.sh @@ -88,9 +88,6 @@ case "$OS" in Linux) # note that building 32-bit binaries on x86_64 is handled later OS=linux-$CPU - ;; - FreeBSD) - OS=freebsd-$CPU ;; CYGWIN*|*_NT-*) OS=windows @@ -126,8 +123,6 @@ case $OS in ;; darwin-*) HOST_OS=darwin ;; - freebsd-*) HOST_OS=freebsd - ;; *) HOST_OS=$OS esac @@ -166,7 +161,6 @@ force_32bit_binaries () case $OS in linux-x86_64) OS=linux-x86 ;; darwin-x86_64) OS=darwin-x86 ;; - freebsd-x86_64) OS=freebsd-x86 ;; esac HOST_ARCH=x86 CPU=x86 diff --git a/android/cmdline-options.h b/android/cmdline-options.h index fabac5c..6a4e7ff 100644 --- a/android/cmdline-options.h +++ b/android/cmdline-options.h @@ -76,7 +76,6 @@ CFG_PARAM( cache, "", "cache partition image (default is temporary file CFG_FLAG ( no_cache, "disable the cache partition" ) CFG_FLAG ( nocache, "same as -no-cache" ) OPT_PARAM( sdcard, "", "SD card image (default /sdcard.img") -OPT_PARAM( sdcard2, "", "SD card 2 image (default /sdcard2.img") OPT_FLAG ( wipe_data, "reset the use data image (copy it from initdata)" ) CFG_PARAM( avd, "", "use a specific android virtual device" ) CFG_PARAM( skindir, "", "search skins in (default /skins)" ) diff --git a/android/config/freebsd-x86/config-host.h b/android/config/freebsd-x86/config-host.h deleted file mode 100644 index 8a08339..0000000 --- a/android/config/freebsd-x86/config-host.h +++ /dev/null @@ -1,13 +0,0 @@ -/* Automatically generated by configure - do not modify */ -#define CONFIG_QEMU_SHAREDIR "/usr/local/share/qemu" -#define HOST_I386 1 -#define HOST_LONG_BITS 32 -#define CONFIG_GDBSTUB 1 -#define CONFIG_SLIRP 1 -#define CONFIG_OSS 1 -#define QEMU_VERSION "0.8.2" -#define O_LARGEFILE 0 -#define MAP_ANONYMOUS MAP_ANON -#define _BSD 1 -#define CONFIG_UNAME_RELEASE "" -#define CONFIG_SKINS 1 diff --git a/android/console.c b/android/console.c index 45da8aa..ab32213 100644 --- a/android/console.c +++ b/android/console.c @@ -31,8 +31,6 @@ #include "hw/power_supply.h" #include "shaper.h" #include "modem_driver.h" -#include "block.h" -#include "block_int.h" #include "android/gps.h" #include "android/globals.h" #include "android/utils/bufprint.h" @@ -2068,135 +2066,6 @@ static const CommandDefRec geo_commands[] = /********************************************************************************************/ /********************************************************************************************/ /***** ******/ -/***** S D C A R D C O M M A N D S ******/ -/***** ******/ -/********************************************************************************************/ -/********************************************************************************************/ - -static int -do_sdcard_insert( ControlClient client, char* args ) -{ - char img[255]; - char *p; - int n; - int drv_idx; - - if (!args) { - control_write( client, "K0: argument missing, try 'sdcard insert [imagefile]'\r\n" ); - return -1; - } - - memset(img, 0, sizeof(img)); - - n = strtoul(args, &p, 0); - if (n > 2) { - control_write( client, "K0: argument out of range\r\n" ); - return -1; - } - - if (p) { - p++; - strncpy(img, p, sizeof(img) -1); - } - - if (goldfish_mmc_is_media_inserted(n)) { - control_write( client, "K0: Slot %d already has media inserted\r\n", n ); - return -1; - } - - drv_idx = drive_get_index( IF_IDE, 0, n); - if (drv_idx >= 0) { - if (img[0] != '\0' && strcmp(img, drives_table[drv_idx].bdrv->filename)) { - if (drive_swap(drives_table[drv_idx].bdrv, img)) { - control_write (client, "K0: Drive swap failed\r\n"); - return -1; - } - } - } else { - drv_idx = drive_hotadd(img, "index=%d,media=disk", n); - if (drv_idx < 0) { - control_write (client, "K0: Drive hot-add failed\r\n"); - return -1; - } - } - - goldfish_mmc_insert(n, drives_table[drv_idx].bdrv); - - return 0; -} - -static int -do_sdcard_remove( ControlClient client, char* args ) -{ - int n; - int ins; - - if (!args) { - control_write( client, "K0: argument missing, try 'sdcard remove '\r\n" ); - return -1; - } - - n = atoi(args); - - if ((ins = goldfish_mmc_is_media_inserted(n)) < 0) { - control_write( client, "K0: Slot %d is invalid\r\n", n ); - } else if (!ins) { - control_write( client, "K0: Slot %d has no media\r\n", n ); - return -1; - } - - goldfish_mmc_remove(n); - return 0; -} - -static int -do_sdcard_status( ControlClient client, char* args ) -{ - int i; - control_write( client, "Current SD card status:\r\n" ); - - for (i = 0; i < 2; i++) { - int drv_idx = drive_get_index( IF_IDE, 0, i); - - control_write( client, - " Slot %d, image %s, inserted %d\r\n", i, - (drv_idx >=0 ? drives_table[drv_idx].bdrv->filename : "none"), - goldfish_mmc_is_media_inserted(i)); - } - return 0; -} - -static int -do_sdcard_fail( ControlClient client, char* args ) -{ - return -ENOSYS; -} - -static const CommandDefRec sdcard_commands[] = -{ - { "insert", "hot-insert a virtual sdcard", - "'sdcard insert [imagefile]'\r\n", - NULL, do_sdcard_insert, NULL }, - - { "remove", "hot-remove a virtual sdcard", - "'sdcard remove '\r\n", - NULL, do_sdcard_remove, NULL }, - - { "status", "query virtual device status", - "'sdcard status'\r\n", - NULL, do_sdcard_status, NULL }, - - { "fail", "simulate an sdcard failure", - "'sdcard fail '\r\n", - NULL, do_sdcard_fail, NULL }, - - { NULL, NULL, NULL, NULL, NULL, NULL } -}; - - -/********************************************************************************************/ -/********************************************************************************************/ -/***** ******/ /***** M A I N C O M M A N D S ******/ /***** ******/ /********************************************************************************************/ @@ -2307,10 +2176,6 @@ static const CommandDefRec main_commands[] = "allows you to modify the emulator window\r\n", NULL, NULL, window_commands }, - { "sdcard", "manage emulator sdcards", - "allows you to modify the emulator sdcard configuration\r\n", NULL, - NULL, sdcard_commands }, - { NULL, NULL, NULL, NULL, NULL, NULL } }; diff --git a/android/help.c b/android/help.c index cbca332..a142f9d 100644 --- a/android/help.c +++ b/android/help.c @@ -120,8 +120,8 @@ help_build_images( stralloc_t* out ) " You can use the -sysdir, -system, -kernel, -ramdisk, -datadir, -data options\n" " to specify different search directories or specific image files. You can\n" - " also use the -cache, -sdcard, and -sdcard2 options to indicate specific \n" - " cache partition and SD Card image files.\n\n" + " also use the -cache and -sdcard options to indicate specific cache partition\n" + " and SD Card image files.\n\n" " For more details, see the corresponding -help-