Skip to content

Commit 4a85d2e

Browse files
dgarskedanielinux
authored andcommitted
Added documentation for the two parsers (ELF and FDT).
1 parent dec2653 commit 4a85d2e

3 files changed

Lines changed: 54 additions & 1 deletion

File tree

tools/elf-parser/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
CC=gcc
66
CFLAGS=-Wall -g -ggdb
7-
CFLAGS+=-I../../include -DWOLFBOOT_ELF -DELF_PARSER -DDEBUG_ELF -DPRINTF_ENABLED
7+
CFLAGS+=-I../../include -DWOLFBOOT_ELF -DELF_PARSER -DPRINTF_ENABLED
88
EXE=elf-parser
99

1010
LIBS=

tools/elf-parser/README.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# ELF Parser Tool
2+
3+
This tool demonstrates parsing ELF32/ELF64, showing the clear/load sections and entry point.
4+
5+
## Building elf-parser
6+
7+
From root: `make elf-parser`
8+
OR
9+
From `tools/elf-parser` use `make clean && make`
10+
11+
## Example Output
12+
13+
```sh
14+
% ./tools/elf-parser/elf-parser wolfboot.elf
15+
ELF Parser:
16+
Loading elf at 0x7f9a18008000
17+
Found valid elf32 (little endian)
18+
Program Headers 2 (size 32)
19+
Load 18340 bytes (offset 0x10000) to 0x8000000 (p 0x8000000)
20+
Clear 72 bytes at 0x20000000 (p 0x80047a4)
21+
Entry point 0x8000000
22+
Return 0, Load 0x8000000
23+
```

tools/fdt-parser/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Flattened Device Tree (FDT) Parser
2+
3+
This tool uses our internal FDT (fdt.c) parsing code to dump the device tree. There is also a `-t` option that tests making several updates to the device tree.
4+
5+
## Building fdt-parser
6+
7+
From root: `make fdt-parser`
8+
OR
9+
From `tools/fdt-parser` use `make clean && make`
10+
11+
## Example Output
12+
13+
```sh
14+
% ./tools/fdt-parser/fdt-parser ./tools/fdt-parser/nxp_t1024.dtb
15+
FDT Parser (./tools/fdt-parser/nxp_t1024.dtb):
16+
FDT Version 17, Size 31102
17+
root (node offset 0, depth 1, len 0):
18+
compatible (prop offset 8, len 13): fsl,T1024RDB
19+
#address-cells (prop offset 36, len 4): ....| 00 00 00 02
20+
#size-cells (prop offset 52, len 4): ....| 00 00 00 02
21+
interrupt-parent (prop offset 68, len 4): ....| 00 00 00 01
22+
model (prop offset 84, len 13): fsl,T1024RDB
23+
cpus (node offset 112, depth 2, len 4):
24+
power-isa-version (prop offset 124, len 5): 2.06
25+
power-isa-b (prop offset 144, len 0): NULL
26+
power-isa-e (prop offset 156, len 0): NULL
27+
power-isa-atb (prop offset 168, len 0): NULL
28+
power-isa-cs (prop offset 180, len 0): NULL
29+
...
30+
```

0 commit comments

Comments
 (0)