使用int fdt_getprop(const void *fdt, int nodeoffset, const char *name, int *len)函数来获取属性的长度。 参数fdt是 FDT blob 的地址。 参数nodeoffset是节点偏移量,表示要查找属性的节点。 参数name是属性名称,即“abcd”。 参数len是一个指向整数的指针,用于存储属性的长度。 通过获取到的长度动态分配内...
bootargs); i++) {// 获取/chosen节点的bootargs、bootargs_ext属性值bootargs = fdt_getprop(fdt, ...
int fdt_path_offset(const void *fdt, const char *path) eg:node = fdt_path_offset(gd->fdt_blob, “/aliases”); 功能:获得dtb下某个节点的路径path的偏移。这个偏移就代表了这个节点。 fdt_getprop const void *fdt_getprop(const void *fdt, int nodeoffset, const char *name, int *lenp) eg...
(1) 首先执行boot_fit命令,对于FIT uImage,其中地址范围0x00000000~0x00000027表示的是fdt_header结构体的成员信息。 因此会调用fit_get_blob函数获取boot/recovery分区(如果进入的是normal系统,则获取boot分区;如果进入的是recovery系统,则获取recovery分区)第一个扇区数据,并对fdt_header结构体进行校验判断是不是FIT ...
/* Get a pointer to the FDT */ gd->fdt_blob = __dtb_dt_begin;//如果使用 # elif defined CONFIG_OF_SEPARATE # ifdef CONFIG_SPL_BUILD /* FDT is at end of BSS unless it is in a different memory region */ if (IS_ENABLED(CONFIG_SPL_SEPARATE_BSS)) ...
error("Not able to get MDIO address space\n"); return -ENOENT; } priv->data.mdio_base = mdio_base; } if (!strncmp(name, "slave", 5)) { u32 phy_id[2]; if (slave_index >= priv->data.slaves) continue; phy_mode = fdt_getprop(fdt, subnode, "phy-mode", NULL); ...
return 0; // 成功 } // 在需要的时候,可以使用fdt_getprop等函数来获取设备树中的信息 const char *model = fdt_getprop(gd->fdt_blob, 0, "model", NULL); if (model) { printf("Model: %s ", model); } 4. 设备树在uboot中的一些应用场景 硬件识别与初始化:U-Boot通过设备树获取硬件设...
model = fdt_getprop(gd->fdt_blob, 0, "model", NULL);那是不是可以说明uboot采用了这个am57xx-beagle-x15-revc.dtb设备树文件,但是我在uboot代码里面没有找到根据自身板子自动识别设备树的代码?这是我的疑问点 例如am335x中u-boot/include/configs/am335x_evm.h会有相关的代码。
= fdt_getprop(gd->fdt_blob, 0, "model", NULL); printf("++++++++++++++++++++++\r\n"); if (model printf("Model: %s\n", model); #endif return checkboard(); } 第11行,调用fdt_get函数,通过设备树地址gd->fdtblob找到名字为“model”的板子信息。以imx6ull ...
int fdt_path_offset(const void* fdt, const char* path); // 这个函数接收设备树和节点路径,返回该节点在设备树地址中的偏移 const void* fdt_getprop(const void* fdt, int nodeoffset, const char* name, int* lenp); // 这个函数接收设备树和一个节点在设备树中的地址偏移,以及该节点的某个 ...