MAKEFLAGS += -r CFLAGS += -Wall -Wextra null := space := $(null) $(null) KERNVER ?= $(lastword $(subst /,$(space),$(wildcard /lib/modules/*/))) all: initramfs.img 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 $@ 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 rm -f /boot/initramfs.img.old /boot/initramfs.img.new cp initramfs.img /boot/initramfs.img.new || rm -f /boot/initramfs.img.new if [ -e /boot/initramfs.img ]; then mv /boot/initramfs.img /boot/initramfs.img.old; fi mv /boot/initramfs.img.new /boot/initramfs.img clean: rm -f initramfs.img initramfs.d gen_init_cpio load-random-seed modules.dep -include initramfs.d .PHONY: all install clean FORCE: