summaryrefslogtreecommitdiff
path: root/util/cbfstool/Makefile
blob: 5a33598c84913f4fa29e7399c6462fd577b88069 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
top ?= $(abspath ../..)
objutil ?= $(top)/util
RM ?= rm

CONFIG_FMD_GENPARSER ?= n

HOSTCC ?= $(CC)
PREFIX ?= /usr/local
BINDIR ?= $(PREFIX)/bin
INSTALL ?= /usr/bin/env install
OBJCOPY ?= objcopy
override objutil := ..

VBOOT_SOURCE ?= $(top)/3rdparty/vboot
VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
SPDX_ID_STRING := SPDX-License-Identifier

.PHONY: all
all: cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool cse_fpt cse_serger

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

cse_fpt: $(objutil)/cbfstool/cse_fpt

cse_serger: $(objutil)/cbfstool/cse_serger

.PHONY: clean cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool elogtool cse_fpt cse_serger
clean:
	$(RM) -f fmd_parser.c fmd_parser.h fmd_scanner.c fmd_scanner.h
	$(RM) -f $(objutil)/cbfstool/cbfstool $(cbfsobj)
	$(RM) -f $(objutil)/cbfstool/fmaptool $(fmapobj)
	$(RM) -f $(objutil)/cbfstool/rmodtool $(rmodobj)
	$(RM) -f $(objutil)/cbfstool/ifwitool $(ifwiobj)
	$(RM) -f $(objutil)/cbfstool/ifittool $(ifitobj)
	$(RM) -f $(objutil)/cbfstool/cbfs-compression-tool $(cbfscompobj)
	$(RM) -f $(objutil)/cbfstool/elogtool $(elogobj)
	$(RM) -f $(objutil)/cbfstool/cse_fpt $(cse_fpt_obj)
	$(RM) -f $(objutil)/cbfstool/cse_serger $(cse_serger_obj)
	$(RM) -rf $(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_ID_STRING): 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)
	$(INSTALL) cse_fpt $(DESTDIR)$(BINDIR)
	$(INSTALL) cse_serger $(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"
	@echo "  cse_fpt  - Manage Intel CSE Flash Partition Table (FPT)"
	@echo "  cse_serger - Stitch Intel CSE components"

ifneq ($(V),1)
.SILENT:
endif

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

$(VBOOT_SOURCE)/firmware/include/vb2_sha.h:
	cd $(VBOOT_SOURCE) && git submodule update --init .