summaryrefslogtreecommitdiffstats
path: root/hw/mips_mipssim.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/mips_mipssim.c
parentabc0754527e30acf278765f66d2157b6c75dc549 (diff)
downloadhqemu-5cea8590eaa099be8087f363f80d0e6917382385.zip
hqemu-5cea8590eaa099be8087f363f80d0e6917382385.tar.gz
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/mips_mipssim.c')
-rw-r--r--hw/mips_mipssim.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/hw/mips_mipssim.c b/hw/mips_mipssim.c
index 1117db2..448dc02 100644
--- a/hw/mips_mipssim.c
+++ b/hw/mips_mipssim.c
@@ -107,7 +107,7 @@ mips_mipssim_init (ram_addr_t ram_size,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename, const char *cpu_model)
{
- char buf[1024];
+ char *filename;
ram_addr_t ram_offset;
ram_addr_t bios_offset;
CPUState *env;
@@ -140,13 +140,18 @@ mips_mipssim_init (ram_addr_t ram_size,
/* Load a BIOS / boot exception handler image. */
if (bios_name == NULL)
bios_name = BIOS_FILENAME;
- snprintf(buf, sizeof(buf), "%s/%s", bios_dir, bios_name);
- bios_size = load_image_targphys(buf, 0x1fc00000LL, BIOS_SIZE);
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, bios_name);
+ if (filename) {
+ bios_size = load_image_targphys(filename, 0x1fc00000LL, BIOS_SIZE);
+ qemu_free(filename);
+ } else {
+ bios_size = -1;
+ }
if ((bios_size < 0 || bios_size > BIOS_SIZE) && !kernel_filename) {
/* Bail out if we have neither a kernel image nor boot vector code. */
fprintf(stderr,
"qemu: Could not load MIPS bios '%s', and no -kernel argument was specified\n",
- buf);
+ filename);
exit(1);
} else {
/* We have a boot vector start address. */
OpenPOWER on IntegriCloud