From ad1050964eabbbc00547e8c6c91d8a7c3f13598f Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Wed, 3 May 2006 02:02:53 +0000 Subject: 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 --- hooks/ide | 11 ----------- hooks/modload | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ hooks/pci | 9 --------- hooks/sata | 34 ---------------------------------- hooks/scsi | 34 ---------------------------------- hooks/usb | 1 + init | 7 +++++++ install/autodetect | 36 ++++++++++++++++++++++++------------ install/filesystems-auto | 17 ----------------- install/ide | 2 +- install/modload | 18 ++++++++++++++++++ install/pci | 17 ----------------- install/sata | 2 +- install/scsi | 2 +- install/udev | 3 ++- mkinitcpio | 11 ++++++----- mkinitcpio.conf | 16 +++++++++------- 17 files changed, 118 insertions(+), 150 deletions(-) delete mode 100644 hooks/ide create mode 100644 hooks/modload delete mode 100644 hooks/pci delete mode 100644 hooks/sata delete mode 100644 hooks/scsi delete mode 100644 install/filesystems-auto create mode 100644 install/modload delete mode 100644 install/pci 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/modload b/hooks/modload new file mode 100644 index 0000000..6cf4037 --- /dev/null +++ b/hooks/modload @@ -0,0 +1,48 @@ +# vim:set ft=sh: +run_hook () +{ + 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 + 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 + 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/sata b/hooks/sata deleted file mode 100644 index fb6ed90..0000000 --- a/hooks/sata +++ /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/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<' 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" -- cgit v1.2.3-24-g4f1b