aboutsummaryrefslogtreecommitdiff
path: root/hw/ppce500_mpc8544ds.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/ppce500_mpc8544ds.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/ppce500_mpc8544ds.c')
-rw-r--r--hw/ppce500_mpc8544ds.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index 632fb05add..d9ed36ca59 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -79,20 +79,19 @@ static void *mpc8544_load_device_tree(target_phys_addr_t addr,
void *fdt = NULL;
#ifdef HAVE_FDT
uint32_t mem_reg_property[] = {0, ramsize};
- char *path;
+ char *filename;
int fdt_size;
- int pathlen;
int ret;
- pathlen = snprintf(NULL, 0, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE) + 1;
- path = qemu_malloc(pathlen);
-
- snprintf(path, pathlen, "%s/%s", bios_dir, BINARY_DEVICE_TREE_FILE);
-
- fdt = load_device_tree(path, &fdt_size);
- qemu_free(path);
- if (fdt == NULL)
+ filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
+ if (!filename) {
goto out;
+ }
+ fdt = load_device_tree(filename, &fdt_size);
+ qemu_free(filename);
+ if (fdt == NULL) {
+ goto out;
+ }
/* Manipulate device tree in memory. */
ret = qemu_devtree_setprop(fdt, "/memory", "reg", mem_reg_property,