aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--android/main.c54
-rw-r--r--android/ui-core-protocol.c1
-rw-r--r--qemu-options.hx6
-rw-r--r--vl-android.c34
4 files changed, 67 insertions, 28 deletions
diff --git a/android/main.c b/android/main.c
index 5b9475c..c5dc899 100644
--- a/android/main.c
+++ b/android/main.c
@@ -44,8 +44,6 @@
#include "android/skin/window.h"
#include "android/skin/keyset.h"
-#include "android/hw-lcd.h"
-#include "android/boot-properties.h"
#include "android/user-config.h"
#include "android/utils/bufprint.h"
#include "android/utils/dirscanner.h"
@@ -734,7 +732,6 @@ _adjustPartitionSize( const char* description,
return convertMBToBytes(imageMB);
}
-
int main(int argc, char **argv)
{
char tmp[MAX_PATH];
@@ -761,6 +758,11 @@ int main(int argc, char **argv)
char* android_build_out = NULL;
AndroidOptions opts[1];
+ /* LCD density value to pass to the core. */
+ char lcd_density[16];
+ /* net.shared_net_ip boot property value. */
+ char boot_prop_ip[64];
+ boot_prop_ip[0] = '\0';
args[0] = argv[0];
@@ -1112,9 +1114,8 @@ int main(int argc, char **argv)
fprintf(stderr, "option -shared-net-id must be an integer between 1 and 255\n");
exit(1);
}
- char ip[11];
- snprintf(ip, 11, "10.1.2.%ld", shared_net_id);
- boot_property_add("net.shared_net_ip",ip);
+ snprintf(boot_prop_ip, sizeof(boot_prop_ip),
+ "net.shared_net_ip=10.1.2.%ld", shared_net_id);
}
@@ -1179,6 +1180,11 @@ int main(int argc, char **argv)
}
}
+ if (boot_prop_ip[0]) {
+ args[n++] = "-boot-property";
+ args[n++] = boot_prop_ip;
+ }
+
if (opts->tcpdump) {
args[n++] = "-tcpdump";
args[n++] = opts->tcpdump;
@@ -1470,6 +1476,20 @@ int main(int argc, char **argv)
args[n++] = "off";
}
+ /* Pass LCD density value to the core. */
+ snprintf(lcd_density, sizeof(lcd_density), "%d", get_device_dpi(opts));
+ args[n++] = "-lcd-density";
+ args[n++] = lcd_density;
+
+ /* Pass boot properties to the core. */
+ if (opts->prop != NULL) {
+ ParamList* pl = opts->prop;
+ for ( ; pl != NULL; pl = pl->next ) {
+ args[n++] = "-boot-property";
+ args[n++] = pl->param;
+ }
+ }
+
args[n++] = "-append";
if (opts->bootchart) {
@@ -1484,28 +1504,6 @@ int main(int argc, char **argv)
}
}
- /* start the 'boot-properties service, and parse the -prop
- * options, if any.
- */
- boot_property_init_service();
-
- hwLcd_setBootProperty(get_device_dpi(opts));
-
- /* Set the VM's max heap size, passed as a boot property */
- if (hw->vm_heapSize > 0) {
- char tmp[32], *p=tmp, *end=p + sizeof(tmp);
- p = bufprint(p, end, "%dm", hw->vm_heapSize);
-
- boot_property_add("dalvik.vm.heapsize",tmp);
- }
-
- if (opts->prop != NULL) {
- ParamList* pl = opts->prop;
- for ( ; pl != NULL; pl = pl->next ) {
- boot_property_parse_option(pl->param);
- }
- }
-
/* Setup the kernel init options
*/
{
diff --git a/android/ui-core-protocol.c b/android/ui-core-protocol.c
index 6782cf6..fa1a31a 100644
--- a/android/ui-core-protocol.c
+++ b/android/ui-core-protocol.c
@@ -27,6 +27,7 @@
#include "telephony/modem_driver.h"
#include "trace.h"
#include "audio/audio.h"
+/* Implemented in vl-android.c */
extern void qemu_system_shutdown_request(void);
extern char* qemu_find_file(int type, const char* filename);
#endif // CONFIG_STANDALONE_UI
diff --git a/qemu-options.hx b/qemu-options.hx
index 4f6f122..1203680 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -1674,4 +1674,10 @@ DEF("netfast", 0, QEMU_OPTION_netfast, \
DEF("tcpdump", HAS_ARG, QEMU_OPTION_tcpdump, \
"-tcpdump <file> capture network packets to file\n")
+DEF("boot-property", HAS_ARG, QEMU_OPTION_boot_property, \
+ "-boot-property <name>=<value> set system property on boot\n")
+
+DEF("lcd-density", HAS_ARG, QEMU_OPTION_lcd_density, \
+ "-lcd-density <density> sets LCD density system property on boot\n")
+
#endif
diff --git a/vl-android.c b/vl-android.c
index 0cd6b52..a3cf02b 100644
--- a/vl-android.c
+++ b/vl-android.c
@@ -187,6 +187,8 @@
#include "migration.h"
#include "kvm.h"
#include "balloon.h"
+#include "android/hw-lcd.h"
+#include "android/boot-properties.h"
#ifdef CONFIG_STANDALONE_CORE
/* Verbose value used by the standalone emulator core (without UI) */
@@ -391,6 +393,9 @@ int android_op_netfast = 0;
/* -tcpdump option value. */
char* android_op_tcpdump = NULL;
+/* -lcd-density option value. */
+char* android_op_lcd_density = NULL;
+
extern int android_display_width;
extern int android_display_height;
extern int android_display_bpp;
@@ -5198,6 +5203,9 @@ int main(int argc, char **argv, char **envp)
register_watchdogs();
+ /* Initialize boot properties. */
+ boot_property_init_service();
+
optind = 1;
for(;;) {
if (optind >= argc)
@@ -5966,6 +5974,14 @@ int main(int argc, char **argv, char **envp)
android_op_tcpdump = (char*)optarg;
break;
+ case QEMU_OPTION_boot_property:
+ boot_property_parse_option((char*)optarg);
+ break;
+
+ case QEMU_OPTION_lcd_density:
+ android_op_lcd_density = (char*)optarg;
+ break;
+
#ifdef CONFIG_MEMCHECK
case QEMU_OPTION_android_memcheck:
android_op_memcheck = (char*)optarg;
@@ -6027,6 +6043,13 @@ int main(int argc, char **argv, char **envp)
}
#endif // CONFIG_NAND_LIMITS
+ /* Set the VM's max heap size, passed as a boot property */
+ if (android_hw->vm_heapSize > 0) {
+ char tmp[64];
+ snprintf(tmp, sizeof(tmp), "%dm", android_hw->vm_heapSize);
+ boot_property_add("dalvik.vm.heapsize",tmp);
+ }
+
/* Initialize net speed and delays stuff. */
if (android_parse_network_speed(android_op_netspeed) < 0 ) {
fprintf(stderr, "invalid -netspeed parameter '%s'\n",
@@ -6047,6 +6070,17 @@ int main(int argc, char **argv, char **envp)
qemu_net_max_latency = 0;
}
+ /* Initialize LCD density */
+ if (android_op_lcd_density) {
+ char* end;
+ long density = strtol(android_op_lcd_density, &end, 0);
+ if (end == NULL || *end || density < 0) {
+ fprintf(stderr, "option -lcd-density must be a positive integer\n" );
+ exit(1);
+ }
+ hwLcd_setBootProperty(density);
+ }
+
/* Initialize TCP dump */
if (android_op_tcpdump) {
if (qemu_tcpdump_start(android_op_tcpdump) < 0) {