blob: 1425d5a352d5589944f6cbc7f5d99079a81cdba3 [file] [log] [blame]
Patrick Georgic49d7a32020-05-08 22:50:46 +02001## SPDX-License-Identifier: GPL-2.0-only
Martin Roth59aa2b12015-06-20 16:17:12 -06002
3ifeq ($(CONFIG_HAVE_INTEL_FIRMWARE),y)
4
5# Run intermediate steps when producing coreboot.rom
6# that adds additional components to the final firmware
7# image outside of CBFS
8
9ifeq ($(CONFIG_HAVE_IFD_BIN),y)
Patrick Georgid6eb72c2021-01-12 15:09:57 +010010$(call add_intermediate, add_intel_firmware)
Angel Ponsa52016c2018-09-11 13:49:45 +020011else ifeq ($(CONFIG_INTEL_DESCRIPTOR_MODE_REQUIRED),y)
Martin Roth372503f2023-12-08 00:43:23 -070012show_notices:: warn_intel_firmware
Martin Roth59aa2b12015-06-20 16:17:12 -060013endif
14
Martin Roth59aa2b12015-06-20 16:17:12 -060015IFD_BIN_PATH := $(CONFIG_IFD_BIN_PATH)
Andrey Petrovc4d0f522016-11-06 23:43:16 -080016ifneq ($(call strip_quotes,$(CONFIG_IFD_CHIPSET)),)
17IFDTOOL_USE_CHIPSET := -p $(CONFIG_IFD_CHIPSET)
18endif
Martin Roth59aa2b12015-06-20 16:17:12 -060019
Sridhar Siricilla416b8282020-12-03 17:56:49 +053020ifeq ($(CONFIG_ME_REGION_ALLOW_CPU_READ_ACCESS),y)
21IFDTOOL_LOCK_ME_MODE := -lr
22else
23IFDTOOL_LOCK_ME_MODE := -l
24endif
25
Nico Huber26e59a62019-06-08 19:49:48 +020026add_intel_firmware: $(call strip_quotes,$(CONFIG_IFD_BIN_PATH))
27ifeq ($(CONFIG_HAVE_ME_BIN),y)
Furquan Shaikh3959aa62021-10-01 15:18:09 -070028
29OBJ_ME_BIN := $(obj)/me.bin
30
31ifneq ($(CONFIG_STITCH_ME_BIN),y)
32
33$(OBJ_ME_BIN): $(call strip_quotes,$(CONFIG_ME_BIN_PATH))
34 cp $< $@
35
36endif
37
38add_intel_firmware: $(OBJ_ME_BIN)
39
Nico Huber26e59a62019-06-08 19:49:48 +020040endif
41ifeq ($(CONFIG_HAVE_GBE_BIN),y)
42add_intel_firmware: $(call strip_quotes,$(CONFIG_GBE_BIN_PATH))
43endif
44ifeq ($(CONFIG_HAVE_EC_BIN),y)
45add_intel_firmware: $(call strip_quotes,$(CONFIG_EC_BIN_PATH))
46endif
Angel Pons240eaaa2018-08-20 16:32:22 +020047add_intel_firmware: $(obj)/coreboot.pre $(IFDTOOL)
Martin Roth59aa2b12015-06-20 16:17:12 -060048 printf " DD Adding Intel Firmware Descriptor\n"
Patrick Georgi0b7d3a12021-01-13 09:16:41 +010049 dd if=$(IFD_BIN_PATH) \
Martin Roth59aa2b12015-06-20 16:17:12 -060050 of=$(obj)/coreboot.pre conv=notrunc >/dev/null 2>&1
Mathew Kingd8b150f2019-08-09 10:55:37 -060051ifeq ($(CONFIG_VALIDATE_INTEL_DESCRIPTOR),y)
Maximilian Bruneab0e6802023-03-05 04:34:40 +010052 printf " IFDTOOL validate IFD against FMAP\n"
Mathew Kingd8b150f2019-08-09 10:55:37 -060053 $(objutil)/ifdtool/ifdtool \
54 $(IFDTOOL_USE_CHIPSET) \
55 -t $(obj)/coreboot.pre
56endif
Martin Roth59aa2b12015-06-20 16:17:12 -060057ifeq ($(CONFIG_HAVE_ME_BIN),y)
58 printf " IFDTOOL me.bin -> coreboot.pre\n"
59 $(objutil)/ifdtool/ifdtool \
Andrey Petrovc4d0f522016-11-06 23:43:16 -080060 $(IFDTOOL_USE_CHIPSET) \
Furquan Shaikh3959aa62021-10-01 15:18:09 -070061 -i ME:$(OBJ_ME_BIN) \
Marcello Sylvester Bauerefc4be62020-03-04 12:32:14 +010062 -O $(obj)/coreboot.pre \
Martin Roth59aa2b12015-06-20 16:17:12 -060063 $(obj)/coreboot.pre
Martin Roth59aa2b12015-06-20 16:17:12 -060064endif
Nicola Corna16719ad2017-03-10 11:27:39 +010065ifeq ($(CONFIG_CHECK_ME),y)
66 util/me_cleaner/me_cleaner.py -c $(obj)/coreboot.pre > /dev/null
67endif
Nicola Corna92e95ca2017-01-23 15:29:03 +010068ifeq ($(CONFIG_USE_ME_CLEANER),y)
69 printf " ME_CLEANER coreboot.pre\n"
Nicola Corna364f2e12018-03-31 18:24:44 +020070 util/me_cleaner/me_cleaner.py $(obj)/coreboot.pre \
71 $(patsubst "%,%,$(patsubst %",%,$(CONFIG_ME_CLEANER_ARGS))) > \
Nicola Corna92e95ca2017-01-23 15:29:03 +010072 $(obj)/me_cleaner.log
73endif
Martin Rothc6a177d2015-07-09 20:50:51 -060074ifeq ($(CONFIG_HAVE_GBE_BIN),y)
75 printf " IFDTOOL gbe.bin -> coreboot.pre\n"
76 $(objutil)/ifdtool/ifdtool \
Andrey Petrovc4d0f522016-11-06 23:43:16 -080077 $(IFDTOOL_USE_CHIPSET) \
Martin Rothc6a177d2015-07-09 20:50:51 -060078 -i GbE:$(CONFIG_GBE_BIN_PATH) \
Marcello Sylvester Bauerefc4be62020-03-04 12:32:14 +010079 -O $(obj)/coreboot.pre \
Martin Rothc6a177d2015-07-09 20:50:51 -060080 $(obj)/coreboot.pre
Martin Rothc6a177d2015-07-09 20:50:51 -060081endif
Lijian Zhao0fb65682017-05-16 12:11:45 -070082ifeq ($(CONFIG_HAVE_EC_BIN),y)
83 printf " IFDTOOL ec.bin -> coreboot.pre\n"
84 $(objutil)/ifdtool/ifdtool \
85 $(IFDTOOL_USE_CHIPSET) \
86 -i EC:$(CONFIG_EC_BIN_PATH) \
Marcello Sylvester Bauerefc4be62020-03-04 12:32:14 +010087 -O $(obj)/coreboot.pre \
Lijian Zhao0fb65682017-05-16 12:11:45 -070088 $(obj)/coreboot.pre
Lijian Zhao0fb65682017-05-16 12:11:45 -070089endif
Jeff Daly1e4d9d52022-01-06 16:16:46 -050090ifeq ($(CONFIG_HAVE_10GBE_0_BIN),y)
91 printf " IFDTOOL 10gbe0.bin -> coreboot.pre\n"
92 $(objutil)/ifdtool/ifdtool \
93 $(IFDTOOL_USE_CHIPSET) \
94 -i 10GbE_0:$(CONFIG_10GBE_0_BIN_PATH) \
95 -O $(obj)/coreboot.pre \
96 $(obj)/coreboot.pre
97endif
98ifeq ($(CONFIG_HAVE_10GBE_1_BIN),y)
99 printf " IFDTOOL 10gbe1.bin -> coreboot.pre\n"
100 $(objutil)/ifdtool/ifdtool \
101 $(IFDTOOL_USE_CHIPSET) \
102 -i 10GbE_1:$(CONFIG_10GBE_1_BIN_PATH) \
103 -O $(obj)/coreboot.pre \
104 $(obj)/coreboot.pre
105endif
Martin Roth59aa2b12015-06-20 16:17:12 -0600106ifeq ($(CONFIG_LOCK_MANAGEMENT_ENGINE),y)
107 printf " IFDTOOL Locking Management Engine\n"
Andrey Petrovc4d0f522016-11-06 23:43:16 -0800108 $(objutil)/ifdtool/ifdtool \
Sridhar Siricilla416b8282020-12-03 17:56:49 +0530109 $(IFDTOOL_USE_CHIPSET) $(IFDTOOL_LOCK_ME_MODE) \
Marcello Sylvester Bauerefc4be62020-03-04 12:32:14 +0100110 -O $(obj)/coreboot.pre \
111 $(obj)/coreboot.pre
Mario Scheithauer26874432019-02-27 10:29:01 +0100112endif
113ifeq ($(CONFIG_UNLOCK_FLASH_REGIONS),y)
Martin Roth59aa2b12015-06-20 16:17:12 -0600114 printf " IFDTOOL Unlocking Management Engine\n"
Andrey Petrovc4d0f522016-11-06 23:43:16 -0800115 $(objutil)/ifdtool/ifdtool \
Marcello Sylvester Bauerefc4be62020-03-04 12:32:14 +0100116 $(IFDTOOL_USE_CHIPSET) -u \
117 -O $(obj)/coreboot.pre \
118 $(obj)/coreboot.pre
Martin Roth59aa2b12015-06-20 16:17:12 -0600119endif
120
Martin Rothb9de78b2015-12-03 14:27:45 -0700121ifeq ($(CONFIG_EM100),y)
122 printf " IFDTOOL Setting EM100 mode\n"
Andrey Petrovc4d0f522016-11-06 23:43:16 -0800123 $(objutil)/ifdtool/ifdtool \
Marcello Sylvester Bauerefc4be62020-03-04 12:32:14 +0100124 $(IFDTOOL_USE_CHIPSET) --em100 \
125 -O $(obj)/coreboot.pre \
126 $(obj)/coreboot.pre
Martin Rothb9de78b2015-12-03 14:27:45 -0700127endif
128
Angel Ponsa52016c2018-09-11 13:49:45 +0200129warn_intel_firmware:
130 printf "\n\t** WARNING **\n"
Nico Huber5ef34602018-09-19 10:09:16 +0200131 printf "coreboot has been built without an Intel Firmware Descriptor.\n"
Angel Ponsa52016c2018-09-11 13:49:45 +0200132 printf "Never write a complete coreboot.rom without an IFD to your\n"
133 printf "board's flash chip! You can use flashrom's IFD or layout\n"
134 printf "parameters to flash only to the BIOS region.\n\n"
135
Patrick Georgid6eb72c2021-01-12 15:09:57 +0100136PHONY+=warn_intel_firmware
Martin Roth59aa2b12015-06-20 16:17:12 -0600137
138endif