aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBo Hu <bohu@google.com>2019-05-12 15:06:37 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2019-05-12 15:06:37 +0000
commit3b6a6c01e3d78ff2c70950920aa4cebdf2ea3eb8 (patch)
tree64c28f55160774e5376bc46c654f61166800c725
parentc35176f5d8c673e8c3716d971d66dac4825927d0 (diff)
parentabeadaca5e6506366e764c7689a9bc679cd0959c (diff)
downloadqemu-emu-3.1-release.tar.gz
Merge "option: add -qemu-top-dir" into emu-3.1-releaseemu-3.1-release
-rw-r--r--android/emulator/main-emulator.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/android/emulator/main-emulator.cpp b/android/emulator/main-emulator.cpp
index 26309165f4..f059f636c6 100644
--- a/android/emulator/main-emulator.cpp
+++ b/android/emulator/main-emulator.cpp
@@ -268,6 +268,31 @@ int main(int argc, char** argv)
int restartPid = -1;
bool doDeleteTempDir = false;
+#ifdef __linux__
+ const char* qemu_top_dir = nullptr;
+ char my_dumboption_string [] = "-ranchu";
+ for (int nn = 1; nn < argc; nn++) {
+ const char* opt = argv[nn];
+ if (!strcmp(opt, "-qemu-top-dir")) {
+ qemu_top_dir = argv[nn + 1];
+ argv[nn] = my_dumboption_string;
+ nn++;
+ argv[nn] = my_dumboption_string;
+ }
+ }
+ if (qemu_top_dir) {
+ char mybuf[1024];
+ char* c_argv0_dir_name = path_dirname(argv[0]);
+ snprintf(mybuf, sizeof(mybuf), "%s/%s/emulator", c_argv0_dir_name, qemu_top_dir);
+ char* emulatorPath = mybuf;
+ argv[0] = emulatorPath;
+ printf("emulator: INFO: launch %s ... \n", emulatorPath);
+ fflush(stdout);
+ safe_execv(emulatorPath, argv);
+ return errno;
+ }
+#endif
+
/* Test-only actions */
bool isLauncherTest = false;
const char* launcherTestArg = nullptr;