Gerald Van Baren | c71b64f | 2012-10-15 22:24:36 -0400 | [diff] [blame] | 1 | /* |
| 2 | * libfdt - Flat Device Tree manipulation |
| 3 | * Copyright (C) 2012 David Gibson, IBM Corporation. |
Roger Meier | 3508476 | 2013-07-27 01:12:38 +0200 | [diff] [blame] | 4 | * SPDX-License-Identifier: GPL-2.0+ BSD-2-Clause |
Gerald Van Baren | c71b64f | 2012-10-15 22:24:36 -0400 | [diff] [blame] | 5 | */ |
Robert P. J. Day | 6feed2a | 2016-05-23 05:40:55 -0400 | [diff] [blame] | 6 | #include <libfdt_env.h> |
Gerald Van Baren | c71b64f | 2012-10-15 22:24:36 -0400 | [diff] [blame] | 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 | } |