#
# based on mkinitrd from RedHat
-RCSID='$Id: geninitrd,v 2.30 2003/08/07 20:08:23 arekm Exp $'
+RCSID='$Id: geninitrd,v 2.36 2003/08/09 23:42:04 baggins Exp $'
PATH=/sbin:$PATH
export PATH
uselvm="no"
# it should be safe to remove scsi_mod from here, but I'm not sure...
PRESCSIMODS="-scsi_mod unknown -sd_mod"
-PREIDEMODS="-ide-probe -ide-probe-mod -ide-disk"
+PREIDEMODS="-ide-core unknown -ide-detect -ide-disk"
+PREIDEMODSOLD="-ide-probe -ide-probe-mod -ide-disk"
target=""
kernel=""
force=""
find_modules_scsi() {
for n in $PRESCSIMODS; do
if [ "X$n" = "Xunknown" ] ; then
+ if [ "$pack_version" -ge "002005" ]; then
+ modulefile=/etc/modprobe.conf
+ fi
if [ ! -f "$modulefile" ]; then
modulefile=/etc/conf.modules
fi
if [ -f "$modulefile" ]; then
- scsimodules="`awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile| LC_ALL=C sort -u`"
+ scsimodules="`awk '/scsi_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
for n in $scsimodules; do
# for now allow scsi modules to come from anywhere. There are some
# RAID controllers with drivers in block
}
find_modules_ide() {
- for n in $PREIDEMODS; do
+ if [ "$pack_version_long" -lt "002004021" ]; then
+ [ -n "$verbose" ] && echo "Finding IDE modules for kernels <= 2.4.20"
+ for n in $PREIDEMODSOLD; do
findmodule "$n"
- done
+ done
+ else
+ tryauto=1
+ for n in $PREIDEMODS; do
+ if [ "X$n" = "Xunknown" ] ; then
+ if [ "$pack_version" -ge "002005" ]; then
+ modulefile=/etc/modprobe.conf
+ fi
+ if [ ! -f "$modulefile" ]; then
+ modulefile=/etc/conf.modules
+ fi
+ if [ -f "$modulefile" ]; then
+ [ -n "$verbose" ] && echo "Finding IDE modules using ide_hostadapter"
+ idemodules="`awk '/ide_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
+ for n in $idemodules; do
+ tryauto=0;
+ findmodule "$n"
+ done
+ fi
+
+ if [ "$tryauto" -eq 1 ]; then
+ [ -n "$verbose" ] && echo "Finding IDE modules using PCI ID database"
+ idemodules=""
+ for n in $(awk ' { print $2 } ' /proc/bus/pci/devices); do
+ eval `awk -v pciid="$n" 'BEGIN {
+}
+
+{
+ gsub("\t"," ");
+ gsub(" +", " ");
+ gsub("^ ","");
+ if (/^[\t ]*#/)
+ next;
+ compmod = $1 ""; # make sure comparison type will be string
+ # cause pci IDs are hexadecimal numeric
+ if (compmod == pciid) {
+ module=$2;
+ min_kernel=$3;
+ max_kernel=$3;
+ exit 0;
+ }
+}
+
+END {
+ print "module=" module "\nmin_kernel=" min_kernel "\nmax_kernel=\"" max_kernel "\"\n";
+}' /usr/share/pci-database/ide.pci`
+ if [ -n "$module" ]; then
+ echo "$module"
+ gomin=1
+ gomax=1
+ [ -n "$min_kernel" -a "$pack_version_long" -lt "$min_kernel" ] && gomin=0
+ [ -n "$max_kernel" -a "$pack_version_long" -gt "$max_kernel" ] && gomax=0
+ [ "$gomax" -ne 0 -a "$gomin" -ne 0 ] && idemodules="$idemodules $module"
+ fi
+ done
+ idemodules=$(for n in $idemodules; do echo "$n"; done | xargs)
+ for n in $idemodules; do
+ findmodule "$n"
+ done
+ fi
+ fi
+ findmodule "$n"
+ done
+ fi
}
find_modules_for() {
findmodule "cciss"
elif is_yes "`echo "$1" | awk '/\/dev\/ataraid\// { print "yes"; }'`"; then
findmodule "ataraid"
- ataraidmodules="`awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile| LC_ALL=C sort -u`"
+ ataraidmodules="`awk '/ataraid_hostadapter/ && ! /^[\t ]*#/ { print $3; }' $modulefile`"
if -n "$ataraidmodules" ; then
# FIXME: think about modules compiled in kernel
echo "ERROR: ataraid_hostadapter alias not defined in $modulefile !"
fi
pack_version="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d",$1,$2)}'`"
+pack_version_long="`echo "$kernel"|awk -F. '{print sprintf("%03d%03d%03d",$1,$2,$3)}'`"
if [ "$pack_version" -ge "002005" ] ; then
modext=".ko"