c2cf3946c9
Add a new tool that that prints elog events. The tool, as input, accepts either a file with the RW_ELOG contents, or if the file is not provided it reads the contents of RW_ELOG by calling the "flashrom" tool. The tool is based on "mosys eventlog list"[1]. For the moment it only supports "list", but future commits will add additional functionality. This commit also adds missing ELOG defines needed for the tool. These defines are added with the rest of the ELOG defines, in include/commonlib/bsd/elog.h The tool is placed inside util/cbfstool. The rationale behind the decision, is that this tool shares a lot in common with the other tools located in cbfstool: vboot dependency, shared files like common.o and valstr.o, and in spirit is similar to some of the tools located in cbfstool/. As an example, you call the tool like the following: $ elogtool list -f rw_elog_dump.bin [1]: https://chromium.googlesource.com/chromiumos/platform/mosys/+/refs/heads/main/lib/eventlog/elog.c BUG=b:172210863 Signed-off-by: Ricardo Quesada <ricardoq@google.com> Change-Id: Ia1fe1c9ed3c4c6bda846055d4b10943b54463935 Reviewed-on: https://review.coreboot.org/c/coreboot/+/56406 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Tim Wawrzynczak <twawrzynczak@chromium.org> Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
88 lines
2.8 KiB
Makefile
88 lines
2.8 KiB
Makefile
top ?= $(abspath ../..)
|
|
objutil ?= $(top)/util
|
|
|
|
CONFIG_FMD_GENPARSER ?= n
|
|
|
|
HOSTCC ?= $(CC)
|
|
PREFIX ?= /usr/local
|
|
BINDIR ?= $(PREFIX)/bin
|
|
INSTALL ?= /usr/bin/env install
|
|
OBJCOPY ?= objcopy
|
|
|
|
VBOOT_SOURCE ?= $(top)/3rdparty/vboot
|
|
VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
|
|
|
|
.PHONY: all
|
|
all: cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool
|
|
|
|
cbfstool: $(objutil)/cbfstool/cbfstool
|
|
|
|
fmaptool: $(objutil)/cbfstool/fmaptool
|
|
|
|
rmodtool: $(objutil)/cbfstool/rmodtool
|
|
|
|
ifwitool: $(objutil)/cbfstool/ifwitool
|
|
|
|
ifittool: $(objutil)/cbfstool/ifittool
|
|
|
|
cbfs-compression-tool: $(objutil)/cbfstool/cbfs-compression-tool
|
|
|
|
elogtool: $(objutil)/cbfstool/elogtool
|
|
|
|
.PHONY: clean cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool
|
|
clean:
|
|
$(RM) fmd_parser.c fmd_parser.h fmd_scanner.c fmd_scanner.h
|
|
$(RM) $(objutil)/cbfstool/cbfstool $(cbfsobj)
|
|
$(RM) $(objutil)/cbfstool/fmaptool $(fmapobj)
|
|
$(RM) $(objutil)/cbfstool/rmodtool $(rmodobj)
|
|
$(RM) $(objutil)/cbfstool/ifwitool $(ifwiobj)
|
|
$(RM) $(objutil)/cbfstool/ifittool $(ifitobj)
|
|
$(RM) $(objutil)/cbfstool/cbfs-compression-tool $(cbfscompobj)
|
|
$(RM) $(objutil)/cbfstool/elogtool $(elogobj)
|
|
$(RM) -r $(VBOOT_HOST_BUILD)
|
|
|
|
linux_trampoline.c: linux_trampoline.S
|
|
rm -f linux_trampoline.c
|
|
$(CC) -m32 -o linux_trampoline linux_trampoline.S -ffreestanding -nostdlib -nostdinc -Wl,--defsym=_start=0
|
|
$(OBJCOPY) -Obinary -j .data linux_trampoline trampoline
|
|
echo "/* This file is automatically generated. Do not manually change */" > trampoline.c
|
|
echo "/* SPDX-License-Identifier: GPL-2.0-only */" >> trampoline.c
|
|
xxd -c 16 -i trampoline >> trampoline.c
|
|
mv trampoline.c linux_trampoline.c
|
|
rm linux_trampoline trampoline
|
|
|
|
.PHONY: install distclean help
|
|
install: all
|
|
mkdir -p $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) cbfstool $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) fmaptool $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) rmodtool $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) ifwitool $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) ifittool $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) cbfs-compression-tool $(DESTDIR)$(BINDIR)
|
|
$(INSTALL) elogtool $(DESTDIR)$(BINDIR)
|
|
|
|
distclean: clean
|
|
|
|
help:
|
|
@echo "cbfstool & associated tools"
|
|
@echo "Targets: all, clean, distclean, help"
|
|
@echo " cbfstool - Manipulate CBFS images"
|
|
@echo " fmaptool - Compile Flashmap descriptor (fmd) files"
|
|
@echo " rmodtool - Create relocatable modules"
|
|
@echo " ifwitool - Manipulate Intel FW Image (IFWI)"
|
|
@echo " ifittool - Manipulate Intel FW Interface Table (FIT)"
|
|
@echo " cbfs-compression-tool - benchmark compression algorithms"
|
|
@echo " elogtool - Display ELOG events"
|
|
|
|
ifneq ($(V),1)
|
|
.SILENT:
|
|
endif
|
|
|
|
include Makefile.inc
|
|
|
|
$(objutil)/cbfstool/cbfstool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h
|
|
$(objutil)/cbfstool/elogtool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h
|
|
|
|
$(VBOOT_SOURCE)/firmware/include/vb2_sha.h:
|
|
cd $(VBOOT_SOURCE) && git submodule update --init .
|