본문으로 건너뛰기

u-boot configuration

  • target: Odroid-N2
  • tag: v2019.07

Tips to add/remove boards

When adding a new board, the following steps are generally needed:

[1] Add a header file include/configs/<target>.h
[2] Make sure to define necessary CONFIG_SYS_* in Kconfig:
Define CONFIG_SYS_CPU="cpu" to compile arch/<arch>/cpu/<cpu>
Define CONFIG_SYS_SOC="soc" to compile arch/<arch>/cpu/<cpu>/<soc>
Define CONFIG_SYS_VENDOR="vendor" to compile board/<vendor>/common/*
and board/<vendor>/<board>/*
Define CONFIG_SYS_BOARD="board" to compile board/<board>/*
(or board/<vendor>/<board>/* if CONFIG_SYS_VENDOR is defined)
Define CONFIG_SYS_CONFIG_NAME="target" to include
include/configs/<target>.h
[3] Add a new entry to the board select menu in Kconfig.
The board select menu is located in arch/<arch>/Kconfig or
arch/<arch>/*/Kconfig.
[4] Add a MAINTAINERS file
It is generally placed at board/<board>/MAINTAINERS or
board/<vendor>/<board>/MAINTAINERS
[5] Add configs/<target>_defconfig

When removing an obsolete board, the following steps are generally needed:

[1] Remove configs/<target>_defconfig
[2] Remove include/configs/<target>.h if it is not used by any other boards
[3] Remove board/<vendor>/<board>/* or board/<board>/* if it is not used
by any other boards
[4] Update MAINTAINERS if necessary
[5] Remove the unused entry from the board select menu in Kconfig
[6] Add an entry to doc/README.scrapyard

Configuration files for use in C sources

  • include/generated/autoconf.h (generated by Kconfig for Normal)
  • include/configs/<board>.h (exists for all boards)

Configuration file for use in makefiles

  • include/config/auto.conf (generated by Kconfig)
  • include/autoconf.mk (generated by the old config for Normal)
  • spl/include/autoconfig.mk (generated by the old config for SPL)
  • tpl/include/autoconfig.mk (generated by the old config for TPL)

When adding a new CONFIG macro, it is highly recommended to add it to Kconfig rather than to a header file.

CONFIG_SYS_CONFIG_NAME을 설정하면 u-boot 부팅시 u-boot/include/configs/<CONFIG_SYS_CONFIG_NAME>.h와 아래 파일 들을 파싱하여 실행됩니다.

u-boot/scripts/kconfig/Makefile
SRCARCH := ..

%_defconfig: $(obj)/conf
$(Q)$< $(silent) --defconfig=arch/$(SRCARCH)/configs/$@ $(Kconfig)
u-boot/scripts/Makefile.autoconf
# SPDX-License-Identifier: GPL-2.0
# This helper makefile is used for creating
# - symbolic links (arch/$ARCH/include/asm/arch
# - include/autoconf.mk, {spl,tpl}/include/autoconf.mk
# - include/config.h
#
# When our migration to Kconfig is done
# (= When we move all CONFIGs from header files to Kconfig)
# this makefile can be deleted.

Etc

CONFIG_SYS_CPU=

./config.mk:43:CPUDIR=arch/$(ARCH)/cpu$(if $(CPU),/$(CPU),)
./scripts/Makefile.autoconf:130: dest=arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU))

CONFIG_SYS_SOC=

## If arch/$(ARCH)/mach-$(SOC)/include/mach exists,
## make a symbolic link to that directory.
## Otherwise, create a symbolic link to arch/$(ARCH)/include/asm/arch-$(SOC).

CONFIG_SYS_VENDOR=

./config.mk:53:BOARDDIR = $(VENDOR)/$(BOARD)
./scripts/Makefile.spl:69:HAVE_VENDOR_COMMON_LIB = $(if $(wildcard $(srctree)/board/$(VENDOR)/common/Makefile),y,n)
./scripts/Makefile.autoconf:106: echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\

CONFIG_SYS_BOARD=

./include/common.h:156:/* $(BOARD)/$(BOARD).c */
./include/common.h:160:/* $(BOARD)/eeprom.c */
./include/common.h:179:/* $(BOARD)/$(BOARD).c */
./scripts/Makefile.spl:212:ALL-y += $(obj)/$(BOARD)-spl.bin
./scripts/Makefile.spl:325:$(obj)/$(BOARD)-spl.bin: $(obj)/u-boot-spl.bin
./scripts/Makefile.spl:326: $(if $(wildcard $(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl),\
./scripts/Makefile.spl:327: $(objtree)/spl/board/samsung/$(BOARD)/tools/mk$(BOARD)spl,\
./scripts/Makefile.autoconf:106: echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\

CONFIG_SYS_CONFIG_NAME=

./arch/Kconfig:276:       The header file include/configs/<CONFIG_SYS_CONFIG_NAME>.h
./arch/arm/mach-meson/Kconfig:87:config SYS_CONFIG_NAME
./arch/arm/mach-meson/Kconfig:92: Based on this option include/configs/<CONFIG_SYS_CONFIG_NAME>.h header
./scripts/Makefile.autoconf:109: echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>;

Reference