-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
70 lines (50 loc) · 1.67 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
69
70
#!/usr/bin/make
CROSS_COMPILE ?= arm-none-linux-gnueabi-
CC := $(CROSS_COMPILE)gcc
MAKE ?= make
CFLAGS := -O2 -Wall -Wno-unused-variable -static -march=armv7-a -mthumb -I.
LDFLAGS :=
STRIP := $(CROSS_COMPILE)strip
SHARED_OBJS := nvaes.o nvrcm.o
#NVBLOB2GO_OBJS = gpiokeys.o scrollback.o
DEVICE_DIRS = $(shell find devices/ -mindepth 1 -maxdepth 1 -type d)
DEVICE_TARGETS = $(patsubst devices/%,%, $(DEVICE_DIRS))
DEVICE_RAMDISKS = $(patsubst %, %.cpio.gz, $(DEVICE_TARGETS))
DEVICE_BOOTIMGS = $(patsubst %, %.img, $(DEVICE_TARGETS))
all: nvsign nvencrypt nvdecrypt $(DEVICE_TARGETS)
$(DEVICE_TARGETS): nvblob2go.c $(SHARED_OBJS) bins
$(CC) $(CFLAGS) -Idevices/$@ -o $@ nvblob2go.c $(SHARED_OBJS) $(LDFLAGS) && \
$(STRIP) $@
%.cpio.gz: %
@echo "Creating ramdisk $@"
@rm -rf $<_ramdisk
@rm -f $@
@mkdir $<_ramdisk
@cp $< $<_ramdisk/init
@cp vfat.img $<_ramdisk/
@cd $<_ramdisk && find|cpio -o -H newc|gzip -c > ../$@
@rm -rf $<_ramdisk
@echo Done
%.img: % %.cpio.gz
@echo "Creating $@"
mkbootimg --kernel devices/$</kernel.gz --ramdisk $<.cpio.gz -o $@
mknvfblob: mknvfblob.c $(SHARED_OBJS)
$(CC) $(CFLAGS) -o $@ [email protected] $(SHARED_OBJS) && \
$(STRIP) $@
nvsign: nvsign.c $(SHARED_OBJS)
$(CC) $(CFLAGS) -o $@ [email protected] $(SHARED_OBJS)
nvencrypt: nvencrypt.c $(SHARED_OBJS)
$(CC) $(CFLAGS) -o $@ [email protected] $(SHARED_OBJS)
nvdecrypt: nvdecrypt.c $(SHARED_OBJS)
$(CC) $(CFLAGS) -o $@ [email protected] $(SHARED_OBJS)
%.o: %.c
$(CC) $(CFLAGS) -c -o $@ $<
bins:
$(MAKE) -C devices
ramdisks: $(DEVICE_RAMDISKS)
bootimgs: $(DEVICE_BOOTIMGS)
clean:
@rm -f mknvfblob nvencrypt nvdecrypt nvsign $(SHARED_OBJS) \
$(DEVICE_TARGETS) $(DEVICE_RAMDISKS)
@make -C devices clean
.PHONY: all clean bins ramdisks