blob: 5916693d75282588e546b5e7b621fa97cdf02032 [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001LOCAL_DIR := $(GET_LOCAL_DIR)
2
3MODULE := $(LOCAL_DIR)
4COMMON_PLAT := $(LOCAL_DIR)/../mediatek/common
5
6ARCH ?= arm64
7ARM_CPU ?= cortex-a53
8WITH_SMP ?= 0
9WITH_KERNEL_VM ?= 1
10
11LK_HEAP_IMPLEMENTATION ?= miniheap
12
13GLOBAL_INCLUDES += -I$(LK_TOP_DIR)/include \
14
15MODULE_SRCS += \
16 $(COMMON_PLAT)/boot_mode.c \
17 $(LOCAL_DIR)/fixup/plat_fixup.c \
18 $(LOCAL_DIR)/platform.c \
19 $(LOCAL_DIR)/debug.c \
20 $(LOCAL_DIR)/interrupts.c \
21 $(LOCAL_DIR)/plat_dbg_info.c \
22 $(LOCAL_DIR)/../mediatek/common/fastboot_oem_cmd/oem_ab_cmd.c \
23 $(LOCAL_DIR)/../mediatek/common/fastboot_oem_cmd/oem_efuse_cmd.c \
24 $(LOCAL_DIR)/../mediatek/common/fastboot_oem_cmd/oem_mac_cmd.c \
25
26ifeq ($(NAND_DEBUG),1)
27MODULE_SRCS += $(LOCAL_DIR)/../mediatek/common/fastboot_oem_cmd/oem_nand_cmd.c
28endif
29
30MACH_TYPE := 2731
31
32ifeq ($(WITH_KERNEL_VM),1)
33ifeq ($(ARCH),arm64)
34KERNEL_ASPACE_BASE ?= 0xfffffff000000000
35KERNEL_ASPACE_SIZE ?= 0x0000000180000000
36MMU_IDENT_SIZE_SHIFT ?= 32
37endif
38endif
39
40# mempool configuration
41ifeq ($(WITH_KERNEL_VM),1)
42
43ifeq ($(ARCH),arm64)
44CACHED_MEMPOOL_ADDR ?= 0xfffffff044800000
45CACHED_MEMPOOL_SIZE ?= 0x03800000 # 56MB
46UNCACHED_MEMPOOL_ADDR ?= 0xfffffff04FE00000
47UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
48BL33_ADDR ?= 0xfffffff042110000
49MD_ADDR ?= 0xfffffff048000000
50HSM_OS_ADDR ?= 0xfffffff042080000
51AP_MD_SHARE_NC ?= 0xfffffff044000000
52AP_MD_SHARE_C ?= 0xfffffff046000000
53endif
54
55ifeq ($(ARCH),arm)
56CACHED_MEMPOOL_ADDR ?= 0x48000000
57CACHED_MEMPOOL_SIZE ?= 0x03800000 # 56MB
58UNCACHED_MEMPOOL_ADDR ?= 0x4B800000
59UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
60BL33_ADDR ?= 0x42110000
61MD_ADDR ?= 0x48000000
62HSM_OS_ADDR ?= 0x42080000
63AP_MD_SHARE_NC ?= 0x44000000
64AP_MD_SHARE_C ?= 0x46000000
65endif
66
67else
68CACHED_MEMPOOL_ADDR ?= 0 # don't care this when mmu is off
69CACHED_MEMPOOL_SIZE ?= 0
70UNCACHED_MEMPOOL_ADDR ?= 0x4FE00000
71UNCACHED_MEMPOOL_SIZE ?= 0x200000 # 2MB
72BL33_ADDR ?= 0x42110000
73MD_ADDR ?= 0x48000000
74HSM_OS_ADDR ?= 0x42080000
75AP_MD_SHARE_NC ?= 0x44000000
76AP_MD_SHARE_C ?= 0x46000000
77endif
78
79# LK build as BL2 or BL33 setting
80LK_AS_BL33 ?= 0
81
82# CPU FREQ: CA35_FREQ_806MHZ (0.8G), CA35_FREQ_1196MHZ (1.2G)
83CA35_FREQ ?= CA35_FREQ_1196MHZ
84
85MODULE_DEPS += \
86 dev/interrupt/arm_gic_v3 \
87 dev/timer/arm_generic \
88 lib/bio \
89 lib/fastboot \
90 lib/fdt \
91 lib/fit \
92 lib/kcmdline \
93 lib/mempool \
94 lib/partition \
95
96# if BOOTAPP is not specified elsewhere, and AVB is required, choose 'avbboot'
97ifeq ($(strip $(SECURE_BOOT_ENABLE)),yes)
98ifeq ($(strip $(SECURE_BOOT_TYPE)),avb)
99BOOTAPP ?= avbboot
100endif
101endif
102
103# otherwise, choose 'fitboot'
104BOOTAPP ?= fitboot
105
106MODULES += app/$(BOOTAPP)
107
108ifeq ($(WITH_KERNEL_VM),1)
109GLOBAL_DEFINES += MMU_IDENT_SIZE_SHIFT=$(MMU_IDENT_SIZE_SHIFT)
110else
111GLOBAL_DEFINES += NOVM_MAX_ARENAS=2
112endif
113
114ifeq ($(SECURE_BOOT_ENABLE),yes)
115GLOBAL_DEFINES += CUSTOM_DEFAULT_STACK_SIZE=8192
116ifeq ($(MD_VERIFY),yes)
117GLOBAL_DEFINES += MTK_SECURITY_SW_SUPPORT
118endif
119endif
120
121# for AEE
122GLOBAL_DEFINES += MTK_PMIC_FULL_RESET
123
124# for user load
125ifeq ($(BUILD_LOAD_TYPE),user)
126GLOBAL_DEFINES += MTK_BUILD_USER_LOAD
127endif
128
129GLOBAL_DEFINES += \
130 RAMBASE=$(RAMBASE) \
131 MACH_TYPE=$(MACH_TYPE) \
132 PLATFORM_SUPPORTS_PANIC_SHELL=1 \
133 WITH_NO_FP=1 \
134 CACHED_MEMPOOL_ADDR=$(CACHED_MEMPOOL_ADDR) \
135 CACHED_MEMPOOL_SIZE=$(CACHED_MEMPOOL_SIZE) \
136 UNCACHED_MEMPOOL_ADDR=$(UNCACHED_MEMPOOL_ADDR) \
137 UNCACHED_MEMPOOL_SIZE=$(UNCACHED_MEMPOOL_SIZE) \
138 BL33_ADDR=$(BL33_ADDR) \
139 MD_ADDR=$(MD_ADDR) \
140 HSM_OS_ADDR=$(HSM_OS_ADDR) \
141 AP_MD_SHARE_NC=$(AP_MD_SHARE_NC) \
142 AP_MD_SHARE_C=$(AP_MD_SHARE_C) \
143 $(CA35_FREQ) \
144 NAND_DEBUG=$(NAND_DEBUG) \
145 LK_AS_BL33=$(LK_AS_BL33)
146
147LINKER_SCRIPT += \
148 $(BUILDDIR)/system-onesegment.ld
149
150include $(LOCAL_DIR)/bl2_bl33_options.mk
151include make/module.mk $(LOCAL_DIR)/drivers/rules.mk