[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH 21/31] dt: Add -machine dumpdtb option to dump t
From: |
Peter Maydell |
Subject: |
Re: [Qemu-devel] [PATCH 21/31] dt: Add -machine dumpdtb option to dump the current dtb |
Date: |
Tue, 19 Jun 2012 21:51:30 +0100 |
On 19 June 2012 20:15, Alexander Graf <address@hidden> wrote:
> Now that we are dynamically creating the dtb, it's really useful to
> be able to dump the created blob for debugging.
> @@ -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);
> + }
> +
Maybe this should be abstracted out into a subfunction somewhere?
I'm guessing there might be more than one machine in the future
that wants a dumpable device tree.
-- PMM
- [Qemu-devel] [PATCH 07/31] dt: add helper for phandle allocation, (continued)
- [Qemu-devel] [PATCH 07/31] dt: add helper for phandle allocation, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 17/31] PPC: e500: dt: create mpic node dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 15/31] PPC: e500: dt: create /soc8544 node dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 18/31] PPC: e500: dt: create global-utils node dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 04/31] dt: temporarily disable subtree creation failure check, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 22/31] PPC: e500: dt: use 64bit cell helper, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 13/31] PPC: e500: dt: create / node dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 14/31] PPC: e500: dt: create /chosen node dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 11/31] PPC: e500: dt: create /cpus node dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 21/31] dt: Add -machine dumpdtb option to dump the current dtb, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 10/31] PPC: e500: dt: create memory node dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 16/31] PPC: e500: dt: create serial nodes dynamically, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 25/31] Revert "dt: temporarily disable subtree creation failure check", Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 20/31] PPC: e500: dt: start with empty device tree, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 30/31] dt: Add global option to set phandle start offset, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 08/31] dt: add helper for 64bit cell adds, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 27/31] PPC: e500: Use new SOC dt format, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 29/31] PPC: e500: Extend address/size of / to 64bit, Alexander Graf, 2012/06/19
- [Qemu-devel] [PATCH 23/31] PPC: e500: dt: use target_phys_addr_t for ramsize, Alexander Graf, 2012/06/19