HV: Make: enable build for new configs layout

The make command is same as old configs layout:

under acrn-hypervisor folder:
	make hypervisor BOARD=xxx SCENARIO=xxx [TARGET_DIR]=xxx [RELEASE=x]

under hypervisor folder:
	make BOARD=xxx SCENARIO=xxx [TARGET_DIR]=xxx [RELEASE=x]

if BOARD/SCENARIO parameter is not specified, the default will be:
	BOARD=nuc7i7dnb SCENARIO=industry

Tracked-On: #5077

Signed-off-by: Victor Sun <victor.sun@intel.com>
Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Victor Sun
2020-07-15 16:40:24 +08:00
committed by wenlingz
parent e792fa3d3c
commit a57a4fd7fb
11 changed files with 69 additions and 59 deletions

View File

@@ -19,6 +19,10 @@ HV_OBJDIR ?= $(CURDIR)/build
HV_MODDIR ?= $(HV_OBJDIR)/modules
HV_FILE := acrn
ifeq ($(TARGET_DIR),)
override TARGET_DIR := $(realpath ../misc/vm_configs)
endif
LIB_MOD = $(HV_MODDIR)/lib_mod.a
BOOT_MOD = $(HV_MODDIR)/boot_mod.a
HW_MOD = $(HV_MODDIR)/hw_mod.a
@@ -55,13 +59,9 @@ override BOARD := $(shell echo $(CONFIG_BOARD) |sed 's/"//g')
#override SCENARIO from CONFIG_SCENARIO, which is specified in kconfig.mk
override SCENARIO := $(shell echo $(CONFIG_SCENARIO) |sed 's/"//g')
ifeq ($(TARGET_DIR),)
BOARD_CFG_DIR := arch/x86/configs/$(BOARD)
SCENARIO_CFG_DIR := scenarios/$(SCENARIO)
else
BOARD_CFG_DIR := $(TARGET_DIR)/$(BOARD)
SCENARIO_CFG_DIR := $(TARGET_DIR)/$(SCENARIO)
endif
BOARD_INFO_DIR := $(TARGET_DIR)/boards/$(BOARD)
SCENARIO_CFG_DIR := $(TARGET_DIR)/scenarios/$(SCENARIO)
BOARD_CFG_DIR := $(SCENARIO_CFG_DIR)/$(BOARD)
include ../paths.make
@@ -162,6 +162,7 @@ INCLUDE_PATH += include/hw
INCLUDE_PATH += boot/include
INCLUDE_PATH += boot/include/guest
INCLUDE_PATH += $(HV_OBJDIR)/include
INCLUDE_PATH += $(BOARD_INFO_DIR)
INCLUDE_PATH += $(BOARD_CFG_DIR)
INCLUDE_PATH += $(SCENARIO_CFG_DIR)
@@ -250,11 +251,6 @@ HW_C_SRCS += common/sched_bvt.c
endif
HW_C_SRCS += hw/pci.c
HW_C_SRCS += arch/x86/configs/vm_config.c
HW_C_SRCS += $(BOARD_CFG_DIR)/board.c
HW_C_SRCS += $(SCENARIO_CFG_DIR)/vm_configurations.c
ifneq (,$(wildcard $(SCENARIO_CFG_DIR)/pci_dev.c))
HW_C_SRCS += $(SCENARIO_CFG_DIR)/pci_dev.c
endif
HW_C_SRCS += boot/acpi_base.c
HW_C_SRCS += boot/cmdline.c
# ACPI parsing component
@@ -267,6 +263,13 @@ HW_C_SRCS += boot/guest/vboot_wrapper.c
HW_C_SRCS += boot/guest/deprivilege_boot.c
HW_C_SRCS += boot/guest/direct_boot.c
# VM Configuration
VM_CFG_C_SRCS += $(BOARD_INFO_DIR)/board.c
VM_CFG_C_SRCS += $(SCENARIO_CFG_DIR)/vm_configurations.c
ifneq (,$(wildcard $(BOARD_CFG_DIR)/pci_dev.c))
VM_CFG_C_SRCS += $(BOARD_CFG_DIR)/pci_dev.c
endif
# virtual platform base component
VP_BASE_C_SRCS += arch/x86/guest/vcpuid.c
VP_BASE_C_SRCS += arch/x86/guest/vcpu.c
@@ -335,6 +338,7 @@ BOOT_C_OBJS := $(patsubst %.c,$(HV_OBJDIR)/%.o,$(BOOT_C_SRCS))
BOOT_S_OBJS := $(patsubst %.S,$(HV_OBJDIR)/%.o,$(BOOT_S_SRCS))
HW_C_OBJS := $(patsubst %.c,$(HV_OBJDIR)/%.o,$(HW_C_SRCS))
HW_S_OBJS := $(patsubst %.S,$(HV_OBJDIR)/%.o,$(HW_S_SRCS))
VM_CFG_C_OBJS := $(patsubst %.c,$(HV_OBJDIR)/%.o,$(realpath $(VM_CFG_C_SRCS)))
VP_BASE_C_OBJS := $(patsubst %.c,$(HV_OBJDIR)/%.o,$(VP_BASE_C_SRCS))
VP_BASE_S_OBJS := $(patsubst %.S,$(HV_OBJDIR)/%.o,$(VP_BASE_S_SRCS))
VP_DM_C_OBJS := $(patsubst %.c,$(HV_OBJDIR)/%.o,$(VP_DM_C_SRCS))
@@ -374,8 +378,8 @@ VERSION := $(HV_OBJDIR)/include/version.h
# Create platform_acpi_info.h
TEMPLATE_ACPI_INFO_HEADER := arch/x86/configs/platform_acpi_info.h
BOARDTEMPLATE_ACPI_INFO_HEADER := arch/x86/configs/$(BOARD)/platform_acpi_info.h
SOURCE_ACPI_INFO_HEADER := $(BOARD_CFG_DIR)/$(BOARD)_acpi_info.h
BOARDTEMPLATE_ACPI_INFO_HEADER := $(BOARD_INFO_DIR)/platform_acpi_info.h
SOURCE_ACPI_INFO_HEADER := $(BOARD_INFO_DIR)/$(BOARD)_acpi_info.h
TARGET_ACPI_INFO_HEADER := $(HV_OBJDIR)/include/platform_acpi_info.h
$(TARGET_ACPI_INFO_HEADER): $(HV_OBJDIR)/$(HV_CONFIG)
@@ -434,8 +438,8 @@ $(BOOT_MOD): $(BOOT_S_OBJS) $(BOOT_C_OBJS)
boot-mod: $(BOOT_MOD)
$(HW_MOD): $(HW_S_OBJS) $(HW_C_OBJS)
$(AR) $(ARFLAGS) $(HW_MOD) $(HW_S_OBJS) $(HW_C_OBJS)
$(HW_MOD): $(HW_S_OBJS) $(HW_C_OBJS) $(VM_CFG_C_OBJS)
$(AR) $(ARFLAGS) $(HW_MOD) $(HW_S_OBJS) $(HW_C_OBJS) $(VM_CFG_C_OBJS)
hw-mod: $(HW_MOD)

View File

@@ -59,7 +59,7 @@ config BOARD
config DEFCONFIG_LIST
string
option defconfig_list
default "arch/x86/configs/$BOARD.config"
default "../misc/vm_configs/scenarios/$SCENARIO/$(BOARD)/$BOARD.config"
config RELEASE
bool "Release build"

View File

@@ -7,8 +7,7 @@
#ifndef ACPI_H
#define ACPI_H
#include <vm_configurations.h>
#include <board_info.h>
#define ACPI_RSDP_CHECKSUM_LENGTH 20U
#define ACPI_RSDP_XCHECKSUM_LENGTH 36U

View File

@@ -7,7 +7,7 @@
#define BOARD_H
#include <types.h>
#include <misc_cfg.h>
#include <board_info.h>
#include <host_pm.h>
#include <pci.h>

View File

@@ -10,6 +10,7 @@
#include <types.h>
#include <pci.h>
#include <boot.h>
#include <board_info.h>
#include <acrn_common.h>
#include <vm_uuids.h>
#include <vm_configurations.h>

View File

@@ -45,17 +45,13 @@ update_config:
ifeq ($(CONFIG_XML_ENABLED),true)
@if [ ! -f $(UPDATE_RESULT) ]; then \
mkdir -p $(dir $(UPDATE_RESULT));\
if [ "$(TARGET_DIR)" = "" ]; then \
python3 ../misc/acrn-config/board_config/board_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) > $(UPDATE_RESULT);\
else \
python3 ../misc/acrn-config/board_config/board_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) --out $(TARGET_DIR) > $(UPDATE_RESULT);\
fi;\
python3 ../misc/acrn-config/board_config/board_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) --out $(TARGET_DIR) > $(UPDATE_RESULT);\
cat $(UPDATE_RESULT);\
if [ "`sed -n /successfully/p $(UPDATE_RESULT)`" = "" ]; then rm -f $(UPDATE_RESULT); exit 1; fi;\
if [ "$(TARGET_DIR)" = "" ]; then \
python3 ../misc/acrn-config/scenario_config/scenario_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) > $(UPDATE_RESULT);\
else \
python3 ../misc/acrn-config/scenario_config/scenario_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) --out $(TARGET_DIR) > $(UPDATE_RESULT);\
python3 ../misc/acrn-config/scenario_config/scenario_cfg_gen.py --board $(BOARD_FILE) --scenario $(SCENARIO_FILE) --out $(realpath $(TARGET_DIR)) > $(UPDATE_RESULT);\
fi;\
cat $(UPDATE_RESULT);\
if [ "`sed -n /successfully/p $(UPDATE_RESULT)`" = "" ]; then rm -f $(UPDATE_RESULT); exit 1; fi;\

View File

@@ -36,8 +36,8 @@ ifeq ($(shell [ $(HV_OBJDIR)/$(HV_CONFIG) -nt $(HV_OBJDIR)/$(HV_CONFIG_MK) ] &&
# only happens when GNU make checks the prerequisites.
-include $(HV_OBJDIR)/$(HV_CONFIG)
endif
$(eval $(call override_config,BOARD,apl-mrb))
$(eval $(call override_config,SCENARIO,))
$(eval $(call override_config,BOARD,nuc7i7dnb))
$(eval $(call override_config,SCENARIO,industry))
$(eval $(call override_config,RELEASE,y))
override RELEASE := $(CONFIG_RELEASE)
@@ -68,18 +68,19 @@ $(HV_OBJDIR)/$(HV_CONFIG_H): $(HV_OBJDIR)/$(HV_CONFIG)
.PHONY: defconfig
defconfig: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR)
@if ([ "$(KCONFIG_FILE)" == "" ] || ([ "$(KCONFIG_FILE)" != "" ] && [ ! -f $(KCONFIG_FILE) ])) && [ "$(CONFIG_XML_ENABLED)" != "true" ]; then \
BOARD=$(CONFIG_BOARD) python3 $(KCONFIG_DIR)/defconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG); \
@BOARD=$(CONFIG_BOARD) SCENARIO=$(CONFIG_SCENARIO); \
if ([ "$(KCONFIG_FILE)" = "" ] || ([ "$(KCONFIG_FILE)" != "" ] && [ ! -f $(KCONFIG_FILE) ])) && [ "$(CONFIG_XML_ENABLED)" != "true" ]; then \
python3 $(KCONFIG_DIR)/defconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG); \
else \
if [ "$(KCONFIG_FILE)" != "" ] && [ -f $(KCONFIG_FILE) ]; then \
echo "Writing $(HV_OBJDIR)/$(HV_CONFIG) with $(KCONFIG_FILE)"; \
cp $(KCONFIG_FILE) $(HV_OBJDIR)/$(HV_CONFIG); \
elif [ "$(TARGET_DIR)" != "" ] && [ -d $(TARGET_DIR) ]; then \
if [ ! -f $(TARGET_DIR)/$(BOARD).config ]; then \
echo "Board defconfig file $(BOARD).config is not found under $(TARGET_DIR)."; exit 1; \
if [ ! -f $(TARGET_DIR)/scenarios/$(SCENARIO)/$(BOARD)/$(BOARD).config ]; then \
echo "Board defconfig file $(BOARD).config is not found under $(TARGET_DIR)/scenarios/$(SCENARIO)/$(BOARD)/."; exit 1; \
fi; \
echo "Writing $(HV_OBJDIR)/$(HV_CONFIG) with $(TARGET_DIR)/$(BOARD).config"; \
cp $(TARGET_DIR)/$(BOARD).config $(HV_OBJDIR)/$(HV_CONFIG); \
echo "Writing $(HV_OBJDIR)/$(HV_CONFIG) with $(BOARD_CFG_DIR)/$(BOARD).config"; \
cp $(TARGET_DIR)/scenarios/$(SCENARIO)/$(BOARD)/$(BOARD).config $(HV_OBJDIR)/$(HV_CONFIG); \
fi; \
python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig $(HV_OBJDIR)/$(HV_CONFIG) RELEASE=$(RELEASE); \
fi
@@ -91,7 +92,7 @@ defconfig: $(KCONFIG_DEPS)
.PHONY: oldconfig
oldconfig: $(KCONFIG_DEPS)
@mkdir -p $(HV_OBJDIR)
@BOARD=$(CONFIG_BOARD) \
@BOARD=$(CONFIG_BOARD) SCENARIO=$(CONFIG_SCENARIO) \
python3 $(KCONFIG_DIR)/silentoldconfig.py Kconfig \
$(HV_OBJDIR)/$(HV_CONFIG) \
SCENARIO=$(CONFIG_SCENARIO) RELEASE=$(RELEASE)