[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[RFC] Loading of IDE modules by hw-detect



I've felt for a while that disk-detect is unnecessarily loading all 
available IDE modules. This may have been needed for 2.4 and was even 
useful to avoid some issues with the early SATA drivers, but hardware 
detection in the kernel has improved a lot since Sarge and Etch (ignoring 
for the moment the IDE->libata transition).

We're also being inconsistent as we only do this for IDE drivers and not for 
SCSI and SATA drivers. And finally it's totally ineffective as by the time 
the module selection dialog is being displayed, the drivers that are needed 
to actually support the hardware *have already been loaded automatically*.

Currently we load some 30 drivers by default, most of which remain unused as 
they are irrelevant for the system that's being installed.
The attached (fairly simple) patch disables this and leaves things to the 
kernel/udev. It does support a boot parameter (hw-detect/load-ide=true) to 
force the old behavior.
The patch still leaves the (semi-)manual detection for modules for devices 
on Sparc sbus, HPPA bus and some others.

Patch has been tested for i386 (in VirtualBox) for both a netboot and 
CD-based install.

Results are:
- ~ 0.5MB memory saving
- speed up of the installation (loading all the drivers takes time...)
- less confusion for users who may wonder why seemingly random drivers are 
being selected
- shorter and more specific lsmod output

Some comments:
- one reason to list modules explicitly was to allow setting parameters for 
them (especially ide-core); this is no longer really needed as module 
parameters can now also be passed at the boot prompt
- we also loaded the isofs module by default; this is not needed as it will 
be loaded automatically if the '-t iso9660' option is used when mounting a 
CD (image), which we do in both cdrom-detect and iso-scan

The patch may well introduce regressions, probably mainly in arches other 
than i386/amd64. But I feel that we should start moving towards a less 
manual detection (as is done for the installed system) and the best time to 
do so is early in the release cycle.
We can easily add back targeted manual support where needed. I plan a call 
for testing if this change gets uploaded.

Cheers,
FJP

diff --git a/packages/hw-detect/hw-detect.sh b/packages/hw-detect/hw-detect.sh
index f1a5508..343188d 100755
--- a/packages/hw-detect/hw-detect.sh
+++ b/packages/hw-detect/hw-detect.sh
@@ -17,6 +17,11 @@ SUBARCH="$(archdetect)"
 
 finish_install=/usr/lib/finish-install.d/30hw-detect
 
+LOAD_IDE=""
+if db_get hw-detect/load-ide && [ "$RET" = true ]; then
+	LOAD_IDE=1
+fi
+
 if [ -x /sbin/depmod ]; then
 	depmod -a > /dev/null 2>&1 || true
 fi
@@ -142,24 +147,18 @@ get_ide_floppy_info() {
 	esac
 }
 
-# Modules that should load before autodetection.
-get_early_manual_hw_info() {
-	# Load explicitly rather than implicitly to allow the user to
-	# specify parameters when the module is loaded.
-	echo "ide-core:Linux IDE support"
-}
-	
 # Manually load modules to enable things we can't detect.
 # XXX: This isn't the best way to do this; we should autodetect.
 # The order of these modules are important.
 get_manual_hw_info() {
-	get_floppy_info
-	get_ide_chipset_info
-	echo "ide-generic:Linux IDE support"
-	get_ide_floppy_info
-	echo "ide-disk:Linux ATA DISK"
-	echo "ide-cd:Linux ATAPI CD-ROM"
-	echo "isofs:Linux ISO 9660 filesystem"
+	if [ "$LOAD_IDE" ]; then
+		get_floppy_info
+		get_ide_chipset_info
+		echo "ide-generic:Linux IDE support"
+		get_ide_floppy_info
+		echo "ide-disk:Linux ATA DISK"
+		echo "ide-cd:Linux ATAPI CD-ROM"
+	fi
 
 	# on some hppa systems, nic and scsi won't be found because they're
 	# not on a bus that udev understands ... 
@@ -202,7 +201,7 @@ fi
 # TODO: this just loads modules itself, rather than handing back a list
 update-dev
 
-ALL_HW_INFO=$(get_early_manual_hw_info; get_detected_hw_info; get_manual_hw_info)
+ALL_HW_INFO=$(get_detected_hw_info; get_manual_hw_info)
 db_progress STEP $OTHER_STEPSIZE
 
 # Remove modules that are already loaded or not available, and construct

Attachment: signature.asc
Description: This is a digitally signed message part.


Reply to: