-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
75 lines (66 loc) · 2.03 KB
/
Copy pathMakefile
File metadata and controls
75 lines (66 loc) · 2.03 KB
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
# Image Tools Makefile
TARGET = nbimgt
SRC_DIR = ../src
SRCS = nbimgt.c \
res.c \
crypto_ops.c \
key_file.c \
partition.c \
container.c \
$(SRC_DIR)/image_parser.c \
$(SRC_DIR)/lz4.c \
$(SRC_DIR)/units/self.c \
$(SRC_DIR)/crypto/sha512.c \
$(SRC_DIR)/crypto/ed25519.c
CC = gcc
CFLAGS = -Wall -Wextra -O2 -g \
-D_GNU_SOURCE \
-I$(SRC_DIR)/include \
-DHOST_TEST -DDEBUG
LDFLAGS = -lssl -lcrypto -llz4
all: $(TARGET)
$(TARGET): $(SRCS)
@echo "Building $(TARGET)..."
$(CC) $(CFLAGS) $(SRCS) -o $@ $(LDFLAGS)
@echo "Done! Run with:"
@echo " ./$(TARGET) build [--sign KEY.pem] FSBL DTB [OUTPUT]"
@echo " ./$(TARGET) verify [--dump] [--test-parser] IMAGE"
@echo " ./$(TARGET) keygen KEY.pem"
clean:
rm -f $(TARGET) test_key.pem test_key.pem.pub boot_signed.img \
../tftp-root/boot.img
test: $(TARGET)
@echo "Building unsigned image..."
./$(TARGET) build ../tftp-root/boot.bin ../tftp-root/boot.dtb \
../tftp-root/boot.img
@echo ""
@echo "Running parser test (unsigned)..."
./$(TARGET) verify --test-parser ../tftp-root/boot.img
@echo ""
@echo "Verifying output files..."
@echo "=== FSBL Checksums ==="
@md5sum ../tftp-root/boot.bin /tmp/part0.bin || true
@echo ""
@echo "=== DTB Checksums ==="
@md5sum ../tftp-root/boot.dtb /tmp/part1.bin || true
test-signed: $(TARGET)
@echo "Generating test Ed25519 key..."
./$(TARGET) keygen test_key.pem
@echo ""
@echo "Building signed image..."
./$(TARGET) build --sign test_key.pem \
../tftp-root/boot.bin ../tftp-root/boot.dtb boot_signed.img
@echo ""
@echo "Inspecting signed image..."
./$(TARGET) verify boot_signed.img
@echo ""
@echo "Running parser test on signed image..."
./$(TARGET) verify --test-parser boot_signed.img
@echo ""
@echo "Verifying output files..."
@echo "=== FSBL Checksums ==="
@md5sum ../tftp-root/boot.bin /tmp/part0.bin || true
@echo ""
@echo "=== DTB Checksums ==="
@md5sum ../tftp-root/boot.dtb /tmp/part1.bin || true
.PHONY: all clean test test-signed