From 1f30b244b296a131f4eaf95962bab048f8b3d481 Mon Sep 17 00:00:00 2001 From: Martin Roth Date: Thu, 18 Jan 2024 18:46:58 -0700 Subject: util: Rename Makefiles from .inc to .mk 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: I434940ebb46853980596f7ad55d27a62c90280fa Reviewed-on: https://review.coreboot.org/c/coreboot/+/80123 Tested-by: build bot (Jenkins) Reviewed-by: Felix Singer Reviewed-by: Felix Held --- Makefile.mk | 2 +- util/amdfwtool/Makefile.inc | 27 --- util/amdfwtool/Makefile.mk | 27 +++ util/bincfg/Makefile.inc | 42 ----- util/bincfg/Makefile.mk | 42 +++++ util/cbfstool/Makefile | 2 +- util/cbfstool/Makefile.inc | 284 -------------------------------- util/cbfstool/Makefile.mk | 284 ++++++++++++++++++++++++++++++++ util/cbfstool/bpdt_formats/Makefile.inc | 9 - util/cbfstool/bpdt_formats/Makefile.mk | 9 + util/cbfstool/fpt_formats/Makefile.inc | 4 - util/cbfstool/fpt_formats/Makefile.mk | 4 + util/crossgcc/Makefile.inc | 59 ------- util/crossgcc/Makefile.mk | 59 +++++++ util/futility/Makefile | 2 +- util/futility/Makefile.inc | 27 --- util/futility/Makefile.mk | 27 +++ util/ifdtool/Makefile | 2 +- util/ifdtool/Makefile.inc | 19 --- util/ifdtool/Makefile.mk | 19 +++ util/marvell/Makefile.inc | 2 - util/marvell/Makefile.mk | 2 + util/marvell/doimage_mv/Makefile.inc | 15 -- util/marvell/doimage_mv/Makefile.mk | 15 ++ util/nvidia/Makefile.inc | 60 ------- util/nvidia/Makefile.mk | 60 +++++++ util/nvramtool/Makefile.inc | 39 ----- util/nvramtool/Makefile.mk | 39 +++++ util/qemu/Makefile.inc | 51 ------ util/qemu/Makefile.mk | 51 ++++++ util/sconfig/Makefile.inc | 47 ------ util/sconfig/Makefile.mk | 47 ++++++ util/supermicro/Makefile.inc | 24 --- util/supermicro/Makefile.mk | 24 +++ 34 files changed, 713 insertions(+), 713 deletions(-) delete mode 100644 util/amdfwtool/Makefile.inc create mode 100644 util/amdfwtool/Makefile.mk delete mode 100644 util/bincfg/Makefile.inc create mode 100644 util/bincfg/Makefile.mk delete mode 100644 util/cbfstool/Makefile.inc create mode 100644 util/cbfstool/Makefile.mk delete mode 100644 util/cbfstool/bpdt_formats/Makefile.inc create mode 100644 util/cbfstool/bpdt_formats/Makefile.mk delete mode 100644 util/cbfstool/fpt_formats/Makefile.inc create mode 100644 util/cbfstool/fpt_formats/Makefile.mk delete mode 100644 util/crossgcc/Makefile.inc create mode 100644 util/crossgcc/Makefile.mk delete mode 100644 util/futility/Makefile.inc create mode 100644 util/futility/Makefile.mk delete mode 100644 util/ifdtool/Makefile.inc create mode 100644 util/ifdtool/Makefile.mk delete mode 100644 util/marvell/Makefile.inc create mode 100644 util/marvell/Makefile.mk delete mode 100644 util/marvell/doimage_mv/Makefile.inc create mode 100644 util/marvell/doimage_mv/Makefile.mk delete mode 100644 util/nvidia/Makefile.inc create mode 100644 util/nvidia/Makefile.mk delete mode 100644 util/nvramtool/Makefile.inc create mode 100644 util/nvramtool/Makefile.mk delete mode 100644 util/qemu/Makefile.inc create mode 100644 util/qemu/Makefile.mk delete mode 100644 util/sconfig/Makefile.inc create mode 100644 util/sconfig/Makefile.mk delete mode 100644 util/supermicro/Makefile.inc create mode 100644 util/supermicro/Makefile.mk diff --git a/Makefile.mk b/Makefile.mk index 87c6bcb247..f7b98c7c8d 100644 --- a/Makefile.mk +++ b/Makefile.mk @@ -768,7 +768,7 @@ gitconfig: install-git-commit-clangfmt: cp util/scripts/prepare-commit-msg.clang-format .git/hooks/prepare-commit-msg -include util/crossgcc/Makefile.inc +include util/crossgcc/Makefile.mk .PHONY: tools tools: $(objutil)/kconfig/conf $(objutil)/kconfig/toada $(CBFSTOOL) $(objutil)/cbfstool/cbfs-compression-tool $(FMAPTOOL) $(RMODTOOL) $(IFWITOOL) $(objutil)/nvramtool/nvramtool $(objutil)/sconfig/sconfig $(IFDTOOL) $(CBOOTIMAGE) $(AMDFWTOOL) $(AMDCOMPRESS) $(FUTILITY) $(BINCFG) $(IFITTOOL) $(objutil)/supermicro/smcbiosinfo $(CSE_FPT) $(CSE_SERGER) $(AMDFWREAD) diff --git a/util/amdfwtool/Makefile.inc b/util/amdfwtool/Makefile.inc deleted file mode 100644 index 6a83cb9265..0000000000 --- a/util/amdfwtool/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o -amdfwreadobj = amdfwread.o - -AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow -Werror -AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include -AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h - -HOSTPKGCONFIG ?= pkg-config - -AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto) -ifneq ($(.SHELLSTATUS),0) -$(error "Ensure that pkg-config is installed.") -endif -LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto) - -$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER) - $(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) - printf " AMDFWTOOL\n" - $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(LDFLAGS) -o $@ - -$(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) - printf " AMDFWREAD\n" - $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(LDFLAGS) -o $@ diff --git a/util/amdfwtool/Makefile.mk b/util/amdfwtool/Makefile.mk new file mode 100644 index 0000000000..6a83cb9265 --- /dev/null +++ b/util/amdfwtool/Makefile.mk @@ -0,0 +1,27 @@ +# SPDX-License-Identifier: BSD-3-Clause + +amdfwtoolobj = amdfwtool.o data_parse.o signed_psp.o handle_file.o +amdfwreadobj = amdfwread.o + +AMDFWTOOLCFLAGS :=-O2 -Wall -Wextra -Wshadow -Werror +AMDFWTOOLCFLAGS += -I $(top)/src/commonlib/bsd/include +AMDFWTOOLCFLAGS += -D_GNU_SOURCE # memmem() from string.h + +HOSTPKGCONFIG ?= pkg-config + +AMDFWTOOLCFLAGS += $(shell $(HOSTPKGCONFIG) --cflags libcrypto) +ifneq ($(.SHELLSTATUS),0) +$(error "Ensure that pkg-config is installed.") +endif +LDFLAGS += $(shell $(HOSTPKGCONFIG) --libs libcrypto) + +$(objutil)/amdfwtool/%.o: $(top)/util/amdfwtool/%.c # $(HEADER) + $(HOSTCC) $(AMDFWTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/amdfwtool/amdfwtool: $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) + printf " AMDFWTOOL\n" + $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwtoolobj)) $(LDFLAGS) -o $@ + +$(objutil)/amdfwtool/amdfwread: $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) + printf " AMDFWREAD\n" + $(HOSTCC) $(addprefix $(objutil)/amdfwtool/,$(amdfwreadobj)) $(LDFLAGS) -o $@ diff --git a/util/bincfg/Makefile.inc b/util/bincfg/Makefile.inc deleted file mode 100644 index 0f5f442fd1..0000000000 --- a/util/bincfg/Makefile.inc +++ /dev/null @@ -1,42 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -bincfg_obj := bincfg.lex.o bincfg.tab.o - -BINCFG_FLAGS += -I$(top)/util/bincfg -I$(objutil)/bincfg - -$(objutil)/bincfg: - mkdir -p $@ - -$(objutil)/bincfg/.generated: $(objutil)/bincfg - touch $@ - -$(objutil)/bincfg/%.o: util/bincfg/%.c | $(objutil)/bincfg/.generated - printf " HOSTCC $(subst $(obj)/,,$(@))\n" - $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/bincfg/%.o: $(objutil)/bincfg/%.c - printf " HOSTCC $(subst $(obj)/,,$(@))\n" - $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $< - -ifeq ($(CONFIG_UTIL_GENPARSER),y) -$(top)/util/bincfg/bincfg.lex.c_shipped: $(top)/util/bincfg/bincfg.l - printf " FLEX $(subst $(top)/,,$(@))\n" - flex -L -o $@ $< - -# the .c rule also creates .h -$(top)/util/bincfg/bincfg.tab.h_shipped: $(top)/util/bincfg/bincfg.tab.c_shipped -$(top)/util/bincfg/bincfg.tab.c_shipped: $(top)/util/bincfg/bincfg.y - printf " BISON $(subst $(top)/,,$(@))\n" - bison -l --defines=$(top)/util/bincfg/bincfg.tab.h_shipped -o $@ $< -endif - -$(objutil)/bincfg/bincfg.lex.o: $(objutil)/bincfg/bincfg.tab.h - -$(objutil)/bincfg/%: $(top)/util/bincfg/%_shipped - mkdir -p $(dir $@) - cp $< $@ - -$(objutil)/bincfg/bincfg: $(addprefix $(objutil)/bincfg/,$(bincfg_obj)) - printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n" - $(HOSTCC) $(BINCFG_FLAGS) -o $@ $(addprefix $(objutil)/bincfg/,$(bincfg_obj)) - -$(addprefix $(objutil)/bincfg/,$(bincfg_obj)) : $(objutil)/bincfg/bincfg.tab.h $(objutil)/bincfg/bincfg.tab.c $(objutil)/bincfg/bincfg.lex.c diff --git a/util/bincfg/Makefile.mk b/util/bincfg/Makefile.mk new file mode 100644 index 0000000000..0f5f442fd1 --- /dev/null +++ b/util/bincfg/Makefile.mk @@ -0,0 +1,42 @@ +## SPDX-License-Identifier: GPL-2.0-only +bincfg_obj := bincfg.lex.o bincfg.tab.o + +BINCFG_FLAGS += -I$(top)/util/bincfg -I$(objutil)/bincfg + +$(objutil)/bincfg: + mkdir -p $@ + +$(objutil)/bincfg/.generated: $(objutil)/bincfg + touch $@ + +$(objutil)/bincfg/%.o: util/bincfg/%.c | $(objutil)/bincfg/.generated + printf " HOSTCC $(subst $(obj)/,,$(@))\n" + $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/bincfg/%.o: $(objutil)/bincfg/%.c + printf " HOSTCC $(subst $(obj)/,,$(@))\n" + $(HOSTCC) $(BINCFG_FLAGS) $(HOSTCFLAGS) -c -o $@ $< + +ifeq ($(CONFIG_UTIL_GENPARSER),y) +$(top)/util/bincfg/bincfg.lex.c_shipped: $(top)/util/bincfg/bincfg.l + printf " FLEX $(subst $(top)/,,$(@))\n" + flex -L -o $@ $< + +# the .c rule also creates .h +$(top)/util/bincfg/bincfg.tab.h_shipped: $(top)/util/bincfg/bincfg.tab.c_shipped +$(top)/util/bincfg/bincfg.tab.c_shipped: $(top)/util/bincfg/bincfg.y + printf " BISON $(subst $(top)/,,$(@))\n" + bison -l --defines=$(top)/util/bincfg/bincfg.tab.h_shipped -o $@ $< +endif + +$(objutil)/bincfg/bincfg.lex.o: $(objutil)/bincfg/bincfg.tab.h + +$(objutil)/bincfg/%: $(top)/util/bincfg/%_shipped + mkdir -p $(dir $@) + cp $< $@ + +$(objutil)/bincfg/bincfg: $(addprefix $(objutil)/bincfg/,$(bincfg_obj)) + printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n" + $(HOSTCC) $(BINCFG_FLAGS) -o $@ $(addprefix $(objutil)/bincfg/,$(bincfg_obj)) + +$(addprefix $(objutil)/bincfg/,$(bincfg_obj)) : $(objutil)/bincfg/bincfg.tab.h $(objutil)/bincfg/bincfg.tab.c $(objutil)/bincfg/bincfg.lex.c diff --git a/util/cbfstool/Makefile b/util/cbfstool/Makefile index 034aca26a6..8dde77ba52 100644 --- a/util/cbfstool/Makefile +++ b/util/cbfstool/Makefile @@ -91,7 +91,7 @@ ifneq ($(V),1) .SILENT: endif -include Makefile.inc +include Makefile.mk $(objutil)/cbfstool/cbfstool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h $(objutil)/cbfstool/elogtool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h diff --git a/util/cbfstool/Makefile.inc b/util/cbfstool/Makefile.inc deleted file mode 100644 index 80aab6720d..0000000000 --- a/util/cbfstool/Makefile.inc +++ /dev/null @@ -1,284 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -compressionobj := -compressionobj += compress.o -# LZ4 -compressionobj += lz4.o -compressionobj += lz4hc.o -compressionobj += lz4frame.o -compressionobj += xxhash.o -compressionobj += lz4_wrapper.o -# LZMA -compressionobj += lzma.o -compressionobj += LzFind.o -compressionobj += LzmaDec.o -compressionobj += LzmaEnc.o - -cbfsobj := -cbfsobj += cbfstool.o -cbfsobj += common.o -cbfsobj += cbfs_image.o -cbfsobj += cbfs-mkstage.o -cbfsobj += cbfs-mkpayload.o -cbfsobj += elfheaders.o -cbfsobj += rmodule.o -cbfsobj += xdr.o -cbfsobj += partitioned_file.o -cbfsobj += platform_fixups.o -# COMMONLIB -cbfsobj += cbfs_private.o -cbfsobj += fsp_relocate.o -# FMAP -cbfsobj += fmap.o -cbfsobj += kv_pair.o -cbfsobj += valstr.o -# linux as payload -cbfsobj += linux_trampoline.o -cbfsobj += cbfs-payload-linux.o -# compression algorithms -cbfsobj += $(compressionobj) - -fmapobj := -fmapobj += fmaptool.o -fmapobj += cbfs_sections.o -fmapobj += fmap_from_fmd.o -fmapobj += fmd.o -fmapobj += fmd_parser.o -fmapobj += fmd_scanner.o -# FMAP -fmapobj += fmap.o -fmapobj += kv_pair.o -fmapobj += valstr.o - -rmodobj := -rmodobj += rmodtool.o -rmodobj += rmodule.o -rmodobj += common.o -rmodobj += elfheaders.o -rmodobj += xdr.o - -ifwiobj := -ifwiobj += ifwitool.o -ifwiobj += common.o - -ifitobj := -ifitobj += ifittool.o -ifitobj += common.o -ifitobj += fit.o -ifitobj += cbfs_image.o -# Make it link .... -ifitobj += xdr.o -ifitobj += elfheaders.o -ifitobj += partitioned_file.o -ifitobj += cbfs-mkstage.o -ifitobj += cbfs-mkpayload.o -ifitobj += rmodule.o -# FMAP -ifitobj += fmap.o -ifitobj += kv_pair.o -ifitobj += valstr.o -# compression algorithms -ifitobj += $(compressionobj) - - -cbfscompobj := -cbfscompobj += $(compressionobj) -cbfscompobj += cbfscomptool.o - -amdcompobj := -amdcompobj += amdcompress.o -amdcompobj += elfheaders.o -amdcompobj += common.o -amdcompobj += xdr.o - -elogobj := -elogobj := elogtool.o -elogobj += eventlog.o -elogobj += valstr.o -elogobj += elog.o -elogobj += common.o -elogobj += flashrom.o - -include $(top)/util/cbfstool/fpt_formats/Makefile.inc -cse_fpt_obj := -cse_fpt_obj += cse_fpt.o -cse_fpt_obj += common.o -cse_fpt_obj += cse_helpers.o -cse_fpt_obj += $(foreach var, $(fpt_formats_obj), $(var)) - -include $(top)/util/cbfstool/bpdt_formats/Makefile.inc -cse_serger_obj := -cse_serger_obj += cse_serger.o -cse_serger_obj += common.o -cse_serger_obj += cse_helpers.o -cse_serger_obj += $(foreach var, $(bpdt_formats_obj), $(var)) - -TOOLCFLAGS ?= -Werror -Wall -Wextra -Wshadow -TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow -TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings -TOOLCFLAGS += -O2 -TOOLCPPFLAGS ?= -D_DEFAULT_SOURCE # memccpy() from string.h -TOOLCPPFLAGS += -D_BSD_SOURCE -D_SVID_SOURCE # _DEFAULT_SOURCE for older glibc -TOOLCPPFLAGS += -D_GNU_SOURCE # memmem() from string.h -TOOLCPPFLAGS += -I$(top)/util/cbfstool/flashmap -TOOLCPPFLAGS += -I$(top)/util/cbfstool -TOOLCPPFLAGS += -I$(objutil)/cbfstool -TOOLCPPFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include -TOOLCPPFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h -TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/include -TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/2lib/include -TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/host/include -TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/host/lib/include -# UEFI header file support. It's not pretty, but that's what we currently -# have right now. -TOOLCPPFLAGS += -I$(top)/src -TOOLCPPFLAGS += -I$(top)/src/vendorcode/intel/edk2/uefi_2.4/MdePkg/Include - -TOOLLDFLAGS ?= - -ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32) -HOSTCFLAGS += -fms-extensions -TOOLCFLAGS += -mno-ms-bitfields -endif -ifeq ($(shell uname -o 2>/dev/null), Cygwin) -TOOLCFLAGS+=-std=gnu11 -TOOLCPPFLAGS+=-D_GNU_SOURCE -else -TOOLCFLAGS+=-std=c11 -endif - -LZ4CFLAGS ?= -Wno-strict-prototypes - -VBOOT_HOSTLIB = $(VBOOT_HOST_BUILD)/libvboot_host.a - -$(VBOOT_HOSTLIB): - printf " MAKE $(subst $(objutil)/,,$(@))\n" - unset CFLAGS LDFLAGS; $(MAKE) -C $(VBOOT_SOURCE) \ - BUILD=$(VBOOT_HOST_BUILD) \ - CC="$(HOSTCC)" \ - PKG_CONFIG="true" \ - USE_FLASHROM=0 \ - V=$(V) \ - DEBUG= \ - hostlib - -$(objutil)/cbfstool/%.o: $(objutil)/cbfstool/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/flashmap/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/src/commonlib/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/src/commonlib/bsd/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lz4/lib/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) $(LZ4CFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/fpt_formats/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/bpdt_formats/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/cbfstool/cbfstool: $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) $(VBOOT_HOSTLIB) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) -v $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) $(VBOOT_HOSTLIB) - -$(objutil)/cbfstool/fmaptool: $(addprefix $(objutil)/cbfstool/,$(fmapobj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(fmapobj)) - -$(objutil)/cbfstool/rmodtool: $(addprefix $(objutil)/cbfstool/,$(rmodobj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(rmodobj)) - -$(objutil)/cbfstool/ifwitool: $(addprefix $(objutil)/cbfstool/,$(ifwiobj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(ifwiobj)) - -$(objutil)/cbfstool/ifittool: $(addprefix $(objutil)/cbfstool/,$(ifitobj)) $(VBOOT_HOSTLIB) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(ifitobj)) $(VBOOT_HOSTLIB) - -$(objutil)/cbfstool/cbfs-compression-tool: $(addprefix $(objutil)/cbfstool/,$(cbfscompobj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfscompobj)) - -$(objutil)/cbfstool/amdcompress: $(addprefix $(objutil)/cbfstool/,$(amdcompobj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(amdcompobj)) -lz - -$(objutil)/cbfstool/elogtool: $(addprefix $(objutil)/cbfstool/,$(elogobj)) $(VBOOT_HOSTLIB) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(elogobj)) $(VBOOT_HOSTLIB) - -$(objutil)/cbfstool/cse_fpt: $(addprefix $(objutil)/cbfstool/,$(cse_fpt_obj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cse_fpt_obj)) - -$(objutil)/cbfstool/cse_serger: $(addprefix $(objutil)/cbfstool/,$(cse_serger_obj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cse_serger_obj)) - -# Yacc source is superset of header -$(objutil)/cbfstool/fmd.o: TOOLCFLAGS += -Wno-redundant-decls -$(objutil)/cbfstool/fmd_parser.o: TOOLCFLAGS += -Wno-redundant-decls -# Lex generates unneeded functions and declarations -$(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-redundant-decls -$(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-unused-function -# Tolerate lzma sdk warnings -$(objutil)/cbfstool/LzmaEnc.o: TOOLCFLAGS += -Wno-sign-compare -Wno-cast-qual -# Tolerate commonlib warnings -$(objutil)/cbfstool/cbfs_private.o: TOOLCFLAGS += -Wno-sign-compare -# Tolerate lz4 warnings -$(objutil)/cbfstool/lz4.o: TOOLCFLAGS += -Wno-missing-prototypes -$(objutil)/cbfstool/lz4_wrapper.o: TOOLCFLAGS += -Wno-attributes - -$(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_parser.h -$(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_scanner.h -$(objutil)/cbfstool/fmd_parser.o: $(objutil)/cbfstool/fmd.o -$(objutil)/cbfstool/fmd_scanner.o: $(objutil)/cbfstool/fmd.o -$(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-sign-compare - -$(objutil)/cbfstool/%: $(top)/util/cbfstool/%_shipped - mkdir -p $(dir $@) - cp $< $@ - -ifeq ($(CONFIG_FMD_GENPARSER),y) -TOOLLEX := lex -TOOLYACC := bison - -# the .c rule also creates .h -$(top)/util/cbfstool/fmd_scanner.h_shipped: $(top)/util/cbfstool/fmd_scanner.c_shipped -$(top)/util/cbfstool/fmd_scanner.c_shipped: $(top)/util/cbfstool/fmd_scanner.l - echo " LEX util/cbfstool/fmd_scanner.[ch]" - $(TOOLLEX) -L -o $@ --header-file=$(patsubst %.c_shipped,%.h_shipped,$@) $< - -# the .c rule also creates .h -$(top)/util/cbfstool/fmd_parser.h_shipped: $(top)/util/cbfstool/fmd_parser.c_shipped -$(top)/util/cbfstool/fmd_parser.c_shipped: $(top)/util/cbfstool/fmd_parser.y - echo " YACC util/cbfstool/fmd_parser.[ch]" - $(TOOLYACC) -l -o $@ --defines=$(patsubst %.c_shipped,%.h_shipped,$@) $< - -endif # CONFIG_FMD_GENPARSER diff --git a/util/cbfstool/Makefile.mk b/util/cbfstool/Makefile.mk new file mode 100644 index 0000000000..8577874044 --- /dev/null +++ b/util/cbfstool/Makefile.mk @@ -0,0 +1,284 @@ +## SPDX-License-Identifier: GPL-2.0-only +compressionobj := +compressionobj += compress.o +# LZ4 +compressionobj += lz4.o +compressionobj += lz4hc.o +compressionobj += lz4frame.o +compressionobj += xxhash.o +compressionobj += lz4_wrapper.o +# LZMA +compressionobj += lzma.o +compressionobj += LzFind.o +compressionobj += LzmaDec.o +compressionobj += LzmaEnc.o + +cbfsobj := +cbfsobj += cbfstool.o +cbfsobj += common.o +cbfsobj += cbfs_image.o +cbfsobj += cbfs-mkstage.o +cbfsobj += cbfs-mkpayload.o +cbfsobj += elfheaders.o +cbfsobj += rmodule.o +cbfsobj += xdr.o +cbfsobj += partitioned_file.o +cbfsobj += platform_fixups.o +# COMMONLIB +cbfsobj += cbfs_private.o +cbfsobj += fsp_relocate.o +# FMAP +cbfsobj += fmap.o +cbfsobj += kv_pair.o +cbfsobj += valstr.o +# linux as payload +cbfsobj += linux_trampoline.o +cbfsobj += cbfs-payload-linux.o +# compression algorithms +cbfsobj += $(compressionobj) + +fmapobj := +fmapobj += fmaptool.o +fmapobj += cbfs_sections.o +fmapobj += fmap_from_fmd.o +fmapobj += fmd.o +fmapobj += fmd_parser.o +fmapobj += fmd_scanner.o +# FMAP +fmapobj += fmap.o +fmapobj += kv_pair.o +fmapobj += valstr.o + +rmodobj := +rmodobj += rmodtool.o +rmodobj += rmodule.o +rmodobj += common.o +rmodobj += elfheaders.o +rmodobj += xdr.o + +ifwiobj := +ifwiobj += ifwitool.o +ifwiobj += common.o + +ifitobj := +ifitobj += ifittool.o +ifitobj += common.o +ifitobj += fit.o +ifitobj += cbfs_image.o +# Make it link .... +ifitobj += xdr.o +ifitobj += elfheaders.o +ifitobj += partitioned_file.o +ifitobj += cbfs-mkstage.o +ifitobj += cbfs-mkpayload.o +ifitobj += rmodule.o +# FMAP +ifitobj += fmap.o +ifitobj += kv_pair.o +ifitobj += valstr.o +# compression algorithms +ifitobj += $(compressionobj) + + +cbfscompobj := +cbfscompobj += $(compressionobj) +cbfscompobj += cbfscomptool.o + +amdcompobj := +amdcompobj += amdcompress.o +amdcompobj += elfheaders.o +amdcompobj += common.o +amdcompobj += xdr.o + +elogobj := +elogobj := elogtool.o +elogobj += eventlog.o +elogobj += valstr.o +elogobj += elog.o +elogobj += common.o +elogobj += flashrom.o + +include $(top)/util/cbfstool/fpt_formats/Makefile.mk +cse_fpt_obj := +cse_fpt_obj += cse_fpt.o +cse_fpt_obj += common.o +cse_fpt_obj += cse_helpers.o +cse_fpt_obj += $(foreach var, $(fpt_formats_obj), $(var)) + +include $(top)/util/cbfstool/bpdt_formats/Makefile.mk +cse_serger_obj := +cse_serger_obj += cse_serger.o +cse_serger_obj += common.o +cse_serger_obj += cse_helpers.o +cse_serger_obj += $(foreach var, $(bpdt_formats_obj), $(var)) + +TOOLCFLAGS ?= -Werror -Wall -Wextra -Wshadow +TOOLCFLAGS += -Wcast-qual -Wmissing-prototypes -Wredundant-decls -Wshadow +TOOLCFLAGS += -Wstrict-prototypes -Wwrite-strings +TOOLCFLAGS += -O2 +TOOLCPPFLAGS ?= -D_DEFAULT_SOURCE # memccpy() from string.h +TOOLCPPFLAGS += -D_BSD_SOURCE -D_SVID_SOURCE # _DEFAULT_SOURCE for older glibc +TOOLCPPFLAGS += -D_GNU_SOURCE # memmem() from string.h +TOOLCPPFLAGS += -I$(top)/util/cbfstool/flashmap +TOOLCPPFLAGS += -I$(top)/util/cbfstool +TOOLCPPFLAGS += -I$(objutil)/cbfstool +TOOLCPPFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include +TOOLCPPFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h +TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/include +TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/firmware/2lib/include +TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/host/include +TOOLCPPFLAGS += -I$(VBOOT_SOURCE)/host/lib/include +# UEFI header file support. It's not pretty, but that's what we currently +# have right now. +TOOLCPPFLAGS += -I$(top)/src +TOOLCPPFLAGS += -I$(top)/src/vendorcode/intel/edk2/uefi_2.4/MdePkg/Include + +TOOLLDFLAGS ?= + +ifeq ($(shell uname -s | cut -c-7 2>/dev/null), MINGW32) +HOSTCFLAGS += -fms-extensions +TOOLCFLAGS += -mno-ms-bitfields +endif +ifeq ($(shell uname -o 2>/dev/null), Cygwin) +TOOLCFLAGS+=-std=gnu11 +TOOLCPPFLAGS+=-D_GNU_SOURCE +else +TOOLCFLAGS+=-std=c11 +endif + +LZ4CFLAGS ?= -Wno-strict-prototypes + +VBOOT_HOSTLIB = $(VBOOT_HOST_BUILD)/libvboot_host.a + +$(VBOOT_HOSTLIB): + printf " MAKE $(subst $(objutil)/,,$(@))\n" + unset CFLAGS LDFLAGS; $(MAKE) -C $(VBOOT_SOURCE) \ + BUILD=$(VBOOT_HOST_BUILD) \ + CC="$(HOSTCC)" \ + PKG_CONFIG="true" \ + USE_FLASHROM=0 \ + V=$(V) \ + DEBUG= \ + hostlib + +$(objutil)/cbfstool/%.o: $(objutil)/cbfstool/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/flashmap/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lzma/C/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/src/commonlib/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/src/commonlib/bsd/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/lz4/lib/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) $(LZ4CFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/fpt_formats/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/%.o: $(top)/util/cbfstool/bpdt_formats/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(TOOLCPPFLAGS) $(TOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/cbfstool/cbfstool: $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) $(VBOOT_HOSTLIB) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) -v $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfsobj)) $(VBOOT_HOSTLIB) + +$(objutil)/cbfstool/fmaptool: $(addprefix $(objutil)/cbfstool/,$(fmapobj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(fmapobj)) + +$(objutil)/cbfstool/rmodtool: $(addprefix $(objutil)/cbfstool/,$(rmodobj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(rmodobj)) + +$(objutil)/cbfstool/ifwitool: $(addprefix $(objutil)/cbfstool/,$(ifwiobj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(ifwiobj)) + +$(objutil)/cbfstool/ifittool: $(addprefix $(objutil)/cbfstool/,$(ifitobj)) $(VBOOT_HOSTLIB) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(ifitobj)) $(VBOOT_HOSTLIB) + +$(objutil)/cbfstool/cbfs-compression-tool: $(addprefix $(objutil)/cbfstool/,$(cbfscompobj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cbfscompobj)) + +$(objutil)/cbfstool/amdcompress: $(addprefix $(objutil)/cbfstool/,$(amdcompobj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(amdcompobj)) -lz + +$(objutil)/cbfstool/elogtool: $(addprefix $(objutil)/cbfstool/,$(elogobj)) $(VBOOT_HOSTLIB) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(elogobj)) $(VBOOT_HOSTLIB) + +$(objutil)/cbfstool/cse_fpt: $(addprefix $(objutil)/cbfstool/,$(cse_fpt_obj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cse_fpt_obj)) + +$(objutil)/cbfstool/cse_serger: $(addprefix $(objutil)/cbfstool/,$(cse_serger_obj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(TOOLLDFLAGS) -o $@ $(addprefix $(objutil)/cbfstool/,$(cse_serger_obj)) + +# Yacc source is superset of header +$(objutil)/cbfstool/fmd.o: TOOLCFLAGS += -Wno-redundant-decls +$(objutil)/cbfstool/fmd_parser.o: TOOLCFLAGS += -Wno-redundant-decls +# Lex generates unneeded functions and declarations +$(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-redundant-decls +$(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-unused-function +# Tolerate lzma sdk warnings +$(objutil)/cbfstool/LzmaEnc.o: TOOLCFLAGS += -Wno-sign-compare -Wno-cast-qual +# Tolerate commonlib warnings +$(objutil)/cbfstool/cbfs_private.o: TOOLCFLAGS += -Wno-sign-compare +# Tolerate lz4 warnings +$(objutil)/cbfstool/lz4.o: TOOLCFLAGS += -Wno-missing-prototypes +$(objutil)/cbfstool/lz4_wrapper.o: TOOLCFLAGS += -Wno-attributes + +$(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_parser.h +$(objutil)/cbfstool/fmd.o: $(objutil)/cbfstool/fmd_scanner.h +$(objutil)/cbfstool/fmd_parser.o: $(objutil)/cbfstool/fmd.o +$(objutil)/cbfstool/fmd_scanner.o: $(objutil)/cbfstool/fmd.o +$(objutil)/cbfstool/fmd_scanner.o: TOOLCFLAGS += -Wno-sign-compare + +$(objutil)/cbfstool/%: $(top)/util/cbfstool/%_shipped + mkdir -p $(dir $@) + cp $< $@ + +ifeq ($(CONFIG_FMD_GENPARSER),y) +TOOLLEX := lex +TOOLYACC := bison + +# the .c rule also creates .h +$(top)/util/cbfstool/fmd_scanner.h_shipped: $(top)/util/cbfstool/fmd_scanner.c_shipped +$(top)/util/cbfstool/fmd_scanner.c_shipped: $(top)/util/cbfstool/fmd_scanner.l + echo " LEX util/cbfstool/fmd_scanner.[ch]" + $(TOOLLEX) -L -o $@ --header-file=$(patsubst %.c_shipped,%.h_shipped,$@) $< + +# the .c rule also creates .h +$(top)/util/cbfstool/fmd_parser.h_shipped: $(top)/util/cbfstool/fmd_parser.c_shipped +$(top)/util/cbfstool/fmd_parser.c_shipped: $(top)/util/cbfstool/fmd_parser.y + echo " YACC util/cbfstool/fmd_parser.[ch]" + $(TOOLYACC) -l -o $@ --defines=$(patsubst %.c_shipped,%.h_shipped,$@) $< + +endif # CONFIG_FMD_GENPARSER diff --git a/util/cbfstool/bpdt_formats/Makefile.inc b/util/cbfstool/bpdt_formats/Makefile.inc deleted file mode 100644 index a3be46be5d..0000000000 --- a/util/cbfstool/bpdt_formats/Makefile.inc +++ /dev/null @@ -1,9 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only - -bpdt_formats_obj += bpdt_1_6.o -bpdt_formats_obj += bpdt_1_7.o - -bpdt_formats_obj += subpart_hdr_1.o -bpdt_formats_obj += subpart_hdr_2.o - -bpdt_formats_obj += subpart_entry_1.o diff --git a/util/cbfstool/bpdt_formats/Makefile.mk b/util/cbfstool/bpdt_formats/Makefile.mk new file mode 100644 index 0000000000..a3be46be5d --- /dev/null +++ b/util/cbfstool/bpdt_formats/Makefile.mk @@ -0,0 +1,9 @@ +## SPDX-License-Identifier: GPL-2.0-only + +bpdt_formats_obj += bpdt_1_6.o +bpdt_formats_obj += bpdt_1_7.o + +bpdt_formats_obj += subpart_hdr_1.o +bpdt_formats_obj += subpart_hdr_2.o + +bpdt_formats_obj += subpart_entry_1.o diff --git a/util/cbfstool/fpt_formats/Makefile.inc b/util/cbfstool/fpt_formats/Makefile.inc deleted file mode 100644 index 11cb30d274..0000000000 --- a/util/cbfstool/fpt_formats/Makefile.inc +++ /dev/null @@ -1,4 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only - -fpt_formats_obj += fpt_hdr_20.o -fpt_formats_obj += fpt_hdr_21.o diff --git a/util/cbfstool/fpt_formats/Makefile.mk b/util/cbfstool/fpt_formats/Makefile.mk new file mode 100644 index 0000000000..11cb30d274 --- /dev/null +++ b/util/cbfstool/fpt_formats/Makefile.mk @@ -0,0 +1,4 @@ +## SPDX-License-Identifier: GPL-2.0-only + +fpt_formats_obj += fpt_hdr_20.o +fpt_formats_obj += fpt_hdr_21.o diff --git a/util/crossgcc/Makefile.inc b/util/crossgcc/Makefile.inc deleted file mode 100644 index 8a4f3c53a2..0000000000 --- a/util/crossgcc/Makefile.inc +++ /dev/null @@ -1,59 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only - -TOOLCHAIN_ARCHES := i386 x64 arm aarch64 riscv ppc64 nds32le - -help_toolchain help:: - @echo - @echo '*** Toolchain targets ***' - @echo ' crossgcc - Build coreboot cross-compilers for all platforms' - @echo ' crossgcc-clean - Remove all built coreboot cross-compilers' - @echo ' iasl - Build coreboot IASL compiler (built by all cross targets)' - @echo ' clang - Build coreboot clang compiler' - @echo ' nasm - Build coreboot nasm' - @echo ' test-toolchain - Reports if toolchain components are out of date' - @echo ' crossgcc-ARCH - Build cross-compiler for specific architecture' - @echo ' ARCH can be "$(subst $(spc),"$(comma) ",$(TOOLCHAIN_ARCHES))"' - @echo ' Use "make [target] CPUS=#" to build toolchain using multiple cores' - @echo ' Use "make [target] DEST=some/path" to install toolchain there' - @echo ' Use "make [target] BUILDGCC_OPTIONS="-m" to get packages from coreboot mirror"' - @echo - -# For the toolchain builds, use CPUS=x to use multiple processors to build -# use BUILDGCC_OPTIONS= to set any crossgcc command line options -# Example: BUILDGCC_OPTIONS='-t' will keep temporary files after build -crossgcc: clean-for-update - $(MAKE) -C util/crossgcc all SKIP_CLANG=1 - -.PHONY: crossgcc crossgcc-i386 crossgcc-x64 crossgcc-arm crossgcc-aarch64 \ - crossgcc-riscv crossgcc-power8 crossgcc-clean iasl \ - clang jenkins-build-toolchain nasm - -$(foreach arch,$(TOOLCHAIN_ARCHES),crossgcc-$(arch)): clean-for-update - $(MAKE) -C util/crossgcc $(patsubst crossgcc-%,build-%,$@) build_iasl - -iasl: clean-for-update - $(MAKE) -C util/crossgcc build_iasl - -clang: clean-for-update - $(MAKE) -C util/crossgcc build_clang - -nasm: clean-for-update - $(MAKE) -C util/crossgcc build_nasm - -crossgcc-clean: clean-for-update - $(MAKE) -C util/crossgcc clean - -test-toolchain: -ifeq ($(COMPILER_OUT_OF_DATE),1) - echo "The coreboot toolchain is not the current version." - $(error ) -else - echo "The coreboot toolchain is the current version." -endif # ifeq ($(COMPILER_OUT_OF_DATE),1) - -# This target controls what the jenkins builder tests -jenkins-build-toolchain: BUILDGCC_OPTIONS ?= -y --nocolor -jenkins-build-toolchain: - $(MAKE) crossgcc clang KEEP_SOURCES=1 BUILDGCC_OPTIONS='$(BUILDGCC_OPTIONS)' - PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) what-jenkins-does - PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) test-toolchain diff --git a/util/crossgcc/Makefile.mk b/util/crossgcc/Makefile.mk new file mode 100644 index 0000000000..8a4f3c53a2 --- /dev/null +++ b/util/crossgcc/Makefile.mk @@ -0,0 +1,59 @@ +## SPDX-License-Identifier: GPL-2.0-only + +TOOLCHAIN_ARCHES := i386 x64 arm aarch64 riscv ppc64 nds32le + +help_toolchain help:: + @echo + @echo '*** Toolchain targets ***' + @echo ' crossgcc - Build coreboot cross-compilers for all platforms' + @echo ' crossgcc-clean - Remove all built coreboot cross-compilers' + @echo ' iasl - Build coreboot IASL compiler (built by all cross targets)' + @echo ' clang - Build coreboot clang compiler' + @echo ' nasm - Build coreboot nasm' + @echo ' test-toolchain - Reports if toolchain components are out of date' + @echo ' crossgcc-ARCH - Build cross-compiler for specific architecture' + @echo ' ARCH can be "$(subst $(spc),"$(comma) ",$(TOOLCHAIN_ARCHES))"' + @echo ' Use "make [target] CPUS=#" to build toolchain using multiple cores' + @echo ' Use "make [target] DEST=some/path" to install toolchain there' + @echo ' Use "make [target] BUILDGCC_OPTIONS="-m" to get packages from coreboot mirror"' + @echo + +# For the toolchain builds, use CPUS=x to use multiple processors to build +# use BUILDGCC_OPTIONS= to set any crossgcc command line options +# Example: BUILDGCC_OPTIONS='-t' will keep temporary files after build +crossgcc: clean-for-update + $(MAKE) -C util/crossgcc all SKIP_CLANG=1 + +.PHONY: crossgcc crossgcc-i386 crossgcc-x64 crossgcc-arm crossgcc-aarch64 \ + crossgcc-riscv crossgcc-power8 crossgcc-clean iasl \ + clang jenkins-build-toolchain nasm + +$(foreach arch,$(TOOLCHAIN_ARCHES),crossgcc-$(arch)): clean-for-update + $(MAKE) -C util/crossgcc $(patsubst crossgcc-%,build-%,$@) build_iasl + +iasl: clean-for-update + $(MAKE) -C util/crossgcc build_iasl + +clang: clean-for-update + $(MAKE) -C util/crossgcc build_clang + +nasm: clean-for-update + $(MAKE) -C util/crossgcc build_nasm + +crossgcc-clean: clean-for-update + $(MAKE) -C util/crossgcc clean + +test-toolchain: +ifeq ($(COMPILER_OUT_OF_DATE),1) + echo "The coreboot toolchain is not the current version." + $(error ) +else + echo "The coreboot toolchain is the current version." +endif # ifeq ($(COMPILER_OUT_OF_DATE),1) + +# This target controls what the jenkins builder tests +jenkins-build-toolchain: BUILDGCC_OPTIONS ?= -y --nocolor +jenkins-build-toolchain: + $(MAKE) crossgcc clang KEEP_SOURCES=1 BUILDGCC_OPTIONS='$(BUILDGCC_OPTIONS)' + PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) what-jenkins-does + PATH=$(if $(DEST),$(DEST)/bin,$(top)/util/crossgcc/xgcc/bin):$$PATH; $(MAKE) test-toolchain diff --git a/util/futility/Makefile b/util/futility/Makefile index 6901948fa0..14d5f8204c 100644 --- a/util/futility/Makefile +++ b/util/futility/Makefile @@ -23,4 +23,4 @@ ifneq ($(Q),) endif endif -include Makefile.inc +include Makefile.mk diff --git a/util/futility/Makefile.inc b/util/futility/Makefile.inc deleted file mode 100644 index a7bcee50d3..0000000000 --- a/util/futility/Makefile.inc +++ /dev/null @@ -1,27 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -additional-dirs += $(objutil)/futility - -VBOOT_FUTILITY = $(VBOOT_HOST_BUILD)/futility/futility - -HOSTPKGCONFIG ?= pkg-config - -$(VBOOT_FUTILITY): | check-openssl-presence - @printf " MAKE $(subst $(objutil)/,,$(@))\n" - unset CFLAGS LDFLAGS; $(MAKE) -C $(VBOOT_SOURCE) \ - BUILD=$(VBOOT_HOST_BUILD) \ - CC="$(HOSTCC)" \ - WERROR="-Werror -Wno-deprecated-declarations" \ - PKG_CONFIG="$(HOSTPKGCONFIG)" \ - V=$(V) \ - USE_FLASHROM=0 \ - $@ - -.PHONY: check-openssl-presence -check-openssl-presence: - @$(HOSTPKGCONFIG) --exists libcrypto || \ - (echo "Error: Ensure that pkg-config and openssl's libcrypto, including header files, are installed."; exit 1) - -$(objutil)/futility/futility: $(VBOOT_FUTILITY) - mkdir -p $(dir $@) - cp $< $@.tmp - mv $@.tmp $@ diff --git a/util/futility/Makefile.mk b/util/futility/Makefile.mk new file mode 100644 index 0000000000..a7bcee50d3 --- /dev/null +++ b/util/futility/Makefile.mk @@ -0,0 +1,27 @@ +## SPDX-License-Identifier: GPL-2.0-only +additional-dirs += $(objutil)/futility + +VBOOT_FUTILITY = $(VBOOT_HOST_BUILD)/futility/futility + +HOSTPKGCONFIG ?= pkg-config + +$(VBOOT_FUTILITY): | check-openssl-presence + @printf " MAKE $(subst $(objutil)/,,$(@))\n" + unset CFLAGS LDFLAGS; $(MAKE) -C $(VBOOT_SOURCE) \ + BUILD=$(VBOOT_HOST_BUILD) \ + CC="$(HOSTCC)" \ + WERROR="-Werror -Wno-deprecated-declarations" \ + PKG_CONFIG="$(HOSTPKGCONFIG)" \ + V=$(V) \ + USE_FLASHROM=0 \ + $@ + +.PHONY: check-openssl-presence +check-openssl-presence: + @$(HOSTPKGCONFIG) --exists libcrypto || \ + (echo "Error: Ensure that pkg-config and openssl's libcrypto, including header files, are installed."; exit 1) + +$(objutil)/futility/futility: $(VBOOT_FUTILITY) + mkdir -p $(dir $@) + cp $< $@.tmp + mv $@.tmp $@ diff --git a/util/ifdtool/Makefile b/util/ifdtool/Makefile index c0210693d8..72a4dabe5c 100644 --- a/util/ifdtool/Makefile +++ b/util/ifdtool/Makefile @@ -10,7 +10,7 @@ HOSTCC ?= $(CC) HOSTCFLAGS ?= $(CFLAGS) top := ../.. objutil := .. -include Makefile.inc +include Makefile.mk PROGRAM=$(objutil)/ifdtool/ifdtool diff --git a/util/ifdtool/Makefile.inc b/util/ifdtool/Makefile.inc deleted file mode 100644 index 2b97bf51c8..0000000000 --- a/util/ifdtool/Makefile.inc +++ /dev/null @@ -1,19 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -ifdtoolobj = ifdtool.o fmap.o kv_pair.o valstr.o - -IFDTOOLCFLAGS = -O2 -g -Wall -Wextra -Wmissing-prototypes -Werror -IFDTOOLCFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include -IFDTOOLCFLAGS += -I$(top)/util/cbfstool/flashmap -IFDTOOLCFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h -IFDTOOLCFLAGS += -D_DEFAULT_SOURCE # for endianness converting functions - -$(objutil)/ifdtool/%.o: $(top)/util/ifdtool/%.c - $(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/ifdtool/%.o: $(top)/util/cbfstool/flashmap/%.c - $(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/ifdtool/ifdtool: $(addprefix $(objutil)/ifdtool/,$(ifdtoolobj)) - printf " IFDTOOL\n" - $(HOSTCC) ${LDFLAGS} $(addprefix $(objutil)/ifdtool/,$(ifdtoolobj)) -o $@ diff --git a/util/ifdtool/Makefile.mk b/util/ifdtool/Makefile.mk new file mode 100644 index 0000000000..2b97bf51c8 --- /dev/null +++ b/util/ifdtool/Makefile.mk @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: BSD-3-Clause + +ifdtoolobj = ifdtool.o fmap.o kv_pair.o valstr.o + +IFDTOOLCFLAGS = -O2 -g -Wall -Wextra -Wmissing-prototypes -Werror +IFDTOOLCFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include +IFDTOOLCFLAGS += -I$(top)/util/cbfstool/flashmap +IFDTOOLCFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h +IFDTOOLCFLAGS += -D_DEFAULT_SOURCE # for endianness converting functions + +$(objutil)/ifdtool/%.o: $(top)/util/ifdtool/%.c + $(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/ifdtool/%.o: $(top)/util/cbfstool/flashmap/%.c + $(HOSTCC) $(IFDTOOLCFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/ifdtool/ifdtool: $(addprefix $(objutil)/ifdtool/,$(ifdtoolobj)) + printf " IFDTOOL\n" + $(HOSTCC) ${LDFLAGS} $(addprefix $(objutil)/ifdtool/,$(ifdtoolobj)) -o $@ diff --git a/util/marvell/Makefile.inc b/util/marvell/Makefile.inc deleted file mode 100644 index d58c9d83ba..0000000000 --- a/util/marvell/Makefile.inc +++ /dev/null @@ -1,2 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -subdirs-$(CONFIG_SOC_MARVELL_ARMADA38X) += doimage_mv diff --git a/util/marvell/Makefile.mk b/util/marvell/Makefile.mk new file mode 100644 index 0000000000..d58c9d83ba --- /dev/null +++ b/util/marvell/Makefile.mk @@ -0,0 +1,2 @@ +## SPDX-License-Identifier: GPL-2.0-only +subdirs-$(CONFIG_SOC_MARVELL_ARMADA38X) += doimage_mv diff --git a/util/marvell/doimage_mv/Makefile.inc b/util/marvell/doimage_mv/Makefile.inc deleted file mode 100644 index 3f4f528abd..0000000000 --- a/util/marvell/doimage_mv/Makefile.inc +++ /dev/null @@ -1,15 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -TOP = $(abspath ../../..) -DOIMAGE_FOLDER = marvell/doimage_mv -DOIMAGE_BINARY = doimage - -CFLAGS = -g -O1 -I./../inc -DMV_CPU_LE -I $(TOP)/src/commonlib/bsd/include - -$(objutil)/$(DOIMAGE_FOLDER): - mkdir -p $@ - -$(objutil)/$(DOIMAGE_FOLDER)/doimage.o: $(top)/util/marvell/doimage_mv/doimage.c $(objutil)/$(DOIMAGE_FOLDER) - $(HOSTCC) $(CFLAGS) -c $< -o $@ - -$(objutil)/$(DOIMAGE_FOLDER)/$(DOIMAGE_BINARY): $(objutil)/$(DOIMAGE_FOLDER)/doimage.o - $(HOSTCC) $(CFLAGS) -o $@ $^ diff --git a/util/marvell/doimage_mv/Makefile.mk b/util/marvell/doimage_mv/Makefile.mk new file mode 100644 index 0000000000..3f4f528abd --- /dev/null +++ b/util/marvell/doimage_mv/Makefile.mk @@ -0,0 +1,15 @@ +## SPDX-License-Identifier: GPL-2.0-only +TOP = $(abspath ../../..) +DOIMAGE_FOLDER = marvell/doimage_mv +DOIMAGE_BINARY = doimage + +CFLAGS = -g -O1 -I./../inc -DMV_CPU_LE -I $(TOP)/src/commonlib/bsd/include + +$(objutil)/$(DOIMAGE_FOLDER): + mkdir -p $@ + +$(objutil)/$(DOIMAGE_FOLDER)/doimage.o: $(top)/util/marvell/doimage_mv/doimage.c $(objutil)/$(DOIMAGE_FOLDER) + $(HOSTCC) $(CFLAGS) -c $< -o $@ + +$(objutil)/$(DOIMAGE_FOLDER)/$(DOIMAGE_BINARY): $(objutil)/$(DOIMAGE_FOLDER)/doimage.o + $(HOSTCC) $(CFLAGS) -o $@ $^ diff --git a/util/nvidia/Makefile.inc b/util/nvidia/Makefile.inc deleted file mode 100644 index 04199d062e..0000000000 --- a/util/nvidia/Makefile.inc +++ /dev/null @@ -1,60 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -# copied from cbootimage/src/Makefile.am -CBOOTIMAGE_RAW_SRCS:= \ - cbootimage.c \ - data_layout.c \ - set.c \ - crypto.c \ - aes_ref.c \ - context.c \ - parse.c \ - t210/parse_t210.c \ - t132/parse_t132.c \ - t124/parse_t124.c \ - t114/parse_t114.c \ - t30/parse_t30.c \ - t20/parse_t20.c \ - t210/nvbctlib_t210.c \ - t132/nvbctlib_t132.c \ - t124/nvbctlib_t124.c \ - t114/nvbctlib_t114.c \ - t30/nvbctlib_t30.c \ - t20/nvbctlib_t20.c \ - cbootimage.h \ - context.h \ - crypto.h \ - data_layout.h \ - nvaes_ref.h \ - parse.h \ - set.h \ - t20/nvboot_bct_t20.h \ - t20/nvboot_sdram_param_t20.h \ - t30/nvboot_bct_t30.h \ - t30/nvboot_sdram_param_t30.h \ - t114/nvboot_bct_t114.h \ - t114/nvboot_sdram_param_t114.h \ - t124/nvboot_bct_t124.h \ - t124/nvboot_sdram_param_t124.h \ - t132/nvboot_bct_t132.h \ - t132/nvboot_sdram_param_t132.h \ - t210/nvboot_bct_t210.h \ - t210/nvboot_sdram_param_t210.h - -CBOOTIMAGE_SRCS:=$(addprefix util/nvidia/cbootimage/src/,$(filter %.c,$(CBOOTIMAGE_RAW_SRCS))) -CBOOTIMAGE_OBJS:=$(addprefix $(objutil)/nvidia/cbootimage/,$(patsubst %.c,%.o,$(filter %.c,$(CBOOTIMAGE_RAW_SRCS)))) -CBOOTIMAGE_FLAGS:=-Wall -std=c99 -O2 - -ifeq ($(OS_ARCH), FreeBSD) -CBOOTIMAGE_FLAGS:=-DENODATA=ENOATTR -endif - -additional-dirs += $(sort $(dir $(CBOOTIMAGE_OBJS))) - -$(objutil)/nvidia/cbootimage/%.o: util/nvidia/cbootimage/src/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(CBOOTIMAGE_FLAGS) -c -o $@ $< - -$(CBOOTIMAGE): $(CBOOTIMAGE_OBJS) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(CBOOTIMAGE_FLAGS) -o $@.tmp $^ -lm - mv $@.tmp $@ diff --git a/util/nvidia/Makefile.mk b/util/nvidia/Makefile.mk new file mode 100644 index 0000000000..04199d062e --- /dev/null +++ b/util/nvidia/Makefile.mk @@ -0,0 +1,60 @@ +## SPDX-License-Identifier: GPL-2.0-only +# copied from cbootimage/src/Makefile.am +CBOOTIMAGE_RAW_SRCS:= \ + cbootimage.c \ + data_layout.c \ + set.c \ + crypto.c \ + aes_ref.c \ + context.c \ + parse.c \ + t210/parse_t210.c \ + t132/parse_t132.c \ + t124/parse_t124.c \ + t114/parse_t114.c \ + t30/parse_t30.c \ + t20/parse_t20.c \ + t210/nvbctlib_t210.c \ + t132/nvbctlib_t132.c \ + t124/nvbctlib_t124.c \ + t114/nvbctlib_t114.c \ + t30/nvbctlib_t30.c \ + t20/nvbctlib_t20.c \ + cbootimage.h \ + context.h \ + crypto.h \ + data_layout.h \ + nvaes_ref.h \ + parse.h \ + set.h \ + t20/nvboot_bct_t20.h \ + t20/nvboot_sdram_param_t20.h \ + t30/nvboot_bct_t30.h \ + t30/nvboot_sdram_param_t30.h \ + t114/nvboot_bct_t114.h \ + t114/nvboot_sdram_param_t114.h \ + t124/nvboot_bct_t124.h \ + t124/nvboot_sdram_param_t124.h \ + t132/nvboot_bct_t132.h \ + t132/nvboot_sdram_param_t132.h \ + t210/nvboot_bct_t210.h \ + t210/nvboot_sdram_param_t210.h + +CBOOTIMAGE_SRCS:=$(addprefix util/nvidia/cbootimage/src/,$(filter %.c,$(CBOOTIMAGE_RAW_SRCS))) +CBOOTIMAGE_OBJS:=$(addprefix $(objutil)/nvidia/cbootimage/,$(patsubst %.c,%.o,$(filter %.c,$(CBOOTIMAGE_RAW_SRCS)))) +CBOOTIMAGE_FLAGS:=-Wall -std=c99 -O2 + +ifeq ($(OS_ARCH), FreeBSD) +CBOOTIMAGE_FLAGS:=-DENODATA=ENOATTR +endif + +additional-dirs += $(sort $(dir $(CBOOTIMAGE_OBJS))) + +$(objutil)/nvidia/cbootimage/%.o: util/nvidia/cbootimage/src/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(CBOOTIMAGE_FLAGS) -c -o $@ $< + +$(CBOOTIMAGE): $(CBOOTIMAGE_OBJS) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(CBOOTIMAGE_FLAGS) -o $@.tmp $^ -lm + mv $@.tmp $@ diff --git a/util/nvramtool/Makefile.inc b/util/nvramtool/Makefile.inc deleted file mode 100644 index 00e5efa995..0000000000 --- a/util/nvramtool/Makefile.inc +++ /dev/null @@ -1,39 +0,0 @@ -## -## Integration of nvramtool into the coreboot build system -## -## (C) 2005-2008 coresystems GmbH -## written by Stefan Reinauer -## (C) 2012 secunet Security Networks AG -## -## SPDX-License-Identifier: GPL-2.0-only - -OS_ARCH = $(shell uname) -NVRAMTOOLFLAGS := -I$(top)/util/nvramtool -ifeq ($(OS_ARCH), NetBSD) -NVRAMTOOLLDLFLAGS = -l$(shell uname -p) -endif -ifeq ($(shell uname -o 2>/dev/null), Cygwin) -NVRAMTOOLFLAGS += -O2 -g -Wall -W -D__GLIBC__ -HOSTCFLAGS = -endif - -nvramtoolobj := -nvramtoolobj += cli/nvramtool.o cli/opts.o -nvramtoolobj += cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o -nvramtoolobj += hexdump.o input_file.o layout.o accessors/layout-common.o accessors/layout-text.o accessors/layout-bin.o lbtable.o -nvramtoolobj += reg_expr.o cbfs.o accessors/cmos-mem.o - -ifeq ($(shell uname -s 2>/dev/null | cut -c-7), MINGW32) -NVRAMTOOLLDFLAGS += -lregex -lwsock32 -nvramtoolobj += win32mmap.o -endif - -additional-dirs += $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli - -$(objutil)/nvramtool/%.o: $(top)/util/nvramtool/%.c - printf " HOSTCC $(subst $(objutil)/,,$(@))\n" - $(HOSTCC) $(NVRAMTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/nvramtool/nvramtool: $(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) - printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" - $(HOSTCC) $(NVRAMTOOLFLAGS) -o $@ $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) $(NVRAMTOOLLDFLAGS) diff --git a/util/nvramtool/Makefile.mk b/util/nvramtool/Makefile.mk new file mode 100644 index 0000000000..00e5efa995 --- /dev/null +++ b/util/nvramtool/Makefile.mk @@ -0,0 +1,39 @@ +## +## Integration of nvramtool into the coreboot build system +## +## (C) 2005-2008 coresystems GmbH +## written by Stefan Reinauer +## (C) 2012 secunet Security Networks AG +## +## SPDX-License-Identifier: GPL-2.0-only + +OS_ARCH = $(shell uname) +NVRAMTOOLFLAGS := -I$(top)/util/nvramtool +ifeq ($(OS_ARCH), NetBSD) +NVRAMTOOLLDLFLAGS = -l$(shell uname -p) +endif +ifeq ($(shell uname -o 2>/dev/null), Cygwin) +NVRAMTOOLFLAGS += -O2 -g -Wall -W -D__GLIBC__ +HOSTCFLAGS = +endif + +nvramtoolobj := +nvramtoolobj += cli/nvramtool.o cli/opts.o +nvramtoolobj += cmos_lowlevel.o cmos_ops.o common.o compute_ip_checksum.o +nvramtoolobj += hexdump.o input_file.o layout.o accessors/layout-common.o accessors/layout-text.o accessors/layout-bin.o lbtable.o +nvramtoolobj += reg_expr.o cbfs.o accessors/cmos-mem.o + +ifeq ($(shell uname -s 2>/dev/null | cut -c-7), MINGW32) +NVRAMTOOLLDFLAGS += -lregex -lwsock32 +nvramtoolobj += win32mmap.o +endif + +additional-dirs += $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli + +$(objutil)/nvramtool/%.o: $(top)/util/nvramtool/%.c + printf " HOSTCC $(subst $(objutil)/,,$(@))\n" + $(HOSTCC) $(NVRAMTOOLFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/nvramtool/nvramtool: $(objutil)/nvramtool $(objutil)/nvramtool/accessors $(objutil)/nvramtool/cli $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) + printf " HOSTCC $(subst $(objutil)/,,$(@)) (link)\n" + $(HOSTCC) $(NVRAMTOOLFLAGS) -o $@ $(addprefix $(objutil)/nvramtool/,$(nvramtoolobj)) $(NVRAMTOOLLDFLAGS) diff --git a/util/qemu/Makefile.inc b/util/qemu/Makefile.inc deleted file mode 100644 index e1181ade73..0000000000 --- a/util/qemu/Makefile.inc +++ /dev/null @@ -1,51 +0,0 @@ -# SPDX-License-Identifier: BSD-3-Clause - -# This automatically adds a `qemu` make target if a compatible -# configuration is selected. There are some notable variables -# that can be set or adapted in `Makefile.inc` files, the make -# command line or the environment: -# -# Primarily for `Makefile.inc` use: -# QEMU-y the QEMU executable -# QEMU_CFG-y a QEMU config that sets the available default devices, -# used to run more comprehensive tests by default, -# e.g. many more PCI devices -# -# For general use: -# QEMU_ARGS additional command line arguments (default: -serial stdio) -# QEMU_EXTRA_CFGS additional config files that can add devices -# -# QEMU_CFG_ARGS gathers config file related arguments, -# can be used to override a default config (QEMU_CFG-y) -# -# Examples: -# -# $ # Run coreboot's default config with additional command line args -# $ make qemu QEMU_ARGS="-cdrom site-local/grml64-small_2018.12.iso" -# -# $ # Force QEMU's built-in config -# $ make qemu QEMU_CFG_ARGS= - -QEMU-$(CONFIG_BOARD_EMULATION_QEMU_AARCH64) ?= qemu-system-aarch64 \ - -M virt,secure=on,virtualization=on -cpu cortex-a53 -m 1G - -QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_I440FX) ?= qemu-system-x86_64 -M pc - -QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= qemu-system-x86_64 -M q35 -QEMU_CFG-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= util/qemu/q35-base.cfg - -ifneq ($(QEMU-y),) - -QEMU_ARGS ?= -serial stdio -QEMU_EXTRA_CFGS ?= - -QEMU_CFG_ARGS ?= \ - $(if $(QEMU_CFG-y),-nodefaults) \ - $(addprefix -readconfig ,$(QEMU_CFG-y) $(QEMU_EXTRA_CFGS)) - -qemu: $(obj)/coreboot.rom - $(QEMU-y) $(QEMU_CFG_ARGS) $(QEMU_ARGS) -bios $< - -.PHONY: qemu - -endif diff --git a/util/qemu/Makefile.mk b/util/qemu/Makefile.mk new file mode 100644 index 0000000000..077fde772d --- /dev/null +++ b/util/qemu/Makefile.mk @@ -0,0 +1,51 @@ +# SPDX-License-Identifier: BSD-3-Clause + +# This automatically adds a `qemu` make target if a compatible +# configuration is selected. There are some notable variables +# that can be set or adapted in `Makefile.mk` files, the make +# command line or the environment: +# +# Primarily for `Makefile.mk` use: +# QEMU-y the QEMU executable +# QEMU_CFG-y a QEMU config that sets the available default devices, +# used to run more comprehensive tests by default, +# e.g. many more PCI devices +# +# For general use: +# QEMU_ARGS additional command line arguments (default: -serial stdio) +# QEMU_EXTRA_CFGS additional config files that can add devices +# +# QEMU_CFG_ARGS gathers config file related arguments, +# can be used to override a default config (QEMU_CFG-y) +# +# Examples: +# +# $ # Run coreboot's default config with additional command line args +# $ make qemu QEMU_ARGS="-cdrom site-local/grml64-small_2018.12.iso" +# +# $ # Force QEMU's built-in config +# $ make qemu QEMU_CFG_ARGS= + +QEMU-$(CONFIG_BOARD_EMULATION_QEMU_AARCH64) ?= qemu-system-aarch64 \ + -M virt,secure=on,virtualization=on -cpu cortex-a53 -m 1G + +QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_I440FX) ?= qemu-system-x86_64 -M pc + +QEMU-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= qemu-system-x86_64 -M q35 +QEMU_CFG-$(CONFIG_BOARD_EMULATION_QEMU_X86_Q35) ?= util/qemu/q35-base.cfg + +ifneq ($(QEMU-y),) + +QEMU_ARGS ?= -serial stdio +QEMU_EXTRA_CFGS ?= + +QEMU_CFG_ARGS ?= \ + $(if $(QEMU_CFG-y),-nodefaults) \ + $(addprefix -readconfig ,$(QEMU_CFG-y) $(QEMU_EXTRA_CFGS)) + +qemu: $(obj)/coreboot.rom + $(QEMU-y) $(QEMU_CFG_ARGS) $(QEMU_ARGS) -bios $< + +.PHONY: qemu + +endif diff --git a/util/sconfig/Makefile.inc b/util/sconfig/Makefile.inc deleted file mode 100644 index c3da29d199..0000000000 --- a/util/sconfig/Makefile.inc +++ /dev/null @@ -1,47 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -sconfigobj := -sconfigobj += lex.yy.o -sconfigobj += sconfig.tab.o -sconfigobj += main.o - -SCONFIGFLAGS += -I$(top)/util/sconfig -I$(objutil)/sconfig -SCONFIGFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include - -$(objutil)/sconfig: - mkdir -p $@ - -$(objutil)/sconfig/.generated: $(objutil)/sconfig - touch $@ - -$(objutil)/sconfig/%.o: util/sconfig/%.c | $(objutil)/sconfig/.generated - printf " HOSTCC $(subst $(obj)/,,$(@))\n" - $(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -$(objutil)/sconfig/%.o: $(objutil)/sconfig/%.c - printf " HOSTCC $(subst $(obj)/,,$(@))\n" - $(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $< - -ifeq ($(CONFIG_UTIL_GENPARSER),y) -$(top)/util/sconfig/lex.yy.c_shipped: $(top)/util/sconfig/sconfig.l - printf " FLEX $(subst $(top)/,,$(@))\n" - flex -L -o $@ $< - -# the .c rule also creates .h -$(top)/util/sconfig/sconfig.tab.h_shipped: $(top)/util/sconfig/sconfig.tab.c_shipped -$(top)/util/sconfig/sconfig.tab.c_shipped: $(top)/util/sconfig/sconfig.y - printf " BISON $(subst $(top)/,,$(@))\n" - bison -l --defines=$(top)/util/sconfig/sconfig.tab.h_shipped -o $@ $< - -endif - -$(objutil)/sconfig/lex.yy.o: $(objutil)/sconfig/sconfig.tab.h - -$(objutil)/sconfig/%: $(top)/util/sconfig/%_shipped - mkdir -p $(dir $@) - cp $< $@ - -$(objutil)/sconfig/sconfig: $(addprefix $(objutil)/sconfig/,$(sconfigobj)) - printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n" - $(HOSTCC) $(SCONFIGFLAGS) -o $@ $(addprefix $(objutil)/sconfig/,$(sconfigobj)) - -$(addprefix $(objutil)/sconfig/,$(sconfigobj)) : $(objutil)/sconfig/sconfig.tab.h $(objutil)/sconfig/sconfig.tab.c $(objutil)/sconfig/lex.yy.c diff --git a/util/sconfig/Makefile.mk b/util/sconfig/Makefile.mk new file mode 100644 index 0000000000..c3da29d199 --- /dev/null +++ b/util/sconfig/Makefile.mk @@ -0,0 +1,47 @@ +## SPDX-License-Identifier: GPL-2.0-only +sconfigobj := +sconfigobj += lex.yy.o +sconfigobj += sconfig.tab.o +sconfigobj += main.o + +SCONFIGFLAGS += -I$(top)/util/sconfig -I$(objutil)/sconfig +SCONFIGFLAGS += -I$(top)/src/commonlib/include -I$(top)/src/commonlib/bsd/include + +$(objutil)/sconfig: + mkdir -p $@ + +$(objutil)/sconfig/.generated: $(objutil)/sconfig + touch $@ + +$(objutil)/sconfig/%.o: util/sconfig/%.c | $(objutil)/sconfig/.generated + printf " HOSTCC $(subst $(obj)/,,$(@))\n" + $(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +$(objutil)/sconfig/%.o: $(objutil)/sconfig/%.c + printf " HOSTCC $(subst $(obj)/,,$(@))\n" + $(HOSTCC) $(SCONFIGFLAGS) $(HOSTCFLAGS) -c -o $@ $< + +ifeq ($(CONFIG_UTIL_GENPARSER),y) +$(top)/util/sconfig/lex.yy.c_shipped: $(top)/util/sconfig/sconfig.l + printf " FLEX $(subst $(top)/,,$(@))\n" + flex -L -o $@ $< + +# the .c rule also creates .h +$(top)/util/sconfig/sconfig.tab.h_shipped: $(top)/util/sconfig/sconfig.tab.c_shipped +$(top)/util/sconfig/sconfig.tab.c_shipped: $(top)/util/sconfig/sconfig.y + printf " BISON $(subst $(top)/,,$(@))\n" + bison -l --defines=$(top)/util/sconfig/sconfig.tab.h_shipped -o $@ $< + +endif + +$(objutil)/sconfig/lex.yy.o: $(objutil)/sconfig/sconfig.tab.h + +$(objutil)/sconfig/%: $(top)/util/sconfig/%_shipped + mkdir -p $(dir $@) + cp $< $@ + +$(objutil)/sconfig/sconfig: $(addprefix $(objutil)/sconfig/,$(sconfigobj)) + printf " HOSTCC $(subst $(obj)/,,$(@)) (link)\n" + $(HOSTCC) $(SCONFIGFLAGS) -o $@ $(addprefix $(objutil)/sconfig/,$(sconfigobj)) + +$(addprefix $(objutil)/sconfig/,$(sconfigobj)) : $(objutil)/sconfig/sconfig.tab.h $(objutil)/sconfig/sconfig.tab.c $(objutil)/sconfig/lex.yy.c diff --git a/util/supermicro/Makefile.inc b/util/supermicro/Makefile.inc deleted file mode 100644 index 7d295a0205..0000000000 --- a/util/supermicro/Makefile.inc +++ /dev/null @@ -1,24 +0,0 @@ -## SPDX-License-Identifier: GPL-2.0-only -TOOLCPPFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h - -SMCBIOSINFOTOOL:= $(objutil)/supermicro/smcbiosinfo - -$(SMCBIOSINFOTOOL): $(dir)/smcbiosinfo/smcbiosinfo.c - printf " HOSTCC Creating SMCBIOSINFO tool\n" - mkdir -p $(objutil)/supermicro - $(HOSTCC) $(TOOLCPPFLAGS) $< -o $@ - -ifeq ($(CONFIG_VENDOR_SUPERMICRO),y) -ifneq ($(call strip_quotes, $(CONFIG_SUPERMICRO_BOARDID)),) - -cbfs-files-y += smcbiosinfo.bin - -smcbiosinfo.bin-file := $(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin -smcbiosinfo.bin-type := raw -smcbiosinfo.bin-compression := none - -$(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin: $(SMCBIOSINFOTOOL) $(build_h) - printf " TOOL Creating SMC BIOSINFO metadata\n" - $(SMCBIOSINFOTOOL) -i $(build_h) -b $(CONFIG_SUPERMICRO_BOARDID) -o $@ -endif -endif diff --git a/util/supermicro/Makefile.mk b/util/supermicro/Makefile.mk new file mode 100644 index 0000000000..7d295a0205 --- /dev/null +++ b/util/supermicro/Makefile.mk @@ -0,0 +1,24 @@ +## SPDX-License-Identifier: GPL-2.0-only +TOOLCPPFLAGS += -include $(top)/src/commonlib/bsd/include/commonlib/bsd/compiler.h + +SMCBIOSINFOTOOL:= $(objutil)/supermicro/smcbiosinfo + +$(SMCBIOSINFOTOOL): $(dir)/smcbiosinfo/smcbiosinfo.c + printf " HOSTCC Creating SMCBIOSINFO tool\n" + mkdir -p $(objutil)/supermicro + $(HOSTCC) $(TOOLCPPFLAGS) $< -o $@ + +ifeq ($(CONFIG_VENDOR_SUPERMICRO),y) +ifneq ($(call strip_quotes, $(CONFIG_SUPERMICRO_BOARDID)),) + +cbfs-files-y += smcbiosinfo.bin + +smcbiosinfo.bin-file := $(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin +smcbiosinfo.bin-type := raw +smcbiosinfo.bin-compression := none + +$(obj)/mainboard/$(MAINBOARDDIR)/smcbiosinfo.bin: $(SMCBIOSINFOTOOL) $(build_h) + printf " TOOL Creating SMC BIOSINFO metadata\n" + $(SMCBIOSINFOTOOL) -i $(build_h) -b $(CONFIG_SUPERMICRO_BOARDID) -o $@ +endif +endif -- cgit v1.2.3