2 * libfdt - Flat Device Tree manipulation
3 * Copyright (C) 2012 David Gibson, IBM Corporation.
5 * Redistribution and use in source and binary forms, with or
6 * without modification, are permitted provided that the following
9 * 1. Redistributions of source code must retain the above
10 * copyright notice, this list of conditions and the following
12 * 2. Redistributions in binary form must reproduce the above
13 * copyright notice, this list of conditions and the following
14 * disclaimer in the documentation and/or other materials
15 * provided with the distribution.
17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
18 * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
19 * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
22 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
24 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
29 * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 #include "libfdt_env.h"
35 #include "libfdt_internal.h"
37 int fdt_create_empty_tree(void *buf
, int bufsize
)
41 err
= fdt_create(buf
, bufsize
);
45 err
= fdt_finish_reservemap(buf
);
49 err
= fdt_begin_node(buf
, "");
53 err
= fdt_end_node(buf
);
57 err
= fdt_finish(buf
);
61 return fdt_open_into(buf
, buf
, bufsize
);