blob: 66155a40ddbbc3e30d4dd84bc204a22fc203938d [file] [log] [blame]
Furquan Shaikh2af76f42014-04-28 16:39:40 -07001################################################################################
2##
3## This file is part of the coreboot project.
4##
5## Copyright (C) 2014 Google Inc.
6## Copyright (C) 2012-2013 The ChromiumOS Authors
7## Copyright (C) 2012 Alexandru Gagniuc <mr.nuke.me@gmail.com>
8## Copyright (C) 2009-2010 coresystems GmbH
9## Copyright (C) 2009 Ronald G. Minnich
10##
11## This program is free software; you can redistribute it and/or modify
12## it under the terms of the GNU General Public License as published by
13## the Free Software Foundation; version 2 of the License.
14##
15## This program is distributed in the hope that it will be useful,
16## but WITHOUT ANY WARRANTY; without even the implied warranty of
17## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18## GNU General Public License for more details.
19##
20## You should have received a copy of the GNU General Public License
21## along with this program; if not, write to the Free Software
Patrick Georgib890a122015-03-26 15:17:45 +010022## Foundation, Inc.
Furquan Shaikh2af76f42014-04-28 16:39:40 -070023##
24################################################################################
25
26################################################################################
27# Take care of subdirectories
28################################################################################
29
Furquan Shaikh36d35862015-03-27 22:55:59 -070030subdirs-y += armv8/ cpu/
Furquan Shaikh2af76f42014-04-28 16:39:40 -070031
32################################################################################
33# ARM specific options
34################################################################################
35
36ifeq ($(CONFIG_ARCH_ROMSTAGE_ARM64),y)
Julius Wernerefcee762014-11-10 13:14:24 -080037CBFSTOOL_PRE1_OPTS = -m arm64 -s $(CONFIG_CBFS_SIZE)
Furquan Shaikh2af76f42014-04-28 16:39:40 -070038endif
39
Marc Jones17b9c192015-01-16 13:45:23 -070040ifeq ($(CONFIG_ARCH_ARM64),y)
41stages_c = $(src)/arch/arm64/stages.c
42stages_o = $(obj)/arch/arm64/stages.o
43
44$(stages_o): $(stages_c) $(obj)/config.h
45 @printf " CC $(subst $(obj)/,,$(@))\n"
46 $(CC_arm) -I. $(CPPFLAGS_arm) -c -o $@ $< -marm
47
48endif
49
Furquan Shaikh2af76f42014-04-28 16:39:40 -070050################################################################################
51# bootblock
52################################################################################
53
54ifeq ($(CONFIG_ARCH_BOOTBLOCK_ARM64),y)
55
56bootblock-y += div0.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -070057bootblock-y += id.S
58$(obj)/arch/arm64/id.bootblock.o: $(obj)/build.h
59
Aaron Durbinb3847e62015-03-20 15:55:08 -050060bootblock-y += boot.c
Aaron Durbin30cda7e2014-07-15 10:25:48 -050061bootblock-y += c_entry.c
62bootblock-y += stage_entry.S
Furquan Shaikh36d35862015-03-27 22:55:59 -070063bootblock-y += cpu-stubs.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -070064bootblock-y += stages.c
65bootblock-y += eabi_compat.c
Furquan Shaikh668316b2014-08-30 21:59:11 -070066bootblock-y += transition.c transition_asm.S
Furquan Shaikhdbe57562014-10-14 15:25:39 -070067bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Furquan Shaikh668316b2014-08-30 21:59:11 -070068
Aaron Durbin00263d02014-07-10 17:01:22 -050069bootblock-y += ../../lib/memset.c
70bootblock-y += ../../lib/memcpy.c
71bootblock-y += ../../lib/memmove.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -070072
73# Build the bootblock
74
Julius Wernerec5e5e02014-08-20 15:29:56 -070075$(objcbfs)/bootblock.debug: $$(bootblock-objs) $(obj)/config.h
Furquan Shaikh2af76f42014-04-28 16:39:40 -070076 @printf " LINK $(subst $(obj)/,,$(@))\n"
Patrick Georgieec8dfb2015-05-07 22:24:41 +020077 $(LD_bootblock) --gc-sections -static -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(bootblock-objs)) --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.bootblock.ld
Furquan Shaikh2af76f42014-04-28 16:39:40 -070078
79endif # CONFIG_ARCH_BOOTBLOCK_ARM64
80
Furquan Shaikh6f33f0a2014-10-02 16:43:19 -070081###############################################################################
82# verification stage
83###############################################################################
84
85ifeq ($(CONFIG_ARCH_VERSTAGE_ARM64),y)
86
Aaron Durbinbc409332015-05-08 15:52:52 -050087$(objcbfs)/verstage.debug: $(objgenerated)/libverstage.a $$(verstage-objs)
Furquan Shaikh6f33f0a2014-10-02 16:43:19 -070088 @printf " LINK $(subst $(obj)/,,$(@))\n"
Patrick Georgieec8dfb2015-05-07 22:24:41 +020089 $(LD_verstage) --gc-sections -static -o $@ -L$(obj) --whole-archive --start-group $(objgenerated)/libverstage.a $$(verstage-objs) --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.verstage.ld
Furquan Shaikh6f33f0a2014-10-02 16:43:19 -070090
91verstage-$(CONFIG_EARLY_CONSOLE) += early_console.c
Aaron Durbinbc409332015-05-08 15:52:52 -050092verstage-y += boot.c
Furquan Shaikh6f33f0a2014-10-02 16:43:19 -070093verstage-y += div0.c
94verstage-y += eabi_compat.c
95verstage-y += ../../lib/memset.c
96verstage-y += ../../lib/memcpy.c
97verstage-y += ../../lib/memmove.c
98verstage-y += stages.c
Furquan Shaikhdbe57562014-10-14 15:25:39 -070099verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Furquan Shaikh6f33f0a2014-10-02 16:43:19 -0700100
101endif # CONFIG_ARCH_VERSTAGE_ARM64
102
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700103################################################################################
104# romstage
105################################################################################
106
107ifeq ($(CONFIG_ARCH_ROMSTAGE_ARM64),y)
108
Aaron Durbinb3847e62015-03-20 15:55:08 -0500109romstage-y += boot.c
Aaron Durbin30cda7e2014-07-15 10:25:48 -0500110romstage-y += c_entry.c
111romstage-y += stage_entry.S
Furquan Shaikh36d35862015-03-27 22:55:59 -0700112romstage-y += cpu-stubs.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700113romstage-y += stages.c
114romstage-y += div0.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700115romstage-y += eabi_compat.c
Aaron Durbin00263d02014-07-10 17:01:22 -0500116romstage-y += ../../lib/memset.c
117romstage-y += ../../lib/memcpy.c
118romstage-y += ../../lib/memmove.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700119romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
Furquan Shaikh668316b2014-08-30 21:59:11 -0700120romstage-y += transition.c transition_asm.S
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700121
Furquan Shaikha742ef12014-07-23 11:41:59 -0700122rmodules_arm64-y += ../../lib/memset.c
123rmodules_arm64-y += ../../lib/memcpy.c
124rmodules_arm64-y += ../../lib/memmove.c
125rmodules_arm64-y += eabi_compat.c
126
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700127# Build the romstage
Marc Jones17b9c192015-01-16 13:45:23 -0700128VBOOT_STUB_DEPS += $(obj)/arch/arm/eabi_compat.rmodules_arm64.o
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700129
Julius Wernerec5e5e02014-08-20 15:29:56 -0700130$(objcbfs)/romstage.debug: $$(romstage-objs)
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700131 @printf " LINK $(subst $(obj)/,,$(@))\n"
Patrick Georgieec8dfb2015-05-07 22:24:41 +0200132 $(LD_romstage) -nostdlib --gc-sections -static -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(romstage-objs)) --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.romstage.ld
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700133
134endif # CONFIG_ARCH_ROMSTAGE_ARM64
135
136################################################################################
137# ramstage
138################################################################################
139
140ifeq ($(CONFIG_ARCH_RAMSTAGE_ARM64),y)
141
Aaron Durbin30cda7e2014-07-15 10:25:48 -0500142ramstage-y += c_entry.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700143ramstage-y += stages.c
Furquan Shaikh94824982014-11-21 15:42:40 -0800144ramstage-y += startup.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700145ramstage-y += div0.c
146ramstage-y += cpu.c
Aaron Durbinb30c9b12014-09-18 11:52:16 -0500147ramstage-y += cpu_ramstage.c
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700148ramstage-y += eabi_compat.c
149ramstage-y += boot.c
150ramstage-y += tables.c
Aaron Durbin00263d02014-07-10 17:01:22 -0500151ramstage-y += ../../lib/memset.c
152ramstage-y += ../../lib/memcpy.c
153ramstage-y += ../../lib/memmove.c
Aaron Durbin0df877a2014-07-10 12:40:30 -0500154ramstage-y += stage_entry.S
Furquan Shaikh36d35862015-03-27 22:55:59 -0700155ramstage-y += cpu-stubs.c
Julius Wernerf1df50e2015-05-07 16:59:31 -0700156ramstage-$(CONFIG_ARM64_USE_SPINTABLE) += spintable.c spintable_asm.S
Julius Werner745a75f2015-05-11 16:45:56 -0700157ramstage-$(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE) += arm_tf.c
Furquan Shaikh668316b2014-08-30 21:59:11 -0700158ramstage-y += transition.c transition_asm.S
159
Furquan Shaikhfbff9082014-07-22 15:59:16 -0700160rmodules_arm64-y += ../../lib/memset.c
161rmodules_arm64-y += ../../lib/memcpy.c
162rmodules_arm64-y += ../../lib/memmove.c
163rmodules_arm64-y += eabi_compat.c
Furquan Shaikhabde3b52014-08-26 15:39:51 -0700164
Julius Werner59e7b422015-05-07 16:59:31 -0700165secmon-y += stage_entry.S
166secmon-y += cpu-stubs.c
167secmon-y += startup.c
168secmon-y += ../../lib/malloc.c
169secmon-y += ../../lib/memset.c
170secmon-y += ../../lib/memcmp.c
171secmon-y += ../../lib/memcpy.c
Furquan Shaikhabde3b52014-08-26 15:39:51 -0700172
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700173ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c
174
Marc Jones17b9c192015-01-16 13:45:23 -0700175ramstage-srcs += $(wildcard src/mainboard/$(MAINBOARDDIR)/mainboard.c)
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700176
177# Build the ramstage
178
Julius Wernerec5e5e02014-08-20 15:29:56 -0700179$(objcbfs)/ramstage.debug: $$(ramstage-objs)
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700180 @printf " CC $(subst $(obj)/,,$(@))\n"
Patrick Georgieec8dfb2015-05-07 22:24:41 +0200181 $(LD_ramstage) -nostdlib --gc-sections -o $@ -L$(obj) --whole-archive --start-group $(filter-out %.ld,$(ramstage-objs)) --end-group -T $(obj)/mainboard/$(MAINBOARDDIR)/memlayout.ramstage.ld
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700182
Julius Werner745a75f2015-05-11 16:45:56 -0700183# Build ARM Trusted Firmware (BL31)
184
185ifeq ($(CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE),y)
186
187BL31_SOURCE := $(top)/3rdparty/arm-trusted-firmware
188
189BL31_MAKEARGS := PLAT=$(call strip_quotes,$(CONFIG_ARM_TF_PLATFORM_NAME))
190
191ifeq ($(V),1)
192BL31_MAKEARGS += V=1
193endif
194
195# Build ARM TF in debug mode (with serial output) if coreboot uses serial
196ifeq ($(CONFIG_CONSOLE_SERIAL),y)
197BL31_MAKEARGS += DEBUG=1
198endif # CONFIG_CONSOLE_SERIAL
199
200# Avoid build/release|build/debug distinction by overriding BUILD_PLAT directly
201BL31_MAKEARGS += BUILD_PLAT="$(top)/$(obj)/3rdparty/arm-trusted-firmware"
202
203BL31_CFLAGS := -fno-pic -fno-stack-protector
204BL31_LDFLAGS := --emit-relocs
205
206BL31 := $(obj)/3rdparty/arm-trusted-firmware/bl31/bl31.elf
207
208$(BL31):
209 @printf " MAKE $(subst $(obj)/,,$(@))\n"
Furquan Shaikhe45a3eb2015-05-20 10:12:19 -0700210 CROSS_COMPILE="$(CROSS_COMPILE_arm64)" \
Julius Werner745a75f2015-05-11 16:45:56 -0700211 CFLAGS="$(BL31_CFLAGS)" \
212 LDFLAGS="$(BL31_LDFLAGS)" \
213 $(MAKE) -C $(BL31_SOURCE) $(BL31_MAKEARGS) bl31
214
215.PHONY: $(BL31)
216
217BL31_CBFS := $(call strip_quotes,$(CONFIG_CBFS_PREFIX))/bl31
218$(BL31_CBFS)-file := $(BL31)
219$(BL31_CBFS)-type := stage
220$(BL31_CBFS)-compression := $(CBFS_COMPRESS_FLAG)
221cbfs-files-y += $(BL31_CBFS)
222
223endif # CONFIG_ARM64_USE_ARM_TRUSTED_FIRMWARE
224
Furquan Shaikh2af76f42014-04-28 16:39:40 -0700225endif # CONFIG_ARCH_RAMSTAGE_ARM64