diff options
author | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-11-11 07:55:00 -0500 |
---|---|---|
committer | Alex Xu (Hello71) <alex_y_xu@yahoo.ca> | 2020-11-11 08:09:28 -0500 |
commit | 3182b56e35e1a07c920ebded54fc55686ced99bf (patch) | |
tree | 33ed00cb3df1c00680dd1821034b47a5583823ef /Makefile | |
parent | 9ac1d14079b3bd400a78d650d43fb8bad1d1e7a3 (diff) | |
download | minitramfs-3182b56e35e1a07c920ebded54fc55686ced99bf.tar.xz minitramfs-3182b56e35e1a07c920ebded54fc55686ced99bf.zip |
revamp module support, other refactoring
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: |