Makefile: separate PLATFORM into BOARD+FIRMWARE

Combination of BOARD and FIRMWARE is a more precious definition.
And we decide PLATFORM_XXX based on FIRMWARE, remove relative one in
board config.

We reserve PLATFORM for backward compatibility.

Tracked-On: #1995
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Yin Fengwei < fengwei.yin@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
This commit is contained in:
Tw 2018-12-11 16:00:56 +08:00 committed by wenlingz
parent 064a31067f
commit 59c2b33a90
4 changed files with 40 additions and 20 deletions

View File

@ -1,7 +1,33 @@
# global helper variables
T := $(CURDIR)
# PLATFORM is now deprecated, just reserve for compatability
ifdef PLATFORM
$(warning PLATFORM is deprecated, pls use BOARD instead)
endif
PLATFORM ?= uefi
# 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)
ifeq ($(PLATFORM),sbl)
BOARD ?= apl-mrb
else ifeq ($(PLATFORM),uefi)
BOARD ?= apl-nuc
endif
ifndef BOARD
$(error BOARD must be set (apl-mrb, apl-nuc, cb2_dnv, nuc6cayh)
endif
ifeq ($(BOARD),apl-nuc)
FIRMWARE ?= uefi
else ifeq ($(BOARD),nuc6cayh)
FIRMWARE ?= uefi
endif
FIRMWARE ?= sbl
RELEASE ?= 0
O ?= build
@ -18,13 +44,13 @@ export TOOLS_OUT
all: hypervisor devicemodel tools
hypervisor:
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) PLATFORM=$(PLATFORM) RELEASE=$(RELEASE) clean
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) PLATFORM=$(PLATFORM) RELEASE=$(RELEASE)
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) clean
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE)
sbl-hypervisor:
@mkdir -p $(HV_OUT)-sbl
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl PLATFORM=sbl RELEASE=$(RELEASE) clean
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl PLATFORM=sbl RELEASE=$(RELEASE)
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl BOARD=apl-mrb FIRMWARE=sbl RELEASE=$(RELEASE) clean
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl BOARD=apl-mrb FIRMWARE=sbl RELEASE=$(RELEASE)
devicemodel: tools
make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) clean
@ -47,10 +73,10 @@ clean:
install: hypervisor-install devicemodel-install tools-install
hypervisor-install:
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) PLATFORM=$(PLATFORM) RELEASE=$(RELEASE) install
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT) BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) install
sbl-hypervisor-install:
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl PLATFORM=sbl RELEASE=$(RELEASE) install
make -C $(T)/hypervisor HV_OBJDIR=$(HV_OUT)-sbl BOARD=$(BOARD) FIRMWARE=$(FIRMWARE) RELEASE=$(RELEASE) install
devicemodel-install:
make -C $(T)/devicemodel DM_OBJDIR=$(DM_OUT) install

View File

@ -1,4 +1,3 @@
# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)
CONFIG_PLATFORM_UEFI=y
CONFIG_BOARD="NUC6CAYH"
CONFIG_SERIAL_LEGACY=y

View File

@ -1,5 +1,4 @@
# Generated by Kconfiglib (https://github.com/ulfalizer/Kconfiglib)
CONFIG_PLATFORM_UEFI=y
CONFIG_BOARD="UP2"
CONFIG_SERIAL_PCI=y
CONFIG_SERIAL_PCI_BDF=0x00C1

View File

@ -29,6 +29,13 @@ override RELEASE := n
endif
endif
OVERWRITTEN := ""
ifeq ($(FIRMWARE),sbl)
OVERWRITTEN += "PLATFORM_SBL=y"
else ifeq ($(FIRMWARE),uefi)
OVERWRITTEN += "PLATFORM_UEFI=y"
endif
-include $(HV_OBJDIR)/$(HV_CONFIG_MK)
ifeq ($(shell [ $(HV_OBJDIR)/$(HV_CONFIG) -nt $(HV_OBJDIR)/$(HV_CONFIG_MK) ] && echo 1),1)
# config.mk may be outdated if .config has been overwritten. To update config.mk
@ -37,17 +44,6 @@ ifeq ($(shell [ $(HV_OBJDIR)/$(HV_CONFIG) -nt $(HV_OBJDIR)/$(HV_CONFIG_MK) ] &&
-include $(HV_OBJDIR)/$(HV_CONFIG)
endif
# 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))
@ -97,7 +93,7 @@ oldconfig: $(KCONFIG_DEPS)
@BOARD=$(TARGET_BOARD) \
python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig \
$(HV_OBJDIR)/$(HV_CONFIG) \
RELEASE=$(RELEASE)
RELEASE=$(RELEASE) $(OVERWRITTEN)
# Minimize the current .config. This target can be used to generate a defconfig
# for future use.