[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PATCH 21/31] dt: Add -machine dumpdtb option to dump the cur
From: |
Alexander Graf |
Subject: |
[Qemu-ppc] [PATCH 21/31] dt: Add -machine dumpdtb option to dump the current dtb |
Date: |
Wed, 6 Jun 2012 01:53:12 +0200 |
Now that we are dynamically creating the dtb, it's really useful to
be able to dump the created blob for debugging.
This patch implements a -machine dumpdtb=<file> option for e500 that
dumps the dtb exactly in the form the guest would get it to disk. It
can then be analyzed by dtc to get information about the guest
configuration.
Signed-off-by: Alexander Graf <address@hidden>
---
hw/ppce500_mpc8544ds.c | 18 ++++++++++++++++++
qemu-config.c | 4 ++++
2 files changed, 22 insertions(+), 0 deletions(-)
diff --git a/hw/ppce500_mpc8544ds.c b/hw/ppce500_mpc8544ds.c
index 30683e7..2069891 100644
--- a/hw/ppce500_mpc8544ds.c
+++ b/hw/ppce500_mpc8544ds.c
@@ -111,6 +111,8 @@ static int mpc8544_load_device_tree(CPUPPCState *env,
uint32_t pci_ranges[12] = { 0x2000000, 0x0, 0xc0000000, 0xc0000000, 0x0,
0x20000000, 0x1000000, 0x0, 0x0, 0xe1000000,
0x0, 0x10000 };
+ QemuOpts *machine_opts;
+ const char *dumpdtb = NULL;
fdt = create_device_tree(&fdt_size);
if (fdt == NULL) {
@@ -300,6 +302,22 @@ static int mpc8544_load_device_tree(CPUPPCState *env,
qemu_devtree_setprop_cell(fdt, pci, "#address-cells", 3);
qemu_devtree_setprop_string(fdt, "/aliases", "pci0", pci);
+ machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
+ if (machine_opts) {
+ dumpdtb = qemu_opt_get(machine_opts, "dumpdtb");
+ }
+ if (dumpdtb) {
+ /* Dump the dtb to a file and quit */
+ FILE *f = fopen(dumpdtb, "wb");
+ size_t len;
+ len = fwrite(fdt, fdt_size, 1, f);
+ fclose(f);
+ if (len != fdt_size) {
+ exit(1);
+ }
+ exit(0);
+ }
+
ret = rom_add_blob_fixed(BINARY_DEVICE_TREE_FILE, fdt, fdt_size, addr);
if (ret < 0) {
goto out;
diff --git a/qemu-config.c b/qemu-config.c
index be84a03..ef4714e 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -582,6 +582,10 @@ static QemuOptsList qemu_machine_opts = {
.name = "dtb",
.type = QEMU_OPT_STRING,
.help = "Linux kernel device tree file",
+ }, {
+ .name = "dumpdtb",
+ .type = QEMU_OPT_STRING,
+ .help = "Dump current dtb to a file and quit",
},
{ /* End of list */ }
},
--
1.6.0.2
- [Qemu-ppc] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, (continued)
- [Qemu-ppc] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, Alexander Graf, 2012/06/05
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, Peter Crosthwaite, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, Alexander Graf, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, Scott Wood, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, David Gibson, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, Alexander Graf, 2012/06/07
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, David Gibson, 2012/06/07
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, Alexander Graf, 2012/06/08
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 02/31] dt: add helpers for 2, 3 and 4 cell adds, David Gibson, 2012/06/08
[Qemu-ppc] [PATCH 18/31] PPC: e500: dt: create global-utils node dynamically, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 21/31] dt: Add -machine dumpdtb option to dump the current dtb,
Alexander Graf <=
[Qemu-ppc] [PATCH 31/31] PPC: e500: Refactor serial dt generation, Alexander Graf, 2012/06/05
[Qemu-ppc] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/05
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Peter Crosthwaite, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Peter Crosthwaite, 2012/06/06
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/08
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Peter Crosthwaite, 2012/06/08
- Re: [Qemu-ppc] [Qemu-devel] [PATCH 05/31] dt: add helper for phandle enumeration, Alexander Graf, 2012/06/19
[Qemu-ppc] [PATCH 03/31] dt: add helper for phandle references, Alexander Graf, 2012/06/05