qemu-devel
[Top][All Lists]
Advanced

[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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]