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 即具體的板子