summaryrefslogtreecommitdiffstats
path: root/src/makefile
blob: f8343555b4dadea2d883e7f2790a5cdd5b63520f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
# IBM_PROLOG_BEGIN_TAG
# This is an automatically generated prolog.
#
# $Source: src/makefile $
#
# OpenPOWER HostBoot Project
#
# Contributors Listed Below - COPYRIGHT 2010,2019
# [+] Google Inc.
# [+] International Business Machines Corp.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied. See the License for the specific language governing
# permissions and limitations under the License.
#
# IBM_PROLOG_END_TAG


ROOTPATH = ..

SUBDIRS += bootloader.d
SUBDIRS += kernel.d
SUBDIRS += lib.d
SUBDIRS += libc++.d
SUBDIRS += sys.d
SUBDIRS += usr.d
SUBDIRS += build.d
SUBDIRS += runtime.d
SUBDIRS += securerom.d

# Reducing HB extended img size for VPO by disabling certain libs using
# CONFIG_VPO_COMPILE option
IMGS += hbibl
IMGS += hbicore
IMGS += hbicore_test
IMGS += hbirt
IMGS += hbirt_test
IMGS += securerom

BASE_OBJECTS += string.o
BASE_OBJECTS += string_ext.o
BASE_OBJECTS += string_utils.o
BASE_OBJECTS += ctype.o
BASE_OBJECTS += math.o
BASE_OBJECTS += builtins.o
BASE_OBJECTS += stdio.o
BASE_OBJECTS += splaytree.o
BASE_OBJECTS += cxxtest_data.o
BASE_OBJECTS += sprintf.o
BASE_OBJECTS += crc32.o
BASE_OBJECTS += utilmisc.o

BL_BASE_OBJECTS += bl_builtins.o

BOOTLDR_OBJECTS += bl_start.o
BOOTLDR_OBJECTS += bootloader.o
BOOTLDR_OBJECTS += bl_pnorAccess.o
BOOTLDR_OBJECTS += bl_pnor_utils.o
BOOTLDR_OBJECTS += bl_pnor_ecc.o
BOOTLDR_OBJECTS += bl_terminate.o
BOOTLDR_OBJECTS += forceattn_p9.o
BOOTLDR_OBJECTS += bl_string_utils.o
BOOTLDR_OBJECTS += rom_entry.o

SECUREROM_OBJECTS += ROM.o
SECUREROM_OBJECTS += ecverify.o
SECUREROM_OBJECTS += hw_utils.o
SECUREROM_OBJECTS += sha512.o
SECUREROM_OBJECTS += string_utils.o
SECUREROM_OBJECTS += rom_entry.o
SECUREROM_OBJECTS += secureromasm.o

DIRECT_BOOT_OBJECTS += start.o
DIRECT_BOOT_OBJECTS += kernel.o
DIRECT_BOOT_OBJECTS += taskmgr.o
DIRECT_BOOT_OBJECTS += cpumgr.o
DIRECT_BOOT_OBJECTS += syscall.o
DIRECT_BOOT_OBJECTS += doorbell.o
DIRECT_BOOT_OBJECTS += scheduler.o
DIRECT_BOOT_OBJECTS += exception.o
DIRECT_BOOT_OBJECTS += vmmmgr.o
DIRECT_BOOT_OBJECTS += timemgr.o
DIRECT_BOOT_OBJECTS += syscall_stub.o
DIRECT_BOOT_OBJECTS += syscall_task.o
DIRECT_BOOT_OBJECTS += syscall_misc.o
DIRECT_BOOT_OBJECTS += syscall_msg.o
DIRECT_BOOT_OBJECTS += syscall_mmio.o
DIRECT_BOOT_OBJECTS += syscall_time.o
DIRECT_BOOT_OBJECTS += syscall_mm.o
DIRECT_BOOT_OBJECTS += init_main.o
DIRECT_BOOT_OBJECTS += vfs_main.o
DIRECT_BOOT_OBJECTS += sync.o
DIRECT_BOOT_OBJECTS += futexmgr.o
DIRECT_BOOT_OBJECTS += ptmgr.o
DIRECT_BOOT_OBJECTS += segmentmgr.o
DIRECT_BOOT_OBJECTS += basesegment.o
DIRECT_BOOT_OBJECTS += devicesegment.o
DIRECT_BOOT_OBJECTS += block.o
DIRECT_BOOT_OBJECTS += misc.o
DIRECT_BOOT_OBJECTS += msghandler.o
DIRECT_BOOT_OBJECTS += blockmsghdlr.o
DIRECT_BOOT_OBJECTS += stacksegment.o
DIRECT_BOOT_OBJECTS += softpatch_p8.o
DIRECT_BOOT_OBJECTS += shutdown.o
DIRECT_BOOT_OBJECTS += forceattn_p9.o
DIRECT_BOOT_OBJECTS += terminate.o
DIRECT_BOOT_OBJECTS += ipc.o
DIRECT_BOOT_OBJECTS += machchk.o
DIRECT_BOOT_OBJECTS += console.o
DIRECT_BOOT_OBJECTS += spinlock.o
DIRECT_BOOT_OBJECTS += heapmgr.o
DIRECT_BOOT_OBJECTS += pagemgr.o
DIRECT_BOOT_OBJECTS += barrier.o
DIRECT_BOOT_OBJECTS += idebug.o
DIRECT_BOOT_OBJECTS += intmsghandler.o
DIRECT_BOOT_OBJECTS += deferred.o
DIRECT_BOOT_OBJECTS += idletask.o
DIRECT_BOOT_OBJECTS += vfs_init.o
DIRECT_BOOT_OBJECTS += cpuid.o
DIRECT_BOOT_OBJECTS += stdlib.o
DIRECT_BOOT_OBJECTS += assert.o
DIRECT_BOOT_OBJECTS += workitem.o
DIRECT_BOOT_OBJECTS += bltohbdatamgr.o
DIRECT_BOOT_OBJECTS += errno.o
ifdef HOSTBOOT_PROFILE
DIRECT_BOOT_OBJECTS += gcov.o
endif

BASE_MODULES += trace
BASE_MODULES += errl
BASE_MODULES += devicefw
BASE_MODULES += scom
BASE_MODULES += xscom
BASE_MODULES += initservice
BASE_MODULES += secureboot_base
BASE_MODULES += lpc
BASE_MODULES += $(if $(CONFIG_BMC_IPMI),ipmibase)
BASE_MODULES += pnor
BASE_MODULES += vfs
BASE_MODULES += $(if $(CONFIG_AST2400) || $(CONFIG_AST2500), sio)
BASE_MODULES += $(if $(CONFIG_CONSOLE),console)

# This is exported so that gcov knows the list of base modules to
# exclude from instrumentation. We can't simply export BASE_MODULES or
# else we get duplicate modules in the list which causes linker errors.
export BASE_MODULES_GCOV_BLACKLIST:=$(BASE_MODULES)

EXTENDED_MODULES += istep06
EXTENDED_MODULES += istep07
EXTENDED_MODULES += istep08
EXTENDED_MODULES += istep09
EXTENDED_MODULES += istep10
EXTENDED_MODULES += istep11
EXTENDED_MODULES += istep12
EXTENDED_MODULES += istep13
EXTENDED_MODULES += istep14
EXTENDED_MODULES += istep15
EXTENDED_MODULES += istep16
EXTENDED_MODULES += istep18
EXTENDED_MODULES += istep20
EXTENDED_MODULES += istep21
EXTENDED_MODULES += isteps
EXTENDED_MODULES += pm
EXTENDED_MODULES += targeting
EXTENDED_MODULES += fapi2
EXTENDED_MODULES += extinitsvc
EXTENDED_MODULES += istepdisp
EXTENDED_MODULES += hwas
EXTENDED_MODULES += fsi
EXTENDED_MODULES += fsiscom
EXTENDED_MODULES += i2c
EXTENDED_MODULES += intr
EXTENDED_MODULES += scan
EXTENDED_MODULES += vpd
EXTENDED_MODULES += util
EXTENDED_MODULES += tracedaemon
EXTENDED_MODULES += mbox
EXTENDED_MODULES += attn
EXTENDED_MODULES += prdf
EXTENDED_MODULES += $(if $(CONFIG_VPO_COMPILE),,mdia)
EXTENDED_MODULES += ibscom
EXTENDED_MODULES += thread_activate
EXTENDED_MODULES += $(if $(CONFIG_VPO_COMPILE),,dump)
EXTENDED_MODULES += $(if $(CONFIG_VPO_COMPILE),,runtime)
EXTENDED_MODULES += $(if $(CONFIG_TPMDD),secureboot_trusted,)
EXTENDED_MODULES += sbe
EXTENDED_MODULES += cen
EXTENDED_MODULES += imageprocs
EXTENDED_MODULES += sbeio
EXTENDED_MODULES += $(if $(CONFIG_HTMGT),htmgt)
EXTENDED_MODULES += $(if $(CONFIG_GPIODD),gpio,)
EXTENDED_MODULES += $(if $(CONFIG_CONSOLE_OUTPUT_ERRORDISPLAY),errldisplay)
EXTENDED_MODULES += $(if $(CONFIG_BMC_IPMI),ipmiext)
EXTENDED_MODULES += xz
EXTENDED_MODULES += p9_stop_util
EXTENDED_MODULES += isteps_mss
EXTENDED_MODULES += p9_cpuWkup
EXTENDED_MODULES += p9_phbPerst
EXTENDED_MODULES += $(if $(CONFIG_ENABLE_HDAT_IN_HOSTBOOT),hdat)
EXTENDED_MODULES += $(if $(CONFIG_SECUREBOOT),secureboot_ext)
EXTENDED_MODULES += tod
EXTENDED_MODULES += nestmemutils
EXTENDED_MODULES += fab_iovalid
EXTENDED_MODULES += isteps_nest
EXTENDED_MODULES += isteps_io
EXTENDED_MODULES += node_comm
EXTENDED_MODULES += $(if $(CONFIG_NVDIMM),nvdimm)
EXTENDED_MODULES += $(if $(CONFIG_UCD_FLASH_UPDATES),ucd)
EXTENDED_MODULES += $(if $(CONFIG_FSP_BUILD),,nvram)
EXTENDED_MODULES += mmio
EXTENDED_MODULES += smf
EXTENDED_MODULES += expaccess
EXTENDED_MODULES += expupd
EXTENDED_MODULES += fapiwrap

#***************************************
# Working test modules
#***************************************
TESTCASE_MODULES += cxxtest
TESTCASE_MODULES += testtrace
TESTCASE_MODULES += testdevicefw
TESTCASE_MODULES += initsvctesttask
TESTCASE_MODULES += testcxxtest
TESTCASE_MODULES += testpnor
TESTCASE_MODULES += testvfs
TESTCASE_MODULES += testutil
TESTCASE_MODULES += testscan
TESTCASE_MODULES += testsecureboot
TESTCASE_MODULES += testfsiscom
TESTCASE_MODULES += testlpc
#TODO: RTC 213102 to properly add & execute HTMGT test
#TESTCASE_MODULES += $(if $(CONFIG_HTMGT),testhtmgt)
TESTCASE_MODULES += testinitservice
TESTCASE_MODULES += testfsi
TESTCASE_MODULES += testibscom
TESTCASE_MODULES += testxscom
TESTCASE_MODULES += testkernel
TESTCASE_MODULES += testtargeting
TESTCASE_MODULES += testmemoize
TESTCASE_MODULES += testprdf
TESTCASE_MODULES += $(if $(CONFIG_VPO_COMPILE),,testmdia)
TESTCASE_MODULES += testpirformat
TESTCASE_MODULES += testi2c
TESTCASE_MODULES += testmbox
TESTCASE_MODULES += $(if $(CONFIG_EARLY_TESTCASES) ,,testrtloader)
TESTCASE_MODULES += testsbe
TESTCASE_MODULES += testsbeio
TESTCASE_MODULES += testerrl
TESTCASE_MODULES += testhwas
TESTCASE_MODULES += testvpd
TESTCASE_MODULES += testsyslib
TESTCASE_MODULES += testtlsmod
TESTCASE_MODULES += testscom
TESTCASE_MODULES += $(if $(CONFIG_VPO_COMPILE),,testruntime)
TESTCASE_MODULES += testintr
TESTCASE_MODULES += testfapi2
TESTCASE_MODULES += $(if $(CONFIG_EARLY_TESTCASES) && $(FSP_BUILD) ,,testnvram)
TESTCASE_MODULES += testsmf
TESTCASE_MODULES += testexpaccess
TESTCASE_MODULES += testexpupd
TESTCASE_MODULES += testmmio

#******************************************************************
#KNOWN ISSUES (I might let these run but there is something wrong)
#All of these are tracked by a RTC story
#******************************************************************

#TESTCASE_MODULES += $(if $(CONFIG_VPO_COMPILE),,testdump)  @fixme-RTC:180751
# @TODO DefecT: 1035550 Figure out why testattn is failing sometimes
#TESTCASE_MODULES += testattn

include ${ROOTPATH}/src/usr/runtime/common/common.mk

RUNTIME_OBJECTS += rt_start.o
RUNTIME_OBJECTS += rt_main.o
RUNTIME_OBJECTS += rt_console.o
RUNTIME_OBJECTS += rt_stdlib.o
RUNTIME_OBJECTS += rt_sync.o
RUNTIME_OBJECTS += rt_assert.o
RUNTIME_OBJECTS += rt_vfs.o
RUNTIME_OBJECTS += rt_task.o
RUNTIME_OBJECTS += rt_time.o
RUNTIME_OBJECTS += runtime_utils.o
ifdef HOSTBOOT_PROFILE
# we don't instrument runtime because we don't have space, but we
# still link this in because it uses some object files that need it
RUNTIME_OBJECTS += gcov.o
endif

RUNTIME_MODULES += trace_rt
RUNTIME_MODULES += errl_rt
RUNTIME_MODULES += targeting_rt
RUNTIME_MODULES += util_rt
RUNTIME_MODULES += devicefw_rt
RUNTIME_MODULES += xscom_rt
RUNTIME_MODULES += fsiscom_rt
RUNTIME_MODULES += ibscom_rt
RUNTIME_MODULES += scom_rt
RUNTIME_MODULES += vpd_rt
RUNTIME_MODULES += i2c_rt
RUNTIME_MODULES += $(if $(CONFIG_HTMGT),htmgt_rt)
RUNTIME_MODULES += $(if $(CONFIG_HBRT_PRD),attn_rt)
RUNTIME_MODULES += $(if $(CONFIG_HBRT_PRD),prdf_rt)
RUNTIME_MODULES += $(if $(CONFIG_BMC_IPMI),ipmi_rt)
RUNTIME_MODULES += pm_rt
RUNTIME_MODULES += pnor_rt
RUNTIME_MODULES += fapi2_rt
RUNTIME_MODULES += secureboot_rt
RUNTIME_MODULES += p9_cpuWkup
RUNTIME_MODULES += fsi_rt
RUNTIME_MODULES += sbeio_rt
RUNTIME_MODULES += tod_rt
RUNTIME_MODULES += nestmemutils
RUNTIME_MODULES += imageprocs_rt
RUNTIME_MODULES += $(if $(CONFIG_NVDIMM),nvdimm_rt)
RUNTIME_MODULES += mss_rt
RUNTIME_MODULES += expaccess_rt
RUNTIME_MODULES += mmio_rt

# This is exported so that gcov knows the list of runtime modules to
# exclude from instrumentation. We can't simply export RUNTIME_MODULES or
# else we get duplicate modules in the list which causes linker errors.
export RUNTIME_MODULES_GCOV_BLACKLIST:=$(RUNTIME_MODULES)

RUNTIME_DATA_MODULES +=

RUNTIME_TESTCASE_MODULES += cxxtest_rt
RUNTIME_TESTCASE_MODULES += testsyslib_rt
RUNTIME_TESTCASE_MODULES += testxscom_rt
RUNTIME_TESTCASE_MODULES += testerrl_rt
RUNTIME_TESTCASE_MODULES += testdevicefw_rt
RUNTIME_TESTCASE_MODULES += testscom_rt
RUNTIME_TESTCASE_MODULES += testutil_rt
RUNTIME_TESTCASE_MODULES += testvpd_rt
RUNTIME_TESTCASE_MODULES += $(if $(CONFIG_HBRT_PRD),testprdf_rt)
RUNTIME_TESTCASE_MODULES += $(if $(CONFIG_HBRT_PRD),testattn_rt)
RUNTIME_TESTCASE_MODULES += $(if $(CONFIG_BMC_IPMI),testipmi_rt)
RUNTIME_TESTCASE_MODULES += testpnor_rt
RUNTIME_TESTCASE_MODULES += testfapi2_rt
RUNTIME_TESTCASE_MODULES += testsecureboot_rt
RUNTIME_TESTCASE_MODULES += testtargeting_rt
RUNTIME_TESTCASE_MODULES += testsbeio_rt
RUNTIME_TESTCASE_MODULES += testpm_rt
RUNTIME_TESTCASE_MODULES += testrsvdtracebuf_rt
RUNTIME_TESTCASE_MODULES += testexpaccess_rt

RELOCATABLE_IMAGE_LDFLAGS = -pie --export-dynamic

hbibl_OBJECTS += ${BL_BASE_OBJECTS}
hbibl_OBJECTS += ${BOOTLDR_OBJECTS}
hbibl_LDFILE = bootloader.ld
hbibl_NO_RELOCATION = 1

hbicore_OBJECTS += ${BASE_OBJECTS} tls.o
hbicore_OBJECTS += ${DIRECT_BOOT_OBJECTS}
hbicore_MODULES += ${BASE_MODULES}
hbicore_EXTENDED_MODULES += ${EXTENDED_MODULES}
hbicore_LDFILE = kernel.ld

securerom_OBJECTS += ${SECUREROM_OBJECTS}
securerom_LDFILE = securerom.ld
securerom_NO_RELOCATION = 1

# for PRDR_RULE_TABLE_TARGETS
include ${ROOTPATH}/src/usr/diag/prdf/common/rule/prdf_rule.mk

hbicore_DATA_MODULES += ${prd_rule_prf_targets}

hbicore_test_OBJECTS += ${hbicore_OBJECTS}
hbicore_test_MODULES += ${hbicore_MODULES}
hbicore_test_EXTENDED_MODULES += ${hbicore_EXTENDED_MODULES}
hbicore_test_EXTENDED_MODULES += ${TESTCASE_MODULES}
hbicore_test_DATA_MODULES += ${hbicore_DATA_MODULES}
hbicore_test_DATA_MODULES += testdata
ifndef SKIP_BINARY_FILES
hbicore_test_DATA_MODULES += secureboot_signed_container
hbicore_test_DATA_MODULES += secureboot_hash_page_table_container
endif

hbicore_test_LDFILE = kernel.ld

hbirt_OBJECTS += ${RUNTIME_OBJECTS}
hbirt_OBJECTS += ${BASE_OBJECTS} tlsrt.o
hbirt_MODULES += ${RUNTIME_MODULES}
hbirt_DATA_MODULES += ${RUNTIME_DATA_MODULES}
hbirt_DATA_MODULES += $(if $(CONFIG_HBRT_PRD),$(prd_rule_prf_targets))
hbirt_LDFLAGS = ${RELOCATABLE_IMAGE_LDFLAGS}
hbirt_LDFILE = kernel.ld

hbirt_test_OBJECTS += ${hbirt_OBJECTS}
hbirt_test_MODULES += ${hbirt_MODULES}
hbirt_test_MODULES += ${RUNTIME_TESTCASE_MODULES}
hbirt_test_DATA_MODULES += ${hbirt_DATA_MODULES}
hbirt_test_LDFLAGS = ${RELOCATABLE_IMAGE_LDFLAGS}
hbirt_test_LDFILE = kernel.ld

IMAGE_PASS_POST += buildpnor
IMAGE_PASS_POST += imgsizecheck

IMAGE_PASS_POST += $(IMGDIR)/hbotStringFile
CLEAN_TARGETS += $(IMGDIR)/hbotStringFile

include ${ROOTPATH}/config.mk

buildpnor: ${IMAGES}
	cd build/buildpnor/ && ${MAKE} buildpnor

$(IMGDIR)/hbotStringFile : $(IMAGES)
	$(ROOTPATH)/src/build/trace/tracehash_hb.pl -c -d $(ROOTPATH)/obj -s $@

.PHONY: imgsizecheck
#make sure base image isn't over 904K (908K - 4K for secure header)
#PROCESS: get size of hbicore.bin, sort with respect to 904k (925696), then see
# if last word is 904k.  If not, the base image is too big.
#NOTE: HBB size is 1MB in pnor layout. 908K is the size without ECC rounded down
#      to the nearest 4K page.
#make sure bootloader image isn't over 32k (32K = 12K for exception vectors +
#20K for bootloader code and data)
#PROCESS: get size of hbibl.bin, sort with respect to 32k (32768),
#then see if last word is 32k.  If not, the bootloader image is too big.

MAX_BASE_SIZE = 925696
MAX_BTLDR_SIZE = 32768

imgsizecheck: ${IMGDIR}/hbicore.bin ${IMGDIR}/hbibl.bin
	$(if $(findstring $(shell (stat -c%s ${IMGDIR}/hbicore.bin; echo $(MAX_BASE_SIZE)) | sort -n | tail -n1), $(MAX_BASE_SIZE)),true, @echo ERROR: ${IMGDIR}/hbicore.bin too large.  Max allowed size is $(MAX_BASE_SIZE); false)
	$(if $(findstring $(shell (stat -c%s ${IMGDIR}/hbibl.bin; echo $(MAX_BTLDR_SIZE)) | sort -n | tail -n1), $(MAX_BTLDR_SIZE)),true, @echo ERROR: ${IMGDIR}/hbibl.bin too large.  Max allowed size is $(MAX_BTLDR_SIZE); false)
OpenPOWER on IntegriCloud