wolfBoot/tools/fdt-parser
David Garske c643215c5e fit: gzip-compressed kernel + ramdisk (initramfs) support
Wires the new wolfBoot_gunzip inflater into the FIT image-loading path
and adds initramfs (ramdisk) extraction with DTB /chosen fixup so a
single signed FIT can carry kernel, DTB, and rootfs.

GZIP path
---------
* fit_load_image_ex(out_max) added; fit_load_image kept as a wrapper.
* When a subimage carries compression="gzip", inflate straight to the
  FIT-declared load address, then verify the FIT hash-1 subnode
  (sha256 / sha384 if available) for defense in depth on top of the
  outer wolfBoot signature. The compression property is now read
  unconditionally so a build without WOLFBOOT_GZIP can warn and fail
  closed instead of silently memcpy-ing compressed bytes as if they
  were raw.
* fit_verify_hash propagates wc_InitSha256 / wc_Sha256Update /
  wc_Sha256Final return codes (and the SHA-384 equivalents) - any
  non-zero return is treated as a verification failure so a misbehaving
  backend cannot silently degrade to a no-op.
* GZIP=1 is the new default in the FIT-using example configs (zynqmp,
  zynqmp_sdcard, polarfire_mpfs250, polarfire_mpfs250_qspi,
  versal_vmk180, versal_vmk180_sdcard); set GZIP=0 to opt out.

Ramdisk path
------------
* fit_find_images() gains a ramdisk out-arg and fdt_fixup_initrd()
  writes /chosen/linux,initrd-{start,end} as 64-bit big-endian cells.
* update_disk.c and update_ram.c load the FIT ramdisk node (under
  WOLFBOOT_FIT_RAMDISK) and patch the loaded DTB. Compressed (gzip)
  ramdisks reuse the same fit_load_image_ex() decompress path.
* RAMDISK=1 build switch defines WOLFBOOT_FIT_RAMDISK;
  WOLFBOOT_LOAD_RAMDISK_ADDRESS is plumbed through tools/config.mk ->
  Makefile sed -> include/target.h.in. Defaults to 0; when 0 the
  ramdisk stays at whatever fit_load_image returned.
* hal/zynq.c and hal/versal.c bump fdt_totalsize headroom from 512 to
  768 bytes to fit the new linux,initrd-{start,end} entries.
* config/examples/zynqmp_sdcard.config gains a commented-out opt-in
  block (RAMDISK=1, WOLFBOOT_LOAD_RAMDISK_ADDRESS=0x40000000, alt
  LINUX_BOOTARGS) so a single config file covers both rootfs-on-disk
  and FIT-bundled-initramfs flows.

Builds against the existing master configs are byte-identical when
GZIP=0 and RAMDISK is unset.
2026-05-05 10:16:16 +02:00
..
Makefile Support for Microchip PolarFire SoC (MPFS250) 2025-12-24 18:31:55 +01:00
README.md
fdt-parser.c fit: gzip-compressed kernel + ramdisk (initramfs) support 2026-05-05 10:16:16 +02:00
nxp_t1024.dtb

README.md

Flattened Device Tree (FDT) Parser

This tool uses our internal FDT (fdt.c) parsing code to dump the device tree.

Use -i to parse a Flattened uImage Tree (FIT) image.

There is also a -t option that tests making several updates to the device tree (useful with the nxp_t1024.dtb).

Building fdt-parser

From root: make fdt-parser OR From tools/fdt-parser use make clean && make

Example FDT Output

% ./tools/fdt-parser/fdt-parser ./tools/fdt-parser/nxp_t1024.dtb
FDT Parser (./tools/fdt-parser/nxp_t1024.dtb):
FDT Version 17, Size 31102
root (node offset 0, depth 1, len 0):
	compatible (prop offset 8, len 13): fsl,T1024RDB
	#address-cells (prop offset 36, len 4): ....| 00 00 00 02
	#size-cells (prop offset 52, len 4): ....| 00 00 00 02
	interrupt-parent (prop offset 68, len 4): ....| 00 00 00 01
	model (prop offset 84, len 13): fsl,T1024RDB
	cpus (node offset 112, depth 2, len 4):
		power-isa-version (prop offset 124, len 5): 2.06
		power-isa-b (prop offset 144, len 0): NULL
		power-isa-e (prop offset 156, len 0): NULL
		power-isa-atb (prop offset 168, len 0): NULL
		power-isa-cs (prop offset 180, len 0): NULL
...

Example FIT Output

% ./tools/fdt-parser/fdt-parser -i ./tools/fdt-parser/lynx-test-arm.srp
FDT Parser (./tools/fdt-parser/lynx-test-arm.srp):
FDT Version 17, Size 164232633
FIT: Found 'conf@1' configuration
        description (len 46): LynxSecure 2024.06.0-96ce6f31a0 SRP (aarch64)
Kernel Image: kernel@1
        description (len 46): LynxSecure 2024.06.0-96ce6f31a0 SRP (aarch64)
        type (len 7): kernel
        os (len 6): linux
        arch (len 6): arm64
        compression (len 5): none
        load (len 4):
        entry (len 4):
        data (len 164186944): not rendering
FDT Image: fdt@1
        description (len 77): Flattened Device Tree blob for LynxSecure 2024.06.0-96ce6f31a0 SRP (aarch64)
        type (len 8): flat_dt
        arch (len 6): arm64
        compression (len 5): none
        padding (len 8):
        data (len 44770): not rendering
Return 0