User Tools

Site Tools


u-boot_configuration

Overview

Show the result of doing a configuration, using Zynq Zedboard as an example. The output in the generated .config file includes the following (among much more):

CONFIG_ARM=y
CONFIG_SYS_ARCH="arm"
CONFIG_SYS_CPU="armv7"
CONFIG_SYS_SOC="zynq"
CONFIG_SYS_VENDOR="xilinx"
CONFIG_SYS_BOARD="zynq"
CONFIG_SYS_CONFIG_NAME="zynq-common"
...
CONFIG_CPU_V7A=y
CONFIG_SYS_ARM_ARCH=7
...
CONFIG_ARCH_ZYNQ=y

So which files contribute to that, and how is it generated?

Files

Files and directories that contribute to the final configuration of a Zedboard (not necessarily a complete list):

  • Makefile
  • config.mk
  • configs/
    • zynq_zed_defconfig
  • include/
    • configs/
      • zynq-common.h
  • arch/
    • arm/
      • Makefile
      • Kconfig
      • config.mk
      • mach-zynq/
      • cpu/
        • armv7/
  • board/
    • xilinx/
      • common/
        • board.c
      • zynq/
        • Makefile
        • Kconfig
        • board.c

Makefile

...
export ARCH CPU BOARD VENDOR SOC CPUDIR BOARDDIR
...
ifeq ($(autoconf_is_old),)
include config.mk
include arch/$(ARCH)/Makefile
endif
...

config.mk

ARCH := $(CONFIG_SYS_ARCH:"%"=%)
CPU := $(CONFIG_SYS_CPU:"%"=%)
ifdef CONFIG_SPL_BUILD
ifdef CONFIG_TEGRA
CPU := arm720t
endif
endif
BOARD := $(CONFIG_SYS_BOARD:"%"=%)
ifneq ($(CONFIG_SYS_VENDOR),)
VENDOR := $(CONFIG_SYS_VENDOR:"%"=%)
endif
ifneq ($(CONFIG_SYS_SOC),)
SOC := $(CONFIG_SYS_SOC:"%"=%)
endif

# Some architecture config.mk files need to know what CPUDIR is set to,
# so calculate CPUDIR before including ARCH/SOC/CPU config.mk files.
# Check if arch/$ARCH/cpu/$CPU exists, otherwise assume arch/$ARCH/cpu contains
# CPU-specific code.
CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)

sinclude $(srctree)/arch/$(ARCH)/config.mk      # include architecture dependend rules
sinclude $(srctree)/$(CPUDIR)/config.mk         # include  CPU  specific rules

ifdef   SOC
sinclude $(srctree)/$(CPUDIR)/$(SOC)/config.mk  # include  SoC  specific rules
endif
ifneq ($(BOARD),)
ifdef   VENDOR
BOARDDIR = $(VENDOR)/$(BOARD)
else
BOARDDIR = $(BOARD)
endif
endif
ifdef   BOARD
sinclude $(srctree)/board/$(BOARDDIR)/config.mk # include board specific rules
endif

configs/

zynq_zed_defconfig

CONFIG_ARM=y
CONFIG_ARCH_ZYNQ=y
... much more ...

include/

configs/

zynq-common.h

Consulted from arch/arm/mach-zynq/Kconfig.

arch/arm/

Kconfig

config SYS_ARCH
        default "arm"

... snip ...

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
        
... snip ...

Makefile

machine-$(CONFIG_ARCH_ZYNQ)             += zynq
machdirs := $(patsubst %,arch/arm/mach-%/,$(machine-y))
head-y := arch/arm/cpu/$(CPU)/start.o
...
libs-y += arch/arm/cpu/$(CPU)/
libs-y += arch/arm/cpu/
libs-y += arch/arm/lib/

mach-zynq/

Kconfig

config SYS_BOARD
        string "Board name"
        default "zynq"

config SYS_VENDOR
        string "Vendor name"
        default "xilinx"

config SYS_SOC
        default "zynq"

config SYS_CONFIG_NAME
        string "Board configuration name"
        default "zynq-common"
        help
          This option contains information about board configuration name.
          Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header
          will be used for board configuration.

make cfg

In addition to generating the appropriate .config file, you can go one step further and produce the subsequent u-boot.cfg file with:

$ make cfg

Relevant entries that define the remainder of the build:

#define CONFIG_SYS_CPU "armv7"
#define CONFIG_SYS_CONFIG_NAME "zynq-common"
#define CONFIG_BOARDDIR board/xilinx/zynq
#define CONFIG_CPU_V7A 1
#define CONFIG_SYS_VENDOR "xilinx"
#define CONFIG_SYS_ARCH "arm"
#define CONFIG_SYS_BOARD "zynq"
#define CONFIG_SYS_ARM_ARCH 7
#define CONFIG_ARM 1
#define CONFIG_ARCH_ZYNQ 1
u-boot_configuration.txt · Last modified: 2019/04/08 09:08 by rpjday