diff options
author | Bruce Beare <brucex.j.beare@intel.com> | 2011-02-24 09:10:52 -0800 |
---|---|---|
committer | Bruce Beare <bruce.j.beare@intel.com> | 2011-03-02 13:54:44 -0800 |
commit | 02c6385fd50f926d0f0801dfe60480cd90d8df81 (patch) | |
tree | 514a627f516fefd0e6672b420ae36d9183c50d97 /vl-android.c | |
parent | 44374ce7ef50bd50fa647fb9dc32b11fb2a8ad26 (diff) | |
download | external_qemu-02c6385fd50f926d0f0801dfe60480cd90d8df81.zip external_qemu-02c6385fd50f926d0f0801dfe60480cd90d8df81.tar.gz external_qemu-02c6385fd50f926d0f0801dfe60480cd90d8df81.tar.bz2 |
look for the pc-bios files in the SDK tools/lib/pc-bios directory
Change-Id: I6d546f79617032dea0d72d8d38dab3016e6bd4a0
Signed-off-by: Bruce Beare <brucex.j.beare@intel.com>
Diffstat (limited to 'vl-android.c')
-rw-r--r-- | vl-android.c | 30 |
1 files 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); |