Revision 71193433 device_tree.c

b/device_tree.c
304 304
    g_free(dupname);
305 305
    return retval;
306 306
}
307

  
308
void qemu_devtree_dumpdtb(void *fdt, int size)
309
{
310
    QemuOpts *machine_opts;
311

  
312
    machine_opts = qemu_opts_find(qemu_find_opts("machine"), 0);
313
    if (machine_opts) {
314
        const char *dumpdtb = qemu_opt_get(machine_opts, "dumpdtb");
315
        if (dumpdtb) {
316
            /* Dump the dtb to a file and quit */
317
            FILE *f = fopen(dumpdtb, "wb");
318
            size_t len;
319
            len = fwrite(fdt, size, 1, f);
320
            fclose(f);
321
            if (len != size) {
322
                exit(1);
323
            }
324
            exit(0);
325
        }
326
    }
327

  
328
}

Also available in: Unified diff