1 /* 2 * libfdt - Flat Device Tree manipulation 3 * Copyright (C) 2012 David Gibson, IBM Corporation. 4 * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause 5 */ 6 #include <libfdt_env.h> 7 #include <fdt.h> 8 #include <libfdt.h> 9 10 #include "libfdt_internal.h" 11 12 int fdt_create_empty_tree(void *buf, int bufsize) 13 { 14 int err; 15 16 err = fdt_create(buf, bufsize); 17 if (err) 18 return err; 19 20 err = fdt_finish_reservemap(buf); 21 if (err) 22 return err; 23 24 err = fdt_begin_node(buf, ""); 25 if (err) 26 return err; 27 28 err = fdt_end_node(buf); 29 if (err) 30 return err; 31 32 err = fdt_finish(buf); 33 if (err) 34 return err; 35 36 return fdt_open_into(buf, buf, bufsize); 37 } 38