From 02c6385fd50f926d0f0801dfe60480cd90d8df81 Mon Sep 17 00:00:00 2001 From: Bruce Beare Date: Thu, 24 Feb 2011 09:10:52 -0800 Subject: look for the pc-bios files in the SDK tools/lib/pc-bios directory Change-Id: I6d546f79617032dea0d72d8d38dab3016e6bd4a0 Signed-off-by: Bruce Beare --- vl-android.c | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/vl-android.c b/vl-android.c index cb32eb2..b93ce9c 100644 --- a/vl-android.c +++ b/vl-android.c @@ -3547,9 +3547,11 @@ static char *find_datadir(const char *argv0) /* Find a likely location for support files using the location of the binary. For installed binaries this will be "$bindir/../share/qemu". When - running from the build tree this will be "$bindir/../pc-bios". */ + running from the build tree this will be "$bindir/../pc-bios". + The emulator running from the SDK will find the support files in $bindir/lib/pc-bios. */ #define SHARE_SUFFIX "/share/qemu" #define BUILD_SUFFIX "/pc-bios" +#define SDK_SUFFIX "/lib/pc-bios" static char *find_datadir(const char *argv0) { char *dir; @@ -3590,19 +3592,25 @@ static char *find_datadir(const char *argv0) return NULL; } } - dir = dirname(p); - dir = dirname(dir); - max_len = strlen(dir) + - MAX(strlen(SHARE_SUFFIX), strlen(BUILD_SUFFIX)) + 1; +#define STRLEN_CONST(str) (sizeof(str)-1) + dir = dirname(p); + max_len = strlen(dir) + 1 + + MAX(STRLEN_CONST(SDK_SUFFIX), MAX(STRLEN_CONST(SHARE_SUFFIX), STRLEN_CONST(BUILD_SUFFIX))); res = qemu_mallocz(max_len); - snprintf(res, max_len, "%s%s", dir, SHARE_SUFFIX); + + snprintf(res, max_len, "%s%s", dir, SDK_SUFFIX); if (access(res, R_OK)) { - snprintf(res, max_len, "%s%s", dir, BUILD_SUFFIX); - if (access(res, R_OK)) { - qemu_free(res); - res = NULL; - } + dir = dirname(dir); + + snprintf(res, max_len, "%s%s", dir, SHARE_SUFFIX); + if (access(res, R_OK)) { + snprintf(res, max_len, "%s%s", dir, BUILD_SUFFIX); + if (access(res, R_OK)) { + qemu_free(res); + res = NULL; + } + } } #ifndef PATH_MAX free(p); -- cgit v1.1