mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 12:12:16 +00:00
HV: make: skip duplicated PLATFORM= on command line
Since .config has PLATFORM now, it is expected that the PLATFORM= command line option is no longer necessary as long as a proper .config exists. This patch implements this expectation. Now the platform to be selected is determined by the following steps. 1. If PLATFORM= is provided on the command line, the specified value is used. 2. If there is no PLATFORM= on the command line and PLATFORM is defined in config.mk, its value is used. 3. If neither PLATFORM= on the command line nor config.mk is available, a predefined default value is used. v1 -> v2: * 'make oldconfig' should not pass CONFIG_xxx to the script since config.mk can be out-dated. * Change the default value of PLATFORM to SBL for backward compatibility of 'make all'. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com> Acked-by: Geoffroy VanCutsem <geoffroy.vancutsem@intel.com>
This commit is contained in:
parent
6df3ac0038
commit
c4493cc1f8
@ -18,7 +18,6 @@ GCC_MINOR=$(shell echo __GNUC_MINOR__ | $(CC) -E -x c - | tail -n 1)
|
|||||||
STACK_PROTECTOR := 1
|
STACK_PROTECTOR := 1
|
||||||
|
|
||||||
BASEDIR := $(shell pwd)
|
BASEDIR := $(shell pwd)
|
||||||
PLATFORM ?= sbl
|
|
||||||
HV_OBJDIR ?= $(CURDIR)/build
|
HV_OBJDIR ?= $(CURDIR)/build
|
||||||
HV_FILE := acrn
|
HV_FILE := acrn
|
||||||
|
|
||||||
@ -75,7 +74,7 @@ INCLUDE_PATH += include/debug
|
|||||||
INCLUDE_PATH += include/public
|
INCLUDE_PATH += include/public
|
||||||
INCLUDE_PATH += include/common
|
INCLUDE_PATH += include/common
|
||||||
INCLUDE_PATH += bsp/include
|
INCLUDE_PATH += bsp/include
|
||||||
INCLUDE_PATH += bsp/$(PLATFORM)/include/bsp
|
INCLUDE_PATH += bsp/$(CONFIG_PLATFORM)/include/bsp
|
||||||
INCLUDE_PATH += boot/include
|
INCLUDE_PATH += boot/include
|
||||||
INCLUDE_PATH += $(HV_OBJDIR)/include
|
INCLUDE_PATH += $(HV_OBJDIR)/include
|
||||||
|
|
||||||
@ -146,14 +145,14 @@ ifdef STACK_PROTECTOR
|
|||||||
C_SRCS += common/stack_protector.c
|
C_SRCS += common/stack_protector.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
C_SRCS += bsp/$(PLATFORM)/vm_description.c
|
C_SRCS += bsp/$(CONFIG_PLATFORM)/vm_description.c
|
||||||
C_SRCS += bsp/$(PLATFORM)/$(PLATFORM).c
|
C_SRCS += bsp/$(CONFIG_PLATFORM)/$(CONFIG_PLATFORM).c
|
||||||
C_SRCS += bsp/$(PLATFORM)/platform_acpi_info.c
|
C_SRCS += bsp/$(CONFIG_PLATFORM)/platform_acpi_info.c
|
||||||
|
|
||||||
ifeq ($(PLATFORM),uefi)
|
ifeq ($(CONFIG_PLATFORM),uefi)
|
||||||
C_SRCS += bsp/$(PLATFORM)/cmdline.c
|
C_SRCS += bsp/$(CONFIG_PLATFORM)/cmdline.c
|
||||||
else
|
else
|
||||||
ifeq ($(PLATFORM), sbl)
|
ifeq ($(CONFIG_PLATFORM), sbl)
|
||||||
C_SRCS += boot/sbl/multiboot.c
|
C_SRCS += boot/sbl/multiboot.c
|
||||||
C_SRCS += boot/sbl/hob_parse.c
|
C_SRCS += boot/sbl/hob_parse.c
|
||||||
endif
|
endif
|
||||||
@ -180,13 +179,13 @@ endif
|
|||||||
S_OBJS := $(patsubst %.S,$(HV_OBJDIR)/%.o,$(S_SRCS))
|
S_OBJS := $(patsubst %.S,$(HV_OBJDIR)/%.o,$(S_SRCS))
|
||||||
|
|
||||||
DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
|
DISTCLEAN_OBJS := $(shell find $(BASEDIR) -name '*.o')
|
||||||
VERSION := bsp/$(PLATFORM)/include/bsp/version.h
|
VERSION := bsp/$(CONFIG_PLATFORM)/include/bsp/version.h
|
||||||
|
|
||||||
.PHONY: all
|
.PHONY: all
|
||||||
all: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
|
all: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out $(HV_OBJDIR)/$(HV_FILE).bin
|
||||||
rm -f $(VERSION)
|
rm -f $(VERSION)
|
||||||
|
|
||||||
ifeq ($(PLATFORM), uefi)
|
ifeq ($(CONFIG_PLATFORM), uefi)
|
||||||
all: efi
|
all: efi
|
||||||
.PHONY: efi
|
.PHONY: efi
|
||||||
efi: $(HV_OBJDIR)/$(HV_FILE).bin
|
efi: $(HV_OBJDIR)/$(HV_FILE).bin
|
||||||
@ -197,7 +196,7 @@ install: efi
|
|||||||
make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR) RELEASE=$(RELEASE) install
|
make -C bsp/uefi/efi HV_OBJDIR=$(HV_OBJDIR) RELEASE=$(RELEASE) install
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(PLATFORM), sbl)
|
ifeq ($(CONFIG_PLATFORM), sbl)
|
||||||
install: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out
|
install: $(VERSION) $(HV_OBJDIR)/$(HV_FILE).32.out
|
||||||
install -D $(HV_OBJDIR)/$(HV_FILE).32.out $(DESTDIR)/usr/lib/acrn/$(HV_FILE).sbl
|
install -D $(HV_OBJDIR)/$(HV_FILE).32.out $(DESTDIR)/usr/lib/acrn/$(HV_FILE).sbl
|
||||||
endif
|
endif
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
choice
|
choice
|
||||||
prompt "Platform"
|
prompt "Platform"
|
||||||
default PLATFORM_UEFI
|
default PLATFORM_SBL
|
||||||
|
|
||||||
config PLATFORM_UEFI
|
config PLATFORM_UEFI
|
||||||
bool "UEFI"
|
bool "UEFI"
|
||||||
@ -11,6 +11,11 @@ config PLATFORM_SBL
|
|||||||
|
|
||||||
endchoice
|
endchoice
|
||||||
|
|
||||||
|
config PLATFORM
|
||||||
|
string
|
||||||
|
default "uefi" if PLATFORM_UEFI
|
||||||
|
default "sbl" if PLATFORM_SBL
|
||||||
|
|
||||||
config NR_IOAPICS
|
config NR_IOAPICS
|
||||||
int "Maximum number of IOAPICs supported"
|
int "Maximum number of IOAPICs supported"
|
||||||
default 1
|
default 1
|
||||||
|
@ -1,3 +1,18 @@
|
|||||||
|
# usage: override_config <symbol> <default>
|
||||||
|
#
|
||||||
|
# Given a configuration symbol (without the CONFIG_ prefix), this macro
|
||||||
|
# overrides its value as follows.
|
||||||
|
# 1. If a value is specified from command line, that value is used.
|
||||||
|
# 2. If neither config.mk nor the command line specifies a value, the given
|
||||||
|
# default is used.
|
||||||
|
define override_config =
|
||||||
|
ifdef $(1)
|
||||||
|
CONFIG_$(1) := $($(1))
|
||||||
|
else ifndef CONFIG_$(1)
|
||||||
|
CONFIG_$(1) := $(2)
|
||||||
|
endif
|
||||||
|
endef
|
||||||
|
|
||||||
HV_CONFIG := .config
|
HV_CONFIG := .config
|
||||||
HV_DEFCONFIG := defconfig
|
HV_DEFCONFIG := defconfig
|
||||||
HV_CONFIG_H := include/config.h
|
HV_CONFIG_H := include/config.h
|
||||||
@ -5,6 +20,9 @@ HV_CONFIG_MK := include/config.mk
|
|||||||
|
|
||||||
KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig
|
KCONFIG_DIR := $(BASEDIR)/../scripts/kconfig
|
||||||
|
|
||||||
|
-include $(HV_OBJDIR)/$(HV_CONFIG_MK)
|
||||||
|
$(eval $(call override_config,PLATFORM,sbl))
|
||||||
|
|
||||||
$(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
|
$(eval $(call check_dep_exec,python3,KCONFIG_DEPS))
|
||||||
$(eval $(call check_dep_exec,pip3,KCONFIG_DEPS))
|
$(eval $(call check_dep_exec,pip3,KCONFIG_DEPS))
|
||||||
$(eval $(call check_dep_py3lib,kconfiglib,KCONFIG_DEPS))
|
$(eval $(call check_dep_py3lib,kconfiglib,KCONFIG_DEPS))
|
||||||
@ -28,28 +46,35 @@ $(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
|
|||||||
.PHONY: defconfig
|
.PHONY: defconfig
|
||||||
defconfig: $(KCONFIG_DEPS)
|
defconfig: $(KCONFIG_DEPS)
|
||||||
@mkdir -p $(HV_OBJDIR)
|
@mkdir -p $(HV_OBJDIR)
|
||||||
@python3 $(KCONFIG_DIR)/defconfig.py Kconfig arch/x86/configs/$(PLATFORM).config $(HV_OBJDIR)/$(HV_CONFIG)
|
@python3 $(KCONFIG_DIR)/defconfig.py Kconfig \
|
||||||
|
arch/x86/configs/$(CONFIG_PLATFORM).config \
|
||||||
|
$(HV_OBJDIR)/$(HV_CONFIG)
|
||||||
|
|
||||||
# Use silentoldconfig to forcefully update the current .config, or generate a
|
# Use silentoldconfig to forcefully update the current .config, or generate a
|
||||||
# new one if no previous .config exists. This target can be used as a
|
# new one if no previous .config exists. This target can be used as a
|
||||||
# prerequisite of all the others to make sure that the .config is consistent
|
# prerequisite of all the others to make sure that the .config is consistent
|
||||||
# even it has been modified manually before.
|
# even it has been modified manually before.
|
||||||
|
#
|
||||||
|
# Note: Should not pass CONFIG_xxx to silentoldconfig here because config.mk can
|
||||||
|
# be out-dated.
|
||||||
.PHONY: oldconfig
|
.PHONY: oldconfig
|
||||||
oldconfig: $(KCONFIG_DEPS)
|
oldconfig: $(KCONFIG_DEPS)
|
||||||
@mkdir -p $(HV_OBJDIR)
|
@mkdir -p $(HV_OBJDIR)
|
||||||
@python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y
|
@python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig \
|
||||||
|
$(HV_OBJDIR)/$(HV_CONFIG) \
|
||||||
|
PLATFORM_$(shell echo $(PLATFORM) | tr a-z A-Z)=y
|
||||||
|
|
||||||
# Minimize the current .config. This target can be used to generate a defconfig
|
# Minimize the current .config. This target can be used to generate a defconfig
|
||||||
# for future use.
|
# for future use.
|
||||||
.PHONY: minimalconfig
|
.PHONY: minimalconfig
|
||||||
minimalconfig: $(HV_OBJDIR)/$(HV_CONFIG)
|
minimalconfig: $(HV_OBJDIR)/$(HV_CONFIG)
|
||||||
@python3 $(KCONFIG_DIR)/minimalconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) $(HV_OBJDIR)/$(HV_DEFCONFIG)
|
@python3 $(KCONFIG_DIR)/minimalconfig.py Kconfig \
|
||||||
|
$(HV_OBJDIR)/$(HV_CONFIG) \
|
||||||
|
$(HV_OBJDIR)/$(HV_DEFCONFIG)
|
||||||
|
|
||||||
$(eval $(call check_dep_exec,menuconfig,MENUCONFIG_DEPS))
|
$(eval $(call check_dep_exec,menuconfig,MENUCONFIG_DEPS))
|
||||||
export KCONFIG_CONFIG := $(HV_OBJDIR)/$(HV_CONFIG)
|
export KCONFIG_CONFIG := $(HV_OBJDIR)/$(HV_CONFIG)
|
||||||
menuconfig: $(MENUCONFIG_DEPS) $(HV_OBJDIR)/$(HV_CONFIG)
|
menuconfig: $(MENUCONFIG_DEPS) $(HV_OBJDIR)/$(HV_CONFIG)
|
||||||
@python3 $(shell which menuconfig) Kconfig
|
@python3 $(shell which menuconfig) Kconfig
|
||||||
|
|
||||||
-include $(HV_OBJDIR)/$(HV_CONFIG_MK)
|
|
||||||
|
|
||||||
CFLAGS += -include $(HV_OBJDIR)/$(HV_CONFIG_H)
|
CFLAGS += -include $(HV_OBJDIR)/$(HV_CONFIG_H)
|
||||||
|
@ -44,7 +44,7 @@ def main():
|
|||||||
if sym_val.find("=") == -1:
|
if sym_val.find("=") == -1:
|
||||||
continue
|
continue
|
||||||
sym_name, val = sym_val.split("=")[:2]
|
sym_name, val = sym_val.split("=")[:2]
|
||||||
if sym_name in kconfig.syms.keys():
|
if sym_name in kconfig.syms.keys() and val:
|
||||||
cmdline_conf[sym_name] = val
|
cmdline_conf[sym_name] = val
|
||||||
|
|
||||||
# Check if the old .config conflicts with those specified on cmdline
|
# Check if the old .config conflicts with those specified on cmdline
|
||||||
|
Loading…
Reference in New Issue
Block a user