src/: Replace GPL boilerplate with SPDX headers
[coreboot.git] / src / southbridge / intel / common / firmware / Makefile.inc
blobb93b785e7d536c31613c03532982ae570ded8c05
1 ##
2 ## This file is part of the coreboot project.
3 ##
4 ##
5 ## SPDX-License-Identifier: GPL-2.0-only
7 ifeq ($(CONFIG_HAVE_INTEL_FIRMWARE),y)
9 # Run intermediate steps when producing coreboot.rom
10 # that adds additional components to the final firmware
11 # image outside of CBFS
13 ifeq ($(CONFIG_HAVE_IFD_BIN),y)
14 INTERMEDIATE+=add_intel_firmware
15 else ifeq ($(CONFIG_INTEL_DESCRIPTOR_MODE_REQUIRED),y)
16 files_added:: warn_intel_firmware
17 endif
19 IFD_BIN_PATH := $(CONFIG_IFD_BIN_PATH)
20 ifneq ($(call strip_quotes,$(CONFIG_IFD_CHIPSET)),)
21 IFDTOOL_USE_CHIPSET := -p $(CONFIG_IFD_CHIPSET)
22 endif
24 add_intel_firmware: $(call strip_quotes,$(CONFIG_IFD_BIN_PATH))
25 ifeq ($(CONFIG_HAVE_ME_BIN),y)
26 add_intel_firmware: $(call strip_quotes,$(CONFIG_ME_BIN_PATH))
27 endif
28 ifeq ($(CONFIG_HAVE_GBE_BIN),y)
29 add_intel_firmware: $(call strip_quotes,$(CONFIG_GBE_BIN_PATH))
30 endif
31 ifeq ($(CONFIG_HAVE_EC_BIN),y)
32 add_intel_firmware: $(call strip_quotes,$(CONFIG_EC_BIN_PATH))
33 endif
34 add_intel_firmware: $(obj)/coreboot.pre $(IFDTOOL)
35         printf "    DD         Adding Intel Firmware Descriptor\n"
36         dd if=$(IFD_BIN_PATH) \
37                 of=$(obj)/coreboot.pre conv=notrunc >/dev/null 2>&1
38 ifeq ($(CONFIG_VALIDATE_INTEL_DESCRIPTOR),y)
39         $(objutil)/ifdtool/ifdtool \
40                 $(IFDTOOL_USE_CHIPSET) \
41                 -t $(obj)/coreboot.pre
42 endif
43 ifeq ($(CONFIG_HAVE_ME_BIN),y)
44         printf "    IFDTOOL    me.bin -> coreboot.pre\n"
45         $(objutil)/ifdtool/ifdtool \
46                 $(IFDTOOL_USE_CHIPSET) \
47                 -i ME:$(CONFIG_ME_BIN_PATH) \
48                 -O $(obj)/coreboot.pre \
49                 $(obj)/coreboot.pre
50 endif
51 ifeq ($(CONFIG_CHECK_ME),y)
52         util/me_cleaner/me_cleaner.py -c $(obj)/coreboot.pre > /dev/null
53 endif
54 ifeq ($(CONFIG_USE_ME_CLEANER),y)
55         printf "    ME_CLEANER coreboot.pre\n"
56         util/me_cleaner/me_cleaner.py $(obj)/coreboot.pre \
57                 $(patsubst "%,%,$(patsubst %",%,$(CONFIG_ME_CLEANER_ARGS))) > \
58                 $(obj)/me_cleaner.log
59 endif
60 ifeq ($(CONFIG_HAVE_GBE_BIN),y)
61         printf "    IFDTOOL    gbe.bin -> coreboot.pre\n"
62         $(objutil)/ifdtool/ifdtool \
63                 $(IFDTOOL_USE_CHIPSET) \
64                 -i GbE:$(CONFIG_GBE_BIN_PATH) \
65                 -O $(obj)/coreboot.pre \
66                 $(obj)/coreboot.pre
67 endif
68 ifeq ($(CONFIG_HAVE_EC_BIN),y)
69         printf "    IFDTOOL    ec.bin -> coreboot.pre\n"
70         $(objutil)/ifdtool/ifdtool \
71                 $(IFDTOOL_USE_CHIPSET) \
72                 -i EC:$(CONFIG_EC_BIN_PATH) \
73                 -O $(obj)/coreboot.pre \
74                 $(obj)/coreboot.pre
75 endif
77 ifeq ($(CONFIG_LOCK_MANAGEMENT_ENGINE),y)
78         printf "    IFDTOOL    Locking Management Engine\n"
79         $(objutil)/ifdtool/ifdtool \
80                 $(IFDTOOL_USE_CHIPSET) -l \
81                 -O $(obj)/coreboot.pre \
82                 $(obj)/coreboot.pre
83 endif
84 ifeq ($(CONFIG_UNLOCK_FLASH_REGIONS),y)
85         printf "    IFDTOOL    Unlocking Management Engine\n"
86         $(objutil)/ifdtool/ifdtool \
87         $(IFDTOOL_USE_CHIPSET) -u \
88         -O $(obj)/coreboot.pre \
89         $(obj)/coreboot.pre
90 endif
92 ifeq ($(CONFIG_EM100),y)
93         printf "    IFDTOOL    Setting EM100 mode\n"
94         $(objutil)/ifdtool/ifdtool \
95                 $(IFDTOOL_USE_CHIPSET) --em100 \
96                 -O $(obj)/coreboot.pre \
97                 $(obj)/coreboot.pre
98 endif
100 warn_intel_firmware:
101         printf "\n\t** WARNING **\n"
102         printf "coreboot has been built without an Intel Firmware Descriptor.\n"
103         printf "Never write a complete coreboot.rom without an IFD to your\n"
104         printf "board's flash chip! You can use flashrom's IFD or layout\n"
105         printf "parameters to flash only to the BIOS region.\n\n"
107 PHONY+=add_intel_firmware warn_intel_firmware
109 endif