Skip to main content

Module fdt

Module fdt 

Source
Expand description

Device Tree (FDT) parsing Device Tree (FDT) parsing for the custom boot protocol.

Parses the Flattened Device Tree to extract boot information:

  • Memory map
  • Framebuffer
  • ACPI RSDP (via EFI System Table)
  • Boot command line
  • HHDM offset (derived from memory map)

Β§FDT format

The DTB is a binary blob with big-endian fields. Structure tokens:

  • 0x1 = FDT_BEGIN_NODE
  • 0x2 = FDT_END_NODE
  • 0x3 = FDT_PROP
  • 0x4 = FDT_NOP
  • 0x9 = FDT_END

Β§Cell sizes

The root node defines #address-cells and #size-cells which determine how many 32-bit cells are used for addresses and sizes in reg properties. Default on most platforms: #address-cells=2, #size-cells=2 (8 bytes each).

StructsΒ§

FdtHeader πŸ”’

ConstantsΒ§

DEFAULT_HHDM_OFFSET πŸ”’
Default HHDM offset for x86_64 (4 GiB). Used when DTB doesn’t specify one.
MAX_CSTRING_LEN πŸ”’
Maximum string length for FDT strings
MAX_DTB_MEMORY_REGIONS πŸ”’
Maximum number of memory regions supported from DTB

StaticsΒ§

DTB_MEMORY_MAP πŸ”’
Static storage for memory map parsed from DTB.

FunctionsΒ§

build_kernel_args_from_dtb⚠
Parse the Flattened Device Tree and build a KernelArgs structure.
derive_hhdm_offset πŸ”’
Derive HHDM offset from the memory map.
find_rsdp_from_efi_systab πŸ”’ ⚠
Find RSDP from EFI System Table.
parse_chosen_node πŸ”’ ⚠
Parse /chosen node for bootargs, initrd, stdout-path, uefi-systab.
parse_fdt_header πŸ”’ ⚠
parse_framebuffer πŸ”’ ⚠
Parse framebuffer information from DTB.
parse_memory_nodes πŸ”’ ⚠
Parse /memory nodes to build the memory map.
parse_root_properties πŸ”’ ⚠
Parse root node properties to extract #address-cells and #size-cells.
read_be32 πŸ”’ ⚠
Read a big-endian 32-bit value.
read_be64 πŸ”’ ⚠
Read a big-endian 64-bit value.
read_be_int πŸ”’ ⚠
Read a big-endian integer of num_bytes bytes (1–8).
read_cstring πŸ”’ ⚠
Read a null-terminated string from memory.
read_prop_u64 πŸ”’ ⚠
Read a property value as u64 (32 or 64 bit depending on prop_len).
read_reg_property πŸ”’ ⚠
Read a reg property value using the correct cell sizes.