[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v1 5/5] microblaze_boot: enabled -dtb argument
From: |
Peter A. G. Crosthwaite |
Subject: |
[Qemu-devel] [PATCH v1 5/5] microblaze_boot: enabled -dtb argument |
Date: |
Sun, 4 Mar 2012 21:03:55 +1000 |
From: "Peter A. G. Crosthwaite" <address@hidden>
Use the -dtb argument for passing is a custom dtb rather than the old
hardcoded "mb.dtb"
Signed-off-by: Peter A. G. Crosthwaite <address@hidden>
---
hw/microblaze_boot.c | 34 ++++++++++++++--------------------
1 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/hw/microblaze_boot.c b/hw/microblaze_boot.c
index 37fce50..b2f96df 100644
--- a/hw/microblaze_boot.c
+++ b/hw/microblaze_boot.c
@@ -59,23 +59,16 @@ static int microblaze_load_dtb(target_phys_addr_t addr,
const char *kernel_cmdline,
const char *dtb_filename)
{
- char *path;
int fdt_size;
#ifdef CONFIG_FDT
- void *fdt;
+ void *fdt = NULL;
int r;
- /* Try the local "mb.dtb" override. */
- fdt = load_device_tree("mb.dtb", &fdt_size);
+ if (dtb_filename) {
+ fdt = load_device_tree(dtb_filename, &fdt_size);
+ }
if (!fdt) {
- path = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename);
- if (path) {
- fdt = load_device_tree(path, &fdt_size);
- g_free(path);
- }
- if (!fdt) {
- return 0;
- }
+ return 0;
}
if (kernel_cmdline) {
@@ -90,15 +83,9 @@ static int microblaze_load_dtb(target_phys_addr_t addr,
#else
/* We lack libfdt so we cannot manipulate the fdt. Just pass on the blob
to the kernel. */
- fdt_size = load_image_targphys("mb.dtb", addr, 0x10000);
- if (fdt_size < 0) {
- path = qemu_find_file(QEMU_FILE_TYPE_BIOS, BINARY_DEVICE_TREE_FILE);
- if (path) {
- fdt_size = load_image_targphys(path, addr, 0x10000);
- g_free(path);
- }
+ if (dtb_filename) {
+ fdt_size = load_image_targphys(dtb_filename, addr, 0x10000);
}
-
if (kernel_cmdline) {
fprintf(stderr,
"Warning: missing libfdt, cannot pass cmdline to kernel!\n");
@@ -123,8 +110,15 @@ void microblaze_load_kernel(CPUState *env,
target_phys_addr_t ddr_base,
machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
if (machine_opts) {
+ const char *dtb_arg;
kernel_filename = qemu_opt_get(machine_opts, "kernel");
kernel_cmdline = qemu_opt_get(machine_opts, "append");
+ dtb_arg = qemu_opt_get(machine_opts, "dtb");
+ if (dtb_arg) { /* Preference a -dtb argument */
+ dtb_filename = dtb_arg;
+ } else { /* default to pcbios dtb as passed by machine_init */
+ dtb_filename = qemu_find_file(QEMU_FILE_TYPE_BIOS, dtb_filename);
+ }
}
boot_info.machine_cpu_reset = machine_cpu_reset;
--
1.7.5.4
- [Qemu-devel] [PATCH v1 0/5] Microblaze machine models and bootloader refactoring, Peter A. G. Crosthwaite, 2012/03/04
- [Qemu-devel] [PATCH v1 1/5] microblaze: factored out common boot code, Peter A. G. Crosthwaite, 2012/03/04
- [Qemu-devel] [PATCH v1 2/5] petalogix_s2adsp1800: moved rst logic to rst fn, Peter A. G. Crosthwaite, 2012/03/04
- [Qemu-devel] [PATCH v1 3/5] petalogix_s2adsp1800: macro'd magic numbers, Peter A. G. Crosthwaite, 2012/03/04
- [Qemu-devel] [PATCH v1 4/5] qemu-options.hx: allow -dtb argument for all archs, Peter A. G. Crosthwaite, 2012/03/04
- [Qemu-devel] [PATCH v1 5/5] microblaze_boot: enabled -dtb argument,
Peter A. G. Crosthwaite <=
- Re: [Qemu-devel] [PATCH v1 0/5] Microblaze machine models and bootloader refactoring, Edgar E. Iglesias, 2012/03/05