blob: 4b5d67b908e13015b81b8d569c6d7690dd60e240 [file] [log] [blame]
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -05001################################################################################
2## Subdirectories
3################################################################################
Alexandru Gagniucf64111b2013-12-13 20:44:48 -06004subdirs-y += allwinner
Ronald G. Minnichfd4519b2009-08-12 15:56:17 +00005subdirs-y += amd
Hung-Te Lin7635a602013-02-12 00:07:38 +08006subdirs-y += armltd
Patrick Georgi0588d192009-08-12 15:00:51 +00007subdirs-y += intel
Gabe Black3c7e9392013-05-26 07:15:57 -07008subdirs-y += ti
Alexandru Gagniuccc328422015-10-04 19:34:08 -07009subdirs-$(CONFIG_ARCH_X86) += x86
Gerd Hoffmanncbf30732013-05-31 09:23:26 +020010subdirs-$(CONFIG_CPU_QEMU_X86) += qemu-x86
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050011
Furquan Shaikh99ac98f2014-04-23 10:18:48 -070012$(eval $(call create_class_compiler,cpu_microcode,x86_32))
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050013################################################################################
14## Rules for building the microcode blob in CBFS
15################################################################################
16
Timothy Pearson24e6d042015-10-08 16:58:58 -050017ifneq ($(CONFIG_CPU_MICROCODE_MULTIPLE_FILES), y)
Nico Huberf5ca9222018-11-29 17:05:32 +010018cbfs-files-$(CONFIG_USE_CPU_MICROCODE_CBFS_BINS) += cpu_microcode_blob.bin
Timothy Pearson24e6d042015-10-08 16:58:58 -050019endif
Alexandru Gagniuc00b579a2012-07-20 00:11:21 -050020
Martin Roth4c502692015-11-05 08:03:45 -070021ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_HEADER),y)
22cbfs-files-y += cpu_microcode_blob.bin
23cpu_microcode_blob.bin-file = $(objgenerated)/microcode.bin
24
Julien Viard de Galbertc4673342017-11-03 14:07:55 +010025$(objgenerated)/microcode.bin: $(call strip_quotes,$(CONFIG_CPU_MICROCODE_HEADER_FILES))
Martin Roth4c502692015-11-05 08:03:45 -070026 echo " util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin \"$(CONFIG_CPU_MICROCODE_HEADER_FILES)\""
27 util/scripts/ucode_h_to_bin.sh $(objgenerated)/microcode.bin $(CONFIG_CPU_MICROCODE_HEADER_FILES)
28endif
29
Nico Huberf5ca9222018-11-29 17:05:32 +010030ifeq ($(CONFIG_CPU_MICROCODE_CBFS_EXTERNAL_BINS),y)
31cpu_microcode_bins := $(call strip_quotes,$(CONFIG_CPU_UCODE_BINARIES))
32endif
33# otherwise `cpu_microcode_bins` should be filled by platform makefiles
34
Alexandru Gagniuc1d857002015-09-09 22:38:06 -070035# We just mash all microcode binaries together into one binary to rule them all.
36# This approach assumes that the microcode binaries are properly padded, and
37# their headers specify the correct size. This works fairly well on isolatied
38# updates, such as Intel and some AMD microcode, but won't work very well if the
39# updates are wrapped in a container, like AMD's microcode update container. If
40# there is only one microcode binary (i.e. one container), then we don't have
41# this issue, and this rule will continue to work.
Martin Roth85653742016-12-22 10:29:20 -070042$(obj)/cpu_microcode_blob.bin: $$(wildcard $$(cpu_microcode_bins))
43 for bin in $(cpu_microcode_bins); do \
44 if [ ! -f "$$bin" ]; then \
45 echo "Microcode error: $$bin does not exist"; \
46 NO_MICROCODE_FILE=1; \
47 fi; \
48 done; \
49 if [ -n "$$NO_MICROCODE_FILE" ]; then \
Nico Huberf5ca9222018-11-29 17:05:32 +010050 if [ -z "$(CONFIG_USE_BLOBS)" ] && [ -n "$(CONFIG_CPU_MICROCODE_CBFS_DEFAULT_BINS)" ]; then \
Martin Roth85653742016-12-22 10:29:20 -070051 echo "Try enabling binary-only repository in Kconfig 'General setup' menu."; \
52 fi; \
53 false; \
54 fi
Nico Huberf5ca9222018-11-29 17:05:32 +010055 $(if $^,,false) # fail if no file is given at all
Daniele Forsi21fbc082014-08-10 15:18:42 +020056 @printf " MICROCODE $(subst $(obj)/,,$(@))\n"
Alexandru Gagniuc1d857002015-09-09 22:38:06 -070057 @echo $(cpu_microcode_bins)
Nico Huberf5ca9222018-11-29 17:05:32 +010058 cat $^ > $@
Aaron Durbin32ab2832013-06-11 16:36:37 -050059
Martin Roth4c502692015-11-05 08:03:45 -070060cpu_microcode_blob.bin-file ?= $(obj)/cpu_microcode_blob.bin
Alexandru Gagniucf55e6682015-09-07 00:35:55 -070061cpu_microcode_blob.bin-type := microcode
Alexandru Gagniucf55e6682015-09-07 00:35:55 -070062cpu_microcode_blob.bin-align := 16