diff options
| author | maximilian attems <maks@debian.org> | 2007-05-01 18:31:38 +0200 |
|---|---|---|
| committer | maximilian attems <maks@debian.org> | 2007-05-01 18:31:38 +0200 |
| commit | b71721f02b6b46fddfc624888f61aafbc2399129 (patch) | |
| tree | 6363339aa510abc4ac52581fa7989ec7f1b63fa0 /hook-functions | |
| parent | 27d498d8d190e67d51bc1a25a331acb805425721 (diff) | |
| download | initramfs-tools-b71721f02b6b46fddfc624888f61aafbc2399129.tar.gz initramfs-tools-b71721f02b6b46fddfc624888f61aafbc2399129.zip | |
mkinitramfs: better heuristics for MODULES=dep
* add a first shoot that survives ide, scsi boot testing
nfs still needs work
let's see what other testers have to say
* next step is to cut on the added libs for smaller initramfs
enhances boot speed due to smaller initramfs for tuning freaks,
others might still be better off with safe MODULES=most setting.
Diffstat (limited to 'hook-functions')
| -rw-r--r-- | hook-functions | 34 |
1 files changed, 22 insertions, 12 deletions
diff --git a/hook-functions b/hook-functions index a5d1f61..12faeff 100644 --- a/hook-functions +++ b/hook-functions @@ -113,24 +113,34 @@ copy_modules_dir() done } +# only copy relevant modules dep_add_modules() { + # findout root block device + fstype + eval "$(mount | awk '/ \/ / {print "root=" $1 "\nrootfs=" $5; exit}')" + block=${root#/dev/} + block=${block%[0-9]*} - # Things that are too hard to autodetect. - for x in ext2 ext3 isofs jfs nfs reiserfs xfs af_packet; do - manual_add_modules "${x}" - done + # Error out if /sys lack block dev + if [ -z "${block}" ] || [ ! -e /sys/block/${block} ]; then + echo "Error: missing ${block} root ${root} /sys entry" + exit 1 + fi - for x in /sys/bus/pci/devices/*; do - if [ -e "${x}/modalias" ]; then - manual_add_modules $(cat "${x}/modalias") - fi - done + # Add rootfs + force_load "${rootfs}" - for x in /sys/bus/usb/devices/*; do - if [ -e "${x}/modalias" ]; then - manual_add_modules $(cat "${x}/modalias") + # walk /sys for relevant modules + device_path=$(readlink -f /sys/block/${block}/device) + while [ "${device_path}" != "/sys" ]; do + driver_path="$(readlink -f ${device_path}/driver)" + if [ -e "$driver_path" ]; then + module="$(basename $(readlink -f $driver_path))" + if [ -n "${module}" ]; then + force_load "${module}" + fi fi + device_path="$(dirname ${device_path})" done if [ -e /proc/ide ]; then |
