From 5cea8590eaa099be8087f363f80d0e6917382385 Mon Sep 17 00:00:00 2001 From: Paul Brook Date: Sat, 30 May 2009 00:52:44 +0100 Subject: 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 --- hw/ppc440_bamboo.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) (limited to 'hw/ppc440_bamboo.c') diff --git a/hw/ppc440_bamboo.c b/hw/ppc440_bamboo.c index cbe7236..00aa2c7 100644 --- a/hw/ppc440_bamboo.c +++ b/hw/ppc440_bamboo.c @@ -34,20 +34,19 @@ static void *bamboo_load_device_tree(target_phys_addr_t addr, void *fdt = NULL; #ifdef HAVE_FDT uint32_t mem_reg_property[] = { 0, 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); - 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. */ -- cgit v1.1