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

[PATCH] Fix condition for adding IDE or SCSI disk driver when MODULES=dep



The transition from old-style IDE to libata-based drivers means the
new kernel may need different drivers from the running system.  We
already handle the change of controller driver correctly since we find
driver modules via module aliases.  However for the disk driver
(sd_mod or ide-disk) we look at which types of devices exist in the
running system, so we may not select the one we need.

Since all the controller driver modules depend on the core modules
under drivers/ide or drivers/scsi, we can work out which disk
driver(s) may be needed by checking whether those module
subdirectories have been created under the target directory.

Reported-by: Gordon Farquharson <gordonfarquharson@gmail.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
I've given this a very little testing and it seems to do the right
thing.  This obviously needs careful review!

Ben.

 hook-functions |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/hook-functions b/hook-functions
index 0684296..da16478 100644
--- a/hook-functions
+++ b/hook-functions
@@ -349,7 +349,7 @@ dep_add_modules()
 	sys_walk_mod_add ${root_dev_path}
 
 	# catch old-style IDE
-	if [ -e /sys/bus/ide/devices/ ]; then
+	if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/ide" ]; then
 		sys_walk_modalias ${root_dev_path}
 		manual_add_modules ide-gd_mod
 		# FIXME: remove post Squeeze
@@ -357,7 +357,7 @@ dep_add_modules()
 		manual_add_modules ide-cd
 	fi
 
-	if [ -e /sys/bus/scsi/devices/ ]; then
+	if [ -d "${DESTDIR}/lib/modules/${version}/kernel/drivers/scsi" ]; then
 		manual_add_modules sd_mod
 	fi
 
-- 
1.7.2.3



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


Reply to: