]>
git.ipfire.org Git - people/ms/u-boot.git/blob - tools/fit_info.c
3 * DENX Software Engineering
4 * Heiko Schocher <hs@denx.de>
6 * fit_info: print the offset and the len of a property from
10 * (C) Copyright 2008 Semihalf
12 * (C) Copyright 2000-2004
13 * DENX Software Engineering
14 * Wolfgang Denk, wd@denx.de
16 * Updated-by: Prafulla Wadaskar <prafulla@marvell.com>
17 * FIT image specific code abstracted from mkimage.c
18 * some functions added to address abstraction
20 * All rights reserved.
22 * SPDX-License-Identifier: GPL-2.0+
26 #include "fit_common.h"
28 #include <u-boot/crc.h>
30 void usage(char *cmdname
)
32 fprintf(stderr
, "Usage: %s -f fit file -n node -p property\n"
33 " -f ==> set fit file which is used'\n"
34 " -n ==> set node name'\n"
35 " -p ==> set property name'\n",
40 int main(int argc
, char **argv
)
46 int nodeoffset
; /* node offset from libfdt */
47 const void *nodep
; /* property node pointer */
49 char *nodename
= NULL
;
50 char *propertyname
= NULL
;
54 strncpy(cmdname
, *argv
, sizeof(cmdname
) - 1);
55 cmdname
[sizeof(cmdname
) - 1] = '\0';
56 while ((c
= getopt(argc
, argv
, "f:n:p:")) != -1)
65 propertyname
= optarg
;
73 fprintf(stderr
, "%s: Missing fdt file\n", *argv
);
77 fprintf(stderr
, "%s: Missing node name\n", *argv
);
81 fprintf(stderr
, "%s: Missing property name\n", *argv
);
84 ffd
= mmap_fdt(cmdname
, fdtfile
, 0, &fit_blob
, &fsbuf
, false);
87 printf("Could not open %s\n", fdtfile
);
91 nodeoffset
= fdt_path_offset(fit_blob
, nodename
);
93 printf("%s not found.", nodename
);
96 nodep
= fdt_getprop(fit_blob
, nodeoffset
, propertyname
, &len
);
98 printf("len == 0 %s\n", propertyname
);
102 printf("NAME: %s\n", fit_get_name(fit_blob
, nodeoffset
, NULL
));
103 printf("LEN: %d\n", len
);
104 printf("OFF: %d\n", (int)(nodep
- fit_blob
));
105 (void) munmap((void *)fit_blob
, fsbuf
.st_size
);