[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#339092: initramfs-tools: check if filesystem is already present in kernel



Package: initramfs-tools
Severity: minor
Tags: patch

This patch adds a separate function to load a filesystem driver which first checks if it is already compiled into the kernel which should remove some superflous modprobe error messages if it is.

Re,
David
Index: initramfs-tools-0.38/scripts/functions
===================================================================
--- initramfs-tools-0.38.orig/scripts/functions	2005-11-14 22:42:06.000000000 +0100
+++ initramfs-tools-0.38/scripts/functions	2005-11-14 22:44:11.000000000 +0100
@@ -270,3 +270,13 @@
 	mknod /dev/root b ${major} ${minor}
 	ROOT=/dev/root
 }
+
+load_fs()
+{
+	if [ -e /proc/filesystems ]; then
+		grep -q "$1" /proc/filesystems && return 0
+	fi
+
+	modprobe "$1" || return 1
+	return 0
+}
Index: initramfs-tools-0.38/scripts/local
===================================================================
--- initramfs-tools-0.38.orig/scripts/local	2005-10-21 18:37:46.000000000 +0200
+++ initramfs-tools-0.38/scripts/local	2005-11-14 22:44:04.000000000 +0100
@@ -24,8 +24,7 @@
 		roflag=-w
 	fi
 
-	# FIXME This has no error checking
-	modprobe ${FSTYPE}
+	load_fs "${FSTYPE}" || panic "Failed to load root fs type ${FSTYPE}"
 
 	# FIXME This has no error checking
 	# Mount root

Reply to: