summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2006-05-03 04:02:53 +0200
committerAaron Griffin <aaron@archlinux.org>2006-05-03 04:02:53 +0200
commitad1050964eabbbc00547e8c6c91d8a7c3f13598f (patch)
tree79962456d502bbbb8a072568f31bd18e99b85099
parent66f28ea341f293cbddd30242f9ea03673d4674d2 (diff)
downloadmkinitcpio-ad1050964eabbbc00547e8c6c91d8a7c3f13598f.tar.gz
mkinitcpio-ad1050964eabbbc00547e8c6c91d8a7c3f13598f.tar.xz
Merged autodetect changes from tpowa.
Removed older subsystem specific scripts, replaced then with 'modload' just to keep the option in place. git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@43 880c04e9-e011-0410-abf7-b926e227c9cd
-rw-r--r--hooks/ide11
-rw-r--r--hooks/modload (renamed from hooks/sata)18
-rw-r--r--hooks/pci9
-rw-r--r--hooks/scsi34
-rw-r--r--hooks/usb1
-rw-r--r--init7
-rw-r--r--install/autodetect36
-rw-r--r--install/filesystems-auto17
-rw-r--r--install/ide2
-rw-r--r--install/modload18
-rw-r--r--install/pci17
-rw-r--r--install/sata2
-rw-r--r--install/scsi2
-rw-r--r--install/udev3
-rw-r--r--mkinitcpio11
-rw-r--r--mkinitcpio.conf16
16 files changed, 86 insertions, 118 deletions
diff --git a/hooks/ide b/hooks/ide
deleted file mode 100644
index a6ca17c..0000000
--- a/hooks/ide
+++ /dev/null
@@ -1,11 +0,0 @@
-# vim: set ft=sh:
-run_hook ()
-{
- if [ -e /proc/ide ]; then
- msg -n "Loading ide modules..."
- /bin/modprobe -q -a $(/bin/cat /sys/bus/ide/devices/*/modalias) >/dev/null 2>&1
- msg "done"
- else
- msg "No ide devices detected..."
- fi
-}
diff --git a/hooks/sata b/hooks/modload
index fb6ed90..6cf4037 100644
--- a/hooks/sata
+++ b/hooks/modload
@@ -1,7 +1,20 @@
-# vim: set ft=sh:
+# vim:set ft=sh:
run_hook ()
{
- if [ -e /sys/bus/scsi/devices/ ]; then
+ msg ":: Begin manual module load"
+ if [ -e "/sys/bus/pci/" ]; then
+ msg -n "Loading pci bus modules..."
+ /bin/modprobe -a -q $(/bin/cat /sys/bus/pci/devices/*/modalias) >/dev/null 2>&1
+ msg "done."
+ fi
+
+ if [ -e "/sys/bus/ide/devices/" ]; then
+ msg -n "Loading ide modules..."
+ /bin/modprobe -q -a $(/bin/cat /sys/bus/ide/devices/*/modalias) >/dev/null 2>&1
+ msg "done"
+ fi
+
+ if [ -e "/sys/bus/scsi/devices/" ]; then
msg -n "Loading scsi modules..."
for d in /sys/bus/scsi/devices/*; do
if [ -e "${d}/type" ]; then
@@ -31,4 +44,5 @@ run_hook ()
done
msg "done."
fi
+ msg ":: End manual module load"
}
diff --git a/hooks/pci b/hooks/pci
deleted file mode 100644
index d158d25..0000000
--- a/hooks/pci
+++ /dev/null
@@ -1,9 +0,0 @@
-# vim:set ft=sh:
-run_hook ()
-{
- if [ -e "/sys/bus/pci" ]; then
- msg -n "Loading pci bus modules..."
- /bin/modprobe -a -q $(/bin/cat /sys/bus/pci/devices/*/modalias) >/dev/null 2>&1
- msg "done."
- fi
-}
diff --git a/hooks/scsi b/hooks/scsi
deleted file mode 100644
index fb6ed90..0000000
--- a/hooks/scsi
+++ /dev/null
@@ -1,34 +0,0 @@
-# vim: set ft=sh:
-run_hook ()
-{
- if [ -e /sys/bus/scsi/devices/ ]; then
- msg -n "Loading scsi modules..."
- for d in /sys/bus/scsi/devices/*; do
- if [ -e "${d}/type" ]; then
- read m < "${d}/type"
- case "$m" in
- 0) /bin/modprobe -q sd_mod 2>&1 >/dev/null ;;
- # this below is take from the Arch udev rules
- 1) read vendor < "${d}/vendor"
- if [ "${vendor}" = "Onstream" ]; then
- read model < "${d}/model"
- case "$model" in
- ADR*) /bin/modprobe -q st >/dev/null 2>&1;;
- *) /bin/modprobe -q osst >/dev/null 2>&1;;
- esac
- else
- /bin/modprobe -q st >/dev/null 2>&1
- fi
- ;;
- 2|3) /bin/modprobe -q sg >/dev/null 2>&1;;
- 4|5) /bin/modprobe -q sr_mod >/dev/null 2>&1;;
- 6) /bin/modprobe -q sg >/dev/null 2>&1;;
- 7) /bin/modprobe -q sd_mod >/dev/null 2>&1;;
- 8|9) /bin/modprobe -q sg >/dev/null 2>&1;;
- 14) /bin/modprobe -q sd_mod >/dev/null 2>&1;;
- esac
- fi
- done
- msg "done."
- fi
-}
diff --git a/hooks/usb b/hooks/usb
index 89af004..ece3950 100644
--- a/hooks/usb
+++ b/hooks/usb
@@ -4,6 +4,7 @@ run_hook ()
msg -n "Loading usb modules..."
/bin/modprobe -aq $(/bin/cat /sys/bus/usb/devices/*/modalias) >/dev/null 2>&1
#allow 'usbdelay' on the kernel param line
+ msg -n "waiting for usb to settle..."
/bin/sleep ${usbdelay:-5}
msg "done."
}
diff --git a/init b/init
index 5aee024..e1c6ac4 100644
--- a/init
+++ b/init
@@ -63,6 +63,13 @@ if [ "${break}" = "y" ]; then
PS1="ramfs$ " /bin/sh -i
fi
+#Special handling is udev is running
+udevpid=$(/bin/minips -C udevd -o pid=)
+if [ "x${udevpid}" != "x" ]; then
+ /bin/kill -9 $udevpid
+ /bin/sleep 0.01
+fi
+
# Optimize fs type loop for mounting rootfs
msg ":: Initramfs Completed - control passing to kinit"
diff --git a/install/autodetect b/install/autodetect
index 9e23783..c851a4b 100644
--- a/install/autodetect
+++ b/install/autodetect
@@ -5,21 +5,33 @@ install ()
msg ":: Autodetecting modules"
#blegh, we'll let /tmp clean itself up
modtmp=$( mktemp /tmp/initcpio_modules.XXXXXX )
- MODULES=" $(auto_modules "/scsi/" | grep -v "ata")
- $(auto_modules "/block/")
- $(auto_modules "/fusion/")
- $(auto_modules "/usb/") usb_storage usbhid
- $(auto_modules "scsi/.*ata")
- $(auto_modules "/ide/")
- $(cat /proc/filesystems | grep -v nodev) "
- for m in $MODULES; do
+ modall=$( mktemp /tmp/initcpio_modulesall.XXXXXX )
+ AUTODETECT=" $(auto_modules "/scsi/" | grep -v "imm"| grep -v "pcmcia" | grep -v "ide" && echo "sd_mod sr_mod")
+ $(auto_modules "/block/" && echo "sd_mod sr_mod")
+ $(auto_modules "/fusion/" && echo "sd_mod sr_mod")
+ $(auto_modules "/usb/" && echo "usb_storage usbhid sd_mod sr_mod")
+ $(auto_modules "/ide/")
+ $(auto_modules "/ieee1394/" && echo "sbp2 sd_mod sr_mod")
+ $(auto_modules "/cdrom/")
+ $(cat /proc/filesystems | grep -v nodev) "
+
+ for m in $AUTODETECT; do
echo $(basename ${m//\.ko/}) >> $modtmp
- [ "$m" == "ata_piix" ] && echo "piix" >> $modtmp
+ [ "$m" == "ext3" ] && echo "jbd" >> $modtmp
done
- add_file $modtmp "/modules"
-
+ grep "file /lib/modules" ${FILELIST} >>$modall
+ for i in `cat $modtmp`; do
+ sed -i -e "\=/$i=d" $modall
+ done
+ for i in `grep "file /lib/modules" $modall | awk '{print $2}'`; do
+ sed -i -e "\=$i=d" ${FILELIST}
+ done
+ msg "Included MODULES:"
+ msg "-----------------"
+ msg "$(grep "file /lib/modules/" ${FILELIST} | awk '{print $2}')"
+ msg "-----------------"
BINARIES=""
FILES=""
- SCRIPT="autodetect"
+ SCRIPT=""
}
diff --git a/install/filesystems-auto b/install/filesystems-auto
deleted file mode 100644
index bf7976c..0000000
--- a/install/filesystems-auto
+++ /dev/null
@@ -1,17 +0,0 @@
-# vim: set ft=sh:
-
-install ()
-{
- MODULES=" $(cat /proc/filesystems | grep -v nodev) "
- BINARIES=""
- FILES=""
- SCRIPT="filesystems"
-}
-
-help ()
-{
-cat<<HELPEOF
- This hook is responsible for loading filesystems for the root device.
- Detection will be done at runtime.
-HELPEOF
-}
diff --git a/install/ide b/install/ide
index bbd1ef5..b8aafc3 100644
--- a/install/ide
+++ b/install/ide
@@ -5,7 +5,7 @@ install ()
MODULES=" $(all_modules "/ide/" | grep -v "legacy") ";
BINARIES=""
FILES=""
- SCRIPT="ide"
+ SCRIPT=""
}
help ()
diff --git a/install/modload b/install/modload
new file mode 100644
index 0000000..fd46a22
--- /dev/null
+++ b/install/modload
@@ -0,0 +1,18 @@
+# vim: set ft=sh:
+
+install ()
+{
+ MODULES=""
+ BINARIES=""
+ FILES=""
+ SCRIPT="modload"
+}
+
+help ()
+{
+cat<<HELPEOF
+ This hook manually detects and loads modules. It is much
+ slower than udev and the udev hook should be preferred.
+ This remains meerly as another option for a user.
+HELPEOF
+}
diff --git a/install/pci b/install/pci
deleted file mode 100644
index 4329720..0000000
--- a/install/pci
+++ /dev/null
@@ -1,17 +0,0 @@
-# vim: set ft=sh:
-
-install ()
-{
- MODULES=""
- BINARIES=""
- FILES=""
- SCRIPT="pci"
-}
-
-help ()
-{
-cat<<HELPEOF
- This hook loads the necessary modules for the pci bus.
- No modules are installed by this hook, it is script-only.
-HELPEOF
-}
diff --git a/install/sata b/install/sata
index 708e3ff..e50ffee 100644
--- a/install/sata
+++ b/install/sata
@@ -5,7 +5,7 @@ install ()
MODULES=" $(all_modules "scsi/.*ata") sx8 ahci pdc_adma sd_mod sr_mod piix"
BINARIES=""
FILES=""
- SCRIPT="sata"
+ SCRIPT=""
}
help ()
diff --git a/install/scsi b/install/scsi
index 6e822c1..0525ae4 100644
--- a/install/scsi
+++ b/install/scsi
@@ -7,7 +7,7 @@ install ()
$(all_modules "/fusion/")"
BINARIES=""
FILES=""
- SCRIPT="scsi"
+ SCRIPT=""
}
help ()
diff --git a/install/udev b/install/udev
index 8f1f570..120b3f2 100644
--- a/install/udev
+++ b/install/udev
@@ -9,9 +9,10 @@ install ()
add_file /lib/initcpio/udev/udevd /sbin/udevd
add_file /lib/initcpio/udev/udevtrigger /sbin/udevtrigger
add_file /lib/initcpio/udev/udevsettle /sbin/udevsettle
- add_file /lib/initcpio/udev/udev.rules etc/udev/rules.d/udev.rules
+ add_file /lib/initcpio/udev/udev.rules /etc/udev/rules.d/udev.rules
add_file /lib/initcpio/udev/start_udev /etc/start_udev
add_file /lib/initcpio/udev/load-modules.sh /lib/udev/load-modules.sh
+ add_file /lib/initcpio/udev/modalias_ieee1394 /lib/udev/modalias_ieee1394
}
help ()
diff --git a/mkinitcpio b/mkinitcpio
index e1581d0..c50e9f0 100644
--- a/mkinitcpio
+++ b/mkinitcpio
@@ -10,8 +10,6 @@
# use "x${var}" = "x" to test for nulls/empty strings
# incase of embedded spaces, quote all path names and string comarpisons
#
-# TODO
-# hook help: help() function in install script, "-h base"
# Settings
@@ -118,9 +116,12 @@ for hook in $HOOKS; do
done
if [ "${HAS_MODULES}" == "y" ]; then
- add_file "${MODULEDIR}/modules.dep"
- add_file "${MODULEDIR}/modules.alias"
- add_file "${MODULEDIR}/modules.symbols"
+ [ -e /tmp${MODULEDIR}/ ] && rm -r /tmp${MODULEDIR}/
+ cp --parents `grep "file /lib/modules" .tmpfilelist | awk '{print $2}'` /tmp/
+ depmod -b /tmp ${KERNELVERSION}
+ add_file /tmp${MODULEDIR}/modules.dep ${MODULEDIR}/modules.dep
+ add_file /tmp${MODULEDIR}/modules.alias ${MODULEDIR}/modules.alias
+ add_file /tmp${MODULEDIR}/modules.symbols ${MODULEDIR}/modules.symbols
fi
if [ "x$GENIMG" != "x" ]; then
diff --git a/mkinitcpio.conf b/mkinitcpio.conf
index 4754a6d..8057495 100644
--- a/mkinitcpio.conf
+++ b/mkinitcpio.conf
@@ -1,5 +1,4 @@
# vim:set ft=sh
-
# MODULES
# The following modules are loaded before any boot hooks are
# run. Advanced users may wish to specify all system modules
@@ -13,7 +12,7 @@ MODULES=""
# be used to override the actual binaries used in a given hook.
# (Existing files are NOT overwritten is already added)
# BINARIES are dependancy parsed, so you may safely ignore libraries
-BINARIES="fbxine"
+BINARIES=""
# FILES
# This setting is similar to BINARIES above, however, files are added
@@ -30,6 +29,9 @@ FILES=""
# order in which HOOKS are added. Run 'mkinitcpio -H <hook name>' for
# help on a given hook.
# 'base' is _required_ unless you know precisely what you are doing.
+# 'udev' is _required_ in order to automatically load modules
+# 'modload' may be used in place of 'udev', but is not recommended
+# 'filesystems' is _required_ unless you specify your fs modules in MODULES
# Examples:
# This setup specifies all modules in the MODULES setting above.
# No raid, lvm, or encrypted root is needed.
@@ -37,16 +39,16 @@ FILES=""
#
# This setup will autodetect all modules for your system and should
# work as a sane default
-# HOOKS="base ide scsi sata usb filesystems autodetect"
+# HOOKS="base udev ide scsi sata filesystems autodetect"
#
# This setup will generate a 'full' image which supports most systems.
# No autodetection is done.
-# HOOKS="base ide scsi sata usb filesystems"
+# HOOKS="base udev ide scsi sata usb filesystems"
#
# This setup assembles an ide raid array with an encrypted root FS.
# Note: See 'mkinitcpio -H raid' for more information on raid devices.
-# HOOKS="base ide raid encrypt"
+# HOOKS="base udev ide filesystems raid encrypt"
#
# This setup loads an LVM volume group on a usb device.
-# HOOKS="base usb lvm"
-HOOKS="base autodetect"
+# HOOKS="base udev usb filesystems lvm"
+HOOKS="base udev ide filesystems autodetect"