diff options
author | Paul Brook <paul@codesourcery.com> | 2009-05-30 00:52:44 +0100 |
---|---|---|
committer | Paul Brook <paul@codesourcery.com> | 2009-05-30 01:59:37 +0100 |
commit | 5cea8590eaa099be8087f363f80d0e6917382385 (patch) | |
tree | 485aa34f5047dd2835642d88957d8236adf45b3c /hw/sun4u.c | |
parent | abc0754527e30acf278765f66d2157b6c75dc549 (diff) |
Use relative path for bios
Look for bios and other support files relative to qemu binary, rather than
a hardcoded prefix.
Signed-off-by: Paul Brook <paul@codesourcery.com>
Diffstat (limited to 'hw/sun4u.c')
-rw-r--r-- | hw/sun4u.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/hw/sun4u.c b/hw/sun4u.c index f5bb7322cf..7d020182fe 100644 --- a/hw/sun4u.c +++ b/hw/sun4u.c @@ -333,7 +333,7 @@ static void sun4uv_init(ram_addr_t RAM_size, const struct hwdef *hwdef) { CPUState *env; - char buf[1024]; + char *filename; m48t59_t *nvram; int ret, linux_boot; unsigned int i; @@ -392,17 +392,23 @@ static void sun4uv_init(ram_addr_t RAM_size, if (bios_name == NULL) bios_name = PROM_FILENAME; - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); - ret = load_elf(buf, hwdef->prom_addr - PROM_VADDR, NULL, NULL, NULL); - if (ret < 0) { - ret = load_image_targphys(buf, hwdef->prom_addr, - (PROM_SIZE_MAX + TARGET_PAGE_SIZE) & - TARGET_PAGE_MASK); + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (filename) { + ret = load_elf(filename, hwdef->prom_addr - PROM_VADDR, + NULL, NULL, NULL); if (ret < 0) { - fprintf(stderr, "qemu: could not load prom '%s'\n", - buf); - exit(1); + ret = load_image_targphys(filename, hwdef->prom_addr, + (PROM_SIZE_MAX + TARGET_PAGE_SIZE) & + TARGET_PAGE_MASK); } + qemu_free(filename); + } else { + ret = -1; + } + if (ret < 0) { + fprintf(stderr, "qemu: could not load prom '%s'\n", + bios_name); + exit(1); } kernel_size = 0; |