blob: 7d7befef9576f397da9b90541303025d60f56549 [file] [log] [blame]
Patrick Georgiae570d52015-09-16 16:34:15 +02001top ?= $(abspath ../..)
2objutil ?= $(top)/util
Patrick Georgiae570d52015-09-16 16:34:15 +02003
Alexander Couzens2c68b1c2016-06-16 20:16:54 -07004CONFIG_FMD_GENPARSER ?= n
Peter Stuge1d862de2009-04-14 00:08:34 +00005
Alexandru Gagniuc4a7b1152014-01-27 17:17:29 -06006HOSTCC ?= $(CC)
Denis 'GNUtoo' Carikli3ef241f2015-11-11 05:27:25 +01007PREFIX ?= /usr/local
8BINDIR ?= $(PREFIX)/bin
Yegor Timoshenkoc2e49412018-10-07 01:58:27 +00009INSTALL ?= /usr/bin/env install
Stefan Reinauer0316e1a2015-11-20 17:58:59 +010010OBJCOPY ?= objcopy
Sol Boucher0e539312015-03-05 15:38:03 -080011
Paul Kocialkowski61486b52016-07-24 12:14:38 +020012VBOOT_SOURCE ?= $(top)/3rdparty/vboot
Yu-Ping Wu0beddb52020-03-09 10:58:37 +080013VBOOT_HOST_BUILD ?= $(abspath $(objutil)/vboot_lib)
Paul Kocialkowski61486b52016-07-24 12:14:38 +020014
Sol Boucher0e539312015-03-05 15:38:03 -080015.PHONY: all
Philipp Deppenwiese5ada0022018-11-20 13:54:49 +010016all: cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool
Peter Stuge1d862de2009-04-14 00:08:34 +000017
Antonello Dettori75c37052016-06-05 17:26:01 +020018cbfstool: $(objutil)/cbfstool/cbfstool
19
20fmaptool: $(objutil)/cbfstool/fmaptool
21
22rmodtool: $(objutil)/cbfstool/rmodtool
23
24ifwitool: $(objutil)/cbfstool/ifwitool
25
Philipp Deppenwiese5ada0022018-11-20 13:54:49 +010026ifittool: $(objutil)/cbfstool/ifittool
27
Patrick Georgic88d16b2017-01-11 15:26:58 +010028cbfs-compression-tool: $(objutil)/cbfstool/cbfs-compression-tool
29
Philipp Deppenwiese5ada0022018-11-20 13:54:49 +010030.PHONY: clean cbfstool ifittool fmaptool rmodtool ifwitool cbfs-compression-tool
Patrick Georgib7b56dd82009-09-14 13:29:27 +000031clean:
Nico Huber37743a92015-10-22 13:34:06 +020032 $(RM) fmd_parser.c fmd_parser.h fmd_scanner.c fmd_scanner.h
Patrick Georgiae570d52015-09-16 16:34:15 +020033 $(RM) $(objutil)/cbfstool/cbfstool $(cbfsobj)
34 $(RM) $(objutil)/cbfstool/fmaptool $(fmapobj)
35 $(RM) $(objutil)/cbfstool/rmodtool $(rmodobj)
Furquan Shaikh233f1b62016-05-19 16:12:16 -070036 $(RM) $(objutil)/cbfstool/ifwitool $(ifwiobj)
Philipp Deppenwiese5ada0022018-11-20 13:54:49 +010037 $(RM) $(objutil)/cbfstool/ifittool $(ifitobj)
Patrick Georgic88d16b2017-01-11 15:26:58 +010038 $(RM) $(objutil)/cbfstool/cbfs-compression-tool $(cbfscompobj)
Yu-Ping Wu0beddb52020-03-09 10:58:37 +080039 $(RM) -r $(VBOOT_HOST_BUILD)
Peter Stuge1d862de2009-04-14 00:08:34 +000040
Stefan Reinauer0316e1a2015-11-20 17:58:59 +010041linux_trampoline.c: linux_trampoline.S
42 rm -f linux_trampoline.c
43 $(CC) -m32 -o linux_trampoline linux_trampoline.S -ffreestanding -nostdlib -nostdinc -Wl,--defsym=_start=0
44 $(OBJCOPY) -Obinary -j .data linux_trampoline trampoline
45 echo "/* This file is automatically generated. Do not manually change */" > trampoline.c
Patrick Georgi1dd517c2020-05-10 20:45:08 +020046 echo "/* SPDX-License-Identifier: GPL-2.0-only */" >> trampoline.c
Stefan Reinauer0316e1a2015-11-20 17:58:59 +010047 xxd -c 16 -i trampoline >> trampoline.c
Stefan Reinauer0316e1a2015-11-20 17:58:59 +010048 mv trampoline.c linux_trampoline.c
49 rm linux_trampoline trampoline
50
Martin Roth92f447a2021-02-14 14:57:06 -070051.PHONY: install distclean help
Denis 'GNUtoo' Carikli3ef241f2015-11-11 05:27:25 +010052install: all
53 mkdir -p $(DESTDIR)$(BINDIR)
54 $(INSTALL) cbfstool $(DESTDIR)$(BINDIR)
55 $(INSTALL) fmaptool $(DESTDIR)$(BINDIR)
56 $(INSTALL) rmodtool $(DESTDIR)$(BINDIR)
57 $(INSTALL) ifwitool $(DESTDIR)$(BINDIR)
Philipp Deppenwiese5ada0022018-11-20 13:54:49 +010058 $(INSTALL) ifittool $(DESTDIR)$(BINDIR)
Denis 'GNUtoo' Carikli3ef241f2015-11-11 05:27:25 +010059 $(INSTALL) cbfs-compression-tool $(DESTDIR)$(BINDIR)
60
Martin Roth92f447a2021-02-14 14:57:06 -070061distclean: clean
62
63help:
64 @echo "cbfstool & associated tools"
65 @echo "Targets: all, clean, distclean, help"
66 @echo " cbfstool - Manipulate CBFS images"
67 @echo " fmaptool - Compile Flashmap descriptor (fmd) files"
68 @echo " rmodtool - Create relocatable modules"
69 @echo " ifwitool - Manipulate Intel FW Image (IFWI)"
70 @echo " ifittool - Manipulate Intel FW Interface Table (FIT)"
71 @echo " cbfs-compression-tool - benchmark compression algorithms"
72
Vadim Bendebury98485de2018-11-01 20:48:21 -070073ifneq ($(V),1)
Stefan Reinauer30ff3622015-11-21 17:53:32 +010074.SILENT:
Vadim Bendebury98485de2018-11-01 20:48:21 -070075endif
Stefan Reinauer30ff3622015-11-21 17:53:32 +010076
Patrick Georgiae570d52015-09-16 16:34:15 +020077include Makefile.inc
Patrick Georgi67d958b2021-05-29 16:12:29 +020078
79$(objutil)/cbfstool/cbfstool.o: $(VBOOT_SOURCE)/firmware/include/vb2_sha.h
80
81$(VBOOT_SOURCE)/firmware/include/vb2_sha.h:
82 cd $(VBOOT_SOURCE) && git submodule update --init .