[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/6] device_tree.c: add the main function to analyse
From: |
john.liuli |
Subject: |
[Qemu-devel] [PATCH 4/6] device_tree.c: add the main function to analyse the parameter 'dumpdts' |
Date: |
Mon, 25 Aug 2014 12:00:35 +0800 |
From: Li Liu <address@hidden>
add the main function to analyse the parameter 'dumpdts' as a
filename the dts will be dumped to.
Signed-off-by: Li Liu <address@hidden>
---
device_tree.c | 21 +++++++++++++++++++++
include/sysemu/device_tree.h | 1 +
2 files changed, 22 insertions(+)
diff --git a/device_tree.c b/device_tree.c
index 1e407d2..b9a924f 100644
--- a/device_tree.c
+++ b/device_tree.c
@@ -496,3 +496,24 @@ static void qemu_write_dts(FILE *fp, void *fdt)
fprintf(fp, ";\n");
}
}
+
+void qemu_fdt_dumpdts(void *fdt)
+{
+ FILE *fp;
+ const char *filename = qemu_opt_get(qemu_get_machine_opts(), "dumpdts");
+
+ if (!filename || !fdt) {
+ return;
+ }
+
+ fp = fopen(filename, "w");
+ if (!fp) {
+ fprintf(stderr, "Failed to open file '%s'\n", filename);
+ goto ret;
+ }
+
+ qemu_write_dts(fp, fdt);
+
+ret:
+ fclose(fp);
+}
diff --git a/include/sysemu/device_tree.h b/include/sysemu/device_tree.h
index 899f05c..27145fb 100644
--- a/include/sysemu/device_tree.h
+++ b/include/sysemu/device_tree.h
@@ -50,6 +50,7 @@ int qemu_fdt_add_subnode(void *fdt, const char *name);
} while (0)
void qemu_fdt_dumpdtb(void *fdt, int size);
+void qemu_fdt_dumpdts(void *fdt);
/**
* qemu_fdt_setprop_sized_cells_from_array:
--
1.7.9.5
- [Qemu-devel] [PATCH 0/6] add dumpdts ability to convert dtb to dts, john.liuli, 2014/08/25
- [Qemu-devel] [PATCH 3/6] device_tree.c: Format a blob in memory as dts stream and dump to a file., john.liuli, 2014/08/25
- [Qemu-devel] [PATCH 1/6] device_tree.c: Introduce a function to check multiple strings for dts, john.liuli, 2014/08/25
- [Qemu-devel] [PATCH 2/6] device_tree.c: dump three kind data types of dts to a file desciptor, john.liuli, 2014/08/25
- [Qemu-devel] [PATCH 4/6] device_tree.c: add the main function to analyse the parameter 'dumpdts',
john.liuli <=
- [Qemu-devel] [PATCH 6/6] arm: Allow dumping generated dtb to dts file, john.liuli, 2014/08/25
- [Qemu-devel] [PATCH 5/6] machine: add 'dumpdts' parameter to 'machine' optslist., john.liuli, 2014/08/25
- Re: [Qemu-devel] [PATCH 0/6] add dumpdts ability to convert dtb to dts, Peter Maydell, 2014/08/25