aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.android12
-rw-r--r--Makefile.common9
-rw-r--r--Makefile.target4
-rw-r--r--android/avd/hardware-properties.ini11
-rw-r--r--android/cmdline-options.h2
-rw-r--r--android/help.c9
-rw-r--r--android/main-emulator.c37
-rwxr-xr-xandroid/tools/gen-hw-config.py70
-rw-r--r--vl-android.c4
9 files changed, 69 insertions, 89 deletions
diff --git a/Makefile.android b/Makefile.android
index c526172..6fccf71 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -98,13 +98,13 @@ ifneq ($(BUILD_STANDALONE_EMULATOR),true)
# which contains the relevant headers and 32-bit libraries for audio (The host 64-bit
# Lucid doesn't provide these anymore, only their 64-bit versions).
ifeq ($(HOST_OS),linux)
- HOST_SDK_TOOLCHAIN_PREFIX := prebuilt/linux-x86/toolchain/i686-linux-glibc2.7-4.4.3/bin/i686-linux
+ HOST_SDK_TOOLCHAIN_PREFIX := prebuilts/tools/gcc-sdk
# Don't do anything if the toolchain is not there
- ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc)))
- MY_CC := $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc
- MY_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)-g++
- MY_AR := $(HOST_SDK_TOOLCHAIN_PREFIX)-ar
- endif # $(HOST_SDK_TOOLCHAIN_PREFIX)-gcc exists
+ ifneq (,$(strip $(wildcard $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc)))
+ MY_CC := $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc
+ MY_CXX := $(HOST_SDK_TOOLCHAIN_PREFIX)/g++
+ MY_AR := $(HOST_SDK_TOOLCHAIN_PREFIX)/ar
+ endif # $(HOST_SDK_TOOLCHAIN_PREFIX)/gcc exists
endif # HOST_OS == linux
ifneq ($(USE_CCACHE),)
diff --git a/Makefile.common b/Makefile.common
index cecbf28..a72d719 100644
--- a/Makefile.common
+++ b/Makefile.common
@@ -139,12 +139,11 @@ $(call gen-hw-config-defs)
$(call end-emulator-library)
## another for 64-bit
-##### NOTE: disable 64-bit for now until new 64-bit prebuilts/gcc toolchain exist in AOSP
# NOTE: only linux in non-standalone mode is supported, because
# 1) For Windows: amd64-mingw32msvc-gcc doesn't work, see http://b/issue?id=5949152.
# 2) For MacOSX: 64-bit libSDL*.a 1.2.x depends on NSQuickDrawView doesn't exist
# 3) Standalone has --try-64
-ifeq ($(HOST_OS),)
+ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-common)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
@@ -295,7 +294,7 @@ $(call end-emulator-library)
## another for 64-bit, see note in emulator64-common
-ifeq ($(HOST_OS),)
+ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-libui)
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
@@ -617,7 +616,7 @@ $(call end-emulator-library)
## another for 64-bit, see note in emulator64-common
-ifeq ($(HOST_OS),)
+ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-libqemu)
# gdbstub-xml.c contains C-compilable arrays corresponding to the content
@@ -711,7 +710,7 @@ $(call end-emulator-library)
## another for 64-bit, see note in emulator64-common
-ifeq ($(HOST_OS),)
+ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-libelff)
LOCAL_CPP_EXTENSION := .cc
diff --git a/Makefile.target b/Makefile.target
index 92ac855..1961acf 100644
--- a/Makefile.target
+++ b/Makefile.target
@@ -246,7 +246,7 @@ $(call gen-hx-header,qemu-options.hx,qemu-options.def,os-posix.c os-win32.c)
$(call end-emulator-library)
## another for 64-bit, see note in file Makefile.common emulator64-common
-ifeq ($(HOST_OS),)
+ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-library, emulator64-target-$(EMULATOR_TARGET_CPU))
LOCAL_CFLAGS += $(common_LOCAL_CFLAGS) -m64
@@ -433,7 +433,7 @@ $(call end-emulator-program)
## another for 64-bit, see note in file Makefile.common emulator64-common
-ifeq ($(HOST_OS),)
+ifeq ($(HOST_OS),linux)
ifneq ($(BUILD_STANDALONE_EMULATOR),true)
$(call start-emulator-program, emulator64-$(EMULATOR_TARGET_ARCH))
LOCAL_STATIC_LIBRARIES += \
diff --git a/android/avd/hardware-properties.ini b/android/avd/hardware-properties.ini
index 4ea63ca..582083c 100644
--- a/android/avd/hardware-properties.ini
+++ b/android/avd/hardware-properties.ini
@@ -49,9 +49,10 @@ description = The amount of physical RAM on the device, in megabytes.
# Touch screen type
name = hw.screen
type = string
+enum = touch, multi-touch, no-touch
default = touch
abstract = Touch screen type
-description = Defines type of the screen. Can be 'touch', 'multi-touch', or 'no-touch'.
+description = Defines type of the screen.
# Hardware main keys (back/home)
name = hw.mainKeys
@@ -192,16 +193,18 @@ abstract = LCD pixel height
name = hw.lcd.depth
type = integer
+enum = 16, 32
default = 16
abstract = LCD color depth
-description = Must be 16 or 32. Color bit depth of emulated framebuffer.
+description = Color bit depth of emulated framebuffer.
# LCD density
name = hw.lcd.density
type = integer
+enum = 120, 160, 240, 213, 320
default = 160
abstract = Abstracted LCD density
-description = Must be one of 120 / 160 / 240 / 213/ 320. A value used to roughly describe the density of the LCD screen for automatic resource/asset selection.
+description = A value used to roughly describe the density of the LCD screen for automatic resource/asset selection.
# LCD backlight - Enable/Disable LCD backlight simulation
# default = no : Disabled
@@ -224,6 +227,7 @@ description = Enable/Disable emulated OpenGLES GPU
#
name = hw.camera.back
type = string
+enum = emulated, none, webcam0, ...
default = emulated
abstract = Configures camera facing back
description = Must be 'emulated' for a fake camera, 'webcam<N>' for a web camera, or 'none' if back camera is disabled.
@@ -232,6 +236,7 @@ description = Must be 'emulated' for a fake camera, 'webcam<N>' for a web camera
#
name = hw.camera.front
type = string
+enum = emulated, none, webcam0, ...
default = none
abstract = Configures camera facing front
description = Must be 'emulated' for a fake camera, 'webcam<N>' for a web camera, or 'none' if front camera is disabled.
diff --git a/android/cmdline-options.h b/android/cmdline-options.h
index aa85c0e..eb8ede0 100644
--- a/android/cmdline-options.h
+++ b/android/cmdline-options.h
@@ -162,6 +162,8 @@ OPT_FLAG( webcam_list, "lists web cameras available for emulation" )
OPT_PARAM( screen, "<mode>", "set emulated screen mode" )
+OPT_FLAG( force_32bit, "always use 32-bit emulator" )
+
#undef CFG_FLAG
#undef CFG_PARAM
#undef OPT_FLAG
diff --git a/android/help.c b/android/help.c
index 54d2f10..20758c0 100644
--- a/android/help.c
+++ b/android/help.c
@@ -1505,6 +1505,15 @@ help_screen(stralloc_t* out)
);
}
+static void
+help_force_32bit(stralloc_t* out)
+{
+ PRINTF(
+ " Use -force-32bit to use 32-bit emulator on 64-bit platforms\n\n"
+
+ );
+}
+
#define help_no_skin NULL
#define help_netspeed help_shaper
#define help_netdelay help_shaper
diff --git a/android/main-emulator.c b/android/main-emulator.c
index f2e30e2..0981a71 100644
--- a/android/main-emulator.c
+++ b/android/main-emulator.c
@@ -63,7 +63,7 @@ int android_verbose;
/* Forward declarations */
-static char* getTargetEmulatorPath(const char* progName, const char* avdArch);
+static char* getTargetEmulatorPath(const char* progName, const char* avdArch, const int force_32bit);
static char* getSharedLibraryPath(const char* progName, const char* libName);
static void prependSharedLibraryPath(const char* prefix);
@@ -90,6 +90,7 @@ int main(int argc, char** argv)
const char* avdName = NULL;
char* avdArch = NULL;
char* emulatorPath;
+ int force_32bit = 0;
/* Define ANDROID_EMULATOR_DEBUG to 1 in your environment if you want to
* see the debug messages from this launcher program.
@@ -99,8 +100,9 @@ int main(int argc, char** argv)
if (debug != NULL && *debug && *debug != '0')
android_verbose = 1;
- /* Parse command-line and look for an avd name
- * Either in the form or '-avd <name>' or '@<name>'
+ /* Parse command-line and look for
+ * 1) an avd name either in the form or '-avd <name>' or '@<name>'
+ * 2) '-force-32bit' which always use 32-bit emulator on 64-bit platforms
*/
int nn;
for (nn = 1; nn < argc; nn++) {
@@ -109,13 +111,18 @@ int main(int argc, char** argv)
if (!strcmp(opt,"-qemu"))
break;
- if (!strcmp(opt,"-avd") && nn+1 < argc) {
- avdName = argv[nn+1];
- break;
+ if (!strcmp(opt,"-force-32bit")) {
+ force_32bit = 1;
+ continue;
}
- else if (opt[0] == '@' && opt[1] != '\0') {
- avdName = opt+1;
- break;
+
+ if (!avdName) {
+ if (!strcmp(opt,"-avd") && nn+1 < argc) {
+ avdName = argv[nn+1];
+ }
+ else if (opt[0] == '@' && opt[1] != '\0') {
+ avdName = opt+1;
+ }
}
}
@@ -143,7 +150,7 @@ int main(int argc, char** argv)
}
/* Find the architecture-specific program in the same directory */
- emulatorPath = getTargetEmulatorPath(argv[0], avdArch);
+ emulatorPath = getTargetEmulatorPath(argv[0], avdArch, force_32bit);
D("Found target-specific emulator binary: %s\n", emulatorPath);
/* Replace it in our command-line */
@@ -212,7 +219,7 @@ getHostOSBitness()
* the directory of the current program.
*/
static char*
-getTargetEmulatorPath(const char* progName, const char* avdArch)
+getTargetEmulatorPath(const char* progName, const char* avdArch, const int force_32bit)
{
char* progDir;
char path[PATH_MAX], *pathEnd=path+sizeof(path), *p;
@@ -222,16 +229,16 @@ getTargetEmulatorPath(const char* progName, const char* avdArch)
const char* exeExt = ".exe";
/* ToDo: currently amd64-mingw32msvc-gcc doesn't work (http://b/issue?id=5949152)
which prevents us from generating 64-bit emulator for Windows */
- int host_runs_64bit_OS = 0;
+ int search_for_64bit_emulator = 0;
#else
const char* exeExt = "";
- int host_runs_64bit_OS = getHostOSBitness() == 64;
+ int search_for_64bit_emulator = !force_32bit && getHostOSBitness() == 64;
#endif
/* Get program's directory name in progDir */
path_split(progName, &progDir, NULL);
- if (host_runs_64bit_OS) {
+ if (search_for_64bit_emulator) {
/* Find 64-bit emulator first */
p = bufprint(path, pathEnd, "%s/%s%s%s", progDir, emulator64Prefix, avdArch, exeExt);
if (p >= pathEnd) {
@@ -262,7 +269,7 @@ getTargetEmulatorPath(const char* progName, const char* avdArch)
#else
if (strchr(progName, '/') == NULL) {
#endif
- if (host_runs_64bit_OS) {
+ if (search_for_64bit_emulator) {
p = bufprint(path, pathEnd, "%s%s%s", emulator64Prefix, avdArch, exeExt);
if (p < pathEnd) {
char* resolved = path_search_exec(path);
diff --git a/android/tools/gen-hw-config.py b/android/tools/gen-hw-config.py
index a55d7a3..201ef04 100755
--- a/android/tools/gen-hw-config.py
+++ b/android/tools/gen-hw-config.py
@@ -71,65 +71,23 @@ class Item:
self.description = ""
self.enum_values = []
- # gets base type for an enum value.
- # This is a very basic implementation of enum parser that assumes that enum
- # is formatted as such:
- #
- # enum(type: val1[, val2[, ..., valN] [, ...])
- #
- # where:
- # - 'type' defines type of enumerated values, and must be one of the types
- # listed in typesToMacros
- # - 'val1'... 'valN' lists enumerated values, separated with a comma.
- # - '...' is a special value indicating that AVD editor may set property
- # value that doesn't match values enumerated in the .ini file. However,
- # default value set for the property must match one of the enumerated
- # values.
- # This method provides some basic checking for the format, but it could, or
- # should be improved.
- #
- def trueenumtype(self,type):
- # Make sure enum ends with a ')'
- if not type.endswith(")"):
- print"Bad enum fomat in '" + type + "'"
- sys.exit(1)
- # Cut substring between 'enum(', and terminating ')'
- enum_data = type[5:len(type)-1]
- # Locate enum's value type
- type_index = enum_data.find(':')
- if type_index == -1:
- print "Property '" + self.name + "': Value type is missing in enum."
- sys.exit(1)
- value_type = enum_data[:type_index].strip()
- # Make sure value type is known
- if not value_type in typesToMacros:
- print "Property '" + self.name + "': Unknown value type '" + value_type + "' in enum."
- sys.exit(1)
- # Save list of enumerated values, stripped of spaces.
- for value in enum_data[type_index+1:].split(','):
- self.enum_values.append(value.strip())
- return value_type
-
- # gets true basic type for a type obtained from the .ini file
- # Here we simply check if type is an enum, and if so, we extract basic
- # type for enumerated values.
- def truetype(self,type):
- if type.startswith("enum("):
- return self.trueenumtype(type.strip())
- return type
-
def add(self,key,val):
if key == 'type':
- self.type = self.truetype(val)
+ self.type = val
+ elif key == 'enum':
+ # Build list of enumerated values
+ self.enum_values = [ s.strip() for s in val.split(',') ]
+ # If default value has been already set, make sure it's in the list
+ if self.default and not self.default in self.enum_values:
+ print "Property '" + self.name + "': Default value '" + self.default + "' is missing in enum: ",
+ print self.enum_values,
+ sys.exit(1)
elif key == 'default':
- if len(val) > 0 and len(self.enum_values) > 0:
- # Make sure that default value (if set) is present in enum.
- if self.enum_values.count(val) == 0:
- print "Property '" + self.name + "': Default value '" + val + "' is missing in enum: ",
- print self.enum_values,
- sys.exit(1)
- else:
- self.default = val
+ # If this is an enum, make sure that default value is in the list.
+ if val and self.enum_values and not val in self.enum_values:
+ print "Property '" + self.name + "': Default value '" + val + "' is missing in enum: ",
+ print self.enum_values,
+ sys.exit(1)
else:
self.default = val
elif key == 'abstract':
diff --git a/vl-android.c b/vl-android.c
index 1ec910b..4c742e7 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -2381,7 +2381,7 @@ net_slirp_forward(const char *optarg)
char *dst_net, *dst_mask, *dst_port;
char *redirect_ip, *redirect_port;
uint32_t dnet, dmask, rip;
- unsigned short dlport, dhport, rport;
+ unsigned short dlport = 0, dhport = 0, rport;
dst_net = strtok(p, ":");
@@ -2447,7 +2447,7 @@ slirp_allow(const char *optarg, u_int8_t proto)
char *argument = strdup(optarg), *p = argument;
char *dst_ip_str, *dst_port_str;
uint32_t dst_ip;
- unsigned short dst_lport, dst_hport;
+ unsigned short dst_lport = 0, dst_hport = 0;
dst_ip_str = strtok(p, ":");
dst_port_str = strtok(NULL, ":");