aboutsummaryrefslogtreecommitdiff
path: root/hw/ppc_oldworld.c
diff options
context:
space:
mode:
authorPaul Brook <paul@codesourcery.com>2009-05-30 00:52:44 +0100
committerPaul Brook <paul@codesourcery.com>2009-05-30 01:59:37 +0100
commit5cea8590eaa099be8087f363f80d0e6917382385 (patch)
tree485aa34f5047dd2835642d88957d8236adf45b3c /hw/ppc_oldworld.c
parentabc0754527e30acf278765f66d2157b6c75dc549 (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/ppc_oldworld.c')
-rw-r--r--hw/ppc_oldworld.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/hw/ppc_oldworld.c b/hw/ppc_oldworld.c
index aeac6aed30..b2c329b74f 100644
--- a/hw/ppc_oldworld.c
+++ b/hw/ppc_oldworld.c
@@ -122,7 +122,7 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
const char *cpu_model)
{
CPUState *env = NULL, *envs[MAX_CPUS];
- char buf[1024];
+ char *filename;
qemu_irq *pic, **heathrow_irqs;
int linux_boot, i;
ram_addr_t ram_offset, bios_offset, vga_bios_offset;
@@ -173,24 +173,35 @@ static void ppc_heathrow_init (ram_addr_t ram_size,
bios_offset = qemu_ram_alloc(BIOS_SIZE);
if (bios_name == NULL)
bios_name = PROM_FILENAME;
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
cpu_register_physical_memory(PROM_ADDR, BIOS_SIZE, bios_offset | IO_MEM_ROM);
/* Load OpenBIOS (ELF) */
- bios_size = load_elf(buf, 0, NULL, NULL, NULL);
+ if (filename) {
+ bios_size = load_elf(filename, 0, NULL, NULL, NULL);
+ qemu_free(filename);
+ } else {
+ bios_size = -1;
+ }
if (bios_size < 0 || bios_size > BIOS_SIZE) {
- hw_error("qemu: could not load PowerPC bios '%s'\n", buf);
+ hw_error("qemu: could not load PowerPC bios '%s'\n", bios_name);
exit(1);
}
/* allocate and load VGA BIOS */
vga_bios_offset = qemu_ram_alloc(VGA_BIOS_SIZE);
vga_bios_ptr = qemu_get_ram_ptr(vga_bios_offset);
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, VGABIOS_FILENAME);
- vga_bios_size = load_image(buf, vga_bios_ptr + 8);
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, VGABIOS_FILENAME);
+ if (filename) {
+ vga_bios_size = load_image(filename, vga_bios_ptr + 8);
+ qemu_free(filename);
+ } else {
+ vga_bios_size = -1;
+ }
if (vga_bios_size < 0) {
/* if no bios is present, we can still work */
- fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n", buf);
+ fprintf(stderr, "qemu: warning: could not load VGA bios '%s'\n",
+ VGABIOS_FILENAME);
vga_bios_size = 0;
} else {
/* set a specific header (XXX: find real Apple format for NDRV