1./u-boot-2019.07/Kconfig 是顶层Kconfig
mainmenu "U-Boot $UBOOTVERSION Configuration" #这是总menu
2.source "arch/Kconfig" #然后就引用了arch目录下的Kconfig 这个Kconfig中可以选择不同的架构,有arm M68K MIPS等
choice
prompt "Architecture select"
default SANDBOX
config ARC
bool "ARC architecture"
select ARCH_EARLY_INIT_R
select ARC_TIMER
select CLK
select HAVE_PRIVATE_LIBGCC
select SUPPORT_OF_CONTROL
select TIMER
config ARM
bool "ARM architecture"
select CREATE_ARCH_SYMLINK
select HAVE_PRIVATE_LIBGCC if !ARM64
select SUPPORT_OF_CONTROL
config M68K
bool "M68000 architecture"
select HAVE_PRIVATE_LIBGCC
select SYS_BOOT_GET_CMDLINE
select SYS_BOOT_GET_KBD
select SUPPORT_OF_CONTROL
config MICROBLAZE
bool "MicroBlaze architecture"
select SUPPORT_OF_CONTROL
imply CMD_IRQ
.
.
.
source "arch/arc/Kconfig"
source "arch/arm/Kconfig"
source "arch/m68k/Kconfig"
source "arch/microblaze/Kconfig" #最后引入了各个架构目录下的Kconfig
3./u-boot-2019.07/arch/arm/Kconfig
menu "ARM architecture"
depends on ARM
config SYS_ARCH
default "arm" #这里定义了CONFIG_SYS_ARCH
config CPU_V7A
bool
select HAS_THUMB2
select HAS_VBAR
select SYS_CACHE_SHIFT_6
imply SYS_ARM_MMU #CPU_V7A还会选择一些宏定义开
config SYS_CPU
default "arm720t" if CPU_ARM720T
default "arm920t" if CPU_ARM920T
default "arm926ejs" if CPU_ARM926EJS
default "arm946es" if CPU_ARM946ES
default "arm1136" if CPU_ARM1136
default "arm1176" if CPU_ARM1176
default "armv7" if CPU_V7A
default "armv7" if CPU_V7R
default "armv7m" if CPU_V7M
default "pxa" if CPU_PXA
default "sa1100" if CPU_SA1100
default "armv8" if ARM64 #这里定义了CONFIG_SYS_CPU(需要预先定义CPU_V7A)
choice
prompt "Target select"
default TARGET_HIKEY
config ARCH_S5PC1XX
bool "Samsung S5PC1XX"
select CPU_V7A
select DM
select DM_GPIO
select DM_I2C
select DM_SERIAL
imply CMD_DM
config ARCH_ZYNQ
bool "Xilinx Zynq based platform"
select BOARD_EARLY_INIT_F if WDT
select CLK
select CLK_ZYNQ
select CPU_V7A
select DM
select DM_ETH if NET
select DM_MMC if MMC
select DM_SERIAL
select DM_SPI
select DM_SPI_FLASH
select DM_USB if USB
select OF_CONTROL
select SPI
select SPL_BOARD_INIT if SPL
select SPL_CLK if SPL
select SPL_DM if SPL
select SPL_OF_CONTROL if SPL
select SPL_SEPARATE_BSS if SPL
select SUPPORT_SPL
imply ARCH_EARLY_INIT_R
imply BOARD_LATE_INIT
imply CMD_CLK
imply CMD_DM
imply CMD_SPL
imply FAT_WRITE #在这里选择了CPU_V7A ARCH_S5PC1XX ARCH_ZYNQ在menuconfig中选中即定义了。
source "arch/arm/mach-s5pc1xx/Kconfig"
source "arch/arm/mach-zynq/Kconfig" #如果有mach需要将Kconfig加入
好像并没有包含source "board/samsung/goni/Kconfig"
source "board/xilinx/zynq/Kconfig" #将board中的Kconfig加入
4.arch/arm/mach-s5pc1xx/Kconfig 答案在这里,s5pc1xx下有两个board需要选择,这其中包含了source "board/samsung/goni/Kconfig",所以每家公司的代码风格不大一样。
if ARCH_S5PC1XX
choice
prompt "S5PC1XX board select"
optional
config TARGET_S5P_GONI
bool "S5P Goni board"
select OF_CONTROL
select BLK
select DM_MMC #选中goni board
config TARGET_SMDKC100
bool "Support smdkc100 board"
select OF_CONTROL
endchoice
config SYS_SOC
default "s5pc1xx"
source "board/samsung/goni/Kconfig"
source "board/samsung/smdkc100/Kconfig"
endif
5.arch/arm/mach-zynq/Kconfig #定义了SYS_BOARD等 而s5pc1xx不是在这里定义的。
if ARCH_ZYNQ
config SPL_LDSCRIPT
default "arch/arm/mach-zynq/u-boot-spl.lds"
config SYS_BOARD
string "Board name"
default "zynq"
config SYS_VENDOR
string "Vendor name"
default "xilinx"
config SYS_SOC
default "zynq"
endif
6.board/samsung/goni/Kconfig #定义了SYS_BOARD等 在arch/arm/mach-s5pc1xx/Kconfig下一层因为if TARGET_S5P_GONI是 arch/arm/mach-s5pc1xx/Kconfig中选定的
if TARGET_S5P_GONI
config SYS_BOARD
default "goni"
config SYS_VENDOR
default "samsung"
config SYS_SOC
default "s5pc1xx"
config SYS_CONFIG_NAME
default "s5p_goni"
endif
7.board/xilinx/zynq/Kconfig 和arch/arm/mach-zynq/Kconfig 感觉平行层级 都用的if ARCH_ZYNQ
# SPDX-License-Identifier: GPL-2.0
#
# Copyright (c) 2018, Xilinx, Inc.
if ARCH_ZYNQ
config CMD_ZYNQ
bool "Enable Zynq specific commands"
default y
help
Enables Zynq specific commands.
config CMD_ZYNQ_AES
bool "Enable zynq aes command for decryption of encrypted images"
depends on CMD_ZYNQ
depends on FPGA_ZYNQPL
help
Decrypts the encrypted image present in source address
and places the decrypted image at destination address.
config CMD_ZYNQ_RSA
bool "Enable zynq rsa command for loading secure images"
default y
depends on CMD_ZYNQ
depends on CMD_ZYNQ_AES
help
Enabling this will support zynq secure image verification.
The secure image is a xilinx specific BOOT.BIN with
either authentication or encryption or both encryption
and authentication feature enabled while generating
BOOT.BIN using Xilinx bootgen tool.
endif
在Kconfig体系结构中,可以明显看到这样一个顺序
1.选架构 ARCH arm
2.选Target ARCH 平台 某一系列
3.选Board 即具体的板子