summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormaximilian attems <maks@debian.org>2007-05-01 18:31:38 +0200
committermaximilian attems <maks@debian.org>2007-05-01 18:31:38 +0200
commitb71721f02b6b46fddfc624888f61aafbc2399129 (patch)
tree6363339aa510abc4ac52581fa7989ec7f1b63fa0
parent27d498d8d190e67d51bc1a25a331acb805425721 (diff)
downloadinitramfs-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.
-rw-r--r--debian/TODO2
-rw-r--r--debian/changelog6
-rw-r--r--hook-functions34
3 files changed, 26 insertions, 16 deletions
diff --git a/debian/TODO b/debian/TODO
index 7ed390f..f62656f 100644
--- a/debian/TODO
+++ b/debian/TODO
@@ -5,8 +5,6 @@ TODO
o Eliminate ?udev?, ?klibc?, busybox (-> glibc).
- o Better heuristics for MODULES=dep option
-
o Default to dep for PPC - Possibly to detect newworld?
o udevsettle timeouts handling
diff --git a/debian/changelog b/debian/changelog
index e604463..22b793b 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,10 @@
initramfs-tools (0.88) UNRELEASED; urgency=low
- * Fix missing colons in closes.
+ * debian/changelog: Fix missing colons in closes.
+ * hook-functions: Add a proper /sys walking dep_add_modules() for a minimal
+ initramfs on MODULES=dep. (closes: #395526)
- -- maximilian attems <maks@debian.org> Sun, 22 Apr 2007 19:08:40 +0200
+ -- maximilian attems <maks@debian.org> Tue, 01 May 2007 18:29:59 +0200
initramfs-tools (0.87b) unstable; urgency=low
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