From f845adc2448c56096f4ba64f676937d9fbdd061b Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Thu, 18 Jan 2024 12:34:16 -0700 Subject: lib,console,sbom: Rename Makefiles from .inc to .mk MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The .inc suffix is confusing to various tools as it's not specific to Makefiles. This means that editors don't recognize the files, and don't open them with highlighting and any other specific editor functionality. This issue is also seen in the release notes generation script where Makefiles get renamed before running cloc. Signed-off-by: Martin Roth Change-Id: I9eabe84d55fd9f434e4128866810c0e4970f2ae7 Reviewed-on: https://review.coreboot.org/c/coreboot/+/80081 Reviewed-by: Michael Niewöhner Tested-by: build bot (Jenkins) Reviewed-by: Maximilian Brune Reviewed-by: Felix Singer --- src/console/Makefile.inc | 44 ----- src/console/Makefile.mk | 44 +++++ src/lib/Makefile.inc | 425 ---------------------------------------------- src/lib/Makefile.mk | 425 ++++++++++++++++++++++++++++++++++++++++++++++ src/lib/gnat/Makefile.inc | 59 ------- src/lib/gnat/Makefile.mk | 59 +++++++ src/sbom/Makefile.inc | 159 ----------------- src/sbom/Makefile.mk | 159 +++++++++++++++++ 8 files changed, 687 insertions(+), 687 deletions(-) delete mode 100644 src/console/Makefile.inc create mode 100644 src/console/Makefile.mk delete mode 100644 src/lib/Makefile.inc create mode 100644 src/lib/Makefile.mk delete mode 100644 src/lib/gnat/Makefile.inc create mode 100644 src/lib/gnat/Makefile.mk delete mode 100644 src/sbom/Makefile.inc create mode 100644 src/sbom/Makefile.mk (limited to 'src') diff --git a/src/console/Makefile.inc b/src/console/Makefile.inc deleted file mode 100644 index fd98cf7354..0000000000 --- a/src/console/Makefile.inc +++ /dev/null @@ -1,44 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only - -ramstage-y += vtxprintf.c printk.c vsprintf.c -ramstage-y += init.c console.c -ramstage-y += post.c -ramstage-y += die.c -ifeq ($(CONFIG_HWBASE_DEBUG_CB),y) -ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.ads -ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.adb -romstage-$(CONFIG_ROMSTAGE_LIBHWBASE) += hw-debug_sink.ads -romstage-$(CONFIG_ROMSTAGE_LIBHWBASE) += hw-debug_sink.adb -endif - -smm-$(CONFIG_DEBUG_SMI) += init.c console.c vtxprintf.c printk.c -smm-y += die.c -smm-y += post.c - -ifneq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) -verstage-y += printk.c -verstage-y += console.c -endif -verstage-y += post.c -verstage-y += die.c -verstage-y += init.c -verstage-y += vtxprintf.c vsprintf.c - -romstage-y += vtxprintf.c printk.c vsprintf.c -romstage-y += init.c console.c -romstage-y += post.c -romstage-y += die.c - -postcar-y += vtxprintf.c vsprintf.c -postcar-$(CONFIG_POSTCAR_CONSOLE) += printk.c -postcar-$(CONFIG_POSTCAR_CONSOLE) += init.c console.c -postcar-y += post.c -postcar-y += die.c - -bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += printk.c -bootblock-y += vtxprintf.c vsprintf.c -bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += init.c console.c -bootblock-y += post.c -bootblock-y += die.c - -decompressor-y += die.c diff --git a/src/console/Makefile.mk b/src/console/Makefile.mk new file mode 100644 index 0000000000..fd98cf7354 --- /dev/null +++ b/src/console/Makefile.mk @@ -0,0 +1,44 @@ +## SPDX-License-Identifier: GPL-2.0-only + +ramstage-y += vtxprintf.c printk.c vsprintf.c +ramstage-y += init.c console.c +ramstage-y += post.c +ramstage-y += die.c +ifeq ($(CONFIG_HWBASE_DEBUG_CB),y) +ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.ads +ramstage-$(CONFIG_RAMSTAGE_LIBHWBASE) += hw-debug_sink.adb +romstage-$(CONFIG_ROMSTAGE_LIBHWBASE) += hw-debug_sink.ads +romstage-$(CONFIG_ROMSTAGE_LIBHWBASE) += hw-debug_sink.adb +endif + +smm-$(CONFIG_DEBUG_SMI) += init.c console.c vtxprintf.c printk.c +smm-y += die.c +smm-y += post.c + +ifneq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) +verstage-y += printk.c +verstage-y += console.c +endif +verstage-y += post.c +verstage-y += die.c +verstage-y += init.c +verstage-y += vtxprintf.c vsprintf.c + +romstage-y += vtxprintf.c printk.c vsprintf.c +romstage-y += init.c console.c +romstage-y += post.c +romstage-y += die.c + +postcar-y += vtxprintf.c vsprintf.c +postcar-$(CONFIG_POSTCAR_CONSOLE) += printk.c +postcar-$(CONFIG_POSTCAR_CONSOLE) += init.c console.c +postcar-y += post.c +postcar-y += die.c + +bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += printk.c +bootblock-y += vtxprintf.c vsprintf.c +bootblock-$(CONFIG_BOOTBLOCK_CONSOLE) += init.c console.c +bootblock-y += post.c +bootblock-y += die.c + +decompressor-y += die.c diff --git a/src/lib/Makefile.inc b/src/lib/Makefile.inc deleted file mode 100644 index fd3f464ffd..0000000000 --- a/src/lib/Makefile.inc +++ /dev/null @@ -1,425 +0,0 @@ -# SPDX-License-Identifier: GPL-2.0-only - -subdirs-y += gnat - -ifeq ($(CONFIG_UBSAN),y) -ramstage-y += ubsan.c -CFLAGS_ramstage += -fsanitize=undefined -endif - -# Ensure that asan_shadow_offset_callback patch is applied to GCC before ASan is used. -CFLAGS_asan += -fsanitize=kernel-address --param asan-use-shadow-offset-callback=1 \ - --param asan-stack=1 -fsanitize-address-use-after-scope \ - --param asan-instrumentation-with-call-threshold=0 \ - --param use-after-scope-direct-emission-threshold=0 - -ifeq ($(CONFIG_ASAN_IN_ROMSTAGE),y) -romstage-y += asan.c -CFLAGS_asan += --param asan-globals=0 -CFLAGS_romstage += $(CFLAGS_asan) -# Allow memory access without __asan_load and __asan_store checks. -$(obj)/romstage/lib/asan.o: CFLAGS_asan = -endif - -ifeq ($(CONFIG_ASAN_IN_RAMSTAGE),y) -ramstage-y += asan.c -CFLAGS_asan += --param asan-globals=1 -CFLAGS_ramstage += $(CFLAGS_asan) -$(obj)/ramstage/lib/asan.o: CFLAGS_asan = -endif - -all-y += list.c - -decompressor-y += decompressor.c -$(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4 -$(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4 -# Must reset CCACHE_EXTRAFILES or make applies it transitively to dependencies. -$(objcbfs)/bootblock.lz4: CCACHE_EXTRAFILES= - -decompressor-y += delay.c -decompressor-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c -decompressor-y += memchr.c -decompressor-y += memcmp.c -decompressor-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c -decompressor-y += prog_ops.c -decompressor-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c - -bootblock-y += bootblock.c -bootblock-y += prog_loaders.c -bootblock-y += prog_ops.c -bootblock-y += cbfs.c -bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c -bootblock-y += libgcc.c -ifneq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) -bootblock-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c -else # ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) -verstage-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c -endif # ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) -bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c - -bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c - -bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c -bootblock-y += delay.c -bootblock-y += memchr.c -bootblock-y += memcmp.c -bootblock-y += boot_device.c -bootblock-y += fmap.c - -verstage-y += prog_loaders.c -verstage-y += prog_ops.c -verstage-y += delay.c -verstage-y += cbfs.c -verstage-y += halt.c -verstage-y += fmap.c -verstage-y += libgcc.c -verstage-y += memcmp.c -verstage-y += string.c - -verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c -verstage-y += boot_device.c -verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c - -verstage-$(CONFIG_GENERIC_UDELAY) += timer.c -verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c - -romstage-$(CONFIG_PROBE_RAM) += ramdetect.c -romstage-y += prog_loaders.c -romstage-y += prog_ops.c -romstage-y += memchr.c -romstage-y += memcmp.c -$(foreach arch,$(ARCH_SUPPORTED),\ - $(eval rmodules_$(arch)-y += memcmp.c) \ - $(eval rmodules_$(arch)-y += rmodule.ld)) - -romstage-y += fmap.c -romstage-y += delay.c -romstage-y += cbfs.c -ifneq ($(CONFIG_COMPRESS_RAMSTAGE_LZMA)$(CONFIG_FSP_COMPRESS_FSP_M_LZMA),) -romstage-y += lzma.c lzmadecode.c -endif -romstage-y += libgcc.c -romstage-y += memrange.c -romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c -ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c -romstage-y += ramtest.c -romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c -ramstage-y += region_file.c -romstage-y += region_file.c -ramstage-y += romstage_handoff.c -romstage-y += romstage_handoff.c -romstage-y += selfboot.c -romstage-y += stack.c -romstage-y += rtc.c -ramstage-y += rtc.c - -romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c -romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c - -bootblock-y += compute_ip_checksum.c -romstage-y += compute_ip_checksum.c -romstage-y += dimm_info_util.c -ifeq ($(CONFIG_COMPILER_GCC),y) -bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += gcc.c -verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += gcc.c -romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c -ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c -smm-y += gcc.c -endif - -romstage-$(CONFIG_GENERIC_UDELAY) += timer.c - -ramstage-$(CONFIG_PROBE_RAM) += ramdetect.c -ramstage-y += prog_loaders.c -ramstage-y += prog_ops.c -ramstage-y += hardwaremain.c -ramstage-y += selfboot.c -ramstage-y += coreboot_table.c -ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c -ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios_defaults.c -ramstage-y += bootmem.c -ramstage-y += fmap.c -ramstage-y += memchr.c -ramstage-y += memcmp.c -ramstage-y += malloc.c -ramstage-y += dimm_info_util.c -ramstage-y += delay.c -ramstage-y += fallback_boot.c -ramstage-y += compute_ip_checksum.c -ramstage-y += cbfs.c -ramstage-y += lzma.c lzmadecode.c -ramstage-y += stack.c -ramstage-y += hexstrtobin.c -ramstage-y += wrdd.c -ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c -ramstage-$(CONFIG_BMP_LOGO) += bmp_logo.c -ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c -ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c -ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c -ramstage-$(CONFIG_COVERAGE) += libgcov.c -ramstage-y += dp_aux.c -ramstage-y += edid.c -ramstage-y += edid_fill_fb.c -ramstage-y += memrange.c -ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c -ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c -ramstage-y += b64_decode.c -ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c -ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c -ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c -ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c - -romstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c -ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c - -romstage-$(CONFIG_COOP_MULTITASKING) += thread.c -ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c - -romstage-y += cbmem_common.c -romstage-y += imd_cbmem.c -romstage-y += imd.c - -ramstage-y += cbmem_common.c -ramstage-y += imd_cbmem.c -ramstage-y += imd.c - -postcar-$(CONFIG_PROBE_RAM) += ramdetect.c -postcar-y += cbmem_common.c -postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c -postcar-y += imd_cbmem.c -postcar-y += imd.c -postcar-y += romstage_handoff.c - -bootblock-y += hexdump.c -postcar-y += hexdump.c -ramstage-y += hexdump.c -romstage-y += hexdump.c -verstage-y += hexdump.c -smm-y += hexdump.c - -bootblock-$(CONFIG_FW_CONFIG) += fw_config.c -verstage-$(CONFIG_FW_CONFIG) += fw_config.c -romstage-$(CONFIG_FW_CONFIG) += fw_config.c -ramstage-$(CONFIG_FW_CONFIG) += fw_config.c - -bootblock-$(CONFIG_ESPI_DEBUG) += espi_debug.c -verstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c -romstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c -ramstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c - -bootblock-$(CONFIG_REG_SCRIPT) += reg_script.c -verstage-$(CONFIG_REG_SCRIPT) += reg_script.c -romstage-$(CONFIG_REG_SCRIPT) += reg_script.c -ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c - -ramstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c -romstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c -postcar-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c - -ramstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c -romstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c -postcar-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c - -romstage-y += boot_device.c -ramstage-y += boot_device.c - -smm-y += boot_device.c -smm-y += delay.c -smm-y += fmap.c -smm-y += cbfs.c memcmp.c -smm-$(CONFIG_GENERIC_UDELAY) += timer.c -ifeq ($(CONFIG_DEBUG_SMI),y) -smm-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c -endif - -all-y += identity.c version.c -smm-y += identity.c version.c - -$(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h -$(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h -$(call src-to-obj,ramstage,$(dir)/version.c) : $(obj)/build.h -$(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h -$(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h -$(call src-to-obj,postcar,$(dir)/version.c) : $(obj)/build.h - -bootblock-y += bootmode.c -romstage-y += bootmode.c -ramstage-y += bootmode.c -verstage-y += bootmode.c - -decompressor-y += halt.c -bootblock-y += halt.c -romstage-y += halt.c -ramstage-y += halt.c -smm-y += halt.c - -decompressor-y += reset.c -bootblock-y += reset.c -verstage-y += reset.c -romstage-y += reset.c -postcar-y += reset.c -ramstage-y += reset.c -smm-y += reset.c - -decompressor-y += string.c -bootblock-y += string.c -verstage-y += string.c -romstage-y += string.c -postcar-y += string.c -ramstage-y += string.c -smm-y += string.c - -decompressor-y += crc_byte.c -bootblock-y += crc_byte.c -verstage-y += crc_byte.c -romstage-y += crc_byte.c -postcar-y += crc_byte.c -ramstage-y += crc_byte.c -smm-y += crc_byte.c - -romstage-y += xxhash.c -ramstage-y += xxhash.c - -postcar-y += bootmode.c -postcar-y += boot_device.c -postcar-y += cbfs.c -postcar-y += delay.c -postcar-y += fmap.c -postcar-y += gcc.c -postcar-y += halt.c -postcar-y += libgcc.c -postcar-$(CONFIG_COMPRESS_RAMSTAGE_LZMA) += lzma.c lzmadecode.c -postcar-y += memchr.c -postcar-y += memcmp.c -postcar-y += prog_loaders.c -postcar-y += prog_ops.c -postcar-y += rmodule.c -postcar-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c -postcar-$(CONFIG_GENERIC_UDELAY) += timer.c - -# Use program.ld for all the platforms which use C fo the bootblock. -bootblock-y += program.ld - -decompressor-y += program.ld -postcar-y += program.ld -romstage-y += program.ld -ramstage-y += program.ld -verstage-y += program.ld - -ifeq ($(CONFIG_RELOCATABLE_MODULES),y) -ramstage-y += rmodule.c -romstage-y += rmodule.c - -RMODULE_LDFLAGS := -z defs -Bsymbolic - -# rmodule_link_rules is a function that should be called with: -# (1) the object name to link -# (2) the dependencies -# (3) heap size of the relocatable module -# (4) arch for which the rmodules are to be linked -# It will create the necessary Make rules to create a rmodule. The resulting -# rmdoule is named $(1).rmod -define rmodule_link -$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL) - $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) $($(1)-ldflags) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group - $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map -endef - -endif - -$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL) - $(RMODTOOL) -i $< -o $@ - -$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL) - $(RMODTOOL) -i $< -o $@ - -romstage-$(CONFIG_ROMSTAGE_ADA) += cb.ads -ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads - -ifneq (,$(filter y, $(CONFIG_RAMSTAGE_LIBHWBASE) $(CONFIG_ROMSTAGE_LIBHWBASE))) - -to-ada-hex = $(eval $(1) := 16\\\#$(patsubst 0x%,%,$($(1)))\\\#) - -$(call to-ada-hex,CONFIG_HWBASE_DEFAULT_MMCONF) - -libhwbase-stages = $(foreach stage, romstage ramstage, \ - $(if $(filter y,$(CONFIG_$(call toupper,$(stage))_LIBHWBASE)),$(stage))) - -$(call add-special-class,hw) -hw-handler +=$(foreach stage, $(libhwbase-stages), \ - $(eval $(stage)-srcs += $$(addprefix $(1),$(2)))) - -$(call add-special-class,hw-gen) -hw-gen-handler = \ - $(eval additional-dirs += $(dir $(2))) \ - $(foreach stage, $(libhwbase-stages), \ - $(eval $(stage)-srcs += $(2)) \ - $(eval $(stage)-ads-deps += $(2)) \ - $(eval $(stage)-adb-deps += $(2))) \ - $(eval $(2): $(obj)/config.h) - -subdirs-y += ../../3rdparty/libhwbase - -$(foreach stage,$(libhwbase-stages), \ - $(eval $(stage)-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb)) - -endif # CONFIG_ROMSTAGE_LIBHWBASE || CONFIG_RAMSTAGE_LIBHWBASE - -romstage-y += spd_bin.c - -ifeq ($(CONFIG_HAVE_SPD_IN_CBFS),y) -LIB_SPD_BIN = $(obj)/spd.bin - -LIB_SPD_DEPS = $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex) - -# Include spd ROM data -$(LIB_SPD_BIN): $(LIB_SPD_DEPS) - test -n "$(SPD_SOURCES)" || \ - (echo "HAVE_SPD_IN_CBFS is set but SPD_SOURCES is empty" && exit 1) - test -n "$(LIB_SPD_DEPS)" || \ - (echo "SPD_SOURCES is set but no SPD file was found" && exit 1) - if [ "$(SPD_SOURCES)" = "placeholder" ]; then \ - printf '\0'; \ - else \ - for f in $(LIB_SPD_DEPS); do \ - if [ ! -f $$f ]; then \ - echo "File not found: $$f" >&2; \ - exit 1; \ - fi; \ - for c in $$(cat $$f | grep --binary-files=text -v ^#); \ - do printf $$(printf '\\%o' 0x$$c); \ - done; \ - done; \ - fi > $@ - -cbfs-files-y += spd.bin -spd.bin-file := $(LIB_SPD_BIN) -spd.bin-type := spd -endif - -ramstage-y += uuid.c - -romstage-$(CONFIG_SPD_CACHE_IN_FMAP) += spd_cache.c - -cbfs-files-y += cbfs_master_header -cbfs_master_header-file := cbfs_master_header.c:struct -cbfs_master_header-type := "cbfs header" -cbfs_master_header-position := 0 - -bootblock-$(CONFIG_ARCH_X86) += master_header_pointer.c - -NEED_CBFS_POINTER= - -ifneq ($(CONFIG_ARCH_X86),y) -NEED_CBFS_POINTER=y -endif -ifneq ($(CONFIG_BOOTBLOCK_IN_CBFS),y) -NEED_CBFS_POINTER=y -endif - -cbfs-files-$(NEED_CBFS_POINTER) += header_pointer -header_pointer-file := master_header_pointer.c:struct -header_pointer-position := -4 -header_pointer-type := "cbfs header" - -romstage-y += ux_locales.c diff --git a/src/lib/Makefile.mk b/src/lib/Makefile.mk new file mode 100644 index 0000000000..fd3f464ffd --- /dev/null +++ b/src/lib/Makefile.mk @@ -0,0 +1,425 @@ +# SPDX-License-Identifier: GPL-2.0-only + +subdirs-y += gnat + +ifeq ($(CONFIG_UBSAN),y) +ramstage-y += ubsan.c +CFLAGS_ramstage += -fsanitize=undefined +endif + +# Ensure that asan_shadow_offset_callback patch is applied to GCC before ASan is used. +CFLAGS_asan += -fsanitize=kernel-address --param asan-use-shadow-offset-callback=1 \ + --param asan-stack=1 -fsanitize-address-use-after-scope \ + --param asan-instrumentation-with-call-threshold=0 \ + --param use-after-scope-direct-emission-threshold=0 + +ifeq ($(CONFIG_ASAN_IN_ROMSTAGE),y) +romstage-y += asan.c +CFLAGS_asan += --param asan-globals=0 +CFLAGS_romstage += $(CFLAGS_asan) +# Allow memory access without __asan_load and __asan_store checks. +$(obj)/romstage/lib/asan.o: CFLAGS_asan = +endif + +ifeq ($(CONFIG_ASAN_IN_RAMSTAGE),y) +ramstage-y += asan.c +CFLAGS_asan += --param asan-globals=1 +CFLAGS_ramstage += $(CFLAGS_asan) +$(obj)/ramstage/lib/asan.o: CFLAGS_asan = +endif + +all-y += list.c + +decompressor-y += decompressor.c +$(call src-to-obj,decompressor,$(dir)/decompressor.c): $(objcbfs)/bootblock.lz4 +$(call src-to-obj,decompressor,$(dir)/decompressor.c): CCACHE_EXTRAFILES=$(objcbfs)/bootblock.lz4 +# Must reset CCACHE_EXTRAFILES or make applies it transitively to dependencies. +$(objcbfs)/bootblock.lz4: CCACHE_EXTRAFILES= + +decompressor-y += delay.c +decompressor-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c +decompressor-y += memchr.c +decompressor-y += memcmp.c +decompressor-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c +decompressor-y += prog_ops.c +decompressor-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c + +bootblock-y += bootblock.c +bootblock-y += prog_loaders.c +bootblock-y += prog_ops.c +bootblock-y += cbfs.c +bootblock-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c +bootblock-y += libgcc.c +ifneq ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) +bootblock-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c +else # ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) +verstage-$(CONFIG_CBFS_VERIFICATION) += metadata_hash.c +endif # ($(CONFIG_VBOOT_STARTS_BEFORE_BOOTBLOCK),y) +bootblock-$(CONFIG_GENERIC_UDELAY) += timer.c + +bootblock-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c + +bootblock-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c +bootblock-y += delay.c +bootblock-y += memchr.c +bootblock-y += memcmp.c +bootblock-y += boot_device.c +bootblock-y += fmap.c + +verstage-y += prog_loaders.c +verstage-y += prog_ops.c +verstage-y += delay.c +verstage-y += cbfs.c +verstage-y += halt.c +verstage-y += fmap.c +verstage-y += libgcc.c +verstage-y += memcmp.c +verstage-y += string.c + +verstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c +verstage-y += boot_device.c +verstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c + +verstage-$(CONFIG_GENERIC_UDELAY) += timer.c +verstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c + +romstage-$(CONFIG_PROBE_RAM) += ramdetect.c +romstage-y += prog_loaders.c +romstage-y += prog_ops.c +romstage-y += memchr.c +romstage-y += memcmp.c +$(foreach arch,$(ARCH_SUPPORTED),\ + $(eval rmodules_$(arch)-y += memcmp.c) \ + $(eval rmodules_$(arch)-y += rmodule.ld)) + +romstage-y += fmap.c +romstage-y += delay.c +romstage-y += cbfs.c +ifneq ($(CONFIG_COMPRESS_RAMSTAGE_LZMA)$(CONFIG_FSP_COMPRESS_FSP_M_LZMA),) +romstage-y += lzma.c lzmadecode.c +endif +romstage-y += libgcc.c +romstage-y += memrange.c +romstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c +ramstage-$(CONFIG_PRIMITIVE_MEMTEST) += primitive_memtest.c +romstage-y += ramtest.c +romstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c +ramstage-y += region_file.c +romstage-y += region_file.c +ramstage-y += romstage_handoff.c +romstage-y += romstage_handoff.c +romstage-y += selfboot.c +romstage-y += stack.c +romstage-y += rtc.c +ramstage-y += rtc.c + +romstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c +romstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c + +bootblock-y += compute_ip_checksum.c +romstage-y += compute_ip_checksum.c +romstage-y += dimm_info_util.c +ifeq ($(CONFIG_COMPILER_GCC),y) +bootblock-$(CONFIG_ARCH_BOOTBLOCK_X86_32) += gcc.c +verstage-$(CONFIG_ARCH_VERSTAGE_X86_32) += gcc.c +romstage-$(CONFIG_ARCH_ROMSTAGE_X86_32) += gcc.c +ramstage-$(CONFIG_ARCH_RAMSTAGE_X86_32) += gcc.c +smm-y += gcc.c +endif + +romstage-$(CONFIG_GENERIC_UDELAY) += timer.c + +ramstage-$(CONFIG_PROBE_RAM) += ramdetect.c +ramstage-y += prog_loaders.c +ramstage-y += prog_ops.c +ramstage-y += hardwaremain.c +ramstage-y += selfboot.c +ramstage-y += coreboot_table.c +ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios.c +ramstage-$(CONFIG_GENERATE_SMBIOS_TABLES) += smbios_defaults.c +ramstage-y += bootmem.c +ramstage-y += fmap.c +ramstage-y += memchr.c +ramstage-y += memcmp.c +ramstage-y += malloc.c +ramstage-y += dimm_info_util.c +ramstage-y += delay.c +ramstage-y += fallback_boot.c +ramstage-y += compute_ip_checksum.c +ramstage-y += cbfs.c +ramstage-y += lzma.c lzmadecode.c +ramstage-y += stack.c +ramstage-y += hexstrtobin.c +ramstage-y += wrdd.c +ramstage-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c +ramstage-$(CONFIG_BMP_LOGO) += bmp_logo.c +ramstage-$(CONFIG_BOOTSPLASH) += bootsplash.c +ramstage-$(CONFIG_BOOTSPLASH) += jpeg.c +ramstage-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c +ramstage-$(CONFIG_COVERAGE) += libgcov.c +ramstage-y += dp_aux.c +ramstage-y += edid.c +ramstage-y += edid_fill_fb.c +ramstage-y += memrange.c +ramstage-$(CONFIG_GENERIC_GPIO_LIB) += gpio.c +ramstage-$(CONFIG_GENERIC_UDELAY) += timer.c +ramstage-y += b64_decode.c +ramstage-$(CONFIG_ACPI_NHLT) += nhlt.c +ramstage-$(CONFIG_FLATTENED_DEVICE_TREE) += device_tree.c +ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit.c +ramstage-$(CONFIG_PAYLOAD_FIT_SUPPORT) += fit_payload.c + +romstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c +ramstage-$(CONFIG_TIMER_QUEUE) += timer_queue.c + +romstage-$(CONFIG_COOP_MULTITASKING) += thread.c +ramstage-$(CONFIG_COOP_MULTITASKING) += thread.c + +romstage-y += cbmem_common.c +romstage-y += imd_cbmem.c +romstage-y += imd.c + +ramstage-y += cbmem_common.c +ramstage-y += imd_cbmem.c +ramstage-y += imd.c + +postcar-$(CONFIG_PROBE_RAM) += ramdetect.c +postcar-y += cbmem_common.c +postcar-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c +postcar-y += imd_cbmem.c +postcar-y += imd.c +postcar-y += romstage_handoff.c + +bootblock-y += hexdump.c +postcar-y += hexdump.c +ramstage-y += hexdump.c +romstage-y += hexdump.c +verstage-y += hexdump.c +smm-y += hexdump.c + +bootblock-$(CONFIG_FW_CONFIG) += fw_config.c +verstage-$(CONFIG_FW_CONFIG) += fw_config.c +romstage-$(CONFIG_FW_CONFIG) += fw_config.c +ramstage-$(CONFIG_FW_CONFIG) += fw_config.c + +bootblock-$(CONFIG_ESPI_DEBUG) += espi_debug.c +verstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c +romstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c +ramstage-$(CONFIG_ESPI_DEBUG) += espi_debug.c + +bootblock-$(CONFIG_REG_SCRIPT) += reg_script.c +verstage-$(CONFIG_REG_SCRIPT) += reg_script.c +romstage-$(CONFIG_REG_SCRIPT) += reg_script.c +ramstage-$(CONFIG_REG_SCRIPT) += reg_script.c + +ramstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c +romstage-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c +postcar-$(CONFIG_TSEG_STAGE_CACHE) += ext_stage_cache.c + +ramstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c +romstage-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c +postcar-$(CONFIG_CBMEM_STAGE_CACHE) += cbmem_stage_cache.c + +romstage-y += boot_device.c +ramstage-y += boot_device.c + +smm-y += boot_device.c +smm-y += delay.c +smm-y += fmap.c +smm-y += cbfs.c memcmp.c +smm-$(CONFIG_GENERIC_UDELAY) += timer.c +ifeq ($(CONFIG_DEBUG_SMI),y) +smm-$(CONFIG_CONSOLE_CBMEM) += cbmem_console.c +endif + +all-y += identity.c version.c +smm-y += identity.c version.c + +$(call src-to-obj,bootblock,$(dir)/version.c) : $(obj)/build.h +$(call src-to-obj,romstage,$(dir)/version.c) : $(obj)/build.h +$(call src-to-obj,ramstage,$(dir)/version.c) : $(obj)/build.h +$(call src-to-obj,smm,$(dir)/version.c) : $(obj)/build.h +$(call src-to-obj,verstage,$(dir)/version.c) : $(obj)/build.h +$(call src-to-obj,postcar,$(dir)/version.c) : $(obj)/build.h + +bootblock-y += bootmode.c +romstage-y += bootmode.c +ramstage-y += bootmode.c +verstage-y += bootmode.c + +decompressor-y += halt.c +bootblock-y += halt.c +romstage-y += halt.c +ramstage-y += halt.c +smm-y += halt.c + +decompressor-y += reset.c +bootblock-y += reset.c +verstage-y += reset.c +romstage-y += reset.c +postcar-y += reset.c +ramstage-y += reset.c +smm-y += reset.c + +decompressor-y += string.c +bootblock-y += string.c +verstage-y += string.c +romstage-y += string.c +postcar-y += string.c +ramstage-y += string.c +smm-y += string.c + +decompressor-y += crc_byte.c +bootblock-y += crc_byte.c +verstage-y += crc_byte.c +romstage-y += crc_byte.c +postcar-y += crc_byte.c +ramstage-y += crc_byte.c +smm-y += crc_byte.c + +romstage-y += xxhash.c +ramstage-y += xxhash.c + +postcar-y += bootmode.c +postcar-y += boot_device.c +postcar-y += cbfs.c +postcar-y += delay.c +postcar-y += fmap.c +postcar-y += gcc.c +postcar-y += halt.c +postcar-y += libgcc.c +postcar-$(CONFIG_COMPRESS_RAMSTAGE_LZMA) += lzma.c lzmadecode.c +postcar-y += memchr.c +postcar-y += memcmp.c +postcar-y += prog_loaders.c +postcar-y += prog_ops.c +postcar-y += rmodule.c +postcar-$(CONFIG_COLLECT_TIMESTAMPS) += timestamp.c +postcar-$(CONFIG_GENERIC_UDELAY) += timer.c + +# Use program.ld for all the platforms which use C fo the bootblock. +bootblock-y += program.ld + +decompressor-y += program.ld +postcar-y += program.ld +romstage-y += program.ld +ramstage-y += program.ld +verstage-y += program.ld + +ifeq ($(CONFIG_RELOCATABLE_MODULES),y) +ramstage-y += rmodule.c +romstage-y += rmodule.c + +RMODULE_LDFLAGS := -z defs -Bsymbolic + +# rmodule_link_rules is a function that should be called with: +# (1) the object name to link +# (2) the dependencies +# (3) heap size of the relocatable module +# (4) arch for which the rmodules are to be linked +# It will create the necessary Make rules to create a rmodule. The resulting +# rmdoule is named $(1).rmod +define rmodule_link +$(strip $(1)): $(strip $(2)) $$(COMPILER_RT_rmodules_$(4)) $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) | $$(RMODTOOL) + $$(LD_rmodules_$(4)) $$(LDFLAGS_rmodules_$(4)) $(RMODULE_LDFLAGS) $($(1)-ldflags) -T $(call src-to-obj,rmodules_$(4),src/lib/rmodule.ld) --defsym=__heap_size=$(strip $(3)) -o $$@ --whole-archive --start-group $(filter-out %.ld,$(2)) --end-group + $$(NM_rmodules_$(4)) -n $$@ > $$(basename $$@).map +endef + +endif + +$(objcbfs)/%.debug.rmod: $(objcbfs)/%.debug | $(RMODTOOL) + $(RMODTOOL) -i $< -o $@ + +$(obj)/%.elf.rmod: $(obj)/%.elf | $(RMODTOOL) + $(RMODTOOL) -i $< -o $@ + +romstage-$(CONFIG_ROMSTAGE_ADA) += cb.ads +ramstage-$(CONFIG_RAMSTAGE_ADA) += cb.ads + +ifneq (,$(filter y, $(CONFIG_RAMSTAGE_LIBHWBASE) $(CONFIG_ROMSTAGE_LIBHWBASE))) + +to-ada-hex = $(eval $(1) := 16\\\#$(patsubst 0x%,%,$($(1)))\\\#) + +$(call to-ada-hex,CONFIG_HWBASE_DEFAULT_MMCONF) + +libhwbase-stages = $(foreach stage, romstage ramstage, \ + $(if $(filter y,$(CONFIG_$(call toupper,$(stage))_LIBHWBASE)),$(stage))) + +$(call add-special-class,hw) +hw-handler +=$(foreach stage, $(libhwbase-stages), \ + $(eval $(stage)-srcs += $$(addprefix $(1),$(2)))) + +$(call add-special-class,hw-gen) +hw-gen-handler = \ + $(eval additional-dirs += $(dir $(2))) \ + $(foreach stage, $(libhwbase-stages), \ + $(eval $(stage)-srcs += $(2)) \ + $(eval $(stage)-ads-deps += $(2)) \ + $(eval $(stage)-adb-deps += $(2))) \ + $(eval $(2): $(obj)/config.h) + +subdirs-y += ../../3rdparty/libhwbase + +$(foreach stage,$(libhwbase-stages), \ + $(eval $(stage)-$(CONFIG_HAVE_MONOTONIC_TIMER) += hw-time-timer.adb)) + +endif # CONFIG_ROMSTAGE_LIBHWBASE || CONFIG_RAMSTAGE_LIBHWBASE + +romstage-y += spd_bin.c + +ifeq ($(CONFIG_HAVE_SPD_IN_CBFS),y) +LIB_SPD_BIN = $(obj)/spd.bin + +LIB_SPD_DEPS = $(foreach f, $(SPD_SOURCES), src/mainboard/$(MAINBOARDDIR)/spd/$(f).spd.hex) + +# Include spd ROM data +$(LIB_SPD_BIN): $(LIB_SPD_DEPS) + test -n "$(SPD_SOURCES)" || \ + (echo "HAVE_SPD_IN_CBFS is set but SPD_SOURCES is empty" && exit 1) + test -n "$(LIB_SPD_DEPS)" || \ + (echo "SPD_SOURCES is set but no SPD file was found" && exit 1) + if [ "$(SPD_SOURCES)" = "placeholder" ]; then \ + printf '\0'; \ + else \ + for f in $(LIB_SPD_DEPS); do \ + if [ ! -f $$f ]; then \ + echo "File not found: $$f" >&2; \ + exit 1; \ + fi; \ + for c in $$(cat $$f | grep --binary-files=text -v ^#); \ + do printf $$(printf '\\%o' 0x$$c); \ + done; \ + done; \ + fi > $@ + +cbfs-files-y += spd.bin +spd.bin-file := $(LIB_SPD_BIN) +spd.bin-type := spd +endif + +ramstage-y += uuid.c + +romstage-$(CONFIG_SPD_CACHE_IN_FMAP) += spd_cache.c + +cbfs-files-y += cbfs_master_header +cbfs_master_header-file := cbfs_master_header.c:struct +cbfs_master_header-type := "cbfs header" +cbfs_master_header-position := 0 + +bootblock-$(CONFIG_ARCH_X86) += master_header_pointer.c + +NEED_CBFS_POINTER= + +ifneq ($(CONFIG_ARCH_X86),y) +NEED_CBFS_POINTER=y +endif +ifneq ($(CONFIG_BOOTBLOCK_IN_CBFS),y) +NEED_CBFS_POINTER=y +endif + +cbfs-files-$(NEED_CBFS_POINTER) += header_pointer +header_pointer-file := master_header_pointer.c:struct +header_pointer-position := -4 +header_pointer-type := "cbfs header" + +romstage-y += ux_locales.c diff --git a/src/lib/gnat/Makefile.inc b/src/lib/gnat/Makefile.inc deleted file mode 100644 index 150a715067..0000000000 --- a/src/lib/gnat/Makefile.inc +++ /dev/null @@ -1,59 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only - -define libgnat-template -# $1 arch - -additional-dirs += $$(obj)/libgnat-$(1)/adainclude -additional-dirs += $$(obj)/libgnat-$(1)/adalib - -ADAFLAGS_libgnat-$(1) := \ - --RTS=$$(obj)/libgnat-$(1)/ \ - -gnatg \ - -gnatpg \ - -I$$(src)/lib/gnat/ \ - $$(GCC_ADAFLAGS_$(1)) \ - -Werror \ - -fno-pie \ - -libgnat-$(1)-y += a-unccon.ads -libgnat-$(1)-y += ada.ads -libgnat-$(1)-y += g-souinf.ads -libgnat-$(1)-y += gnat.ads -libgnat-$(1)-y += i-c.adb -libgnat-$(1)-y += i-c.ads -libgnat-$(1)-y += interfac.ads -libgnat-$(1)-y += s-atacco.ads -libgnat-$(1)-y += s-imenne.adb -libgnat-$(1)-y += s-imenne.ads -libgnat-$(1)-y += s-maccod.ads -libgnat-$(1)-y += s-parame.ads -libgnat-$(1)-y += s-stoele.adb -libgnat-$(1)-y += s-stoele.ads -libgnat-$(1)-y += s-unstyp.ads -libgnat-$(1)-y += system.ads - -# Copy bodies too for inlining -$$(obj)/libgnat-$(1)/libgnat.a: $$$$(libgnat-$(1)-objs) - cp $$(libgnat-$(1)-srcs) $$(libgnat-$(1)-extra-specs) \ - $$(obj)/libgnat-$(1)/adainclude/ - cp $$(libgnat-$(1)-alis) \ - $$(obj)/libgnat-$(1)/adalib/ - rm -f $$@ - @printf " AR $$(subst $$(obj)/,,$$(@))\n" - $$(AR_libgnat-$(1)) cr $$@ $$^ - -endef - - -$(foreach arch,$(standard-archs), \ - $(eval $(call define_class,libgnat-$(arch),$(arch)))) - -$(foreach arch,$(standard-archs), \ - $(eval $(call libgnat-template,$(arch)))) - -ifeq ($(CONFIG_ROMSTAGE_ADA),y) -romstage-libs += $(obj)/libgnat-$(ARCH-romstage-y)/libgnat.a -endif -ifeq ($(CONFIG_RAMSTAGE_ADA),y) -ramstage-libs += $(obj)/libgnat-$(ARCH-ramstage-y)/libgnat.a -endif diff --git a/src/lib/gnat/Makefile.mk b/src/lib/gnat/Makefile.mk new file mode 100644 index 0000000000..150a715067 --- /dev/null +++ b/src/lib/gnat/Makefile.mk @@ -0,0 +1,59 @@ +## SPDX-License-Identifier: GPL-2.0-only + +define libgnat-template +# $1 arch + +additional-dirs += $$(obj)/libgnat-$(1)/adainclude +additional-dirs += $$(obj)/libgnat-$(1)/adalib + +ADAFLAGS_libgnat-$(1) := \ + --RTS=$$(obj)/libgnat-$(1)/ \ + -gnatg \ + -gnatpg \ + -I$$(src)/lib/gnat/ \ + $$(GCC_ADAFLAGS_$(1)) \ + -Werror \ + -fno-pie \ + +libgnat-$(1)-y += a-unccon.ads +libgnat-$(1)-y += ada.ads +libgnat-$(1)-y += g-souinf.ads +libgnat-$(1)-y += gnat.ads +libgnat-$(1)-y += i-c.adb +libgnat-$(1)-y += i-c.ads +libgnat-$(1)-y += interfac.ads +libgnat-$(1)-y += s-atacco.ads +libgnat-$(1)-y += s-imenne.adb +libgnat-$(1)-y += s-imenne.ads +libgnat-$(1)-y += s-maccod.ads +libgnat-$(1)-y += s-parame.ads +libgnat-$(1)-y += s-stoele.adb +libgnat-$(1)-y += s-stoele.ads +libgnat-$(1)-y += s-unstyp.ads +libgnat-$(1)-y += system.ads + +# Copy bodies too for inlining +$$(obj)/libgnat-$(1)/libgnat.a: $$$$(libgnat-$(1)-objs) + cp $$(libgnat-$(1)-srcs) $$(libgnat-$(1)-extra-specs) \ + $$(obj)/libgnat-$(1)/adainclude/ + cp $$(libgnat-$(1)-alis) \ + $$(obj)/libgnat-$(1)/adalib/ + rm -f $$@ + @printf " AR $$(subst $$(obj)/,,$$(@))\n" + $$(AR_libgnat-$(1)) cr $$@ $$^ + +endef + + +$(foreach arch,$(standard-archs), \ + $(eval $(call define_class,libgnat-$(arch),$(arch)))) + +$(foreach arch,$(standard-archs), \ + $(eval $(call libgnat-template,$(arch)))) + +ifeq ($(CONFIG_ROMSTAGE_ADA),y) +romstage-libs += $(obj)/libgnat-$(ARCH-romstage-y)/libgnat.a +endif +ifeq ($(CONFIG_RAMSTAGE_ADA),y) +ramstage-libs += $(obj)/libgnat-$(ARCH-ramstage-y)/libgnat.a +endif diff --git a/src/sbom/Makefile.inc b/src/sbom/Makefile.inc deleted file mode 100644 index 7783f092c3..0000000000 --- a/src/sbom/Makefile.inc +++ /dev/null @@ -1,159 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only - -obj ?= build -src ?= src -build-dir = $(obj)/sbom -src-dir = $(src)/sbom - -# Strip quotes from binary paths and SBOM file paths. Each binary path should have a -# corresponding SBOM file path, but not every SBOM file path needs a binary path. That -# is because binary files are only needed if they are used to extract information from -# them which in turn can be included in the SBOM files (like version or config stuff). -# But for some Software there are only SBOM files, which basically tell the most generic -# information about that piece of Software. Ideally one would not need the binary files -# at all, because extacting information out of mostly unknown binary blobs is a pain. -CONFIG_ME_BIN_PATH := $(call strip_quotes, $(CONFIG_ME_BIN_PATH)) -CONFIG_SBOM_ME_PATH := $(call strip_quotes, $(CONFIG_SBOM_ME_PATH)) -CONFIG_FSP_S_FILE := $(call strip_quotes, $(CONFIG_FSP_S_FILE)) -CONFIG_FSP_M_FILE := $(call strip_quotes, $(CONFIG_FSP_M_FILE)) -CONFIG_FSP_T_FILE := $(call strip_quotes, $(CONFIG_FSP_T_FILE)) -CONFIG_SBOM_FSP_PATH := $(call strip_quotes, $(CONFIG_SBOM_FSP_PATH)) -CONFIG_PAYLOAD_FILE := $(call strip_quotes, $(CONFIG_PAYLOAD_FILE)) -CONFIG_SBOM_PAYLOAD_PATH := $(call strip_quotes, $(CONFIG_SBOM_PAYLOAD_PATH)) -CONFIG_EC_PATH := $(call strip_quotes, $(CONFIG_EC_PATH)) -CONFIG_SBOM_EC_PATH := $(call strip_quotes, $(CONFIG_SBOM_EC_PATH)) -CONFIG_SBOM_BIOS_ACM_PATH := $(call strip_quotes, $(CONFIG_SBOM_BIOS_ACM_PATH)) -CONFIG_SBOM_SINIT_ACM_PATH := $(call strip_quotes, $(CONFIG_SBOM_SINIT_ACM_PATH)) -CONFIG_SBOM_COMPILER_PATH := $(call strip_quotes, $(CONFIG_SBOM_COMPILER_PATH)) - -# Select the correct payload directory for the used payload. Ideally we could just make this -# a one-liner, but since the payload is generated externally (with an extra make command), we -# have to hard code the paths here. -ifeq ($(CONFIG_SBOM_PAYLOAD_GENERATE), y) -payload-git-dir-$(CONFIG_PAYLOAD_BOOTBOOT) = payloads/external/BOOTBOOT/bootboot -payload-git-dir-$(CONFIG_PAYLOAD_DEPTHCHARGE) = payloads/external/depthcharge/depthcharge -payload-git-dir-$(CONFIG_PAYLOAD_FILO) = payloads/external/FILO/filo -payload-git-dir-$(CONFIG_PAYLOAD_GRUB2) = payloads/external/GRUB2/grub2 -payload-git-dir-$(CONFIG_PAYLOAD_LINUXBOOT) = payloads/external/LinuxBoot/linuxboot -payload-git-dir-$(CONFIG_PAYLOAD_SEABIOS) = payloads/external/SeaBIOS/seabios -payload-git-dir-$(CONFIG_PAYLOAD_SKIBOOT) = payloads/external/skiboot/skiboot -#payload-git-dir-$(CONFIG_PAYLOAD_TIANOCORE) = payloads/external/tianocore/ -payload-git-dir-$(CONFIG_PAYLOAD_UBOOT) = payloads/external/U-Boot/u-boot -payload-git-dir-$(CONFIG_PAYLOAD_IPXE) = payloads/external/iPXE/ipxe -ifneq ($(payload-git-dir-y),) -# only proceed with payload sbom data, if one of the above payloads were selected (should be guarded by Kconfig as well) -# e.g. payload-git-dir-y=payloads/external/SeaBIOS/seabios -> payload-json-file=$(build-dir)/payload-SeaBIOS.json -payload-swid = $(build-dir)/payload-$(subst /,,$(dir $(patsubst payloads/external/%,%,$(payload-git-dir-y)))).json -payload-swid-template = $(patsubst $(build-dir)/%.json,$(src-dir)/%.json,$(payload-swid)) -endif -endif - -# Add all SBOM files into the swid-files-y target. This target contains all -# .json, .ini, .uswid, .xml, .pc SBOM files that are later merged into one uSWID SBOM file. -# Some of these have an option that this Makefile generates/extracts some information from -# binary files in order to give more complete/detailed information inside the SBOM file. -# These files are either in src/sbom/ or build/sbom (if they are generated). -swid-files-$(CONFIG_SBOM_ME) += $(if $(CONFIG_SBOM_ME_GENERATE), $(build-dir)/intel-me.json, $(CONFIG_SBOM_ME_PATH)) -swid-files-$(CONFIG_SBOM_PAYLOAD) += $(if $(CONFIG_SBOM_PAYLOAD_GENERATE), $(payload-swid), $(CONFIG_SBOM_PAYLOAD_PATH)) -# TODO think about just using one CoSWID tag for all intel-microcode instead of one for each. maybe put each microcode into files entity of CoSWID tag? -swid-files-$(CONFIG_SBOM_MICROCODE) += $(patsubst 3rdparty/intel-microcode/intel-ucode/%, $(build-dir)/intel-microcode-%.json, $(filter 3rdparty/intel-microcode/intel-ucode/%, $(cpu_microcode_bins))) -swid-files-$(CONFIG_SBOM_MICROCODE) += $(patsubst ${FIRMWARE_LOCATION}/UcodePatch_%.bin, $(build-dir)/amd-microcode-%.json, $(filter ${FIRMWARE_LOCATION}/UcodePatch_%.bin, $(cpu_microcode_bins))) -swid-files-$(CONFIG_SBOM_FSP) += $(CONFIG_SBOM_FSP_PATH) -swid-files-$(CONFIG_SBOM_EC) += $(CONFIG_SBOM_EC_PATH) -swid-files-$(CONFIG_SBOM_BIOS_ACM) += $(CONFIG_BIOS_ACM_PATH) -swid-files-$(CONFIG_SBOM_SINIT_ACM) += $(CONFIG_SINIT_ACM_PATH) - -vboot-pkgconfig-files = $(obj)/external/vboot_reference-bootblock/vboot_host.pc $(obj)/external/vboot_reference-romstage/vboot_host.pc $(obj)/external/vboot_reference-ramstage/vboot_host.pc $(obj)/external/vboot_reference-postcar/vboot_host.pc -swid-files-$(CONFIG_SBOM_VBOOT) += $(vboot-pkgconfig-files) -$(vboot-pkgconfig-files): $(VBOOT_LIB_bootblock) $(VBOOT_LIB_romstage) $(VBOOT_LIB_ramstage) $(VBOOT_LIB_postcar) # src/security/vboot/Makefile.inc - -ifeq ($(CONFIG_SBOM_COMPILER),y) -compiler-toolchain = $(CC_bootblock) $(CC_romstage) $(CC_ramstage) $(CC_postcar) $(CC_verstage) $(LD_bootblock) $(LD_romstage) $(LD_ramstage) $(LD_postcar) $(LD_verstage) $(AS_bootblock) $(AS_romstage) $(AS_ramstage) $(AS_postcar) $(AS_verstage) -swid-files-compiler = $(CONFIG_SBOM_COMPILER_PATH) -endif - -# include all licenses used in coreboot. Ideally we would only include the licenses, -# which are used in this build -coreboot-licenses = $(foreach license, $(patsubst %.txt, %, $(filter-out retained-copyrights.txt, $(patsubst LICENSES/%, %, $(wildcard LICENSES/*)))), https://spdx.org/licenses/$(license).html) - -# only include CBFS SBOM section if there is any data for it -ifeq ($(CONFIG_SBOM),y) -cbfs-files-y += sbom -sbom-file = $(build-dir)/sbom.uswid -sbom-type = raw -endif - -## Build final SBOM (Software Bill of Materials) file in uswid format - -$(build-dir)/sbom.uswid: $(build-dir)/coreboot.json $$(swid-files-y) $(swid-files-compiler) | $(build-dir)/goswid $(build-dir) - echo " SBOM " $^ - $(build-dir)/goswid convert -o $@ \ - --parent $(build-dir)/coreboot.json \ - $(if $(swid-files-y), --requires $$(echo $(swid-files-y) | tr ' ' ','),) \ - $(if $(swid-files-compiler), --compiler $(swid-files-compiler),) - -# all build files depend on the $(build-dir) directory being created -$(build-dir): - mkdir -p $(build-dir) - -$(build-dir)/goswid: | $(build-dir) - echo " SBOM building goswid tool" - cd util/goswid; \ - GOPATH=$(abspath build/go) GO111MODULE=on go build -modcacherw -o $(abspath $@) ./cmd/goswid - -## Generate all .json files - -$(build-dir)/compiler-%.json: $(src-dir)/compiler-%.json | $(build-dir)/goswid - cp $< $@ - for tool in $$(echo $(compiler-toolchain) | tr ' ' '\n' | sort | uniq); do \ - version=$$($$tool --version 2>&1 | head -n 1 | grep -Eo '([0-9]+\.[0-9]+\.*[0-9]*)'); \ - $(build-dir)/goswid add-payload-file -o $@ -i $@ --name $$(basename $$tool) --version $$version; \ - done - -$(build-dir)/coreboot.json: $(src-dir)/coreboot.json .git/HEAD | $(build-dir)/goswid - cp $< $@ - git_tree_hash=$$(git log -n 1 --format=%T);\ - git_comm_hash=$$(git log -n 1 --format=%H);\ - sed -i -e "s//$$git_tree_hash/" -e "s//$$git_comm_hash/" $@;\ - $(build-dir)/goswid add-license -o $@ -i $@ $(coreboot-licenses) - -$(build-dir)/intel-me.json: $(src-dir)/intel-me.json $(CONFIG_ME_BIN_PATH) | $(build-dir) - cp $< $@ - #TODO put more Intel Management Engine metadata in sbom file - - -$(build-dir)/generic-fsp.json: $(src-dir)/generic-fsp.json $(CONFIG_FSP_S_FILE) $(CONFIG_FSP_T_FILE) $(CONFIG_FSP_M_FILE) | $(build-dir)/goswid - cp $(src-dir)/generic-fsp.json $@ -ifneq ($(CONFIG_FSP_S_FILE),) - echo " SBOM Adding FSP-S" - $(build-dir)/goswid add-payload-file -o $@ -i $@ --name "FSP-S" -endif -ifneq ($(CONFIG_FSP_T_FILE),) - echo " SBOM Adding FSP-T" - $(build-dir)/goswid add-payload-file -o $@ -i $@ --name "FSP-T" -endif -ifneq ($(CONFIG_FSP_M_FILE),) - echo " SBOM Adding FSP-M" - $(build-dir)/goswid add-payload-file -o $@ -i $@ --name "FSP-M" -endif - -$(build-dir)/intel-microcode-%.json: $(src-dir)/intel-microcode.json 3rdparty/intel-microcode/intel-ucode/% | $(build-dir) $(build-dir)/goswid - cp $< $@ - year=$$(hexdump --skip 8 --length 2 --format '"%04x"' $(word 2,$^));\ - day=$$(hexdump --skip 10 --length 1 --format '"%02x"' $(word 2,$^));\ - month=$$(hexdump --skip 11 --length 1 --format '"%02x"' $(word 2,$^));\ - sed -i "s//$$year-$$month-$$day/" $@ - #TODO add cpuid (processor family, model, stepping) as extra attribute - -$(build-dir)/amd-microcode-%.json: $(src-dir)/amd-microcode.json ${FIRMWARE_LOCATION}/UcodePatch_%.bin | $(build-dir) $(build-dir)/goswid - cp $< $@ - year=$$(hexdump --skip 0 --length 2 --format '"%04x"' $(word 2,$^));\ - day=$$(hexdump --skip 2 --length 1 --format '"%02x"' $(word 2,$^));\ - month=$$(hexdump --skip 3 --length 1 --format '"%02x"' $(word 2,$^));\ - sed -i "s//$$year-$$month-$$day/" $@ - -$(payload-swid): $(payload-swid-template) $(CONFIG_PAYLOAD_FILE) | $(build-dir) - cp $< $@;\ - git_tree_hash=$$(git --git-dir $(payload-git-dir-y)/.git log -n 1 --format=%T);\ - git_comm_hash=$$(git --git-dir $(payload-git-dir-y)/.git log -n 1 --format=%H);\ - sed -i -e "s//$$git_tree_hash/" -e "s//$$git_comm_hash/" $@; diff --git a/src/sbom/Makefile.mk b/src/sbom/Makefile.mk new file mode 100644 index 0000000000..7783f092c3 --- /dev/null +++ b/src/sbom/Makefile.mk @@ -0,0 +1,159 @@ +## SPDX-License-Identifier: GPL-2.0-only + +obj ?= build +src ?= src +build-dir = $(obj)/sbom +src-dir = $(src)/sbom + +# Strip quotes from binary paths and SBOM file paths. Each binary path should have a +# corresponding SBOM file path, but not every SBOM file path needs a binary path. That +# is because binary files are only needed if they are used to extract information from +# them which in turn can be included in the SBOM files (like version or config stuff). +# But for some Software there are only SBOM files, which basically tell the most generic +# information about that piece of Software. Ideally one would not need the binary files +# at all, because extacting information out of mostly unknown binary blobs is a pain. +CONFIG_ME_BIN_PATH := $(call strip_quotes, $(CONFIG_ME_BIN_PATH)) +CONFIG_SBOM_ME_PATH := $(call strip_quotes, $(CONFIG_SBOM_ME_PATH)) +CONFIG_FSP_S_FILE := $(call strip_quotes, $(CONFIG_FSP_S_FILE)) +CONFIG_FSP_M_FILE := $(call strip_quotes, $(CONFIG_FSP_M_FILE)) +CONFIG_FSP_T_FILE := $(call strip_quotes, $(CONFIG_FSP_T_FILE)) +CONFIG_SBOM_FSP_PATH := $(call strip_quotes, $(CONFIG_SBOM_FSP_PATH)) +CONFIG_PAYLOAD_FILE := $(call strip_quotes, $(CONFIG_PAYLOAD_FILE)) +CONFIG_SBOM_PAYLOAD_PATH := $(call strip_quotes, $(CONFIG_SBOM_PAYLOAD_PATH)) +CONFIG_EC_PATH := $(call strip_quotes, $(CONFIG_EC_PATH)) +CONFIG_SBOM_EC_PATH := $(call strip_quotes, $(CONFIG_SBOM_EC_PATH)) +CONFIG_SBOM_BIOS_ACM_PATH := $(call strip_quotes, $(CONFIG_SBOM_BIOS_ACM_PATH)) +CONFIG_SBOM_SINIT_ACM_PATH := $(call strip_quotes, $(CONFIG_SBOM_SINIT_ACM_PATH)) +CONFIG_SBOM_COMPILER_PATH := $(call strip_quotes, $(CONFIG_SBOM_COMPILER_PATH)) + +# Select the correct payload directory for the used payload. Ideally we could just make this +# a one-liner, but since the payload is generated externally (with an extra make command), we +# have to hard code the paths here. +ifeq ($(CONFIG_SBOM_PAYLOAD_GENERATE), y) +payload-git-dir-$(CONFIG_PAYLOAD_BOOTBOOT) = payloads/external/BOOTBOOT/bootboot +payload-git-dir-$(CONFIG_PAYLOAD_DEPTHCHARGE) = payloads/external/depthcharge/depthcharge +payload-git-dir-$(CONFIG_PAYLOAD_FILO) = payloads/external/FILO/filo +payload-git-dir-$(CONFIG_PAYLOAD_GRUB2) = payloads/external/GRUB2/grub2 +payload-git-dir-$(CONFIG_PAYLOAD_LINUXBOOT) = payloads/external/LinuxBoot/linuxboot +payload-git-dir-$(CONFIG_PAYLOAD_SEABIOS) = payloads/external/SeaBIOS/seabios +payload-git-dir-$(CONFIG_PAYLOAD_SKIBOOT) = payloads/external/skiboot/skiboot +#payload-git-dir-$(CONFIG_PAYLOAD_TIANOCORE) = payloads/external/tianocore/ +payload-git-dir-$(CONFIG_PAYLOAD_UBOOT) = payloads/external/U-Boot/u-boot +payload-git-dir-$(CONFIG_PAYLOAD_IPXE) = payloads/external/iPXE/ipxe +ifneq ($(payload-git-dir-y),) +# only proceed with payload sbom data, if one of the above payloads were selected (should be guarded by Kconfig as well) +# e.g. payload-git-dir-y=payloads/external/SeaBIOS/seabios -> payload-json-file=$(build-dir)/payload-SeaBIOS.json +payload-swid = $(build-dir)/payload-$(subst /,,$(dir $(patsubst payloads/external/%,%,$(payload-git-dir-y)))).json +payload-swid-template = $(patsubst $(build-dir)/%.json,$(src-dir)/%.json,$(payload-swid)) +endif +endif + +# Add all SBOM files into the swid-files-y target. This target contains all +# .json, .ini, .uswid, .xml, .pc SBOM files that are later merged into one uSWID SBOM file. +# Some of these have an option that this Makefile generates/extracts some information from +# binary files in order to give more complete/detailed information inside the SBOM file. +# These files are either in src/sbom/ or build/sbom (if they are generated). +swid-files-$(CONFIG_SBOM_ME) += $(if $(CONFIG_SBOM_ME_GENERATE), $(build-dir)/intel-me.json, $(CONFIG_SBOM_ME_PATH)) +swid-files-$(CONFIG_SBOM_PAYLOAD) += $(if $(CONFIG_SBOM_PAYLOAD_GENERATE), $(payload-swid), $(CONFIG_SBOM_PAYLOAD_PATH)) +# TODO think about just using one CoSWID tag for all intel-microcode instead of one for each. maybe put each microcode into files entity of CoSWID tag? +swid-files-$(CONFIG_SBOM_MICROCODE) += $(patsubst 3rdparty/intel-microcode/intel-ucode/%, $(build-dir)/intel-microcode-%.json, $(filter 3rdparty/intel-microcode/intel-ucode/%, $(cpu_microcode_bins))) +swid-files-$(CONFIG_SBOM_MICROCODE) += $(patsubst ${FIRMWARE_LOCATION}/UcodePatch_%.bin, $(build-dir)/amd-microcode-%.json, $(filter ${FIRMWARE_LOCATION}/UcodePatch_%.bin, $(cpu_microcode_bins))) +swid-files-$(CONFIG_SBOM_FSP) += $(CONFIG_SBOM_FSP_PATH) +swid-files-$(CONFIG_SBOM_EC) += $(CONFIG_SBOM_EC_PATH) +swid-files-$(CONFIG_SBOM_BIOS_ACM) += $(CONFIG_BIOS_ACM_PATH) +swid-files-$(CONFIG_SBOM_SINIT_ACM) += $(CONFIG_SINIT_ACM_PATH) + +vboot-pkgconfig-files = $(obj)/external/vboot_reference-bootblock/vboot_host.pc $(obj)/external/vboot_reference-romstage/vboot_host.pc $(obj)/external/vboot_reference-ramstage/vboot_host.pc $(obj)/external/vboot_reference-postcar/vboot_host.pc +swid-files-$(CONFIG_SBOM_VBOOT) += $(vboot-pkgconfig-files) +$(vboot-pkgconfig-files): $(VBOOT_LIB_bootblock) $(VBOOT_LIB_romstage) $(VBOOT_LIB_ramstage) $(VBOOT_LIB_postcar) # src/security/vboot/Makefile.inc + +ifeq ($(CONFIG_SBOM_COMPILER),y) +compiler-toolchain = $(CC_bootblock) $(CC_romstage) $(CC_ramstage) $(CC_postcar) $(CC_verstage) $(LD_bootblock) $(LD_romstage) $(LD_ramstage) $(LD_postcar) $(LD_verstage) $(AS_bootblock) $(AS_romstage) $(AS_ramstage) $(AS_postcar) $(AS_verstage) +swid-files-compiler = $(CONFIG_SBOM_COMPILER_PATH) +endif + +# include all licenses used in coreboot. Ideally we would only include the licenses, +# which are used in this build +coreboot-licenses = $(foreach license, $(patsubst %.txt, %, $(filter-out retained-copyrights.txt, $(patsubst LICENSES/%, %, $(wildcard LICENSES/*)))), https://spdx.org/licenses/$(license).html) + +# only include CBFS SBOM section if there is any data for it +ifeq ($(CONFIG_SBOM),y) +cbfs-files-y += sbom +sbom-file = $(build-dir)/sbom.uswid +sbom-type = raw +endif + +## Build final SBOM (Software Bill of Materials) file in uswid format + +$(build-dir)/sbom.uswid: $(build-dir)/coreboot.json $$(swid-files-y) $(swid-files-compiler) | $(build-dir)/goswid $(build-dir) + echo " SBOM " $^ + $(build-dir)/goswid convert -o $@ \ + --parent $(build-dir)/coreboot.json \ + $(if $(swid-files-y), --requires $$(echo $(swid-files-y) | tr ' ' ','),) \ + $(if $(swid-files-compiler), --compiler $(swid-files-compiler),) + +# all build files depend on the $(build-dir) directory being created +$(build-dir): + mkdir -p $(build-dir) + +$(build-dir)/goswid: | $(build-dir) + echo " SBOM building goswid tool" + cd util/goswid; \ + GOPATH=$(abspath build/go) GO111MODULE=on go build -modcacherw -o $(abspath $@) ./cmd/goswid + +## Generate all .json files + +$(build-dir)/compiler-%.json: $(src-dir)/compiler-%.json | $(build-dir)/goswid + cp $< $@ + for tool in $$(echo $(compiler-toolchain) | tr ' ' '\n' | sort | uniq); do \ + version=$$($$tool --version 2>&1 | head -n 1 | grep -Eo '([0-9]+\.[0-9]+\.*[0-9]*)'); \ + $(build-dir)/goswid add-payload-file -o $@ -i $@ --name $$(basename $$tool) --version $$version; \ + done + +$(build-dir)/coreboot.json: $(src-dir)/coreboot.json .git/HEAD | $(build-dir)/goswid + cp $< $@ + git_tree_hash=$$(git log -n 1 --format=%T);\ + git_comm_hash=$$(git log -n 1 --format=%H);\ + sed -i -e "s//$$git_tree_hash/" -e "s//$$git_comm_hash/" $@;\ + $(build-dir)/goswid add-license -o $@ -i $@ $(coreboot-licenses) + +$(build-dir)/intel-me.json: $(src-dir)/intel-me.json $(CONFIG_ME_BIN_PATH) | $(build-dir) + cp $< $@ + #TODO put more Intel Management Engine metadata in sbom file + + +$(build-dir)/generic-fsp.json: $(src-dir)/generic-fsp.json $(CONFIG_FSP_S_FILE) $(CONFIG_FSP_T_FILE) $(CONFIG_FSP_M_FILE) | $(build-dir)/goswid + cp $(src-dir)/generic-fsp.json $@ +ifneq ($(CONFIG_FSP_S_FILE),) + echo " SBOM Adding FSP-S" + $(build-dir)/goswid add-payload-file -o $@ -i $@ --name "FSP-S" +endif +ifneq ($(CONFIG_FSP_T_FILE),) + echo " SBOM Adding FSP-T" + $(build-dir)/goswid add-payload-file -o $@ -i $@ --name "FSP-T" +endif +ifneq ($(CONFIG_FSP_M_FILE),) + echo " SBOM Adding FSP-M" + $(build-dir)/goswid add-payload-file -o $@ -i $@ --name "FSP-M" +endif + +$(build-dir)/intel-microcode-%.json: $(src-dir)/intel-microcode.json 3rdparty/intel-microcode/intel-ucode/% | $(build-dir) $(build-dir)/goswid + cp $< $@ + year=$$(hexdump --skip 8 --length 2 --format '"%04x"' $(word 2,$^));\ + day=$$(hexdump --skip 10 --length 1 --format '"%02x"' $(word 2,$^));\ + month=$$(hexdump --skip 11 --length 1 --format '"%02x"' $(word 2,$^));\ + sed -i "s//$$year-$$month-$$day/" $@ + #TODO add cpuid (processor family, model, stepping) as extra attribute + +$(build-dir)/amd-microcode-%.json: $(src-dir)/amd-microcode.json ${FIRMWARE_LOCATION}/UcodePatch_%.bin | $(build-dir) $(build-dir)/goswid + cp $< $@ + year=$$(hexdump --skip 0 --length 2 --format '"%04x"' $(word 2,$^));\ + day=$$(hexdump --skip 2 --length 1 --format '"%02x"' $(word 2,$^));\ + month=$$(hexdump --skip 3 --length 1 --format '"%02x"' $(word 2,$^));\ + sed -i "s//$$year-$$month-$$day/" $@ + +$(payload-swid): $(payload-swid-template) $(CONFIG_PAYLOAD_FILE) | $(build-dir) + cp $< $@;\ + git_tree_hash=$$(git --git-dir $(payload-git-dir-y)/.git log -n 1 --format=%T);\ + git_comm_hash=$$(git --git-dir $(payload-git-dir-y)/.git log -n 1 --format=%H);\ + sed -i -e "s//$$git_tree_hash/" -e "s//$$git_comm_hash/" $@; -- cgit v1.2.3