以下例子都以project X项目tiny210(s5pv210平台,armv7架构)为例
[uboot] uboot流程系列
:
[project X] tiny210(s5pv210)上电启动流程(BL0-BL2)
[project X] tiny210(s5pv210)从存储设备加载代码到DDR
[uboot] (第一章)uboot流程——概述
[uboot] (第二章)uboot流程——uboot-spl编译流程
[uboot] (第三章)uboot流程——uboot-spl代码流程
[uboot] (第四章)uboot流程——uboot编译流程
[uboot] (第五章)uboot流程——uboot启动流程
[uboot] (番外篇)global_data介绍
[uboot] (番外篇)uboot relocation介绍
建议先看《[[uboot] (番外篇)uboot relocation介绍》和《[uboot] (第四章)uboot流程——uboot编译流程》
=================================================================================
因为在学习uboot的driver module,发现有必要先把uboot的fdt整明白点。所以这里就先学习一下fdt咯。
一、介绍
FDT,flatted device tree,扁平设备树。熟悉linux的人对这个概念应该不陌生。
简单理解为将部分设备信息结构存放到device tree文件中。
uboot最终将其device tree编译成dtb文件,使用过程中通过解析该dtb来获取板级设备信息。
uboot的dtb和kernel中的dtb是一致的。这部分建议直接参考wowo的dtb的文章
Device Tree(一):背景介绍
Device Tree(二):基本概念
Device Tree(三):代码分析
关于uboot的fdt,可以参考doc/README.fdt-control。
二、dtb介绍
1、dtb结构介绍
结构体如下 |
---|
DTB header |
alignment gap |
memory reserve map |
alignment gap |
device-tree structure |
alignment gap |
device-tree string |
dtb header结构如下:
结构体如下 |
---|
magic |
totalsize |
off_dt_struct |
off_dt_strings |
off_mem_rsvmap |
version |
…… |
其中,magic是一个固定的值,0xd00dfeed(大端)或者0xedfe0dd0(小端)。
以s5pv210-tiny210.dtb为例:
执行”hexdump -C s5pv210-tiny210.dtb | more”命令
@:dts$ hexdump -C s5pv210-tiny210.dtb | more
00000000 d0 0d fe ed 00 00 5a cc 00