设备树和代码大小 [英] Device Tree and code size

查看:31
本文介绍了设备树和代码大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

根据我对设备树的理解,主要用途之一是从驱动程序中删除特定于平台的代码以支持多个平台.设备树如何处理单个外围设备的多个配置?

As per my understanding of device trees, one of main uses is to remove platform specific code from drivers to support multiple platforms. How does device tree handle multiple configuration for a single peripheral?

例如,如果我想在平台 A 中使用 LCD 面板 A,在平台 B 中使用 LCD 面板 B,我是否需要在最终的二进制文件中同时保留 LCD 面板 A 和面板 B 的相关代码?如果是这种情况,并且有多个外围设备有多个选项,那么二进制文件中似乎会有大量额外代码.

For example if I want to use LCD Panel A in Platform A and LCD Panel B in Platform B, do I need to keep both LCD Panel A and Panel B related code in the final binary? If that is the case and there are multiple peripherals with more than one option, it seems there will be huge additional code in the binary.

推荐答案

假设你有 5 个 LCD 面板和 5 个平台(机器),每个面板保留 5 个 dtsi 文件,每个平台/机器有不同的 dtsi 文件.

Suppose consider if you have 5 LCD panels and 5 platform(machines), keep 5 dtsi files each for each panel and have different dtsi files for each platform/machine.

对于单一配置:在您感兴趣的特定平台/机器的 dtsi 文件中包含特定的 dtsi 面板文件.结果:- 通过这种方式,您不必在板文件中传递所有面板配置和开关 LCD 选项.简而言之,您不必为新机器创建单独的电路板文件,而是拥有多个设备树文件,并在构建过程中包含您感兴趣的任何一个.

For single configuration: Include particular dtsi panel file inside dtsi file of particular platform/machine of your interest. Outcome: - By this way you don't have to pass all the panel configurations and on-off LCD options in your board file. In simple you don't have to create separate board files for your new machine,instead have multiple device tree files and include any one of your interest during build.

对于多重配置:您可以在您感兴趣的机器 dtsi 文件中添加 n 个面板 dtsi 文件.通过在 defconfig 文件中启用/禁用特定的 LCD 面板,您可以在运行时启用任何 LCD 面板驱动程序.结果:- 通过这种方式,您可以避免在单板文件中添加 1000 个面板配置(您知道它有多混乱),而是在机器 dt 文件中添加 1000 个 dtsi 文件和 1000 个 dt 头面板文件,并在 defconfig 中提高特定面板标志.这将减轻工作.在简单的单板文件和包含所有文件的 dtb 中.减少整体内核大小.

For multiple configuration: you can add n panel dtsi files inside your machine dtsi file of interest. and by enabling/disabling particular lcd panel in defconfig file you can have any LCD panel driver enabled at run-time. Outcome: - By this way , you avoid 1000 panel configurations added in single board file(you know how messy it is), Instead have 1000 dtsi files and add 1000 dt header panel files inside machine dt file and raise particular panel flag in defconfig. this will ease the job. In simple- single board file and dtb containing all the files. reduces overall kernel size.

这篇关于设备树和代码大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆