From 6c42d378abe528ee6f10c8272080eec5f3f44acb Mon Sep 17 00:00:00 2001 From: Kairui Song Date: Tue, 6 Dec 2022 17:20:26 +0800 Subject: [PATCH] fix(dracut-functions.sh): check_kernel_module should follow dracutsysrootdir check_kernel_module calls modprobe and tries to dry-run a module load to check if a module is available. modprobe supports `-d` to specify a rootdir, so just pass dracutsysrootdir to it to make it work as expected when building initramfs for another rootfs. Signed-off-by: Kairui Song --- dracut-functions.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dracut-functions.sh b/dracut-functions.sh index adef37f73..6ab31aa87 100755 --- a/dracut-functions.sh +++ b/dracut-functions.sh @@ -731,7 +731,7 @@ check_kernel_config() { # 0 if the kernel module is either built-in or available # 1 if the kernel module is not enabled check_kernel_module() { - modprobe -S "$kernel" --dry-run "$1" &> /dev/null || return 1 + modprobe -d "$dracutsysrootdir" -S "$kernel" --dry-run "$1" &> /dev/null || return 1 } # get_cpu_vendor -- 2.47.3