diff options
Diffstat (limited to 'Makefile')
-rw-r--r-- | Makefile | 18 |
1 files changed, 11 insertions, 7 deletions
@@ -1,9 +1,11 @@ +MAKEFLAGS += -r CFLAGS += -Wall -Wextra +KERNVER ?= $(shell uname -r) all: initramfs.img -initramfs.img: gen_init_cpio load-random-seed dropbear_ed25519_host_key modules.sh - ./make +initramfs.img: gen_init_cpio load-random-seed dropbear_ed25519_host_key modules.dep + KERNVER=$(KERNVER) COMPRESSOR="zstd -19 -c -T0" ./make %: %.c $(CC) $(CFLAGS) $(CPPFLAGS) $(LDFLAGS) $< -o $@ @@ -11,9 +13,11 @@ initramfs.img: gen_init_cpio load-random-seed dropbear_ed25519_host_key modules. dropbear_ed25519_host_key: dropbearkey -t ed25519 -f $@ -modules.sh: modules - printf '%s\n' '#!/bin/sh' 'set -e' > $@ - xargs -a $< -L1 -r modprobe --show-depends >> $@ +modules.dep.ver: FORCE + if ! [ -f $@ ] || [ "$$(cat $@)" != "$(KERNVER)" ]; then echo $(KERNVER) > $@; fi + +modules.dep: modules /lib/modules/$(KERNVER)/modules.dep modules.dep.ver + 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 rm -f /boot/initramfs.img.old /boot/initramfs.img.new @@ -22,9 +26,9 @@ install: initramfs.img mv /boot/initramfs.img.new /boot/initramfs.img clean: - rm -f initramfs.img initramfs.d gen_init_cpio load-random-seed + rm -f initramfs.img initramfs.d gen_init_cpio load-random-seed modules.dep -include initramfs.d .PHONY: all install clean -MAKEFLAGS += -r # slightly faster +FORCE: |