3
3
# global helper variables
4
4
T := $(CURDIR )
5
5
6
+ # BOARD/SCENARIO/BOARD_FILE/SCENARIO_FILE/KCONFIG_FILE parameters sanity check:
7
+ #
8
+ # Only below usages are VALID: (target = all | hypervisor)
9
+ # 1. make <target>
10
+ # 2. make <target> KCONFIG_FILE=xxx
11
+ # 3. make <target> BOARD=xxx SCENARIO=xxx
12
+ # 4. make <target> BOARD_FILE=xxx SCENARIO_FILE=xxx
13
+ # 5. make <target> KCONFIG_FILE=xxx BOARD_FILE=xxx SCENARIO_FILE=xxx
14
+ #
15
+ # Especially for case 1 that no any parameters are specified:
16
+ # a. If hypervisor/build/.config file which generated by "make menuconfig" exist,
17
+ # the .config file will be loaded as KCONFIG_FILE:
18
+ # i.e. equal: make <target> KCONFIG_FILE=hypervisor/build/.config
19
+ #
20
+ # b. If hypervisor/build/.config file does not exist,
21
+ # the default BOARD/SCENARIO will be loaded:
22
+ # i.e. equal: make <target> BOARD=$(BOARD) SCENARIO=$(SCENARIO)
23
+ #
24
+ # The grep process did not handle corner case when '#' is manually put right after config value as comments,
25
+ # i.e. it will be failed in the case of "CONFIG_XXX=y # some comments here "
26
+
6
27
ifneq ($(KCONFIG_FILE ) ,)
7
28
ifneq ($(KCONFIG_FILE), $(wildcard $(KCONFIG_FILE)))
8
29
$(error KCONFIG_FILE : $(KCONFIG_FILE ) does not exist)
12
33
override KCONFIG_FILE := $(T ) /hypervisor/build/.config
13
34
endif
14
35
36
+ ifneq ($(BOARD )$(SCENARIO ) ,)
37
+ ifneq ($(BOARD_FILE)$(SCENARIO_FILE),)
38
+ $(error BOARD/SCENARIO parameter could not coexist with BOARD_FILE/SCENARIO_FILE)
39
+ endif
40
+ endif
41
+
42
+ ifneq ($(BOARD_FILE )$(SCENARIO_FILE ) ,)
43
+ ifneq ($(BOARD_FILE), $(wildcard $(BOARD_FILE)))
44
+ $(error BOARD_FILE : $(BOARD_FILE ) does not exist)
45
+ endif
46
+ ifneq ($(SCENARIO_FILE), $(wildcard $(SCENARIO_FILE)))
47
+ $(error SCENARIO_FILE : $(SCENARIO_FILE ) does not exist)
48
+ endif
49
+
50
+ override BOARD_FILE := $(realpath $(BOARD_FILE ) )
51
+ override SCENARIO_FILE := $(realpath $(SCENARIO_FILE ) )
52
+ endif
53
+
54
+ ifeq ($(KCONFIG_FILE ) , $(wildcard $(KCONFIG_FILE ) ) )
55
+ ifneq ($(BOARD)$(SCENARIO),)
56
+ $(error BOARD/SCENARIO parameter could not coexist with KCONFIG_FILE)
57
+ endif
58
+
59
+ BOARD_IN_KCONFIG := $(shell grep CONFIG_BOARD= $(KCONFIG_FILE ) | grep -v '\#' | awk -F '"' '{print $$2}')
60
+ ifeq ($(BOARD_IN_KCONFIG),)
61
+ $(error no BOARD info in KCONFIG_FILE : $(KCONFIG_FILE ) )
62
+ endif
63
+
64
+ SCENARIO_IN_KCONFIG := $(shell grep -E "SDC=y|SDC2=y|INDUSTRY=y|LOGICAL_PARTITION=y|HYBRID=y" \
65
+ $(KCONFIG_FILE ) | grep -v '\#' | awk -F "=" '{print $$1}' | cut -d '_' -f 2- | tr A-Z a-z)
66
+ ifeq ($(SCENARIO_IN_KCONFIG),)
67
+ $(error no SCENARIO info in KCONFIG_FILE : $(KCONFIG_FILE ) )
68
+ endif
69
+
70
+ override BOARD := $(BOARD_IN_KCONFIG )
71
+ override SCENARIO := $(SCENARIO_IN_KCONFIG )
72
+
73
+ RELEASE := $(shell grep CONFIG_RELEASE=y $(KCONFIG_FILE ) | grep -v '\#')
74
+ ifneq ($(RELEASE),)
75
+ override RELEASE := 1
76
+ endif
77
+
78
+ endif
79
+
15
80
BOARD ?= kbl-nuc-i7
16
81
17
82
ifneq (,$(filter $(BOARD ) ,apl-mrb) )
@@ -35,13 +100,6 @@ BUILD_TAG ?=
35
100
GENED_ACPI_INFO_HEADER = $(T ) /hypervisor/arch/x86/configs/$(BOARD ) /$(BOARD ) _acpi_info.h
36
101
HV_CFG_LOG = $(HV_OUT ) /cfg.log
37
102
38
- ifneq ($(BOARD_FILE ) ,)
39
- override BOARD_FILE := $(shell if [ -f $(BOARD_FILE ) ]; then realpath $(BOARD_FILE ) ; fi)
40
- endif
41
- ifneq ($(SCENARIO_FILE ) ,)
42
- override SCENARIO_FILE := $(shell if [ -f $(SCENARIO_FILE ) ]; then realpath $(SCENARIO_FILE ) ; fi)
43
- endif
44
-
45
103
export TOOLS_OUT BOARD SCENARIO FIRMWARE RELEASE
46
104
47
105
.PHONY : all hypervisor devicemodel tools doc
@@ -54,40 +112,8 @@ else ifeq ($(BOARD), kbl-nuc-i7)
54
112
override BOARD := nuc7i7dnb
55
113
endif
56
114
57
- # BOARD and SCENARIO definition priority:
58
- # If we do menuconfig in advance, the menuconfig will define
59
- # BOARD
60
- # SCENARIO
61
- # else if we have board/scenario file avaiable, BOARD and SCENARIO will be
62
- # extracted from files.
63
- # else if make comand has BORAD/SCENARIO parameters, BOARD and SCENARIO will
64
- # be gotten from parameters
65
- # else
66
- # default value defined in this make file will be used
67
- #
68
-
69
115
include $(T ) /hypervisor/scripts/makefile/cfg_update.mk
70
116
71
- ifeq ($(KCONFIG_FILE ) , $(wildcard $(KCONFIG_FILE ) ) )
72
- BOARD_IN_KCONFIG := $(shell grep CONFIG_BOARD= $(KCONFIG_FILE ) | awk -F '"' '{print $$2}')
73
- SCENARIO_IN_KCONFIG := $(shell grep -E "SDC=y|SDC2=y|INDUSTRY=y|LOGICAL_PARTITION=y|HYBRID=y" \
74
- $(KCONFIG_FILE ) | awk -F "=" '{print $$1}' | cut -d '_' -f 2- | tr A-Z a-z)
75
-
76
- RELEASE := $(shell grep CONFIG_RELEASE=y $(KCONFIG_FILE ) )
77
- ifneq ($(RELEASE),)
78
- override RELEASE := 1
79
- endif
80
-
81
- ifneq ($(BOARD_IN_KCONFIG),$(BOARD))
82
- override BOARD := $(BOARD_IN_KCONFIG )
83
- endif
84
-
85
- ifneq ($(SCENARIO_IN_KCONFIG),$(SCENARIO))
86
- override SCENARIO := $(SCENARIO_IN_KCONFIG )
87
- endif
88
-
89
- endif
90
-
91
117
# help functions to build acrn and install acrn/acrn symbols
92
118
define build_acrn
93
119
$(MAKE ) -C $(T ) /hypervisor HV_OBJDIR=$(HV_OUT ) -$(1 ) /$(2 ) BOARD=$(2 ) FIRMWARE=$(1 ) SCENARIO=$(4 ) RELEASE=$(RELEASE ) clean
0 commit comments