背景
得到 dtb 文件以后,我们需要想办法下载到 板子中,并给 Linux 内核使用。
(高级版本的 uboot也有了 自己使用设备树支持,我们这里不讨论 uboot 使用的设备树)
Linux 内核 有关规定
根据Documentation/arm/Booting的描述,我们需要提供 参数列表 或者 设备树镜像 地址。
4. Setup boot data
------------------
Existing boot loaders: OPTIONAL, HIGHLY RECOMMENDED
New boot loaders: MANDATORY
The boot loader must provide either a tagged list or a dtb image for
passing configuration data to the kernel. The physical address of the
boot data is passed to the kernel in register r2.
Uboot 有关规定
根据上面的描述,uboot 传参有2种类型。
1)通过 tag 传递 参数列表 给 Linux 内核
通过 tag 给内核传参时,是只需要知道内核的地址就可以了。
因为uboot给内核传的参数一般是放到内存的某个地址,因为tag所占的内存比较小,所以一般都时放在内存的起始地址+0x100的位置
所以可以直接使用: bootm + 内核所在内存的地址 来运行内核
bootm
2)使用了设备树之后,一般我们是这样启动的
bootm