summaryrefslogtreecommitdiff
path: root/util/smmstoretool/Makefile
diff options
context:
space:
mode:
authorSergii Dmytruk <sergii.dmytruk@3mdeb.com>2023-11-17 19:31:20 +0200
committerMartin L Roth <gaumless@gmail.com>2024-03-09 23:22:55 +0000
commit04bd9651435843ce4b03c9717f2965fe344fe5cc (patch)
tree0193502b26818c738206a60862c689485d533a50 /util/smmstoretool/Makefile
parent7a51acfbe91c7f9d01837103341526abb6ea46f4 (diff)
util: add smmstoretool for editing SMMSTORE
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 <sergii.dmytruk@3mdeb.com> Reviewed-on: https://review.coreboot.org/c/coreboot/+/79080 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michał Żygowski <michal.zygowski@3mdeb.com> Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Diffstat (limited to 'util/smmstoretool/Makefile')
-rw-r--r--util/smmstoretool/Makefile56
1 files changed, 56 insertions, 0 deletions
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)