All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] Move actually mounting the root filesystem into its own series of hooks.
@ 2009-02-26  2:32 Victor Lowther
       [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Victor Lowther @ 2009-02-26  2:32 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

We now have mount hooks.  They are sourced in an infinite loop until one of
them actually mounts the real root filesystem.

This makes it easier to add support for arbitrarily complex schemes to find
the root filesystem without having to patch the init script.

This patch series is also avaialble ass the hookify-finding-root branch at 
http://git.fnordovax.org/dracut

---
 hooks/mount-partition.sh |   30 ++++++++++++++++++++++++++++
 init                     |   49 ++++++++++++++++-----------------------------
 modules/90crypt.sh       |    2 +-
 modules/99base.sh        |    4 +-
 4 files changed, 51 insertions(+), 34 deletions(-)

diff --git a/hooks/mount-partition.sh b/hooks/mount-partition.sh
new file mode 100755
index 0000000..53a0f4c
--- /dev/null
+++ b/hooks/mount-partition.sh
@@ -0,0 +1,30 @@
+#!/bin/sh
+[ "$root" ] || {
+    root=$(getarg root); root=${root#root=}
+    case $root in
+	LABEL=*) root=${root#LABEL=}
+            root="$(echo $root |sed 's,/,\\x2f,g')"
+            root="/dev/disk/by-label/${root}" ;;
+        UUID=*) root="/dev/disk/by-uuid/${root#UUID=}" ;;
+        '') echo "Warning: no root specified"
+            root="/dev/sda1" ;;
+    esac
+}
+
+[ "$rflags" ] || {
+    if rflags="$(getarg rootflags)"; then
+	rflags="${rflags#rootflags=}"
+	getarg rw >/dev/null && rflags="${rflags},rw" || rflags="${rflags},ro"
+    else
+	getarg rw >/dev/null && rflags=rw || rflags=ro
+    fi
+}
+
+[ "$fstype" ] || {
+    fstype="$(getarg rootfstype)" && fstype="-t ${fstype#rootfstype=}"
+}
+
+[ -e "$root" ] && {
+    ln -sf "$root" /dev/root
+    mount $fstype -o $rflags /dev/root $NEWROOT && ROOTFS_MOUNTED=yes
+}
diff --git a/init b/init
index 581c2b9..3652216 100755
--- a/init
+++ b/init
@@ -50,45 +50,31 @@ mknod /dev/tty0 c 4 0
 mknod /dev/tty1 c 4 1
 mknod /dev/null c 1 3
 
+# pre-udev scripts run before udev starts, and are run only once.
 source_all pre-udev
 
 # start up udev and trigger cold plugs
 udevd --daemon
 udevadm trigger >/dev/null 2>&1
+udevadm settle --timeout=30
 
-# mount the rootfs
 NEWROOT="/sysroot"
-
-# FIXME: there's got to be a better way ...
-# it'd be nice if we had a udev rule that just did all of the bits for
-# figuring out what the specified root is and linking it /dev/root
-root=$(getarg root); root=${root#root=}
-case $root in
-    LABEL=*) root=${root#LABEL=}
-             root="$(echo $root |sed 's,/,\\x2f,g')"
-	     root="/dev/disk/by-label/${root}" ;;
-    UUID=*) root="/dev/disk/by-uuid/${root#UUID=}" ;;
-    '') echo "Warning: no root specified"
-	root="/dev/sda1" ;;
-esac
-
-# should we have a timeout?
-tries=0
-echo "Waiting up to 30 seconds for $root to become available"
-udevadm settle --timeout=30
+# pre-mount happens before we try to mount the root filesystem,
+# and happens once.
 source_all pre-mount
 
-echo "Trying to mount rootfs $root"
-if rflags="$(getarg rootflags)"; then
-    rflags="${rflags#rootflags=}"
-    getarg rw >/dev/null && rflags="${rflags},rw" || rflags="${rflags},ro"
-else
-     getarg rw >/dev/null && rflags=rw || rflags=ro
-fi
-[ -e "$root" ] || emergency_shell
-ln -s "$root" /dev/root 
-fstype="$(getarg rootfstype)" && fstype="-t ${fstype#rootfstype=}" 
-mount $fstype -o $rflags /dev/root $NEWROOT || emergency_shell
+# mount scripts actually try to mount the root filesystem, and may
+# be sourced any number of times. As soon as one suceeds, no more are sourced.
+while :; do
+    for f in /mount/*.sh; do
+	[ -x "$f" ] && . "$f";
+	[ "$ROOTFS_MOUNTED" ] && break;
+    done
+    [ "$ROOTFS_MOUNTED" ] && break;
+    sleep 1
+done
+
+# by the time we get here, the root filesystem should be mounted.
 
 INIT=$(getarg init)
 [ "$INIT" ] || {
@@ -101,7 +87,8 @@ INIT=$(getarg init)
 	emergency_shell
     }
 }
-	    
+
+# pre pivot scripts are sourced just before we switch over to the new root.
 source_all pre-pivot
 echo "Switching to real root filesystem $root"
 exec switch_root "$NEWROOT" "$INIT"  $CMDLINE || {
diff --git a/modules/90crypt.sh b/modules/90crypt.sh
index 9793a4f..5e8f4cb 100755
--- a/modules/90crypt.sh
+++ b/modules/90crypt.sh
@@ -1,4 +1,4 @@
 #!/bin/bash
 inst cryptsetup
 inst_rules "$dsrc/rules.d/63-luks.rules"
-inst_hook pre-mount 50 "$dsrc/hooks/cryptroot.sh"
\ No newline at end of file
+inst_hook mount 10 "$dsrc/hooks/cryptroot.sh"
\ No newline at end of file
diff --git a/modules/99base.sh b/modules/99base.sh
index 1d9f86e..580fb03 100755
--- a/modules/99base.sh
+++ b/modules/99base.sh
@@ -4,5 +4,5 @@ dracut_install mount mknod mkdir modprobe pidof sleep chroot echo sed sh ls
 inst "$initfile" "/init"
 inst "$switchroot" "/sbin/switch_root"
 inst_hook pre-pivot 50 "$dsrc/hooks/selinux-loadpolicy.sh"
-inst_hook pre-mount 99 "$dsrc/hooks/resume.sh"
-
+inst_hook mount 90 "$dsrc/hooks/resume.sh"
+inst_hook mount 99 "$dsrc/hooks/mount-partition.sh"
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 2/4] Modify getarg to be slightly more useful.
       [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2009-02-26  2:32   ` Victor Lowther
  2009-02-26  2:32   ` [PATCH 3/4] Trim out device nodes we do not have to actually create Victor Lowther
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 11+ messages in thread
From: Victor Lowther @ 2009-02-26  2:32 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

If the last character in the argument to search for is "=", then
getarg will echo all the text after the = as well as returning 0 or 1 depending
on whether or not the arg is found.
Otherwise, getarg will jsut return 0 if the exact test of the argument is found,
1 otherwise.
---
 hooks/mount-partition.sh |   17 +++++++----------
 hooks/resume.sh          |   13 +++++--------
 init                     |   20 +++++++++-----------
 modules/95udev-rules.sh  |    4 +++-
 4 files changed, 24 insertions(+), 30 deletions(-)

diff --git a/hooks/mount-partition.sh b/hooks/mount-partition.sh
index 53a0f4c..f554c28 100755
--- a/hooks/mount-partition.sh
+++ b/hooks/mount-partition.sh
@@ -1,6 +1,6 @@
 #!/bin/sh
 [ "$root" ] || {
-    root=$(getarg root); root=${root#root=}
+    root=$(getarg root=)
     case $root in
 	LABEL=*) root=${root#LABEL=}
             root="$(echo $root |sed 's,/,\\x2f,g')"
@@ -12,19 +12,16 @@
 }
 
 [ "$rflags" ] || {
-    if rflags="$(getarg rootflags)"; then
-	rflags="${rflags#rootflags=}"
-	getarg rw >/dev/null && rflags="${rflags},rw" || rflags="${rflags},ro"
+    if rflags="$(getarg rootflags=)"; then
+	getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro"
     else
-	getarg rw >/dev/null && rflags=rw || rflags=ro
+	getarg rw && rflags=rw || rflags=ro
     fi
 }
 
 [ "$fstype" ] || {
-    fstype="$(getarg rootfstype)" && fstype="-t ${fstype#rootfstype=}"
+    fstype="$(getarg rootfstype=)" && fstype="-t ${fstype}"
 }
 
-[ -e "$root" ] && {
-    ln -sf "$root" /dev/root
-    mount $fstype -o $rflags /dev/root $NEWROOT && ROOTFS_MOUNTED=yes
-}
+[ -e "$root" ] && mount $fstype -o "$rflags" "$root" "$NEWROOT" && \
+    ROOTFS_MOUNTED=yes
diff --git a/hooks/resume.sh b/hooks/resume.sh
index 619d634..a01a613 100755
--- a/hooks/resume.sh
+++ b/hooks/resume.sh
@@ -1,10 +1,7 @@
 #!/bin/sh
-resume=$(getarg resume) && [ "$(getarg noresume)" = "" ] && {
-    resume=${resume#resume=}
-    [ -b "$resume" ] && {
-        # parsing the output of ls is Bad, but until there is a better way...
-	ls -lH "$resume" | ( 
-	    read x x x x maj min x;
-	    echo "${maj%,}:$min"> /sys/power/resume)
-    }
+resume=$(getarg resume=) && ! getarg noresume && [ -b "$resume" ] && {
+    # parsing the output of ls is Bad, but until there is a better way...
+    ls -lH "$resume" | ( 
+	read x x x x maj min x;
+	echo "${maj%,}:$min"> /sys/power/resume)
 }
diff --git a/init b/init
index 3652216..c3f5150 100755
--- a/init
+++ b/init
@@ -16,7 +16,8 @@ emergency_shell()
 getarg() {
     local o line
     for o in $CMDLINE; do
-	[ "${o%%=*}" = "$1" ] && { echo $o; return 0; }
+	[ "$o" = "$1" ] && return 0
+	[ "${o%%=*}" = "${1%=}" ] && { echo ${o#*=}; return 0; }
     done
     return 1
 }
@@ -75,17 +76,14 @@ while :; do
 done
 
 # by the time we get here, the root filesystem should be mounted.
-
-INIT=$(getarg init)
+# Try to find init.
+for i in "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
+    [ -f "$NEWROOT$i" -a -x "$NEWROOT$i" ] && { INIT="$i"; break; }
+done
 [ "$INIT" ] || {
-    for i in /sbin/init /etc/init /init /bin/sh; do
-	[ -x "$NEWROOT$i" ] && { INIT="$i"; break; }
-    done
-    [ "$INIT" ] || {
-	echo "Cannot find init! Please check to make sure you passed"
-	echo "a valid root filesystem!  Dropping to a shell."
-	emergency_shell
-    }
+    echo "Cannot find init! Please check to make sure you passed"
+    echo "a valid root filesystem!  Dropping to a shell."
+    emergency_shell
 }
 
 # pre pivot scripts are sourced just before we switch over to the new root.
diff --git a/modules/95udev-rules.sh b/modules/95udev-rules.sh
index 9801e7e..61125cd 100755
--- a/modules/95udev-rules.sh
+++ b/modules/95udev-rules.sh
@@ -7,4 +7,6 @@ dracut_install udevd udevadm /lib/udev/*_id /lib/udev/console_*
 inst_rules /lib/udev/rules.d/10-console* /lib/udev/rules.d/40-redhat* \
     /lib/udev/rules.d/50* /lib/udev/rules.d/60-persistent-storage.rules \
     /lib/udev/rules.d/61*edd* /lib/udev/rules.d/64* /lib/udev/rules.d/80* \
-    /lib/udev/rules.d/95*
\ No newline at end of file
+    /lib/udev/rules.d/95*
+# make udevadm shut up about missing udev.conf
+inst /etc/udev/udev.conf
\ No newline at end of file
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 3/4] Trim out device nodes we do not have to actually create.
       [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2009-02-26  2:32   ` [PATCH 2/4] Modify getarg to be slightly more useful Victor Lowther
@ 2009-02-26  2:32   ` Victor Lowther
  2009-02-26  2:32   ` [PATCH 4/4] Add some predefined break points Victor Lowther
  2009-02-26 12:20   ` [PATCH 1/4] Move actually mounting the root filesystem into its own series of hooks Karel Zak
  3 siblings, 0 replies; 11+ messages in thread
From: Victor Lowther @ 2009-02-26  2:32 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

If plymouth needs more, it can add them back in the hooks.
---
 init |   10 +++-------
 1 files changed, 3 insertions(+), 7 deletions(-)

diff --git a/init b/init
index c3f5150..f5b4177 100755
--- a/init
+++ b/init
@@ -40,16 +40,12 @@ mount -t sysfs /sys /sys
 mount -t tmpfs -omode=0755 udev /dev
 read CMDLINE </proc/cmdline;
 
-
-# FIXME: what device nodes does plymouth really _need_ ?
+# Make some basic devices first, let udev handle the rest
 mknod /dev/ptmx c 5 2
-mknod /dev/console c 5 0
-mknod /dev/fb c 29 0
+mknod /dev/null c 1 3
+mknod /dev/console c 5 1
 mkdir /dev/pts
 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
-mknod /dev/tty0 c 4 0
-mknod /dev/tty1 c 4 1
-mknod /dev/null c 1 3
 
 # pre-udev scripts run before udev starts, and are run only once.
 source_all pre-udev
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 4/4] Add some predefined break points.
       [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2009-02-26  2:32   ` [PATCH 2/4] Modify getarg to be slightly more useful Victor Lowther
  2009-02-26  2:32   ` [PATCH 3/4] Trim out device nodes we do not have to actually create Victor Lowther
@ 2009-02-26  2:32   ` Victor Lowther
       [not found]     ` <43ca8d3a8aed54367069b23fc43720cbf5517ec0.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  2009-02-26 12:20   ` [PATCH 1/4] Move actually mounting the root filesystem into its own series of hooks Karel Zak
  3 siblings, 1 reply; 11+ messages in thread
From: Victor Lowther @ 2009-02-26  2:32 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

We now have a breakpoint just before each of the hook invocations, and one
just before we switch to the real root.
---
 init |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/init b/init
index f5b4177..74b3368 100755
--- a/init
+++ b/init
@@ -48,18 +48,20 @@ mkdir /dev/pts
 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
 
 # pre-udev scripts run before udev starts, and are run only once.
+getarg 'break=pre-udev' && emergency_shell
 source_all pre-udev
 
 # start up udev and trigger cold plugs
 udevd --daemon
 udevadm trigger >/dev/null 2>&1
-udevadm settle --timeout=30
+udevadm settle --timeout=30 >/dev/null 2>&1
 
 NEWROOT="/sysroot"
 # pre-mount happens before we try to mount the root filesystem,
 # and happens once.
+getarg 'break=pre-mount' && emergency_shell
 source_all pre-mount
-
+getarg 'break=mount' && emergency_shell
 # mount scripts actually try to mount the root filesystem, and may
 # be sourced any number of times. As soon as one suceeds, no more are sourced.
 while :; do
@@ -83,7 +85,9 @@ done
 }
 
 # pre pivot scripts are sourced just before we switch over to the new root.
+getarg 'break=pre-pivot' && emergency_shell
 source_all pre-pivot
+getarg break && emergency_shell
 echo "Switching to real root filesystem $root"
 exec switch_root "$NEWROOT" "$INIT"  $CMDLINE || {
     # davej doesn't like initrd bugs
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 1/4] Move actually mounting the root filesystem into its own series of hooks.
       [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
                     ` (2 preceding siblings ...)
  2009-02-26  2:32   ` [PATCH 4/4] Add some predefined break points Victor Lowther
@ 2009-02-26 12:20   ` Karel Zak
  3 siblings, 0 replies; 11+ messages in thread
From: Karel Zak @ 2009-02-26 12:20 UTC (permalink / raw)
  To: Victor Lowther; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA, Kay Sievers

On Wed, Feb 25, 2009 at 06:32:36PM -0800, Victor Lowther wrote:
> We now have mount hooks.  They are sourced in an infinite loop until one of
> them actually mounts the real root filesystem.
> 
> This makes it easier to add support for arbitrarily complex schemes to find
> the root filesystem without having to patch the init script.
> 
> This patch series is also avaialble ass the hookify-finding-root branch at 
> http://git.fnordovax.org/dracut
> 
> ---
>  hooks/mount-partition.sh |   30 ++++++++++++++++++++++++++++
>  init                     |   49 ++++++++++++++++-----------------------------
>  modules/90crypt.sh       |    2 +-
>  modules/99base.sh        |    4 +-
>  4 files changed, 51 insertions(+), 34 deletions(-)
> 
> diff --git a/hooks/mount-partition.sh b/hooks/mount-partition.sh
> new file mode 100755
> index 0000000..53a0f4c
> --- /dev/null
> +++ b/hooks/mount-partition.sh
> @@ -0,0 +1,30 @@
> +#!/bin/sh
> +[ "$root" ] || {
> +    root=$(getarg root); root=${root#root=}
> +    case $root in
> +	LABEL=*) root=${root#LABEL=}
> +            root="$(echo $root |sed 's,/,\\x2f,g')"
> +            root="/dev/disk/by-label/${root}" ;;

 Note that this is probably not a proper way how to encode a label
 string. I guess that LABEL= option (e.g. from grub.conf) is in human
 readable format (like in /etc/fstab). The mount(8) also supports
 quoted LABELs and UUIDs (e.g. LABEL="foo").

 Currently we don't have a command line util that supports all these
 features, the problem should be fixed in the next util-linux-ng
 release by blkid(8).
 
    Karel

-- 
 Karel Zak  <kzak-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] Add some predefined break points.
       [not found]     ` <43ca8d3a8aed54367069b23fc43720cbf5517ec0.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2009-02-26 14:04       ` Bogdan Costescu
       [not found]         ` <Pine.LNX.4.64.0902261501070.2766-qcrbbFV08EMdmw7VdWMmteH3J2bgQ+4lG9Ur7JDdleE@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Bogdan Costescu @ 2009-02-26 14:04 UTC (permalink / raw)
  To: Victor Lowther; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On Wed, 25 Feb 2009, Victor Lowther wrote:

> +getarg 'break=pre-udev' && emergency_shell

I would like to suggest doing something different: look for the value 
of the 'break' parameter at the very beginning and save it in a 
variable such that it would be possible to modify it in the shell run 
for the breakpoint to point to a later breakpoint - this way one can 
do a gradual checking of the initramfs progress by going from one 
breakpoint to the next.

-- 
Bogdan Costescu

IWR, University of Heidelberg, INF 368, D-69120 Heidelberg, Germany
Phone: +49 6221 54 8240, Fax: +49 6221 54 8850
E-mail: bogdan.costescu-hEciA7+sKtudPOQpRHQ53DeJuz7u0hKX@public.gmane.org
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] Add some predefined break points.
       [not found]         ` <Pine.LNX.4.64.0902261501070.2766-qcrbbFV08EMdmw7VdWMmteH3J2bgQ+4lG9Ur7JDdleE@public.gmane.org>
@ 2009-02-27 17:15           ` Victor Lowther
       [not found]             ` <1235754943.6445.3.camel-76q0VzFBGGr21HsLBtNmTckMGDeJXHgy@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: Victor Lowther @ 2009-02-27 17:15 UTC (permalink / raw)
  To: Bogdan Costescu; +Cc: initramfs-u79uwXL29TY76Z2rM5mHXA

On Thu, 2009-02-26 at 15:04 +0100, Bogdan Costescu wrote:
> On Wed, 25 Feb 2009, Victor Lowther wrote:
> 
> > +getarg 'break=pre-udev' && emergency_shell
> 
> I would like to suggest doing something different: look for the value 
> of the 'break' parameter at the very beginning and save it in a 
> variable such that it would be possible to modify it in the shell run 
> for the breakpoint to point to a later breakpoint - this way one can 
> do a gradual checking of the initramfs progress by going from one 
> breakpoint to the next.

Not a bad idea.  I will code something up for this.

> 
-- 
Victor Lowther
RHCE# 805008539634727
LPIC-2# LPI000140019

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] Add some predefined break points.
       [not found]             ` <1235754943.6445.3.camel-76q0VzFBGGr21HsLBtNmTckMGDeJXHgy@public.gmane.org>
@ 2009-03-01 15:07               ` maximilian attems
       [not found]                 ` <20090301150733.GA12608-U9r9yeDMy7A@public.gmane.org>
  0 siblings, 1 reply; 11+ messages in thread
From: maximilian attems @ 2009-03-01 15:07 UTC (permalink / raw)
  To: Victor Lowther; +Cc: Bogdan Costescu, initramfs-u79uwXL29TY76Z2rM5mHXA

On Fri, 27 Feb 2009, Victor Lowther wrote:

> On Thu, 2009-02-26 at 15:04 +0100, Bogdan Costescu wrote:
> > On Wed, 25 Feb 2009, Victor Lowther wrote:
> > 
> > > +getarg 'break=pre-udev' && emergency_shell
> > 
> > I would like to suggest doing something different: look for the value 
> > of the 'break' parameter at the very beginning and save it in a 
> > variable such that it would be possible to modify it in the shell run 
> > for the breakpoint to point to a later breakpoint - this way one can 
> > do a gradual checking of the initramfs progress by going from one 
> > breakpoint to the next.
> 
> Not a bad idea.  I will code something up for this.

right as this is initramfs-tools inspired, we use a variable
and have those predefined breakpoints:
(top, modules, premount, mount, mountroot, bottom, init).

-- 
maks

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] Add some predefined break points.
       [not found]                 ` <20090301150733.GA12608-U9r9yeDMy7A@public.gmane.org>
@ 2009-03-01 15:56                   ` Thiago Galesi
  2009-03-01 20:02                   ` Victor Lowther
  1 sibling, 0 replies; 11+ messages in thread
From: Thiago Galesi @ 2009-03-01 15:56 UTC (permalink / raw)
  To: maximilian attems
  Cc: Victor Lowther, Bogdan Costescu, initramfs-u79uwXL29TY76Z2rM5mHXA

This may be a 'naive idea' but would it be possible to have an
argument that makes Ctrl-C (or something) works

Case in point: things that take a long time to (or will never)
timeout. Supppose someone is booting from NFS and the server is down,
or changed ip. Murphy says you're going to forget to change it until
you're there waiting for it. Or maybe it's something else that's
problematic and you want to debug.

Just an idea.



On Sun, Mar 1, 2009 at 12:07 PM, maximilian attems <max-U9r9yeDMy7A@public.gmane.org> wrote:
> On Fri, 27 Feb 2009, Victor Lowther wrote:
>
>> On Thu, 2009-02-26 at 15:04 +0100, Bogdan Costescu wrote:
>> > On Wed, 25 Feb 2009, Victor Lowther wrote:
>> >
>> > > +getarg 'break=pre-udev' && emergency_shell
>> >
>> > I would like to suggest doing something different: look for the value
>> > of the 'break' parameter at the very beginning and save it in a
>> > variable such that it would be possible to modify it in the shell run
>> > for the breakpoint to point to a later breakpoint - this way one can
>> > do a gradual checking of the initramfs progress by going from one
>> > breakpoint to the next.
>>
>> Not a bad idea.  I will code something up for this.
>
> right as this is initramfs-tools inspired, we use a variable
> and have those predefined breakpoints:
> (top, modules, premount, mount, mountroot, bottom, init).
>
> --
> maks
>
> --
> To unsubscribe from this list: send the line "unsubscribe initramfs" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



-- 
-
Thiago Galesi
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 4/4] Add some predefined break points.
       [not found]                 ` <20090301150733.GA12608-U9r9yeDMy7A@public.gmane.org>
  2009-03-01 15:56                   ` Thiago Galesi
@ 2009-03-01 20:02                   ` Victor Lowther
  1 sibling, 0 replies; 11+ messages in thread
From: Victor Lowther @ 2009-03-01 20:02 UTC (permalink / raw)
  To: maximilian attems
  Cc: Bogdan Costescu,
	initramfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org

On Mar 1, 2009, at 9:07 AM, maximilian attems <max-U9r9yeDMy7A@public.gmane.org> wrote:

> On Fri, 27 Feb 2009, Victor Lowther wrote:
>
>> On Thu, 2009-02-26 at 15:04 +0100, Bogdan Costescu wrote:
>>> On Wed, 25 Feb 2009, Victor Lowther wrote:
>>>
>>>> +getarg 'break=pre-udev' && emergency_shell
>>>
>>> I would like to suggest doing something different: look for the  
>>> value
>>> of the 'break' parameter at the very beginning and save it in a
>>> variable such that it would be possible to modify it in the shell  
>>> run
>>> for the breakpoint to point to a later breakpoint - this way one can
>>> do a gradual checking of the initramfs progress by going from one
>>> breakpoint to the next.
>>
>> Not a bad idea.  I will code something up for this.
>
> right as this is initramfs-tools inspired, we use a variable
> and have those predefined breakpoints:
> (top, modules, premount, mount, mountroot, bottom, init).

Using the same names as debian would be misleading, as we do not have  
the same phases as the debian initramfs.

>
> -- 
> maks
>
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 4/4] Add some predefined break points.
       [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1236220506.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
@ 2009-03-05  2:40   ` Victor Lowther
  0 siblings, 0 replies; 11+ messages in thread
From: Victor Lowther @ 2009-03-05  2:40 UTC (permalink / raw)
  To: initramfs-u79uwXL29TY76Z2rM5mHXA

We now have a breakpoint just before each of the hook invocations, and one
just before we switch to the real root.

I looked at parsing out the break= option early in the init script with an
eye towards letting it be changed when we drop into in interactive shell, but
environment variable inheritance made that too much of a bother.

Passing multiple break= options should work just fine, however.

---
 init |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/init b/init
index f5b4177..74b3368 100755
--- a/init
+++ b/init
@@ -48,18 +48,20 @@ mkdir /dev/pts
 mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts
 
 # pre-udev scripts run before udev starts, and are run only once.
+getarg 'break=pre-udev' && emergency_shell
 source_all pre-udev
 
 # start up udev and trigger cold plugs
 udevd --daemon
 udevadm trigger >/dev/null 2>&1
-udevadm settle --timeout=30
+udevadm settle --timeout=30 >/dev/null 2>&1
 
 NEWROOT="/sysroot"
 # pre-mount happens before we try to mount the root filesystem,
 # and happens once.
+getarg 'break=pre-mount' && emergency_shell
 source_all pre-mount
-
+getarg 'break=mount' && emergency_shell
 # mount scripts actually try to mount the root filesystem, and may
 # be sourced any number of times. As soon as one suceeds, no more are sourced.
 while :; do
@@ -83,7 +85,9 @@ done
 }
 
 # pre pivot scripts are sourced just before we switch over to the new root.
+getarg 'break=pre-pivot' && emergency_shell
 source_all pre-pivot
+getarg break && emergency_shell
 echo "Switching to real root filesystem $root"
 exec switch_root "$NEWROOT" "$INIT"  $CMDLINE || {
     # davej doesn't like initrd bugs
-- 
1.6.0.6

--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2009-03-05  2:40 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-26  2:32 [PATCH 1/4] Move actually mounting the root filesystem into its own series of hooks Victor Lowther
     [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-02-26  2:32   ` [PATCH 2/4] Modify getarg to be slightly more useful Victor Lowther
2009-02-26  2:32   ` [PATCH 3/4] Trim out device nodes we do not have to actually create Victor Lowther
2009-02-26  2:32   ` [PATCH 4/4] Add some predefined break points Victor Lowther
     [not found]     ` <43ca8d3a8aed54367069b23fc43720cbf5517ec0.1235615253.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-02-26 14:04       ` Bogdan Costescu
     [not found]         ` <Pine.LNX.4.64.0902261501070.2766-qcrbbFV08EMdmw7VdWMmteH3J2bgQ+4lG9Ur7JDdleE@public.gmane.org>
2009-02-27 17:15           ` Victor Lowther
     [not found]             ` <1235754943.6445.3.camel-76q0VzFBGGr21HsLBtNmTckMGDeJXHgy@public.gmane.org>
2009-03-01 15:07               ` maximilian attems
     [not found]                 ` <20090301150733.GA12608-U9r9yeDMy7A@public.gmane.org>
2009-03-01 15:56                   ` Thiago Galesi
2009-03-01 20:02                   ` Victor Lowther
2009-02-26 12:20   ` [PATCH 1/4] Move actually mounting the root filesystem into its own series of hooks Karel Zak
  -- strict thread matches above, loose matches on Subject: below --
2009-03-05  2:40 [PATCH 1/4] Move " Victor Lowther
     [not found] ` <40b7db44cbcb49b1fb50445d786cd4851adba14a.1236220506.git.victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2009-03-05  2:40   ` [PATCH 4/4] Add some predefined break points Victor Lowther

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.