From 35308163932b39fbeb147b09b5e807009392c46a Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Thu, 4 May 2006 07:29:25 +0000 Subject: Changes to autodetection: General performance improvement Cleaned up excess modules git-svn-id: http://projects.archlinux.org/svn/initramfs/mkinitcpio@56 880c04e9-e011-0410-abf7-b926e227c9cd --- functions | 8 +++----- install/autodetect | 29 +++++++++++++---------------- install/sata | 8 +++++++- install/scsi | 5 +++++ install/usb | 8 ++++++-- mkinitcpio | 2 +- 6 files changed, 35 insertions(+), 25 deletions(-) diff --git a/functions b/functions index 8396999..e8e7868 100644 --- a/functions +++ b/functions @@ -21,15 +21,13 @@ all_modules () checked_modules () { - ret=1 if [ -e "${MODULE_FILE}" ]; then for mod in $(all_modules ${@}); do if grep "$(basename ${mod%%\.ko})" "${MODULE_FILE}" >/dev/null 2>&1; then - ret=0 echo ${mod} fi done - return $ret + return 1 else all_modules ${@} fi @@ -77,7 +75,7 @@ add_symlink () add_dir $(dirname "${dest}") if ! grep "slink ${dest} " "${FILELIST}" 2>&1 > /dev/null; then msg " adding link ${fil} -> ${dest}" - echo "slink ${dest} ${fil} $(stat -c '%a %u %g' ${fil})" >> "${FILELIST}" + echo "slink ${dest} ${fil} $(stat -c '%a' ${fil}) 0 0" >> "${FILELIST}" fi fi #fail quietly @@ -103,7 +101,7 @@ add_file () if ! grep "file ${dest} " "${FILELIST}" 2>&1 > /dev/null; then msg " adding file ${dest}" - echo "file ${dest} ${fil} $(stat -c '%a %u %g' ${fil})" >> "${FILELIST}" + echo "file ${dest} ${fil} $(stat -c '%a' ${fil}) 0 0" >> "${FILELIST}" fi else err "file '${1}' does not exist" diff --git a/install/autodetect b/install/autodetect index 6371d35..d9214ed 100644 --- a/install/autodetect +++ b/install/autodetect @@ -5,27 +5,24 @@ install () msg ":: Autodetecting modules" MODULE_FILE="$(mktemp /tmp/initcpio_modules.XXXXXX)" #blegh, we'll let /tmp clean itself up - AUTODETECT=" $((auto_modules "/scsi/" | grep -ve "imm" -e "pcmcia" -e "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) " + AUTODETECT="$(auto_modules -e "/scsi/" -e "/block" -e "/fusion/" \ + -e "/usb/" -e "/ide/" -e "/ieee1394/" -e "/cdrom") + $(cat /proc/filesystems | grep -v nodev) " for m in $AUTODETECT; do modname="$(basename ${m%%\.ko})" grep "${modname}" "${MODULE_FILE}" >/dev/null 2>&1 && continue + case "${m}" in + #*/ieee1394/*) echo -e "sbp2\nsd_mod\nsr_mod" >> "${MODULE_FILE}";; + *ext3*) echo "jbd" >> "${MODULE_FILE}" ;; + *afs*)echo "rxrpc" >> "${MODULE_FILE}" ;; + *cramfs*) echo "zlib_inflate" >> "${MODULE_FILE}" ;; + *isofs*) echo "zlib_inflate" >> "${MODULE_FILE}" ;; + *msdos*) echo "fat" >> "${MODULE_FILE}" ;; + *vfat*)echo "fat" >> "${MODULE_FILE}" ;; + *ocfs2*) echo -e "ocfs2_dlm\njbd\nocfs2_nodemanager\nconfigfs" >> "${MODULE_FILE}" ;; + esac echo "${modname}" >> "${MODULE_FILE}" - # fixing missing depends for filesystems - [ "$m" = "ext3" ] && echo "jbd" >> "${MODULE_FILE}" - [ "$m" = "afs" ] && echo "rxrpc" >> "${MODULE_FILE}" - [ "$m" = "cramfs" ] && echo "zlib_inflate" >> "${MODULE_FILE}" - [ "$m" = "isofs" ] && echo "zlib_inflate" >> "${MODULE_FILE}" - [ "$m" = "msdos" ] && echo "fat" >> "${MODULE_FILE}" - [ "$m" = "vfat" ] && echo "fat" >> "${MODULE_FILE}" - [ "$m" = "ocfs2" ] && echo -e "ocfs2_dlm\njbd\nocfs2_nodemanager\nconfigfs" >> "${MODULE_FILE}" done BINARIES="" diff --git a/install/sata b/install/sata index 134ecdb..73c2729 100644 --- a/install/sata +++ b/install/sata @@ -2,7 +2,13 @@ install () { - MODULES=" $(checked_modules "scsi/.*ata" && echo "sx8 ahci pdc_adma sd_mod sr_mod")" + MODULES=" $(checked_modules "scsi/.*ata") " + + MODULES=$(echo ${MODULES}) #trim whitespace + if [ "x${MODULES}" != "x" ]; then + MODULES="${MODULES} sx8 ahci pdc_adma sd_mod sr_mod" + fi + BINARIES="" FILES="" SCRIPT="" diff --git a/install/scsi b/install/scsi index 2f107bc..8e8694b 100644 --- a/install/scsi +++ b/install/scsi @@ -5,6 +5,11 @@ install () MODULES=" $(checked_modules "/scsi/" | grep -ve "imm" -e "pdc_adma" -e "ahci" -e "ata" -e "pcmcia" -e "ide") $(checked_modules "/block/" | grep -v "sx8") $(checked_modules "/fusion/")" + + MODULES=$(echo ${MODULES}) #trim whitespace + if [ "x${MODULES}" != "x" ]; then + MODULES="${MODULES} sd_mod\nsr_mod" + fi BINARIES="" FILES="" SCRIPT="" diff --git a/install/usb b/install/usb index 03ed024..f528322 100644 --- a/install/usb +++ b/install/usb @@ -2,8 +2,12 @@ install () { - MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl1811-hcd" -e "isp116x-hcd") - usb_storage usbhid sd_mod sr_mod " + MODULES=" $(checked_modules "/usb/host" | grep -ve "_cs" -e "sl1811-hcd" -e "isp116x-hcd")" + + MODULES=$(echo ${MODULES}) #trim whitespace + if [ "x${MODULES}" != "x" ]; then + MODULES="${MODULES} usb_storage sd_mod sr_mod" + fi BINARIES="" FILES="" SCRIPT="usb" diff --git a/mkinitcpio b/mkinitcpio index fb8f5a2..3985cc1 100644 --- a/mkinitcpio +++ b/mkinitcpio @@ -111,6 +111,7 @@ for hook in $HOOKS; do install () { msg "${hook}: no install function..."; } if grep "install" "${INSTDIR}/${hook}" >/dev/null 2>&1; then source "${INSTDIR}/${hook}" + msg ":: Parsing hook [${hook}]" install parse_hook fi @@ -123,7 +124,6 @@ if [ "${HAS_MODULES}" == "y" ]; then 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 - add_file "${MODULE_FILE}" "/modules" fi if [ "x$GENIMG" != "x" ]; then -- cgit v1.2.3-24-g4f1b