On 19 June 2012 20:15, Alexander Graf <ag...@suse.de> 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