-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
68 lines (55 loc) · 2.1 KB
/
Makefile
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
DOCKER_BASE ?= docker://
UBUNTU_MIRROR ?= http://archive.ubuntu.com/ubuntu
APP_VERSION = $(shell git describe --tags --always \
"--match=v[0-9]*.[0-9]*.[0-9]*" || echo no-git)
ifeq ($(APP_VERSION),$(filter $(APP_VERSION), "", no-git))
$(error "Bad value for APP_VERSION: '$(APP_VERSION)'")
endif
TOP_D := $(patsubst %/,%,$(dir $(abspath $(lastword $(MAKEFILE_LIST)))))
BUILD_D = $(TOP_D)/build
DL_D = $(TOP_D)/dl
DL_TOOLS = $(DL_D)/tools
STACKER = $(DL_TOOLS)/stacker
STACKER_URL ?= https://github.com/project-stacker/stacker/releases/download
STACKER_RELEASE ?= v1.0.0-rc4
MYPATH = $(DL_TOOLS)
EDK2_TARBALL = $(DL_D)/edk2.tar.gz
SHOWPCR_EFI = $(TOP_D)/showpcr.efi
SHELL_EFI = $(TOP_D)/shell.efi
export PATH := $(MYPATH):$(PATH)
all: showpcr.efi shell.efi
showpcr.efi: $(SHOWPCR_EFI)
shell.efi: $(SHELL_EFI)
edk2.tar.gz: $(EDK2_TARBALL)
$(EDK2_TARBALL): layers/edk2-tarball.yaml
$(STACKER) --debug --storage-type=overlay \
"--oci-dir=$(BUILD_D)/oci" "--roots-dir=$(BUILD_D)/roots" "--stacker-dir=$(BUILD_D)/stacker" \
build --shell-fail \
"--substitute=TOP_D=$(TOP_D)" \
"--substitute=DOCKER_BASE=$(DOCKER_BASE)" \
"--substitute=UBUNTU_MIRROR=$(UBUNTU_MIRROR)" \
"--layer-type=tar" \
"--stacker-file=$<"
$(SHOWPCR_EFI): $(STACKER) showpcr.c showpcr.inf layers/stacker.yaml $(EDK2_TARBALL)
$(STACKER) --debug --storage-type=overlay \
"--oci-dir=$(BUILD_D)/oci" "--roots-dir=$(BUILD_D)/roots" "--stacker-dir=$(BUILD_D)/stacker" \
build --shell-fail \
"--substitute=TOP_D=$(TOP_D)" \
"--substitute=DOCKER_BASE=$(DOCKER_BASE)" \
"--substitute=UBUNTU_MIRROR=$(UBUNTU_MIRROR)" \
"--substitute=EDK2_TARBALL=$(EDK2_TARBALL)" \
"--substitute=APP_VERSION=$(APP_VERSION)" \
"--layer-type=tar" \
"--stacker-file=layers/stacker.yaml"
$(SHELL_EFI): $(SHOWPCR_EFI)
$(STACKER):
@mkdir -p $(DL_TOOLS)
wget --progress=dot:mega -O $@ \
$(STACKER_URL)/$(STACKER_RELEASE)/stacker && chmod +x $@ && $(STACKER) --version
clean:
rm -f showpcr.efi $(TOP_D)/*.pcr7.txt $(TOP_D)/*.pcr7.bin
dist-clean: clean
rm -Rf dl/
rm -f $(TOP_D)/.env
lxc-usernsexec -s -- rm -Rf $(TOP_D)/build
.PHONY: dist-clean clean all edk2.tar.gz