u-boot pre-reloc

  • 了解pre-reloc attribute

1.Introduction

  The driver model provides two ways to pass the device information, platform data and device tree.

  In the platform data way, the pre-reloc DM scan checks if each driver has DM_FLAG_PRE_RELOC flag, that is, each driver has the pre-reloc attribute. Only drivers with DM_FLAG_PRE_RELOC will be bound before relocation.

  In the device tree control, the existence of “u-boot,dm-pre-reloc” is checked for each device node. The driver flag “DM_FLAG_PRE_RELOC” is never checked. That is, each device owns the pre-reloc attribute.

  Drivers should generally work both with platform data and device tree, but this inconsitency has made our life difficult.

1.1.Pre-Relocation Support

  For pre-relocation we simply call the driver model init function. Only drivers marked with DM_FLAG_PRE_RELOC or the device tree ‘u-boot,dm-pre-reloc’ property are initialised prior to relocation. This helps to reduce the driver model overhead. This flag applies to SPL and TPL as well, if device tree is enabled (CONFIG_OF_CONTROL) there.

  Note when device tree is enabled, the device tree ‘u-boot,dm-pre-reloc’ property can provide better control granularity on which device is bound before relocation. While with DM_FLAG_PRE_RELOC flag of the driver all devices with the same driver are bound, which requires allocation a large amount of memory. When device tree is not used, DM_FLAG_PRE_RELOC is the only way for statically declared devices via U_BOOT_DEVICE() to be bound prior to relocation.

  It is possible to limit this to specific relocation steps, by using the more specialized ‘u-boot,dm-spl’ and ‘u-boot,dm-tpl’ flags in the device tree node. For U-Boot proper you can use ‘u-boot,dm-pre-proper’ which means that it will be processed (and a driver bound) in U-Boot proper prior to relocation, but will not be available in SPL or TPL.

  To reduce the size of SPL and TPL, only the nodes with pre-relocation properties (‘u-boot,dm-pre-reloc’, ‘u-boot,dm-spl’ or ‘u-boot,dm-tpl’) are keept in their device trees (see README.SPL for details); the remaining nodes are always bound.

1.2. symbol definition

  After relocation and jumping into the real U-Boot binary it is possible to determine if a node was bound in one of SPL/TPL stages.

There are 4 settings currently in use:

  • u-boot,dm-pre-proper: U-Boot proper pre-relocation only
  • u-boot,dm-pre-reloc: legacy and indicates any of TPL or SPL Existing platforms only use it to indicate nodes needed in SPL. Should probably be replaced by u-boot,dm-spl for new platforms.
  • u-boot,dm-spl: SPL and U-Boot pre-relocation
  • u-boot,dm-tpl: TPL and U-Boot pre-relocation

2.Device tree

  The U-Boot device tree is filtered by the fdtgrep tools during the build process to generate a much smaller device tree used in SPL (spl/u-boot-spl.dtb)
with:

  • the mandatory nodes (/alias, /chosen, /config)
  • the nodes with one pre-relocation property:
    ‘u-boot,dm-pre-reloc’ or ‘u-boot,dm-spl’

fdtgrep is also used to remove:

  • the properties defined in CONFIG_OF_SPL_REMOVE_PROPS
  • all the pre-relocation properties
    (‘u-boot,dm-pre-reloc’, ‘u-boot,dm-spl’ and ‘u-boot,dm-tpl’)

All the nodes remaining in the SPL devicetree are bound (see driver-model/README.txt).

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值