From: Michael Gebetsroither Date: Tue, 6 Mar 2007 22:44:12 +0000 (+0100) Subject: change hw detection from discover to a modalias based one X-Git-Tag: 0.83~13 X-Git-Url: http://git.grml.org/?a=commitdiff_plain;h=744835b3f429c89983adc3d83c27f5a1baebb7fe;p=grml-terminalserver.git change hw detection from discover to a modalias based one --- diff --git a/grml-terminalserver-config b/grml-terminalserver-config index d06b757..f94b3df 100755 --- a/grml-terminalserver-config +++ b/grml-terminalserver-config @@ -154,41 +154,23 @@ function mkInitrd # implanting my initrd changes into the original initrd # copy programs, check if there are already links with this name to busybox - for i in $USR_SHARE_/timeout $USR_SHARE_/discover* $USR_SHARE_/udhcpc $USR_SHARE_/udhcp-config.sh $USR_SHARE_/cdir $USR_SHARE_/rdir /usr/bin/ldd ;do + for i in $USR_SHARE_/timeout $USR_SHARE_/udhcpc $USR_SHARE_/udhcp-config.sh $USR_SHARE_/cdir $USR_SHARE_/rdir; do tmp_name_="${i##*/}" isNotExistent "$INITRD_/static/$tmp_name_" eprint || execute "rm $INITRD_/static/$tmp_name_" cp $i "$INITRD_/static/$tmp_name_" done cp $USR_SHARE_/linuxrc $INITRD_/ mkdir -p $INITRD_/mylib - mkdir -p $INITRD_/myusr/i386-uclibc-linux/lib - for i in libdl libc libuClibc ld-uClibc; do - cp -a $UCLIBC_PATH_/$i*.so* $INITRD_/myusr/i386-uclibc-linux/lib - done - - # copy data files for discover (discover-data) - mkdir -p $INITRD_/mylib/discover - cp /lib/discover/list.xml /lib/discover/pci-*.xml $INITRD_/mylib/discover/ # # which modules should i put into the ramdisk # - # get cards detected by discover - if [ -f /lib/discover/pci.lst ] ; then - isNotExistent $CARDS_DETECTED_BY_DISCOVER && awk '/ethernet/{print $3}' /lib/discover/pci.lst |sort |uniq > $CARDS_DETECTED_BY_DISCOVER - else # newer discover does not provide /lib/discover/pci.lst, get a list of all network drivers therefore - isNotExistent $CARDS_DETECTED_BY_DISCOVER && \ - # find *all* network drivers, but do not include wlan/pcmcia/... related ones - # blacklist: proteon and depca as they seem to cause problems with udevsettle - find /lib/modules/${KERNEL_VERSION_}/kernel/drivers/net/ -name \*.ko | \ - grep -v 'wireless\|wan\|hamradio\|wlan\|ppp\|irda\|pcmcia\|depca\|proteon' | \ - sed 's#.*./## ; s#\.ko##' | sort | uniq > $CARDS_DETECTED_BY_DISCOVER - # find the ones supported by discover - # for mod in `grep "name'>.*" /lib/discover/pci-device.xml | sed "s#.*name'>## ; s###" | sort -u`; do - # find /lib/modules/${KERNEL_VERSION_}/kernel/drivers/net -name ${mod}.ko | sed 's#.*./## ; s#\.ko##' >> $CARDS_DETECTED_BY_DISCOVER - # done - fi + # find *all* network drivers, but do not include wlan/pcmcia/... related ones + # blacklist: proteon and depca as they seem to cause problems with udevsettle + find ${MODULES_PATH_}/${KERNEL_VERSION_}/kernel/drivers/net/ -name \*.ko | \ + grep -v 'wireless\|wan\|hamradio\|wlan\|ppp\|irda\|pcmcia\|depca\|proteon' | \ + sed 's#.*./## ; s#\.ko##' | sort | uniq > $CARDS_DETECTED_BY_DISCOVER local modules="`cat $CARDS_DETECTED_BY_DISCOVER |xargs` af_packet" local modules_dep="" @@ -227,8 +209,9 @@ function mkInitrd cp $MODULES_PATH_/$KERNEL_VERSION_/kernel/$i "$tmp_path" done - # generate modules.dep + # copying modules.* cp $MODULES_PATH_/$KERNEL_VERSION_/modules.dep $mod_path_ + cp $MODULES_PATH_/$KERNEL_VERSION_/modules.alias $mod_path_ #grep "^\/lib\/modules\/$KERNEL_VERSION_\/kernel\/" $MODULES_PATH_/$KERNEL_VERSION_/modules.dep |\ # sed "s/\/lib\/modules\/$KERNEL_VERSION_\/kernel\//\/modules\//g" > $mod_path_/modules.dep diff --git a/linuxrc b/linuxrc index 7d8bba1..971844e 100755 --- a/linuxrc +++ b/linuxrc @@ -516,21 +516,8 @@ if [ -n "$NFS" ]; then tmp_="$(getbootparam nfsdir)" log_begin_msg "Bootoption NFS found." ; echo "$SUCCESS" - # put the mylibs into /lib for discover and udhcpc cdir - # starting hw-detection for network card - currently broken, so don't use it - # echo "Starting hw-detection" - # kernel_version_=`uname -r` - # modules_to_load=$(/static/discover --disable-bus all --enable-bus pci --type network --normalize-whitespace --data-path=linux/module/name --data-version=$kernel_version_ | grep -v '^ $' | uniq) - # echo "trying to load the following network modules: \"$modules_to_load\"" - - KERNELVER=`uname -r` - for mod in `find /lib/modules/$KERNELVER/kernel/drivers/net/ -name \*.ko` ; do - echo `basename $mod | sed -e 's/\.ko$//'` >> /modules.load - done - modules_to_load=`cat /modules.load | xargs` - # FIXME modprobe is buggy from busybox log_begin_msg "Trying to load network driver(s)." ; echo modLoad() @@ -544,8 +531,9 @@ if [ -n "$NFS" ]; then [ -n "$DEBUG" ] && eval "$tmp_" || eval "$tmp_" 1>/dev/null 2>/dev/null done } - modLoad "$modules_to_load" - rm -f /modules.load + # modules.alias and modules.dep are in place so USE IT :)! + modLoad "$(for x in $(find /sys/devices/ -name modalias); do grep pci: $x; done |xargs)" + modLoad "$NIC_PROBE" # loading additional modules modLoad sunrpc lockd af_packet nfs @@ -562,9 +550,9 @@ if [ -n "$NFS" ]; then # sh done - # recreate the old dir structures + # recreate dir layout + remove extra modules rdir - #rm -rf /myusr /mylib + rm -rf /mylib log_begin_msg "Looking for GRML in: ${MAGENTA}$NFS${NORMAL}" ; echo "$SUCCESS" if mount -t nfs "$NFS" -o "async,ro,nolock" /cdrom #>/dev/null 2>&1