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