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 | */ |
| 6 | #include "libfdt_env.h" |
| 7 | |
| 8 | #include <fdt.h> |
| 9 | #include <libfdt.h> |
| 10 | |
| 11 | #include "libfdt_internal.h" |
| 12 | |
| 13 | int fdt_create_empty_tree(void *buf, int bufsize) |
| 14 | { |
| 15 | int err; |
| 16 | |
| 17 | err = fdt_create(buf, bufsize); |
| 18 | if (err) |
| 19 | return err; |
| 20 | |
| 21 | err = fdt_finish_reservemap(buf); |
| 22 | if (err) |
| 23 | return err; |
| 24 | |
| 25 | err = fdt_begin_node(buf, ""); |
| 26 | if (err) |
| 27 | return err; |
| 28 | |
| 29 | err = fdt_end_node(buf); |
| 30 | if (err) |
| 31 | return err; |
| 32 | |
| 33 | err = fdt_finish(buf); |
| 34 | if (err) |
| 35 | return err; |
| 36 | |
| 37 | return fdt_open_into(buf, buf, bufsize); |
| 38 | } |