blob: 96b369531124c3f78fdaec8e6c7002d288881aad (
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
|
# detect kernel version for modules
null :=
space := $(null) $(null)
KERNVER ?= $(lastword $(subst /,$(space),$(wildcard /lib/modules/*/)))
# slightly faster
MAKEFLAGS += -r
all: initramfs.img
initramfs.img: gen_init_cpio make modules.dep $(shell awk '$$1 == "file" { print $$3 }' cpio_list.txt)
KERNVER=$(KERNVER) COMPRESSOR="zstd -19 -c -T0" ./make
gen_init_cpio: gen_init_cpio.c
$(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@
dropbear_ed25519_host_key:
dropbearkey -t ed25519 -f $@
modules.dep.ver: FORCE
if ! [ -f $@ ] || [ "$$(cat $@)" != "$(KERNVER)" ]; then echo $(KERNVER) > $@; fi
modules.dep: modules modules.dep.ver /lib/modules/$(KERNVER)/modules.dep
awk '!/^#/ { print $$1 }' modules | xargs modinfo -F filename -k $(KERNVER) | sed -e 's:^/lib/modules/$(KERNVER)/:^:' | grep -f - /lib/modules/$(KERNVER)/modules.dep > $@
install: initramfs.img
install -bS.old -m644 initramfs.img /boot/initramfs.img
clean:
rm -f initramfs.img initramfs.d gen_init_cpio modules.dep
-include initramfs.d
.PHONY: all install clean
FORCE:
|