aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVladimir Chtchetkine <vchtchetkine@google.com>2010-06-15 16:46:32 -0700
committerVladimir Chtchetkine <vchtchetkine@google.com>2010-06-15 18:07:11 -0700
commitd81e6d1ce722d7e561d495bbd4b137e728e25b83 (patch)
tree4278fc975f104bd5af5673a5075e21aa2de60755
parente3c83b5e03f7c7af930b2e954a8a44a21f115fc9 (diff)
downloadexternal_qemu-d81e6d1ce722d7e561d495bbd4b137e728e25b83.zip
external_qemu-d81e6d1ce722d7e561d495bbd4b137e728e25b83.tar.gz
external_qemu-d81e6d1ce722d7e561d495bbd4b137e728e25b83.tar.bz2
Pass core-specific options to emulator core as cmd-line options.
Change-Id: I7ed897ca92c1344505f982897e2f59cc68c42d89
-rw-r--r--Makefile.android6
-rw-r--r--android/main.c20
-rw-r--r--android/qemu-setup.c33
-rw-r--r--qemu-options.hx16
-rw-r--r--vl-android.c34
5 files changed, 88 insertions, 21 deletions
diff --git a/Makefile.android b/Makefile.android
index 58fc4ff..7e3099f 100644
--- a/Makefile.android
+++ b/Makefile.android
@@ -508,6 +508,11 @@ TELEPHONY_SOURCES := android_modem.c modem_driver.c gsm.c sim_card.c sysdeps_qem
LOCAL_SRC_FILES += $(TELEPHONY_SOURCES:%=telephony/%)
EMULATOR_CORE_CFLAGS += -I$(LOCAL_PATH)/telephony
+# include android related stuff
+#
+ANDROID_SOURCES := qemu-setup.c
+LOCAL_SRC_FILES += $(ANDROID_SOURCES:%=android/%)
+
LOCAL_CFLAGS := $(MY_CFLAGS) $(LOCAL_CFLAGS) $(EMULATOR_CORE_CFLAGS)
include $(BUILD_HOST_STATIC_LIBRARY)
@@ -684,7 +689,6 @@ VL_SOURCES := vl-android.c osdep.c cutils.c \
android/hw-sensors.c \
android/keycode.c \
android/main.c \
- android/qemu-setup.c \
android/qemulator.c \
android/resource.c \
android/user-config.c \
diff --git a/android/main.c b/android/main.c
index 6fcc4eb..3da0602 100644
--- a/android/main.c
+++ b/android/main.c
@@ -2259,6 +2259,26 @@ int main(int argc, char **argv)
args[n++] = strdup(params);
}
+ if (opts->ports) {
+ args[n++] = "-android-ports";
+ args[n++] = opts->ports;
+ }
+
+ if (opts->port) {
+ args[n++] = "-android-port";
+ args[n++] = opts->port;
+ }
+
+ if (opts->report_console) {
+ args[n++] = "-android-report-console";
+ args[n++] = opts->report_console;
+ }
+
+ if (opts->http_proxy) {
+ args[n++] = "-http-proxy";
+ args[n++] = opts->http_proxy;
+ }
+
/* physical memory */
args[n++] = "-m";
args[n++] = opts->memory;
diff --git a/android/qemu-setup.c b/android/qemu-setup.c
index 1ab1737..4a57b42 100644
--- a/android/qemu-setup.c
+++ b/android/qemu-setup.c
@@ -16,7 +16,6 @@
#include "modem_driver.h"
#include "proxy_http.h"
-#include "android/qemulator.h"
#include "android/android.h"
#include "android/globals.h"
#include "android/hw-sensors.h"
@@ -35,6 +34,16 @@
extern int control_console_start( int port ); /* in control.c */
+/* Contains arguments for -android-ports option. */
+char* android_op_ports = NULL;
+/* Contains arguments for -android-port option. */
+char* android_op_port = NULL;
+/* Contains arguments for -android-report-console option. */
+char* android_op_report_console = NULL;
+/* Contains arguments for -http-proxy option. */
+char* op_http_proxy = NULL;
+
+
/*** APPLICATION DIRECTORY
*** Where are we ?
***/
@@ -228,8 +237,6 @@ void android_emulation_setup( void )
}
}
- AndroidOptions* opts = qemulator_get()->opts;
-
inet_strtoip("10.0.2.15", &guest_ip);
#if 0
@@ -239,15 +246,15 @@ void android_emulation_setup( void )
}
#endif
- if (opts->port && opts->ports) {
+ if (android_op_port && android_op_ports) {
fprintf( stderr, "options -port and -ports cannot be used together.\n");
exit(1);
}
- if (opts->ports) {
+ if (android_op_ports) {
char* comma_location;
char* end;
- int console_port = strtol( opts->ports, &comma_location, 0 );
+ int console_port = strtol( android_op_ports, &comma_location, 0 );
if ( comma_location == NULL || *comma_location != ',' ) {
derror( "option -ports must be followed by two comma separated positive integer numbers" );
@@ -275,9 +282,9 @@ void android_emulation_setup( void )
base_port = console_port;
} else {
- if (opts->port) {
+ if (android_op_port) {
char* end;
- int port = strtol( opts->port, &end, 0 );
+ int port = strtol( android_op_port, &end, 0 );
if ( end == NULL || *end ||
(unsigned)((port - base_port) >> 1) >= (unsigned)tries ) {
derror( "option -port must be followed by an even integer number between %d and %d\n",
@@ -316,8 +323,8 @@ void android_emulation_setup( void )
}
}
- if (opts->report_console) {
- report_console(opts->report_console, base_port);
+ if (android_op_report_console) {
+ report_console(android_op_report_console, base_port);
}
android_modem_init( base_port );
@@ -356,13 +363,13 @@ void android_emulation_setup( void )
if (VERBOSE_CHECK(proxy))
proxy_set_verbose(1);
- if (!opts->http_proxy) {
- opts->http_proxy = getenv("http_proxy");
+ if (!op_http_proxy) {
+ op_http_proxy = getenv("http_proxy");
}
do
{
- const char* env = opts->http_proxy;
+ const char* env = op_http_proxy;
int envlen;
ProxyOption option_tab[4];
ProxyOption* option = option_tab;
diff --git a/qemu-options.hx b/qemu-options.hx
index 0864e2d..e67033a 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1603,4 +1603,20 @@ DEF("nand", HAS_ARG, QEMU_OPTION_nand, \
DEF("mic", HAS_ARG, QEMU_OPTION_mic, \
"-mic <file> read audio input from wav file\n")
+DEF("android-ports", HAS_ARG, QEMU_OPTION_android_ports, \
+ "-android-ports <consoleport>,<adbport>"
+ " TCP ports used for the emulator instance and adb bridge\n")
+
+DEF("android-port", HAS_ARG, QEMU_OPTION_android_port, \
+ "-android-port <consoleport>"
+ " TCP port that will be used for the emulator instance\n")
+
+DEF("android-report-console", HAS_ARG, QEMU_OPTION_android_report_console, \
+ "-android-report-console <socket>"
+ " report console port to remote socket\n")
+
+DEF("http-proxy", HAS_ARG, QEMU_OPTION_http_proxy, \
+ "-http-proxy <proxy>"
+ " make TCP connections through a HTTP/HTTPS proxy\n")
+
#endif
diff --git a/vl-android.c b/vl-android.c
index e598f38..4e88d66 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -326,6 +326,11 @@ uint8_t qemu_uuid[16];
extern int qemu_cpu_delay;
extern char* audio_input_source;
+extern char* android_op_ports;
+extern char* android_op_port;
+extern char* android_op_report_console;
+extern char* op_http_proxy;
+
extern void dprint( const char* format, ... );
#define TFR(expr) do { if ((expr) != -1) break; } while (errno == EINTR)
@@ -433,7 +438,7 @@ void hw_error(const char *fmt, ...)
va_end(ap);
abort();
}
-
+
static void set_proc_name(const char *s)
{
#if defined(__linux__) && defined(PR_SET_NAME)
@@ -445,9 +450,9 @@ static void set_proc_name(const char *s)
/* Could rewrite argv[0] too, but that's a bit more complicated.
This simple way is enough for `top'. */
prctl(PR_SET_NAME, name);
-#endif
+#endif
}
-
+
/***************/
/* ballooning */
@@ -1513,7 +1518,7 @@ static int dynticks_start_timer(struct qemu_alarm_timer *t)
sigaction(SIGALRM, &act, NULL);
- /*
+ /*
* Initialize ev struct to 0 to avoid valgrind complaining
* about uninitialized data in timer_create call
*/
@@ -3294,7 +3299,7 @@ static int ram_load(QEMUFile *f, void *opaque, int version_id)
if (ram_load_dead(f, opaque) < 0)
return -EINVAL;
}
-
+
if (flags & RAM_SAVE_FLAG_COMPRESS) {
uint8_t ch = qemu_get_byte(f);
memset(qemu_get_ram_ptr(addr), ch, TARGET_PAGE_SIZE);
@@ -5205,7 +5210,7 @@ int main(int argc, char **argv, char **envp)
{
/* Could easily be extended to 64 devices if needed */
const char *p;
-
+
boot_devices_bitmap = 0;
for (p = boot_devices; *p != '\0'; p++) {
/* Allowed boot devices are:
@@ -5716,6 +5721,21 @@ int main(int argc, char **argv, char **envp)
nand_add_dev(optarg);
break;
#endif
+ case QEMU_OPTION_android_ports:
+ android_op_ports = (char*)optarg;
+ break;
+
+ case QEMU_OPTION_android_port:
+ android_op_port = (char*)optarg;
+ break;
+
+ case QEMU_OPTION_android_report_console:
+ android_op_report_console = (char*)optarg;
+ break;
+
+ case QEMU_OPTION_http_proxy:
+ op_http_proxy = (char*)optarg;
+ break;
}
}
}
@@ -6140,7 +6160,7 @@ int main(int argc, char **argv, char **envp)
show_vnc_port = 1;
#endif
}
-
+
switch (display_type) {
case DT_NOGRAPHIC: