On Fri, Feb 23, 2007 at 04:55:00PM +0100, maximilian attems wrote:
On Fri, Feb 23, 2007 at 04:39:52PM +0100, David Härdeman wrote:
On Fri, February 23, 2007 16:28, maximilian attems said:
No, unfortunately it seems that the times between loading the usb host
controller, loading usb-storage and spawning the usb-storage-scan thread
are all asynchronous. So we can't really know how long time we need to
wait for any of those stages.
zut they were only pasted to irc it seems,
no you had the mandrake one posted, so this one might not
been on the radar yet
http://david.woodhou.se/olpc-init.txt
I've looked at it, and it also has a static sleep of a couple of seconds
(not to mention that their target of possible boot devices is smaller)
Anyways, attached you'll find a new version of the rootdelay patch. This
one has two improvements, first it doesn't require any changes to udev,
second, the rootdelay parameter can now be passed as a number (of
seconds to wait) or a device node (to wait for).
The secondary sleep (after udev, lvm, raid, etc have executed) has been
given a static 180 seconds sleep (there really isn't that much to do
there, either sleep or panic).
You should hopefully find this patch to be better...
--
David Härdeman
diff -Nur initramfs-tools-0.85e-orig/init initramfs-tools-0.85e-hack/init
--- initramfs-tools-0.85e-orig/init 2006-11-03 09:03:44.000000000 +0100
+++ initramfs-tools-0.85e-hack/init 2007-02-25 19:01:16.000000000 +0100
@@ -46,6 +46,7 @@
export debug=
export cryptopts=${CRYPTOPTS}
export panic
+export ROOTDELAY
for x in $(cat /proc/cmdline); do
case $x in
diff -Nur initramfs-tools-0.85e-orig/scripts/local initramfs-tools-0.85e-hack/scripts/local
--- initramfs-tools-0.85e-orig/scripts/local 2006-10-17 09:26:59.000000000 +0200
+++ initramfs-tools-0.85e-hack/scripts/local 2007-02-25 19:42:54.000000000 +0100
@@ -13,11 +13,7 @@
log_begin_msg "Waiting for root file system..."
# Default delay is 180s
- if [ -z "${ROOTDELAY}" ]; then
- slumber=180
- else
- slumber=${ROOTDELAY}
- fi
+ slumber=180
if [ -x /sbin/usplash_write ]; then
/sbin/usplash_write "TIMEOUT ${slumber}" || true
fi
diff -Nur initramfs-tools-0.85e-orig/scripts/local-top/lvm initramfs-tools-0.85e-hack/scripts/local-top/lvm
--- initramfs-tools-0.85e-orig/scripts/local-top/lvm 2006-08-25 15:09:28.000000000 +0200
+++ initramfs-tools-0.85e-hack/scripts/local-top/lvm 2007-02-25 19:55:56.000000000 +0100
@@ -1,6 +1,6 @@
#!/bin/sh
-PREREQ="mdadm mdrun lvm2"
+PREREQ="udev_helper mdadm mdrun lvm2"
prereqs()
{
diff -Nur initramfs-tools-0.85e-orig/scripts/local-top/rootdelay initramfs-tools-0.85e-hack/scripts/local-top/rootdelay
--- initramfs-tools-0.85e-orig/scripts/local-top/rootdelay 1970-01-01 01:00:00.000000000 +0100
+++ initramfs-tools-0.85e-hack/scripts/local-top/rootdelay 2007-02-28 01:28:53.000000000 +0100
@@ -0,0 +1,49 @@
+#!/bin/sh
+
+PREREQ=""
+
+prereqs()
+{
+ echo "$PREREQ"
+}
+
+case $1 in
+# get pre-requisites
+prereqs)
+ prereqs
+ exit 0
+ ;;
+esac
+
+if [ -z "$ROOTDELAY" ]; then
+ exit 0
+fi
+
+. /scripts/functions
+# If the user wants us to, we'll wait for removable devices, etc...
+# (this is after udev has been executed, but not the other scripts such as LVM)
+if [ -x /sbin/usplash_write ]; then
+ # Some versions of udev seem to wrongly treat 0 as immediate timeout
+ /sbin/usplash_write "TIMEOUT 900" || true
+fi
+
+# The rootdelay parameter can be interpreted in two ways
+if [ "${ROOTDELAY%%[^0-9]*}" = "$ROOTDELAY" ]; then
+ # 1) As a number of seconds to wait
+ log_begin_msg "Delaying setup for ${ROOTDELAY} seconds..."
+ sleep $ROOTDELAY
+ log_end_msg
+else
+ # 2) As a device node to wait for
+ if [ ! -e "$ROOTDELAY" ]; then
+ log_begin_msg "Delaying setup until ${ROOTDELAY} is present..."
+ while [ ! -e "$ROOTDELAY" ]; do
+ sleep 1
+ done
+ log_end_msg
+ fi
+fi
+
+if [ -x /sbin/usplash_write ]; then
+ /sbin/usplash_write "TIMEOUT 15" || true
+fi
diff -Nur initramfs-tools-0.85e-orig/scripts/local-top/udev_helper initramfs-tools-0.85e-hack/scripts/local-top/udev_helper
--- initramfs-tools-0.85e-orig/scripts/local-top/udev_helper 2006-07-16 21:20:10.000000000 +0200
+++ initramfs-tools-0.85e-hack/scripts/local-top/udev_helper 2007-02-25 19:32:35.000000000 +0100
@@ -1,6 +1,6 @@
#!/bin/sh
-PREREQ=""
+PREREQ="rootdelay"
prereqs()
{