From 04bd9651435843ce4b03c9717f2965fe344fe5cc Mon Sep 17 00:00:00 2001 From: Sergii Dmytruk Date: Fri, 17 Nov 2023 19:31:20 +0200 Subject: util: add smmstoretool for editing SMMSTORE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Offline SMMSTORE variable modification tool. Can be used to pre-configure ROM image or debug EFI state stored in a dump. Change-Id: I6c1c06f1d0c39c13b5be76a3070f09b715aca6e0 Signed-off-by: Sergii Dmytruk Reviewed-on: https://review.coreboot.org/c/coreboot/+/79080 Tested-by: build bot (Jenkins) Reviewed-by: Michał Żygowski Reviewed-by: Arthur Heymans --- util/smmstoretool/Makefile | 56 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 util/smmstoretool/Makefile (limited to 'util/smmstoretool/Makefile') diff --git a/util/smmstoretool/Makefile b/util/smmstoretool/Makefile new file mode 100644 index 0000000000..78b77caa2d --- /dev/null +++ b/util/smmstoretool/Makefile @@ -0,0 +1,56 @@ +# SPDX-License-Identifier: GPL-2.0-or-later + +PRG := smmstoretool +TOP ?= $(abspath ../..) +ROOT := $(TOP)/src +MDE := $(ROOT)/vendorcode/intel/edk2/UDK2017/MdePkg/Include/ + +CC ?= $(CROSS_COMPILE)gcc +HOSTCC ?= $(CC) +INSTALL ?= /usr/bin/env install +PREFIX ?= /usr/local + +HOSTCFLAGS ?= $(CFLAGS) +HOSTCFLAGS += -Wall -Wextra -MMD -MP -O3 +HOSTCFLAGS += -I $(ROOT)/commonlib/bsd/include +HOSTCFLAGS += -I $(ROOT)/vendorcode/intel/edk2/ +HOSTCFLAGS += -I $(MDE) + +HOSTLDFLAGS ?= $(LDFLAGS) + +MACHINE := $(shell uname -m) +ifeq ($(MACHINE),x86_64) + HOSTCFLAGS += -I $(MDE)/X64 +else ifeq ($(patsubst i%86,Ia32,$(MACHINE)),Ia32) + HOSTCFLAGS += -I $(MDE)/Ia32 +else + $(error Unsupported machine: '$(MACHINE)') +endif + +SRC := data.c fv.c guids.c main.c storage.c utils.c vs.c + +OBJ := $(SRC:.c=.o) +DEP := $(SRC:.c=.o.d) + +.PHONY: all debug clean install + +all: $(PRG) + +debug: HOSTCFLAGS += -O0 -g +debug: HOSTLDFLAGS += -g +debug: all + +install: $(PRG) + $(INSTALL) -d $(DESTDIR)$(PREFIX)/bin/ + $(INSTALL) $^ $(DESTDIR)$(PREFIX)/bin/ + +clean: + -$(RM) $(PRG) $(OBJ) $(DEP) + +$(PRG): $(OBJ) + $(HOSTCC) -o $@ $^ $(HOSTLDFLAGS) + +%.o: %.c + $(HOSTCC) $(HOSTCFLAGS) -c -o $@ -MF $@.d $< + +-include $(DEP) -- cgit v1.2.3