前言
-
u-boot 與 Linux 內核在嵌入式Linux開發中占有重要的地位,掌握 u-boot 的基礎開發,可以大大提升開發能力,并提高開發的效率。
-
u-boot 下 如何配置 板級的Kconfig 呢?u-boot 下板級的 Kconfig 是怎么包含到 主目錄下 Kconfig 中的呢?
-
下面查看一下 board 下 Kconfig 如何 包含到 主目錄下 Kconfig,也就是了解 u-boot 板級 Kconfig 組織關系
開發板示例
-
硬件平臺:正點原子 【AtomPi-CA1】rk3568 的開發板
-
代碼閱讀工具: VSCode
-
手動編譯 u-boot,命令為:
make ARCH=arm CROSS_COMPILE=aarch64-linux-gnu- atompi-ca1_defconfig
-
這里的
atompi-ca1_defconfig
存在與 u-boot 目錄下./configs/atompi-ca1_defconfig
Kconfig 包含流程
-
本篇主要記錄 Kconfig 的包含流程,比如選擇了 ARM 架構、Rockchip系列、RK3568,到某個板子具體配置,這其中的 Kconfig 的配置
-
u-boot 下有 arch 目錄,作為 架構, board 目錄,作為 板級驅動,而 u-boot 根目錄下的 Kconfig 中,并沒有 board 相關的Kconfig 路徑,只有
arch/Kconfig
-
經過梳理,發現 板級 Kconfig 的包含路徑關系如下:
-
u-boot 源碼版本: rockchip u-boot 2017.09(較老版本)
-
u-boot 根目錄 Kconfig 如下
-
u-boot
arch/Kconfig
如下
-
u-boot
arch/arm/Kconfig
如下:
-
u-boot
arch/arm/mach-rockchip/Kconfig
如下:
- u-boot
arch/arm/mach-rockchip/rk3568/Kconfig
如下:
- u-boot
board/rockchip/evb_rk3568/Kconfig
如下:由 arch 包含 board
- 初步總結,Kconfig 板級包含路徑為
Kconfig
--> arch/Kconfig--> arch/arm/Kconfig--> arch/arm/mach-rockchip/Kconfig--> arch/arm/mach-rockchip/rk3568/Kconfig
--> board/rockchip/evb_rk3568/Kconfig
小結
-
u-boot 的板級設備驅動,并沒有在 board 中體現,也就是 板級的 Kconfig 其實只是架構相關的一些配置,設備驅動主要由 板級對應的 【設備樹 dts】實現
-
u-boot 下的 board 的配置,源于 arch 的配置,通過 arch 中具體平臺的 Kconfig,最后包含到 board 目錄下的 具體 Kconfig