]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
- scsi modularized
authorElan Ruusamäe <glen@pld-linux.org>
Thu, 2 Apr 2009 23:18:34 +0000 (23:18 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Thu, 2 Apr 2009 23:18:34 +0000 (23:18 +0000)
svn-id: @10295

Makefile
geninitrd
mod-scsi.sh [new file with mode: 0644]

index 11809b1f370f8eef18c13b50c632f4ac75756c08..d90e2dbd186b66e3458e6f641ce23001060daeb8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -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
index 77022dfdb07e5160664f1eac2159fb6b0d9f43c3..a788f4d3450a07451bbc819052cee494a99ed800 100755 (executable)
--- a/geninitrd
+++ b/geninitrd
@@ -18,8 +18,6 @@ PROGRAM=${0##*/}
 # 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 @@ cache_modprobe_conf() {
        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 @@ find_modules_for_devpath() {
                # 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 @@ if [ -r /etc/sysconfig/geninitrd ]; then
        . /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 @@ if [ "$FBMODULE" ]; then
 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
diff --git a/mod-scsi.sh b/mod-scsi.sh
new file mode 100644 (file)
index 0000000..39c515f
--- /dev/null
@@ -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
+}
This page took 0.124792 seconds and 4 git commands to generate.