From c71b64f3617b5a4362c6e4e0aefdd66d6ac6affd Mon Sep 17 00:00:00 2001 From: Gerald Van Baren Date: Mon, 15 Oct 2012 22:24:36 -0400 Subject: libfdt: Add helper function to create a trivial, empty tree The libfdt read/write functions are now usable enough that it's become a moderately common pattern to use them to build and manipulate a device tree from scratch. For example, we do so ourself in our rw_tree1 testcase, and qemu is starting to use this model when building device trees for some targets such as e500. However, the read/write functions require some sort of valid tree to begin with, so this necessitates either having a trivial canned dtb to begin with or, more commonly, creating an empty tree using the serial-write functions first. This patch adds a helper function which uses the serial-write functions to create a trivial, empty but complete and valid tree in a supplied buffer, ready for manipulation with the read/write functions. Signed-off-by: David Gibson From git://git.jdl.com/software/dtc.git patch hash be6026838 with adaptations to include/libfdt.h and lib/libfdt/Makefile for the U-Boot environment. Signed-off-by: Gerald Van Baren --- include/libfdt.h | 1 + 1 file changed, 1 insertion(+) (limited to 'include/libfdt.h') diff --git a/include/libfdt.h b/include/libfdt.h index 4589c5feb4..c93ae28833 100644 --- a/include/libfdt.h +++ b/include/libfdt.h @@ -1014,6 +1014,7 @@ int fdt_finish(void *fdt); /* Read-write functions */ /**********************************************************************/ +int fdt_create_empty_tree(void *buf, int bufsize); int fdt_open_into(const void *fdt, void *buf, int bufsize); int fdt_pack(void *fdt); -- cgit v1.2.3