kconfig: support board-specific defconfig

The current defconfigs are BIOS-specific which makes it difficult to maintain
multiple defconfigs for boards running the same BIOS.

This patch re-organizes the defconfigs to be board-specific. A command line
option BOARD is introduced to specify a board on which the current build targets
at. The original PLATFORM is kept for backward compatibility which redirects to
apl-mrb and nuc6cayh for sbl and uefi, respectively.

The getting started guide is also updated accordingly.

v1 -> v2:

* Rewrite 'up2' to 'UP2'.

Tracked-On: #1588
Signed-off-by: Junjie Mao <junjie.mao@intel.com>
Reviewed-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Junjie Mao
2018-10-19 21:54:26 +08:00
committed by lijinxia
parent 8bde372c32
commit b9d54f4ab3
8 changed files with 77 additions and 26 deletions

View File

@@ -45,6 +45,16 @@ config PLATFORM
default "uefi" if PLATFORM_UEFI
default "sbl" if PLATFORM_SBL
config BOARD
string "Target board"
help
The target board this build runs on top of.
config DEFCONFIG_LIST
string
option defconfig_list
default "arch/x86/configs/$BOARD.config"
config RELEASE
bool "Release build"
default n

View File

@@ -1,2 +1,3 @@
CONFIG_BOARD="apl-mrb"
# CONFIG_PLATFORM_UEFI is not set
CONFIG_PLATFORM_SBL=y

View File

@@ -0,0 +1 @@
nuc6cayh.config

View File

@@ -0,0 +1,3 @@
CONFIG_BOARD="NUC6CAYH"
CONFIG_PLATFORM_UEFI=y
# CONFIG_PLATFORM_SBL is not set

View File

@@ -1,2 +1,3 @@
CONFIG_BOARD="UP2"
CONFIG_PLATFORM_UEFI=y
# CONFIG_PLATFORM_SBL is not set

View File

@@ -30,9 +30,27 @@ endif
endif
-include $(HV_OBJDIR)/$(HV_CONFIG_MK)
$(eval $(call override_config,PLATFORM,sbl))
# Backward-compatibility for PLATFORM=(sbl|uefi)
# * PLATFORM=sbl is equivalent to BOARD=apl-mrb
# * PLATFORM=uefi is equivalent to BOARD=apl-nuc (i.e. NUC6CAYH)
ifndef BOARD
ifeq ($(PLATFORM),sbl)
BOARD=apl-mrb
else ifeq ($(PLATFORM),uefi)
BOARD=apl-nuc
endif
endif
$(eval $(call override_config,BOARD,apl-mrb))
$(eval $(call override_config,RELEASE,n))
ifdef BOARD
TARGET_BOARD=$(BOARD)
else
TARGET_BOARD=$(CONFIG_BOARD)
endif
$(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
$(eval $(call check_dep_py3lib,kconfiglib,KCONFIG_DEPS))
@@ -59,8 +77,8 @@ $(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
.PHONY: defconfig
defconfig: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR)
@python3 $(KCONFIG_DIR)/defconfig.py Kconfig \
arch/x86/configs/$(CONFIG_PLATFORM).config \
@BOARD=$(TARGET_BOARD) \
python3 $(KCONFIG_DIR)/defconfig.py Kconfig \
$(HV_OBJDIR)/$(HV_CONFIG)
# Use silentoldconfig to forcefully update the current .config, or generate a
@@ -73,9 +91,9 @@ defconfig: $(KCONFIG_DEPS)
.PHONY: oldconfig
oldconfig: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR)
@python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig \
@BOARD=$(TARGET_BOARD) \
python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig \
$(HV_OBJDIR)/$(HV_CONFIG) \
PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y \
RELEASE=$(RELEASE)
# Minimize the current .config. This target can be used to generate a defconfig