上一节我们学习了dts文件的格式,dts文件是方便我们书写和读写的格式。本节我们来学习一下经过Device Tree Compiler编译,Device Tree source file变成了Device Tree Blob(又称作flattened device tree)的格式。
首先先给出dtb文件的格式
一个dtb文件分为4个段,分别是ftd_header,memory reservation block,structure block,strings block
1.dtb的起始段
struct fdt_header {
uint32_t magic;
uint32_t totalsize;
uint32_t off_dt_struct;
uint32_t off_dt_strings;
uint32_t off_mem_rsvmap;
uint32_t version;
uint32_t last_comp_version;
uint32_t boot_cpuid_phys;
uint32_t size_dt_strings;
uint32_t size_dt_struct;
};