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

Bug#486298: [RFR, patch] Wait for MegaRAID initialization during hw-detect



tags 486298 patch
thanks

On Wednesday 16 July 2008, Daniel Dickinson wrote:
> Sorry for not getting back to you sooner.  I just tested the image and
> works, but I forgot about the local wait=10 test, so I'll have to try
> that tomorrow.

Great. I've now updated the patch to also show an appropriate message in 
the progress bar and to automatically set the rootdelay=10 parameter for 
the target system.

Please do your final tests with this new image:
http://people.debian.org/~fjp/tmp/d-i/mini-megaraid.iso

For the d-boot colleagues:
Below the patch that allows waiting for the hardware initialization.
It adds one string (hi Christian!) for the hw-detect progress bar.
Please review and comment.

Cheers,
FJP

commit 23e6a098462084632cd9e6e25d0a56369b93de4b
Author: Frans Pop <fjp@debian.org>
Date:   Wed Jul 16 11:00:22 2008 +0200

    Wait for megaraid_mbox hardware initialization to complete

diff --git a/packages/hw-detect/debian/hw-detect.templates b/packages/hw-detect/debian/hw-detect.templates
index cb92139..0b97508 100644
--- a/packages/hw-detect/debian/hw-detect.templates
+++ b/packages/hw-detect/debian/hw-detect.templates
@@ -13,6 +13,11 @@ Type: text
 # :sl1:
 _Description: Starting PC card services...
 
+Template: hw-detect/hardware_init_step
+Type: text
+# :sl1:
+_Description: Waiting for hardware initialization...
+
 Template: hw-detect/select_modules
 Type: multiselect
 Choices: ${list}
diff --git a/packages/hw-detect/hw-detect.sh b/packages/hw-detect/hw-detect.sh
index 0450024..e940eab 100755
--- a/packages/hw-detect/hw-detect.sh
+++ b/packages/hw-detect/hw-detect.sh
@@ -171,10 +171,40 @@ get_manual_hw_info() {
 	fi
 }
 
+# Based on syslog from #486298
+wait_megaraid_complete() {
+	local wait=300
+
+	megaraid_complete() {
+		dmesg | grep -Eq "megaraid mbox: (Wait for 0 commands to complete|reset sequence completed sucessfully)"
+	}
+
+	if megaraid_complete; then
+		return 0
+	fi
+
+	sleep 10 # Early initialization phase
+	if dmesg | grep -q "megaraid mbox: Wait for [0-9]*[1-9] commands to complete"; then
+	   	log "Megaraid initialization: waiting for reset to complete"
+		while [ $wait -gt 0 ]; do
+			sleep 1
+			if megaraid_complete; then
+	   			log "Megaraid initialization: reset complete"
+				sleep 1
+				break
+			fi
+			wait=$(($wait - 1))
+		done
+		if [ $wait -eq 0 ]; then
+			log "Megaraid initialization: failed to complete reset!"
+		fi
+	fi
+}
+
 # Should be greater than the number of kernel modules we can reasonably
 # expect it will ever need to load.
 MAX_STEPS=1000
-OTHER_STEPS=4
+OTHER_STEPS=5
 # Use 1/10th of the progress bar for the non-module-load steps.
 OTHER_STEPSIZE=$(expr $MAX_STEPS / 10 / $OTHER_STEPS)
 db_progress START 0 $MAX_STEPS $PROGRESSBAR
@@ -490,6 +520,28 @@ case "$(udpkg --print-architecture)" in
 	;;
 esac
 
+# Some hardware may need extra time to initialize:
+
+# megaraid_mbox hardware RAID
+if lsmod | grep -q megaraid_mbox; then
+	db_progress INFO hw-detect/hardware_init_step
+	wait_megaraid_complete
+
+	# Add rootdelay boot option for target system
+	if [ -z "$LOAD_IDE" ]; then
+		kopts=
+		if db_get debian-installer/add-kernel-opts && [ "$RET" ]; then
+			kopts="$RET"
+			# remove any existing rootdelay= option
+			kopts="$(echo "$kopts" | sed -r "s/(^| )rootdelay=[^ ]*//")"
+		fi
+		db_set debian-installer/add-kernel-opts \
+			"${kopts:+$kopts }rootdelay=10"
+	fi
+fi
+db_progress STEP $OTHER_STEPSIZE
+
+
 db_progress SET $MAX_STEPS
 db_progress STOP
 

Reply to: