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/ppc405_boards.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/ppc405_boards.c')
-rw-r--r-- | hw/ppc405_boards.c | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/hw/ppc405_boards.c b/hw/ppc405_boards.c index a8f9a28105..0dec1317e5 100644 --- a/hw/ppc405_boards.c +++ b/hw/ppc405_boards.c @@ -175,7 +175,7 @@ static void ref405ep_init (ram_addr_t ram_size, const char *initrd_filename, const char *cpu_model) { - char buf[1024]; + char *filename; ppc4xx_bd_info_t bd; CPUPPCState *env; qemu_irq *pic; @@ -236,13 +236,19 @@ static void ref405ep_init (ram_addr_t ram_size, #ifdef DEBUG_BOARD_INIT printf("Load BIOS from file\n"); #endif + bios_offset = qemu_ram_alloc(BIOS_SIZE); if (bios_name == NULL) bios_name = BIOS_FILENAME; - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); - bios_offset = qemu_ram_alloc(BIOS_SIZE); - bios_size = load_image(buf, qemu_get_ram_ptr(bios_offset)); + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (filename) { + bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset)); + qemu_free(filename); + } else { + bios_size = -1; + } if (bios_size < 0 || bios_size > BIOS_SIZE) { - fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf); + fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", + bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; @@ -493,7 +499,7 @@ static void taihu_405ep_init(ram_addr_t ram_size, const char *initrd_filename, const char *cpu_model) { - char buf[1024]; + char *filename; CPUPPCState *env; qemu_irq *pic; ram_addr_t bios_offset; @@ -548,10 +554,15 @@ static void taihu_405ep_init(ram_addr_t ram_size, if (bios_name == NULL) bios_name = BIOS_FILENAME; bios_offset = qemu_ram_alloc(BIOS_SIZE); - snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name); - bios_size = load_image(buf, qemu_get_ram_ptr(bios_offset)); + filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name); + if (filename) { + bios_size = load_image(filename, qemu_get_ram_ptr(bios_offset)); + } else { + bios_size = -1; + } if (bios_size < 0 || bios_size > BIOS_SIZE) { - fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", buf); + fprintf(stderr, "qemu: could not load PowerPC bios '%s'\n", + bios_name); exit(1); } bios_size = (bios_size + 0xfff) & ~0xfff; |