You are not logged in.

Here is a bash script to probe your hardware, then come up with a list of kernel modules you may wish to compile into a custom kernel tailored for specific machine!
#/bin/bash
# Script by graysky based on some code found in http://www.kroah.com/lkn/ chapter 7
# Purpose: probe system for devices controlled by modules and list them via name
# Email: graysky <echo Z3JheXNreUBhcmNobGludXgudXMK | base64 -d>
##### edit this to point to the path containing your kernel source
kernelsource="/path/to/kernel/source"
#####
clear && echo "Probing... wait a sec"
[ -f /tmp/list ] && rm -f /tmp/list
for i in `find /sys/ -name modalias -exec cat {} \;`; do
 /sbin/modprobe --config /dev/null --show-depends $i 2>/dev/null >> /tmp/list ;
done 
# clean up list
rev /tmp/list | cut -f 1 -d '/' | rev | sort -u | sed -e ':a;N;$!ba;s/\n//g' -e 's/.ko.gz//g'  > /tmp/list2
[ -f /tmp/list3 ] && rm -f /tmp/list3
for i in $(cat /tmp/list2); do
 echo "---------------  $i  ---------------" >> /tmp/list3
 echo " " >> /tmp/list3
 find $kernelsource -type f -name Makefile | xargs grep $i | grep CONFIG_ | sed -re 's/^.+\$//' >> /tmp/list3
 echo " " >> /tmp/list3
 sed -i -re 's/(.+)=.+$/\1/' -i -e 's/[()+]//g' /tmp/list3
done
rm -f /tmp/list /tmp/list2
echo "Done!"
echo "To see a list of potential kernel config options for your specific hardware"
echo "less /tmp/list3"Sample output:
---------------  ata_generic  ---------------
 
CONFIG_ATA_GENERIC      
---------------  crc-itu-t  ---------------
 
CONFIG_CRC_ITU_T        
 
---------------  drm_kms_helper  ---------------
 
CONFIG_DRM_KMS_HELPER 
 
---------------  ehci-hcd  ---------------
 
CONFIG_USB_EHCI_HCD     
 
---------------  evdev  ---------------
 
CONFIG_INPUT_EVDEV      Last edited by graysky (2011-06-12 15:32:18)
Offline

You can refactor the initial probing and cleanup into a one liner:
find /sys/devices -name modalias -exec sort -zu {} + |  xargs -0 modprobe -aRS "${kernver:-$(uname -r)}" | sort -uIt should be noted that this only scans your system buses. This is not a comprehensive list, and modules to create your root FS are completely ignored here.
Offline

Good points, FI.
Offline

Took a stab at refactoring this, since it interests me... came up with:
#!/bin/bash
#
# uses information gathered from /sys and a kernel source directory to
# determine what kernel config options are needed
#
kernver=${1:-$(uname -r)}
kernelsource=/home/noclaf/build/kernel26-rampage/src/linux-2.6.39.1
if [[ ! -f $kernelsource/Kbuild ]]; then
  printf "error: \`%s' doesn't exist or isn't a valid kernel source directory\n" "$kernelsource"
  exit 1
fi
# scan system buses
IFS=$'\n' read -r -d '' -a mods < <(find /sys/devices -name modalias -exec sort -zu {} + |
  xargs -0 modprobe -aRS "${kernver:-$(uname -r)}" | sort -u)
# include root device filesystem
mods+=("$(findmnt / -uno fstype)")
# grab mdadm info if its available
if [[ -x $(type -P mdadm) ]]; then
  mods+=($(mdadm -Esv /dev/[hrsv]d* /dev/{ida,cciss,ataraid,mapper}/* |
    sed -n 's/.*level=\([^ ]\+\) .*/\1/p' |
    sed 's/\<raid[456]\>/raid456/g' | sort -u))
fi
# scrape the kernel source for CONFIG_ options
find "$kernelsource" -name Makefile -exec grep -ZFf <(printf '%s.o\n' "${mods[@]}") {} + |
  grep -Eoz 'CONFIG_[[:upper:][:digit:]_]+' | sortLast edited by falconindy (2011-06-12 21:12:43)
Offline
FI, this is what I get:
error: `2.6.39-ARCH' doesn't exist or isn't a valid kernel source directoryChances are I'm overseeing something, it's been a long day...
Offline
Doh! Working...
Offline

What is the difference with your modprobed_db ?
Last edited by rwd (2011-06-13 17:13:06)
Offline

@rwd - that script keeps a log of what you have probed. This script (and the one modded by falconindy) interrogates your hardware to see which modules should be loaded.
Offline