SVN: geninitrd/trunk: Makefile geninitrd mod-scsi.sh

glen glen at pld-linux.org
Fri Apr 3 01:18:35 CEST 2009


Author: glen
Date: Fri Apr  3 01:18:34 2009
New Revision: 10295

Added:
   geninitrd/trunk/mod-scsi.sh
Modified:
   geninitrd/trunk/Makefile
   geninitrd/trunk/geninitrd
Log:
- scsi modularized

Modified: geninitrd/trunk/Makefile
==============================================================================
--- geninitrd/trunk/Makefile	(original)
+++ geninitrd/trunk/Makefile	Fri Apr  3 01:18:34 2009
@@ -1,6 +1,6 @@
 # when making release, make sure you do it as RELEASE document describes
 VERSION		:= 10000.3
-MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs
+MODS		:= ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs scsi
 FILES_MODS  := $(MODS:%=mod-%.sh)
 FILES		:= Makefile geninitrd.sysconfig geninitrd functions $(FILES_MODS) geninitrd.8 geninitrd.8.xml ChangeLog
 prefix		:= /usr

Modified: geninitrd/trunk/geninitrd
==============================================================================
--- geninitrd/trunk/geninitrd	(original)
+++ geninitrd/trunk/geninitrd	Fri Apr  3 01:18:34 2009
@@ -18,8 +18,6 @@
 # list of geninitrd modules which need setup routine after commandline args parsing
 GENINITRD_MODS=""
 COMPRESS=yes
-# it should be safe to remove scsi_mod from here, but I'm not sure...
-PRESCSIMODS="-scsi_mod unknown -sd_mod"
 target=""
 kernel=""
 force=""
@@ -434,24 +432,6 @@
 	fi
 }
 
-find_modules_scsi() {
-	local n
-	for n in $PRESCSIMODS; do
-		if [ "X$n" = "Xunknown" ]; then
-			debug "Finding SCSI modules using scsi_hostadapter"
-			local mod scsimodules=$(modprobe_conf | awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }')
-			for mod in $scsimodules; do
-				# for now allow scsi modules to come from anywhere. There are some
-				# RAID controllers with drivers in block
-				find_module "$mod"
-			done
-		else
-			find_module "$n"
-		fi
-	done
-	find_module "-scsi_wait_scan"
-}
-
 # find modules for $devpath
 find_modules_for_devpath() {
 	local devpath="$1"
@@ -501,8 +481,8 @@
 		# fallback
 	fi
 
-	if is_yes "$(echo "$devpath" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')"; then
-		find_modules_scsi
+	if is_scsi "$devpath"; then
+		find_modules_scsi "$devpath"
 		return
 	fi
 
@@ -790,7 +770,7 @@
 	. /etc/sysconfig/geninitrd
 fi
 
-geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs
+geninitrd_load_mods ide luks multipath dmraid lvm md blkid udev tuxonice suspend fbsplash condecor bootsplash uvesafb nfs scsi
 
 while [ $# -gt 0 ]; do
 	case $1 in
@@ -1035,10 +1015,12 @@
 fi
 
 # allow forcing loading SCSI and/or IDE modules
+# XXX: where ADDSCSI cames from? drop?
 if is_yes "$ADDSCSI"; then
 	find_modules_scsi
 fi
 
+# XXX: where ADDIDE cames from? drop?
 if is_yes "$ADDIDE"; then
 	find_modules_ide
 fi

Added: geninitrd/trunk/mod-scsi.sh
==============================================================================
--- (empty file)
+++ geninitrd/trunk/mod-scsi.sh	Fri Apr  3 01:18:34 2009
@@ -0,0 +1,61 @@
+#!/bin/sh
+#
+# geninitrd mod: scsi
+
+# it should be safe to remove scsi_mod from here, but I'm not sure...
+PRESCSIMODS="-scsi_mod unknown -sd_mod"
+
+# ???
+ide_only_root=${ide_only_root:-no}
+
+# allow forcing loading IDE modules, likely from sysconfig/geninitrd
+ADDIDE=${ADDIDE:-no}
+
+# return true if node is scsi device
+# @param	string $node device node to be examined
+# @access	public
+is_scsi() {
+	local node="$1"
+	if [ ! -e "$node" ]; then
+		warn "is_scsi(): node $node doesn't exist!"
+		return 1
+	fi
+
+	# TODO: more sophisticated check, not just pathname check
+	if is_yes "$(echo "$node" | awk '/^\/dev\/(sd|scsi)/ { print "yes"; }')"; then
+		return 0
+	fi
+
+	return 1
+}
+
+# find modules for $devpath
+# @param	$devpath	device to be examined
+# @access	public
+find_modules_scsi() {
+	local devpath=$1
+
+	local n
+	for n in $PRESCSIMODS; do
+		if [ "X$n" = "Xunknown" ]; then
+			debug "Finding SCSI modules using scsi_hostadapter"
+			local mod scsimodules=$(modprobe_conf | awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }')
+			for mod in $scsimodules; do
+				# for now allow scsi modules to come from anywhere. There are some
+				# RAID controllers with drivers in block
+				find_module "$mod"
+			done
+		else
+			find_module "$n"
+		fi
+	done
+	find_module "-scsi_wait_scan"
+}
+
+
+# generate initrd fragment for ide device init
+# @access	public
+initrd_gen_scsi() {
+	# nothing to do here
+	return 0
+}


More information about the pld-cvs-commit mailing list