blob: 6fde1eb9eda0d6c7de1863277b6f4861268d19ff [file] [log] [blame]
Gerald Van Barenc71b64f2012-10-15 22:24:36 -04001/*
2 * libfdt - Flat Device Tree manipulation
3 * Copyright (C) 2012 David Gibson, IBM Corporation.
Roger Meier35084762013-07-27 01:12:38 +02004 * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause
Gerald Van Barenc71b64f2012-10-15 22:24:36 -04005 */
Robert P. J. Day6feed2a2016-05-23 05:40:55 -04006#include <libfdt_env.h>
Gerald Van Barenc71b64f2012-10-15 22:24:36 -04007#include <fdt.h>
8#include <libfdt.h>
9
10#include "libfdt_internal.h"
11
12int 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}