2 * dumptrees - utility for libfdt testing
4 * (C) Copyright David Gibson <dwg@au1.ibm.com>, IBM Corporation. 2006.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License as
9 * published by the Free Software Foundation; either version 2 of the
10 * License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
36 #define TREE(name) { &_##name, #name ".dtb" }
38 TREE(bad_node_char), TREE(bad_node_format), TREE(bad_prop_char),
41 #define NUM_TREES (sizeof(trees) / sizeof(trees[0]))
43 int main(int argc, char *argv[])
47 for (i = 0; i < NUM_TREES; i++) {
48 void *blob = trees[i].blob;
49 const char *filename = trees[i].filename;
54 size = fdt_totalsize(blob);
56 printf("Tree \"%s\", %d bytes\n", filename, size);
58 fd = open(filename, O_WRONLY | O_CREAT | O_TRUNC, 0666);
62 ret = write(fd, blob, size);