* [RFC PATCH 1/9] nfsroot: move to same sort order as block methods
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
@ 2009-06-01 2:45 ` David Dillow
[not found] ` <145ca9e5b331c454ebe13005fdfaed3749ef50f5.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-01 3:19 ` [RFC PATCH 2/9] block root: split out resume parsing and udev rules David Dillow
` (8 subsequent siblings)
9 siblings, 1 reply; 28+ messages in thread
From: David Dillow @ 2009-06-01 2:45 UTC (permalink / raw)
To: initramfs
There is no reason for this to be a 40nfsroot rather than 95nfs
once other network root handlers are added. Go ahead and move it.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
modules.d/40nfsroot/60-nfsroot.rules | 1 -
modules.d/40nfsroot/check | 11 ---
modules.d/40nfsroot/install | 27 -------
modules.d/40nfsroot/nfsroot | 125 --------------------------------
modules.d/40nfsroot/nfsroot-cleanup.sh | 19 -----
modules.d/95nfs/60-nfsroot.rules | 1 +
modules.d/95nfs/check | 11 +++
modules.d/95nfs/install | 27 +++++++
modules.d/95nfs/nfsroot | 125 ++++++++++++++++++++++++++++++++
modules.d/95nfs/nfsroot-cleanup.sh | 19 +++++
10 files changed, 183 insertions(+), 183 deletions(-)
delete mode 100644 modules.d/40nfsroot/60-nfsroot.rules
delete mode 100755 modules.d/40nfsroot/check
delete mode 100755 modules.d/40nfsroot/install
delete mode 100755 modules.d/40nfsroot/nfsroot
delete mode 100644 modules.d/40nfsroot/nfsroot-cleanup.sh
create mode 100644 modules.d/95nfs/60-nfsroot.rules
create mode 100755 modules.d/95nfs/check
create mode 100755 modules.d/95nfs/install
create mode 100755 modules.d/95nfs/nfsroot
create mode 100644 modules.d/95nfs/nfsroot-cleanup.sh
diff --git a/modules.d/40nfsroot/60-nfsroot.rules b/modules.d/40nfsroot/60-nfsroot.rules
deleted file mode 100644
index 99a2acf..0000000
--- a/modules.d/40nfsroot/60-nfsroot.rules
+++ /dev/null
@@ -1 +0,0 @@
-ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/nfsroot $env{INTERFACE}"
diff --git a/modules.d/40nfsroot/check b/modules.d/40nfsroot/check
deleted file mode 100755
index 0625322..0000000
--- a/modules.d/40nfsroot/check
+++ /dev/null
@@ -1,11 +0,0 @@
-#!/bin/sh
-# We depend on network modules being loaded
-[ "$1" = "-d" ] && echo network
-
-# If hostonly was requested, fail the check if we are not actually
-# booting from root.
-[ "$1" = "-h" ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && exit 1
-
-# If our prerequisites are not met, fail anyways.
-which rpcbind rpc.statd mount.nfs mount.nfs4 umount >/dev/null 2>&1 || exit 1
-exit 0
diff --git a/modules.d/40nfsroot/install b/modules.d/40nfsroot/install
deleted file mode 100755
index 80b59a1..0000000
--- a/modules.d/40nfsroot/install
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/sh
-dracut_install rpcbind rpc.statd mount.nfs mount.nfs4 umount
-dracut_install /etc/netconfig /etc/passwd /etc/services
-
-# XXX debug stuff
-dracut_install rpcinfo ping strace dmesg nc free df
-
-dracut_install rpc.idmapd /etc/idmapd.conf
-
-instmods nfs
-inst_rules "$moddir/60-nfsroot.rules"
-inst_hook pre-pivot 70 "$moddir/nfsroot-cleanup.sh"
-inst "$moddir/nfsroot" "/sbin/nfsroot"
-mkdir -p "$initdir/var/lib/nfs/rpc_pipefs"
-mkdir -p "$initdir/var/lib/rpcbind"
-mkdir -p "$initdir/var/lib/nfs/statd/sm"
-
-# XXX debug
-mkdir -p "$initdir/mnt"
-
-# Rather than copy the passwd file in, just set a user for rpcbind
-# We'll save the state and restart the daemon from the root anyway
-#echo "rpc:x:32:32:Rpcbind:/var/lib/rpcbind:/bin/false" >> "$initdir/etc/passwd"
-
-# rpc user needs to be able to write to this directory to save the warmstart
-# file
-chmod 777 "$initdir/var/lib/rpcbind"
diff --git a/modules.d/40nfsroot/nfsroot b/modules.d/40nfsroot/nfsroot
deleted file mode 100755
index b8858bc..0000000
--- a/modules.d/40nfsroot/nfsroot
+++ /dev/null
@@ -1,125 +0,0 @@
-#!/bin/sh
-
-. /lib/dracut-lib
-
-PATH=$PATH:/sbin:/usr/sbin
-
-# XXX needs error handling like ifup/dhclient-script
-
-# XXX need to lock our attempts if we're doing the mount here
-
-getarg rdnetdebug && {
- exec > /tmp/nfsroot.$1.$$.out
- exec 2>> /tmp/nfsroot.$1.$$.out
- set -x
-}
-
-[ "$NFS_LOCKED" ] || {
- NFS_LOCKED=true
- export NFS_LOCKED
- exec flock -xo /tmp/nfs.lock -c "$0 $*"
- exit 1
-}
-
-[ -e /tmp/nfsdone ] && exit 0
-
-nfs_done() {
- >/tmp/nfsdone
- exit 0
-}
-
-root=$(getarg root)
-case $root in
- nfs|/dev/nfs) type=nfs ;;
- nfs4|/dev/nfs4) type=nfs4 ;;
- auto|'') type=auto ;;
-esac
-
-rootfstype=$(getarg rootfstype)
-case $rootfstype in
- nfs|nfs4|auto) type=$rootfstype ;;
-esac
-
-# If we're not doing NFS at all, don't keep banging our head
-[ -n "$type" ] || nfs_done
-
-[ -e /tmp/net.$1.dhcpopts ] && . /tmp/net.$1.dhcpopts
-
-nfsroot=$(getarg nfsroot)
-[ -n "$nfsroot" ] || nfsroot="$new_root_path"
-[ -n "$nfsroot" ] || nfs_done
-
-# check for IP address at front, if there is none, use
-# new_dhcp_server_identifier
-#
-# XXX kernel nfsroot uses , to separate NFS options at end
-#
-nfsserver=${nfsroot%%:*}; nfsroot=${nfsroot#*:}
-nfspath=${nfsroot%%:*}
-flags=${nfsroot#*:}
-[ "$nfsserver" = "$nfspath" ] && nfsserver=$new_dhcp_server_identifier
-[ "$nfspath" = "$flags" ] && unset flags
-
-[ -n "$nfsserver" ] || no_nfs
-
-# look through the flags and see if any are overridden by the command line
-while [ -n "$flags" ]; do
- f=${flags%%,*}; flags=${flags#*,}
- [ "$f" = "nfs" -o "$f" = "nfs4" ] && {
- [ "$type" = "auto" ] && type=$f
- continue
- }
- [ "$f" = "ro" -o "$f" = "rw" ] && {
- nfsrw=$f
- continue
- }
- [ "$f" = "lock" -o "$f" = "nolock" ] && {
- nfslock=$f
- continue
- }
- nfsflags=${nfsflags+$nfsflags,}$f
-done
-
-getarg ro && nfsrw=ro
-getarg rw && nfsrw=rw
-nfsflags=${nfsflags+$nfsflags,}${nfsrw}
-
-# load our modules explicitly, so we can fail fast in the future
-modprobe nfs || nfs_done
-
-# XXX don't forget to move /var/lib/nfs/rpc_pipefs to new /
-# XXX need host name set before now?
-
-# Start rpcbind and rpc.statd as mount won't let us use locks on a NFSv4
-# filesystem without talking to them, even though they are unneeded
-# XXX occasionally saw 'rpcbind: fork failed: No such device' -- why?
-[ -n "$(pidof rpcbind)" ] || rpcbind
-[ -n "$(pidof rpc.statd)" ] || rpc.statd
-
-# XXX should I do rpc.idmapd here, or wait and start in the new root
-# XXX waiting assumes root can read everything it needs right up until
-# XXX we start it...
-
-# XXX really, want to retry in a loop I think, but not here...
-
-[ "$type" = "nfs4" -o "$type" = "auto" ] && {
- # XXX really needed? Do we need non-root users before we start it in
- # XXX the real root image?
- [ -n "$(pidof rpc.idmapd)" ] || rpc.idmapd
-
- # NFSv4 does locks internally
- mount -t nfs4 -o${nfsflags}${nfslock+,$nfslock} \
- $nfsserver:$nfspath /sysroot && nfs_done
-
- # If we're specified to be NFSv4, then stop when we fail
- # Don't mark us done, as this may be transient
- [ "$type" = "nfs4" ] && exit 0
-}
-
-# we're NFSv{2,3} or auto and NFSv4 failed. We don't support using locks
-# on NFSv{2,3} because that requires a helper to transfer the rpcbind state
-# rpcbind to the new root
-[ -z "$nfslock" -o "$nfslock" = "lock" ] &&
- echo "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
-mount -t nfs -onolock,$nfsflags $nfsserver:$nfspath /sysroot && nfs_done
-exit 0
diff --git a/modules.d/40nfsroot/nfsroot-cleanup.sh b/modules.d/40nfsroot/nfsroot-cleanup.sh
deleted file mode 100644
index b8f3a2f..0000000
--- a/modules.d/40nfsroot/nfsroot-cleanup.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/sh
-
-pid=$(pidof rpc.statd)
-[ -n "$pid" ] && kill $pid
-
-pid=$(pidof rpcbind)
-[ -n "$pid" ] && kill $pid
-
-if grep -q rpc_pipefs /proc/mounts; then
- # try to create the destination directory
- [ -d $NEWROOT/var/lib/nfs/rpc_pipefs ] || mkdir -p $NEWROOT/var/lib/nfs/rpc_pipefs 2>/dev/null
-
- if [ -d $NEWROOT/var/lib/nfs/rpc_pipefs ]; then
- mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/var/lib/nfs/rpc_pipefs
- else
- umount /var/lib/nfs/rpc_pipefs
- fi
-fi
-
diff --git a/modules.d/95nfs/60-nfsroot.rules b/modules.d/95nfs/60-nfsroot.rules
new file mode 100644
index 0000000..99a2acf
--- /dev/null
+++ b/modules.d/95nfs/60-nfsroot.rules
@@ -0,0 +1 @@
+ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/nfsroot $env{INTERFACE}"
diff --git a/modules.d/95nfs/check b/modules.d/95nfs/check
new file mode 100755
index 0000000..0625322
--- /dev/null
+++ b/modules.d/95nfs/check
@@ -0,0 +1,11 @@
+#!/bin/sh
+# We depend on network modules being loaded
+[ "$1" = "-d" ] && echo network
+
+# If hostonly was requested, fail the check if we are not actually
+# booting from root.
+[ "$1" = "-h" ] && ! egrep -q '/ nfs[34 ]' /proc/mounts && exit 1
+
+# If our prerequisites are not met, fail anyways.
+which rpcbind rpc.statd mount.nfs mount.nfs4 umount >/dev/null 2>&1 || exit 1
+exit 0
diff --git a/modules.d/95nfs/install b/modules.d/95nfs/install
new file mode 100755
index 0000000..80b59a1
--- /dev/null
+++ b/modules.d/95nfs/install
@@ -0,0 +1,27 @@
+#!/bin/sh
+dracut_install rpcbind rpc.statd mount.nfs mount.nfs4 umount
+dracut_install /etc/netconfig /etc/passwd /etc/services
+
+# XXX debug stuff
+dracut_install rpcinfo ping strace dmesg nc free df
+
+dracut_install rpc.idmapd /etc/idmapd.conf
+
+instmods nfs
+inst_rules "$moddir/60-nfsroot.rules"
+inst_hook pre-pivot 70 "$moddir/nfsroot-cleanup.sh"
+inst "$moddir/nfsroot" "/sbin/nfsroot"
+mkdir -p "$initdir/var/lib/nfs/rpc_pipefs"
+mkdir -p "$initdir/var/lib/rpcbind"
+mkdir -p "$initdir/var/lib/nfs/statd/sm"
+
+# XXX debug
+mkdir -p "$initdir/mnt"
+
+# Rather than copy the passwd file in, just set a user for rpcbind
+# We'll save the state and restart the daemon from the root anyway
+#echo "rpc:x:32:32:Rpcbind:/var/lib/rpcbind:/bin/false" >> "$initdir/etc/passwd"
+
+# rpc user needs to be able to write to this directory to save the warmstart
+# file
+chmod 777 "$initdir/var/lib/rpcbind"
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
new file mode 100755
index 0000000..b8858bc
--- /dev/null
+++ b/modules.d/95nfs/nfsroot
@@ -0,0 +1,125 @@
+#!/bin/sh
+
+. /lib/dracut-lib
+
+PATH=$PATH:/sbin:/usr/sbin
+
+# XXX needs error handling like ifup/dhclient-script
+
+# XXX need to lock our attempts if we're doing the mount here
+
+getarg rdnetdebug && {
+ exec > /tmp/nfsroot.$1.$$.out
+ exec 2>> /tmp/nfsroot.$1.$$.out
+ set -x
+}
+
+[ "$NFS_LOCKED" ] || {
+ NFS_LOCKED=true
+ export NFS_LOCKED
+ exec flock -xo /tmp/nfs.lock -c "$0 $*"
+ exit 1
+}
+
+[ -e /tmp/nfsdone ] && exit 0
+
+nfs_done() {
+ >/tmp/nfsdone
+ exit 0
+}
+
+root=$(getarg root)
+case $root in
+ nfs|/dev/nfs) type=nfs ;;
+ nfs4|/dev/nfs4) type=nfs4 ;;
+ auto|'') type=auto ;;
+esac
+
+rootfstype=$(getarg rootfstype)
+case $rootfstype in
+ nfs|nfs4|auto) type=$rootfstype ;;
+esac
+
+# If we're not doing NFS at all, don't keep banging our head
+[ -n "$type" ] || nfs_done
+
+[ -e /tmp/net.$1.dhcpopts ] && . /tmp/net.$1.dhcpopts
+
+nfsroot=$(getarg nfsroot)
+[ -n "$nfsroot" ] || nfsroot="$new_root_path"
+[ -n "$nfsroot" ] || nfs_done
+
+# check for IP address at front, if there is none, use
+# new_dhcp_server_identifier
+#
+# XXX kernel nfsroot uses , to separate NFS options at end
+#
+nfsserver=${nfsroot%%:*}; nfsroot=${nfsroot#*:}
+nfspath=${nfsroot%%:*}
+flags=${nfsroot#*:}
+[ "$nfsserver" = "$nfspath" ] && nfsserver=$new_dhcp_server_identifier
+[ "$nfspath" = "$flags" ] && unset flags
+
+[ -n "$nfsserver" ] || no_nfs
+
+# look through the flags and see if any are overridden by the command line
+while [ -n "$flags" ]; do
+ f=${flags%%,*}; flags=${flags#*,}
+ [ "$f" = "nfs" -o "$f" = "nfs4" ] && {
+ [ "$type" = "auto" ] && type=$f
+ continue
+ }
+ [ "$f" = "ro" -o "$f" = "rw" ] && {
+ nfsrw=$f
+ continue
+ }
+ [ "$f" = "lock" -o "$f" = "nolock" ] && {
+ nfslock=$f
+ continue
+ }
+ nfsflags=${nfsflags+$nfsflags,}$f
+done
+
+getarg ro && nfsrw=ro
+getarg rw && nfsrw=rw
+nfsflags=${nfsflags+$nfsflags,}${nfsrw}
+
+# load our modules explicitly, so we can fail fast in the future
+modprobe nfs || nfs_done
+
+# XXX don't forget to move /var/lib/nfs/rpc_pipefs to new /
+# XXX need host name set before now?
+
+# Start rpcbind and rpc.statd as mount won't let us use locks on a NFSv4
+# filesystem without talking to them, even though they are unneeded
+# XXX occasionally saw 'rpcbind: fork failed: No such device' -- why?
+[ -n "$(pidof rpcbind)" ] || rpcbind
+[ -n "$(pidof rpc.statd)" ] || rpc.statd
+
+# XXX should I do rpc.idmapd here, or wait and start in the new root
+# XXX waiting assumes root can read everything it needs right up until
+# XXX we start it...
+
+# XXX really, want to retry in a loop I think, but not here...
+
+[ "$type" = "nfs4" -o "$type" = "auto" ] && {
+ # XXX really needed? Do we need non-root users before we start it in
+ # XXX the real root image?
+ [ -n "$(pidof rpc.idmapd)" ] || rpc.idmapd
+
+ # NFSv4 does locks internally
+ mount -t nfs4 -o${nfsflags}${nfslock+,$nfslock} \
+ $nfsserver:$nfspath /sysroot && nfs_done
+
+ # If we're specified to be NFSv4, then stop when we fail
+ # Don't mark us done, as this may be transient
+ [ "$type" = "nfs4" ] && exit 0
+}
+
+# we're NFSv{2,3} or auto and NFSv4 failed. We don't support using locks
+# on NFSv{2,3} because that requires a helper to transfer the rpcbind state
+# rpcbind to the new root
+[ -z "$nfslock" -o "$nfslock" = "lock" ] &&
+ echo "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
+mount -t nfs -onolock,$nfsflags $nfsserver:$nfspath /sysroot && nfs_done
+exit 0
diff --git a/modules.d/95nfs/nfsroot-cleanup.sh b/modules.d/95nfs/nfsroot-cleanup.sh
new file mode 100644
index 0000000..b8f3a2f
--- /dev/null
+++ b/modules.d/95nfs/nfsroot-cleanup.sh
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+pid=$(pidof rpc.statd)
+[ -n "$pid" ] && kill $pid
+
+pid=$(pidof rpcbind)
+[ -n "$pid" ] && kill $pid
+
+if grep -q rpc_pipefs /proc/mounts; then
+ # try to create the destination directory
+ [ -d $NEWROOT/var/lib/nfs/rpc_pipefs ] || mkdir -p $NEWROOT/var/lib/nfs/rpc_pipefs 2>/dev/null
+
+ if [ -d $NEWROOT/var/lib/nfs/rpc_pipefs ]; then
+ mount --move /var/lib/nfs/rpc_pipefs $NEWROOT/var/lib/nfs/rpc_pipefs
+ else
+ umount /var/lib/nfs/rpc_pipefs
+ fi
+fi
+
--
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] 28+ messages in thread* [RFC PATCH 2/9] block root: split out resume parsing and udev rules
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-01 2:45 ` [RFC PATCH 1/9] nfsroot: move to same sort order as block methods David Dillow
@ 2009-06-01 3:19 ` David Dillow
2009-06-01 3:33 ` [RFC PATCH 3/9] dracut: add cmdline hook David Dillow
` (7 subsequent siblings)
9 siblings, 0 replies; 28+ messages in thread
From: David Dillow @ 2009-06-01 3:19 UTC (permalink / raw)
To: initramfs
We have a resume module, and these rules should live in it. Modify
the sort order a bit to ensure the resume rules continue to execute
first.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
modules.d/95resume/install | 3 ++-
modules.d/95resume/resume-genrules.sh | 6 ++++++
modules.d/95rootfs-block/block-genrules.sh | 6 ++++++
modules.d/95rootfs-block/genrules.sh | 14 --------------
modules.d/95rootfs-block/install | 4 ++--
modules.d/95rootfs-block/parse-root-opts.sh | 6 ------
6 files changed, 16 insertions(+), 23 deletions(-)
create mode 100755 modules.d/95resume/resume-genrules.sh
create mode 100755 modules.d/95rootfs-block/block-genrules.sh
delete mode 100755 modules.d/95rootfs-block/genrules.sh
diff --git a/modules.d/95resume/install b/modules.d/95resume/install
index 532fcc3..e656d53 100755
--- a/modules.d/95resume/install
+++ b/modules.d/95resume/install
@@ -1,4 +1,5 @@
#!/bin/bash
+dracut_install echo
inst_hook pre-udev 10 "$moddir/parse-resume.sh"
+inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
inst_hook mount 90 "$moddir/resume.sh"
-
diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh
new file mode 100755
index 0000000..108c3f7
--- /dev/null
+++ b/modules.d/95resume/resume-genrules.sh
@@ -0,0 +1,6 @@
+resume=$(getarg resume=) && ! getarg noresume && {
+(
+ /bin/echo -e 'KERNEL=="'${resume#/dev/}'", RUN+="/bin/echo %M:%m > /sys/power/resume"'
+ /bin/echo -e 'SYMLINK=="'${resume#/dev/}'", RUN+="/bin/echo %M:%m > /sys/power/resume"'
+) >> /etc/udev/rules.d/99-resume.rules
+}
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
new file mode 100755
index 0000000..47083df
--- /dev/null
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -0,0 +1,6 @@
+if [ "${root#/dev/}" != "$root" ]; then
+ (
+ echo 'KERNEL=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
+ echo 'SYMLINK=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
+ ) >> /etc/udev/rules.d/99-mount.rules
+fi
diff --git a/modules.d/95rootfs-block/genrules.sh b/modules.d/95rootfs-block/genrules.sh
deleted file mode 100755
index 4662a32..0000000
--- a/modules.d/95rootfs-block/genrules.sh
+++ /dev/null
@@ -1,14 +0,0 @@
-if [ "${root#/dev/}" != "$root" ]; then
-
- resume=$(getarg resume=) && ! getarg noresume && {
- (
- /bin/echo -e 'KERNEL=="'${resume#/dev/}'", RUN+="/bin/echo %M:%m > /sys/power/resume"'
- /bin/echo -e 'SYMLINK=="'${resume#/dev/}'", RUN+="/bin/echo %M:%m > /sys/power/resume"'
- ) >> /etc/udev/rules.d/99-resume.rules
- }
-
- (
- echo 'KERNEL=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
- echo 'SYMLINK=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
- ) >> /etc/udev/rules.d/99-mount.rules
-fi
\ No newline at end of file
diff --git a/modules.d/95rootfs-block/install b/modules.d/95rootfs-block/install
index bf36cae..9d53855 100755
--- a/modules.d/95rootfs-block/install
+++ b/modules.d/95rootfs-block/install
@@ -1,5 +1,5 @@
#!/bin/sh
dracut_install echo
-inst_hook pre-udev 10 "$moddir/parse-root-opts.sh"
-inst_hook pre-udev 20 "$moddir/genrules.sh"
+inst_hook pre-udev 20 "$moddir/parse-root-opts.sh"
+inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
diff --git a/modules.d/95rootfs-block/parse-root-opts.sh b/modules.d/95rootfs-block/parse-root-opts.sh
index 9c49aa9..3a8b1a6 100755
--- a/modules.d/95rootfs-block/parse-root-opts.sh
+++ b/modules.d/95rootfs-block/parse-root-opts.sh
@@ -1,10 +1,4 @@
#!/bin/sh
-if resume=$(getarg resume=) && ! getarg noresume; then
- export resume
- echo "$resume" >/.resume
-else
- unset resume
-fi
root=$(getarg root=)
case $root in
--
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] 28+ messages in thread* [RFC PATCH 3/9] dracut: add cmdline hook
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-01 2:45 ` [RFC PATCH 1/9] nfsroot: move to same sort order as block methods David Dillow
2009-06-01 3:19 ` [RFC PATCH 2/9] block root: split out resume parsing and udev rules David Dillow
@ 2009-06-01 3:33 ` David Dillow
2009-06-01 4:21 ` [RFC PATCH 4/9] cmdline: cleanup handling and block: handler David Dillow
` (6 subsequent siblings)
9 siblings, 0 replies; 28+ messages in thread
From: David Dillow @ 2009-06-01 3:33 UTC (permalink / raw)
To: initramfs
This hook is where each module should parse kernel command line
options and perform any legacy translation.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
dracut | 2 +-
modules.d/95resume/install | 2 +-
modules.d/95rootfs-block/install | 2 +-
modules.d/99base/init | 4 ++++
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/dracut b/dracut
index f25cf85..84c194e 100755
--- a/dracut
+++ b/dracut
@@ -96,7 +96,7 @@ if [[ -f $outfile && ! $force ]]; then
exit 1
fi
-hookdirs="pre-udev pre-mount pre-pivot mount emergency"
+hookdirs="cmdline pre-udev pre-mount pre-pivot mount emergency"
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
diff --git a/modules.d/95resume/install b/modules.d/95resume/install
index e656d53..945611e 100755
--- a/modules.d/95resume/install
+++ b/modules.d/95resume/install
@@ -1,5 +1,5 @@
#!/bin/bash
dracut_install echo
-inst_hook pre-udev 10 "$moddir/parse-resume.sh"
+inst_hook cmdline 10 "$moddir/parse-resume.sh"
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
inst_hook mount 90 "$moddir/resume.sh"
diff --git a/modules.d/95rootfs-block/install b/modules.d/95rootfs-block/install
index 9d53855..722e47b 100755
--- a/modules.d/95rootfs-block/install
+++ b/modules.d/95rootfs-block/install
@@ -1,5 +1,5 @@
#!/bin/sh
dracut_install echo
-inst_hook pre-udev 20 "$moddir/parse-root-opts.sh"
+inst_hook cmdline 20 "$moddir/parse-root-opts.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 9ff2ff4..9ea4747 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -43,6 +43,10 @@ mknod /dev/console c 5 1
mkdir /dev/pts
mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1
+# run scriptlets to parse the command line
+getarg 'rdbreak=cmdline' && emergency_shell
+source_all cmdline
+
# pre-udev scripts run before udev starts, and are run only once.
getarg 'rdbreak=pre-udev' && emergency_shell
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] 28+ messages in thread* [RFC PATCH 4/9] cmdline: cleanup handling and block: handler
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (2 preceding siblings ...)
2009-06-01 3:33 ` [RFC PATCH 3/9] dracut: add cmdline hook David Dillow
@ 2009-06-01 4:21 ` David Dillow
[not found] ` <d15c7a1ab71af9ab4fccd51fa02915e949f39c86.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-01 4:25 ` [RFC PATCH 5/9] resume: add support for labeled resume devices David Dillow
` (5 subsequent siblings)
9 siblings, 1 reply; 28+ messages in thread
From: David Dillow @ 2009-06-01 4:21 UTC (permalink / raw)
To: initramfs
Now init checks that we understood the root= option, and can
act upon it, presenting and error if not. Also, clean up the
generation of udev rules such that we don't require /bin/echo.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
modules.d/95rootfs-block/block-genrules.sh | 10 +++++++---
modules.d/95rootfs-block/install | 4 ++--
modules.d/95rootfs-block/parse-block.sh | 16 ++++++++++++++++
modules.d/95rootfs-block/parse-root-opts.sh | 15 +++++----------
modules.d/99base/init | 12 ++++++++++++
5 files changed, 42 insertions(+), 15 deletions(-)
create mode 100755 modules.d/95rootfs-block/parse-block.sh
diff --git a/modules.d/95rootfs-block/block-genrules.sh b/modules.d/95rootfs-block/block-genrules.sh
index 47083df..5c3f957 100755
--- a/modules.d/95rootfs-block/block-genrules.sh
+++ b/modules.d/95rootfs-block/block-genrules.sh
@@ -1,6 +1,10 @@
-if [ "${root#/dev/}" != "$root" ]; then
+#!/bin/bash # for highlighting
+
+if [ "${root%%:*}" = "block" ]; then
(
- echo 'KERNEL=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
- echo 'SYMLINK=="'${root#/dev/}'", RUN+="/bin/mount '$fstype' -o '$rflags' '$root' '$NEWROOT'" '
+ printf 'KERNEL=="%s", RUN+="/bin/mount -t %s -o %s %s %s"\n' \
+ ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
+ printf 'SYMLINK=="%s", RUN+="/bin/mount -t %s -o %s %s %s"\n' \
+ ${root#block:/dev/} "$fstype" "$rflags" "${root#block:}" "$NEWROOT"
) >> /etc/udev/rules.d/99-mount.rules
fi
diff --git a/modules.d/95rootfs-block/install b/modules.d/95rootfs-block/install
index 722e47b..b977f9b 100755
--- a/modules.d/95rootfs-block/install
+++ b/modules.d/95rootfs-block/install
@@ -1,5 +1,5 @@
#!/bin/sh
-dracut_install echo
-inst_hook cmdline 20 "$moddir/parse-root-opts.sh"
+inst_hook cmdline 10 "$moddir/parse-root-opts.sh"
+inst_hook cmdline 95 "$moddir/parse-block.sh"
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
inst_hook mount 99 "$moddir/mount-root.sh"
diff --git a/modules.d/95rootfs-block/parse-block.sh b/modules.d/95rootfs-block/parse-block.sh
new file mode 100755
index 0000000..4b6ecfa
--- /dev/null
+++ b/modules.d/95rootfs-block/parse-block.sh
@@ -0,0 +1,16 @@
+#!/bin/bash # for highlighting
+
+case "$root" in
+ block:LABEL=*|LABEL=*)
+ root="${root#block:}"
+ root="$(echo $root | sed 's,/,\\x2f,g')"
+ root="block:/dev/disk/by-label/${root#LABEL=}"
+ rootok=1 ;;
+ block:UUID=*|UUID=*)
+ root="${root#block:}"
+ root="block:/dev/disk/by-uuid/${root#UUID=}"
+ rootok=1 ;;
+ /dev/*)
+ root="block:${root}"
+ rootok=1 ;;
+esac
diff --git a/modules.d/95rootfs-block/parse-root-opts.sh b/modules.d/95rootfs-block/parse-root-opts.sh
index 3a8b1a6..dc0ae6d 100755
--- a/modules.d/95rootfs-block/parse-root-opts.sh
+++ b/modules.d/95rootfs-block/parse-root-opts.sh
@@ -1,14 +1,6 @@
-#!/bin/sh
+#!/bin/bash # for highlighting
root=$(getarg 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
if rflags="$(getarg rootflags=)"; then
getarg rw && rflags="${rflags},rw" || rflags="${rflags},ro"
@@ -16,6 +8,9 @@ else
getarg rw && rflags=rw || rflags=ro
fi
-fstype="$(getarg rootfstype=)" && fstype="-t ${fstype}"
+fstype="$(getarg rootfstype=)"
+if [ -z "$fstype" ]; then
+ fstype="auto"
+fi
export fstype rflags root
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 9ea4747..ebbc6ad 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -47,6 +47,18 @@ mount -t devpts -o gid=5,mode=620 /dev/pts /dev/pts >/dev/null 2>&1
getarg 'rdbreak=cmdline' && emergency_shell
source_all cmdline
+if [ -z "$rootok" -a -n "${root%%error:*}" ]; then
+ root="error: No handler for root=${root}"
+fi
+
+if [ -z "${root%%error:*}" ]; then
+ case "${root%%:*}" in
+ '') echo "FATAL: no root= option specified" ;;
+ error) echo "FATAL: ${root#error:}" ;;
+ esac
+ emergency_shell
+fi
+
# pre-udev scripts run before udev starts, and are run only once.
getarg 'rdbreak=pre-udev' && emergency_shell
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] 28+ messages in thread* [RFC PATCH 5/9] resume: add support for labeled resume devices
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (3 preceding siblings ...)
2009-06-01 4:21 ` [RFC PATCH 4/9] cmdline: cleanup handling and block: handler David Dillow
@ 2009-06-01 4:25 ` David Dillow
[not found] ` <9810ce7e38ec1ba52a9c2f5f5047ea779d1006a3.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-01 4:39 ` [RFC PATCH 6/9] dracut-lib: add source_all to library David Dillow
` (4 subsequent siblings)
9 siblings, 1 reply; 28+ messages in thread
From: David Dillow @ 2009-06-01 4:25 UTC (permalink / raw)
To: initramfs
I noticed when doing the block root= parser that resume
didn't support labeled resume devices. Fix that up and
get rid of a dependency on /bin/echo in the process.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
modules.d/95resume/install | 1 -
modules.d/95resume/parse-resume.sh | 8 ++++++++
modules.d/95resume/resume-genrules.sh | 14 ++++++++------
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/modules.d/95resume/install b/modules.d/95resume/install
index 945611e..cecd2fc 100755
--- a/modules.d/95resume/install
+++ b/modules.d/95resume/install
@@ -1,5 +1,4 @@
#!/bin/bash
-dracut_install echo
inst_hook cmdline 10 "$moddir/parse-resume.sh"
inst_hook pre-udev 30 "$moddir/resume-genrules.sh"
inst_hook mount 90 "$moddir/resume.sh"
diff --git a/modules.d/95resume/parse-resume.sh b/modules.d/95resume/parse-resume.sh
index 447e151..94d7112 100755
--- a/modules.d/95resume/parse-resume.sh
+++ b/modules.d/95resume/parse-resume.sh
@@ -5,3 +5,11 @@ if resume=$(getarg resume=) && ! getarg noresume; then
else
unset resume
fi
+
+case "$resume" in
+ LABEL=*)
+ resume="$(echo $resume | sed 's,/,\\x2f,g')"
+ resume="/dev/disk/by-label/${resume#LABEL=}" ;;
+ UUID=*)
+ resume="/dev/disk/by-uuid/${resume#UUID=}" ;;
+esac
diff --git a/modules.d/95resume/resume-genrules.sh b/modules.d/95resume/resume-genrules.sh
index 108c3f7..7c95715 100755
--- a/modules.d/95resume/resume-genrules.sh
+++ b/modules.d/95resume/resume-genrules.sh
@@ -1,6 +1,8 @@
-resume=$(getarg resume=) && ! getarg noresume && {
-(
- /bin/echo -e 'KERNEL=="'${resume#/dev/}'", RUN+="/bin/echo %M:%m > /sys/power/resume"'
- /bin/echo -e 'SYMLINK=="'${resume#/dev/}'", RUN+="/bin/echo %M:%m > /sys/power/resume"'
-) >> /etc/udev/rules.d/99-resume.rules
-}
+if [ -n "$resume" ]; then
+ (
+ printf 'KERNEL=="%s", RUN+="/bin/echo %%M:%%m > /sys/power/resume"\n' \
+ ${resume#/dev/}
+ printf 'SYMLINK=="%s", RUN+="/bin/echo %%M:%%m > /sys/power/resume"\n' \
+ ${resume#/dev/}
+ ) >> /etc/udev/rules.d/99-resume.rules
+fi
--
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] 28+ messages in thread* [RFC PATCH 6/9] dracut-lib: add source_all to library
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (4 preceding siblings ...)
2009-06-01 4:25 ` [RFC PATCH 5/9] resume: add support for labeled resume devices David Dillow
@ 2009-06-01 4:39 ` David Dillow
2009-06-01 4:42 ` [RFC PATCH 7/9] netroot: add common handler for network root devices David Dillow
` (3 subsequent siblings)
9 siblings, 0 replies; 28+ messages in thread
From: David Dillow @ 2009-06-01 4:39 UTC (permalink / raw)
To: initramfs
The network root handler will need this.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
modules.d/99base/dracut-lib | 6 ++++++
modules.d/99base/init | 6 ------
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/modules.d/99base/dracut-lib b/modules.d/99base/dracut-lib
index 1f31933..7078827 100644
--- a/modules.d/99base/dracut-lib
+++ b/modules.d/99base/dracut-lib
@@ -14,3 +14,9 @@ getarg() {
done
return 1
}
+
+source_all() {
+ local f
+ [ "$1" ] && [ -d "/$1" ] || return
+ for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
+}
diff --git a/modules.d/99base/init b/modules.d/99base/init
index ebbc6ad..73e96fd 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -14,12 +14,6 @@ emergency_shell()
sh -i
}
-source_all() {
- local f
- [ "$1" ] && [ -d "/$1" ] || return
- for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
-}
-
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=linux
NEWROOT="/sysroot"
--
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] 28+ messages in thread* [RFC PATCH 7/9] netroot: add common handler for network root devices
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (5 preceding siblings ...)
2009-06-01 4:39 ` [RFC PATCH 6/9] dracut-lib: add source_all to library David Dillow
@ 2009-06-01 4:42 ` David Dillow
[not found] ` <7d7efa4a3d959a5f834cd1d5e73c1e15112aa77c.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-01 4:53 ` [RFC PATCH 8/9] nfsroot: move to netroot framework David Dillow
` (2 subsequent siblings)
9 siblings, 1 reply; 28+ messages in thread
From: David Dillow @ 2009-06-01 4:42 UTC (permalink / raw)
To: initramfs
/sbin/netroot is a jumping off point to allow various network
root devices to share infrastructure. It will loop over scriptlets
in the netroot handler, looking for a handler to run for this type
of netroot. Handlers can do choose to act based on command line
options to the kernel, or via DHCP options received on this interface.
They should massage root= into a form suitable for their handler.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
dracut | 2 +-
modules.d/40network/60-net.rules | 1 +
modules.d/40network/dhcp-fallback.sh | 14 +++++++++
modules.d/40network/ifup | 8 ++--
modules.d/40network/install | 2 +
modules.d/40network/netroot | 52 ++++++++++++++++++++++++++++++++++
modules.d/99base/init | 11 ++++++-
7 files changed, 84 insertions(+), 6 deletions(-)
create mode 100755 modules.d/40network/dhcp-fallback.sh
create mode 100755 modules.d/40network/netroot
diff --git a/dracut b/dracut
index 84c194e..e5e7ecd 100755
--- a/dracut
+++ b/dracut
@@ -96,7 +96,7 @@ if [[ -f $outfile && ! $force ]]; then
exit 1
fi
-hookdirs="cmdline pre-udev pre-mount pre-pivot mount emergency"
+hookdirs="cmdline pre-udev netroot pre-mount pre-pivot mount emergency"
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
trap 'rm -rf "$initdir"' 0 # clean up after ourselves no matter how we die.
diff --git a/modules.d/40network/60-net.rules b/modules.d/40network/60-net.rules
index 4b030c3..6c79508 100644
--- a/modules.d/40network/60-net.rules
+++ b/modules.d/40network/60-net.rules
@@ -1 +1,2 @@
ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"
+ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/netroot $env{INTERFACE}"
diff --git a/modules.d/40network/dhcp-fallback.sh b/modules.d/40network/dhcp-fallback.sh
new file mode 100755
index 0000000..1f4ec0c
--- /dev/null
+++ b/modules.d/40network/dhcp-fallback.sh
@@ -0,0 +1,14 @@
+# We should go last, and default the root if needed
+
+if [ -z "$root" ]; then
+ root=dhcp
+fi
+
+if [ "$root" = "dhcp" -a -z "$netroot" ]; then
+ rootok=1
+ netroot=dhcp
+fi
+
+if [ "${netroot+set}" = "set" ]; then
+ eval "echo netroot='$netroot'" > /tmp/netroot.info
+fi
diff --git a/modules.d/40network/ifup b/modules.d/40network/ifup
index ee4bc4a..981a207 100755
--- a/modules.d/40network/ifup
+++ b/modules.d/40network/ifup
@@ -12,8 +12,10 @@ getarg rdnetdebug && {
netif=$1
-# bail immediatly if the interface is already up
+# bail immediately if the interface is already up
+# or we don't need the network
[ -f "/tmp/net.$netif.up" ] && exit 0
+[ ! -f /tmp/netroot.info ] && exit 0
# loopback is always handled the same way
[ "$netif" = "lo" ] && {
@@ -93,10 +95,8 @@ ip_to_var() {
[ -n "$autoconf" ] || autoconf=off
}
-root=$(getarg root)
ip=$(getarg ip)
-
-if [ "$root" = "dhcp" -a -z "$ip" ]; then
+if [ -z "$ip" ]; then
do_dhcp;
else
# spin through the kernel command line, looking for ip= lines
diff --git a/modules.d/40network/install b/modules.d/40network/install
index d9ec7f0..3112494 100755
--- a/modules.d/40network/install
+++ b/modules.d/40network/install
@@ -2,8 +2,10 @@
dracut_install ip dhclient hostname
instmods =net
inst "$moddir/ifup" "/sbin/ifup"
+inst "$moddir/netroot" "/sbin/netroot"
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
instmods =networking ecb arc4
inst_rules "$moddir/60-net.rules"
+inst_hook cmdline 99 "$moddir/dhcp-fallback.sh"
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
mkdir -p "${initdir}/var/run"
diff --git a/modules.d/40network/netroot b/modules.d/40network/netroot
new file mode 100755
index 0000000..3d03e72
--- /dev/null
+++ b/modules.d/40network/netroot
@@ -0,0 +1,52 @@
+#!/bin/sh
+
+. /lib/dracut-lib
+
+getarg rdnetdebug && {
+ exec >/tmp/netroot.$1.$$.out
+ exec 2>>/tmp/netroot.$1.$$.out
+ set -x
+}
+
+# Only try to configure from one network interface at a time
+#
+[ "$NETROOT_LOCKED" ] || {
+ NETROOT_LOCKED=true
+ export NETROOT_LOCKED
+ exec flock -xo /tmp/netroot.lock -c "$0 $*"
+ exit 1
+}
+
+netif=$1
+
+# If we've already found a root, or we don't have the info we need,
+# then no point in looking further
+#
+[ -e /tmp/netroot.done ] && exit 0
+[ -s /tmp/netroot.info -a -s /tmp/root.info ] || exit 0
+
+# Pick up our config from the command line; we may already know the
+# handler to run
+#
+. /tmp/root.info
+. /tmp/netroot.info
+[ -e /tmp/net.$netif.dhcpopts ] && . /tmp/net.$netif.dhcpopts
+
+# Now, let the installed network root handlers figure this out
+#
+source_all netroot
+
+# If we didn't get a handler set, then we're done
+#
+if [ -z "$handler" ]; then
+ # XXX informative error message?
+ exit 0
+fi
+
+# Run the handler; don't store the root, it may change from device to device
+# XXX other variables to export?
+export NEWROOT
+if $handler $netif $root; then
+ >/tmp/netroot.done
+fi
+exit 0
diff --git a/modules.d/99base/init b/modules.d/99base/init
index 73e96fd..b4fce6a 100755
--- a/modules.d/99base/init
+++ b/modules.d/99base/init
@@ -47,12 +47,21 @@ fi
if [ -z "${root%%error:*}" ]; then
case "${root%%:*}" in
- '') echo "FATAL: no root= option specified" ;;
+ '') echo "FATAL: no root= option specified, and no network support" ;;
error) echo "FATAL: ${root#error:}" ;;
esac
emergency_shell
fi
+# Network root scripts may need updated root= options,
+# so deposit them where they can see them (udev purges the env)
+{
+ echo "root='$root'"
+ echo "rflags='$rflags'"
+ echo "fstype='$fstype'"
+ echo "NEWROOT='$NEWROOT'"
+} > /tmp/root.info
+
# pre-udev scripts run before udev starts, and are run only once.
getarg 'rdbreak=pre-udev' && emergency_shell
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] 28+ messages in thread* [RFC PATCH 8/9] nfsroot: move to netroot framework
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (6 preceding siblings ...)
2009-06-01 4:42 ` [RFC PATCH 7/9] netroot: add common handler for network root devices David Dillow
@ 2009-06-01 4:53 ` David Dillow
2009-06-01 4:59 ` [RFC PATCH 9/9] Add NBD support David Dillow
2009-06-01 8:58 ` [RFC PATCH 0/9] netroot: modular support for network root devices Seewer Philippe
9 siblings, 0 replies; 28+ messages in thread
From: David Dillow @ 2009-06-01 4:53 UTC (permalink / raw)
To: initramfs
Parse and convert commandline options in the cmdline hook, and
fill in the missing pieces in the netroot hook. This also allows
root=dhcp to work as expected.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
modules.d/95nfs/60-nfsroot.rules | 1 -
modules.d/95nfs/install | 10 +---
modules.d/95nfs/nfs-netroot.sh | 52 +++++++++++++++++++
modules.d/95nfs/nfsroot | 105 +++++++++++--------------------------
modules.d/95nfs/parse-nfsroot.sh | 48 +++++++++++++++++
modules.d/99base/dracut-lib | 16 ++++++
6 files changed, 149 insertions(+), 83 deletions(-)
delete mode 100644 modules.d/95nfs/60-nfsroot.rules
create mode 100755 modules.d/95nfs/nfs-netroot.sh
create mode 100755 modules.d/95nfs/parse-nfsroot.sh
diff --git a/modules.d/95nfs/60-nfsroot.rules b/modules.d/95nfs/60-nfsroot.rules
deleted file mode 100644
index 99a2acf..0000000
--- a/modules.d/95nfs/60-nfsroot.rules
+++ /dev/null
@@ -1 +0,0 @@
-ACTION=="online", SUBSYSTEM=="net", RUN+="/sbin/nfsroot $env{INTERFACE}"
diff --git a/modules.d/95nfs/install b/modules.d/95nfs/install
index 80b59a1..8d7366f 100755
--- a/modules.d/95nfs/install
+++ b/modules.d/95nfs/install
@@ -1,23 +1,17 @@
#!/bin/sh
dracut_install rpcbind rpc.statd mount.nfs mount.nfs4 umount
dracut_install /etc/netconfig /etc/passwd /etc/services
-
-# XXX debug stuff
-dracut_install rpcinfo ping strace dmesg nc free df
-
dracut_install rpc.idmapd /etc/idmapd.conf
instmods nfs
-inst_rules "$moddir/60-nfsroot.rules"
+inst_hook cmdline 90 "$moddir/parse-nfsroot.sh"
+inst_hook netroot 90 "$moddir/nfs-netroot.sh"
inst_hook pre-pivot 70 "$moddir/nfsroot-cleanup.sh"
inst "$moddir/nfsroot" "/sbin/nfsroot"
mkdir -p "$initdir/var/lib/nfs/rpc_pipefs"
mkdir -p "$initdir/var/lib/rpcbind"
mkdir -p "$initdir/var/lib/nfs/statd/sm"
-# XXX debug
-mkdir -p "$initdir/mnt"
-
# Rather than copy the passwd file in, just set a user for rpcbind
# We'll save the state and restart the daemon from the root anyway
#echo "rpc:x:32:32:Rpcbind:/var/lib/rpcbind:/bin/false" >> "$initdir/etc/passwd"
diff --git a/modules.d/95nfs/nfs-netroot.sh b/modules.d/95nfs/nfs-netroot.sh
new file mode 100755
index 0000000..ac72163
--- /dev/null
+++ b/modules.d/95nfs/nfs-netroot.sh
@@ -0,0 +1,52 @@
+#!/bin/sh # for highlighting
+
+# If we're auto-detecting our root type from DHCP, see if this looks like
+# an NFS root option. As the variety of root-path formats is large, validate
+# that the number of colons match what we expect, and our glob didn't
+# inadvertently match a different handler's.
+#
+if [ "$root" = "dhcp" -o "$root" = "nfs" -o "$root" = "nfs4" ]; then
+ nfsver=nfs
+ if [ "$root" = "nfs4" ]; then
+ nfsver=nfs4
+ fi
+ case "$new_root_path" in
+ nfs:*|nfs4:*) root="$new_root_path" ;;
+ *:/*:*)
+ if check_occurances "$new_root_path" ':' 2; then
+ root="$nfsver:$new_root_path"
+ fi ;;
+ *:/*)
+ if check_occurances "$new_root_path" ':' 1; then
+ root="$nfsver:$new_root_path:"
+ fi ;;
+ /*:*)
+ if check_occurances "$new_root_path" ':' 1; then
+ root="$nfsver::$new_root_path"
+ fi ;;
+ /*)
+ if check_occurances "$new_root_path" ':' 0; then
+ root="$nfsver::$new_root_path:"
+ fi ;;
+ esac
+fi
+
+if [ -z "${root%%nfs:*}" -o -z "${root%%nfs4:*}" ]; then
+ # Fill in missing information from DHCP
+ nfsver=${root%%:*}; root=${root#*:}
+ nfsserver=${root%%:*}; root=${root#*:}
+ nfspath=${root%%:*}
+ nfsflags=${root#*:}
+
+ # XXX where does dhclient stash the next-server option? Do we care?
+ if [ -z "$nfsserver" -o "$nfsserver" = "$nfspath" ]; then
+ nfsserver=$new_dhcp_server_identifier
+ fi
+ if [ "$nfspath" = "$nfsflags" ]; then
+ unset nfsflags
+ fi
+
+ # XXX validate we have all the required info?
+ root="$nfsver:$nfsserver:$nfspath:$nfsflags"
+ handler=/sbin/nfsroot
+fi
diff --git a/modules.d/95nfs/nfsroot b/modules.d/95nfs/nfsroot
index b8858bc..18e1300 100755
--- a/modules.d/95nfs/nfsroot
+++ b/modules.d/95nfs/nfsroot
@@ -6,77 +6,38 @@ PATH=$PATH:/sbin:/usr/sbin
# XXX needs error handling like ifup/dhclient-script
-# XXX need to lock our attempts if we're doing the mount here
-
getarg rdnetdebug && {
exec > /tmp/nfsroot.$1.$$.out
exec 2>> /tmp/nfsroot.$1.$$.out
set -x
}
-[ "$NFS_LOCKED" ] || {
- NFS_LOCKED=true
- export NFS_LOCKED
- exec flock -xo /tmp/nfs.lock -c "$0 $*"
- exit 1
-}
-
-[ -e /tmp/nfsdone ] && exit 0
-
-nfs_done() {
- >/tmp/nfsdone
- exit 0
-}
-
-root=$(getarg root)
-case $root in
- nfs|/dev/nfs) type=nfs ;;
- nfs4|/dev/nfs4) type=nfs4 ;;
- auto|'') type=auto ;;
-esac
-
-rootfstype=$(getarg rootfstype)
-case $rootfstype in
- nfs|nfs4|auto) type=$rootfstype ;;
-esac
-
-# If we're not doing NFS at all, don't keep banging our head
-[ -n "$type" ] || nfs_done
-
-[ -e /tmp/net.$1.dhcpopts ] && . /tmp/net.$1.dhcpopts
+# root is in the form root=nfs[4]:server:path:[options]
+netif="$1"
+root="$2"
-nfsroot=$(getarg nfsroot)
-[ -n "$nfsroot" ] || nfsroot="$new_root_path"
-[ -n "$nfsroot" ] || nfs_done
-
-# check for IP address at front, if there is none, use
-# new_dhcp_server_identifier
-#
-# XXX kernel nfsroot uses , to separate NFS options at end
-#
-nfsserver=${nfsroot%%:*}; nfsroot=${nfsroot#*:}
-nfspath=${nfsroot%%:*}
-flags=${nfsroot#*:}
-[ "$nfsserver" = "$nfspath" ] && nfsserver=$new_dhcp_server_identifier
-[ "$nfspath" = "$flags" ] && unset flags
-
-[ -n "$nfsserver" ] || no_nfs
+nfsver=${root%%:*}; root=${root#*:}
+nfsserver=${root%%:*}; root=${root#*:}
+nfspath=${root%%:*}
+flags=${root#*:}
# look through the flags and see if any are overridden by the command line
+# Append a , so we know we terminate
+flags=${flags},
while [ -n "$flags" ]; do
- f=${flags%%,*}; flags=${flags#*,}
- [ "$f" = "nfs" -o "$f" = "nfs4" ] && {
- [ "$type" = "auto" ] && type=$f
- continue
- }
- [ "$f" = "ro" -o "$f" = "rw" ] && {
+ f=${flags%%,*}
+ flags=${flags#*,}
+ if [ -z "$f" ]; then
+ break
+ fi
+ if [ "$f" = "ro" -o "$f" = "rw" ]; then
nfsrw=$f
continue
- }
- [ "$f" = "lock" -o "$f" = "nolock" ] && {
+ fi
+ if [ "$f" = "lock" -o "$f" = "nolock" ]; then
nfslock=$f
continue
- }
+ fi
nfsflags=${nfsflags+$nfsflags,}$f
done
@@ -84,11 +45,10 @@ getarg ro && nfsrw=ro
getarg rw && nfsrw=rw
nfsflags=${nfsflags+$nfsflags,}${nfsrw}
-# load our modules explicitly, so we can fail fast in the future
-modprobe nfs || nfs_done
+# Load the modules so the filesystem type is there
+modprobe nfs || exit 1
# XXX don't forget to move /var/lib/nfs/rpc_pipefs to new /
-# XXX need host name set before now?
# Start rpcbind and rpc.statd as mount won't let us use locks on a NFSv4
# filesystem without talking to them, even though they are unneeded
@@ -102,24 +62,21 @@ modprobe nfs || nfs_done
# XXX really, want to retry in a loop I think, but not here...
-[ "$type" = "nfs4" -o "$type" = "auto" ] && {
+if [ "$nfsver" = "nfs4" ]; then
# XXX really needed? Do we need non-root users before we start it in
# XXX the real root image?
- [ -n "$(pidof rpc.idmapd)" ] || rpc.idmapd
+ if [ -z "$(pidof rpc.idmapd)" ]; then
+ rpc.idmapd
+ fi
# NFSv4 does locks internally
- mount -t nfs4 -o${nfsflags}${nfslock+,$nfslock} \
- $nfsserver:$nfspath /sysroot && nfs_done
-
- # If we're specified to be NFSv4, then stop when we fail
- # Don't mark us done, as this may be transient
- [ "$type" = "nfs4" ] && exit 0
-}
+ exec mount -t nfs4 -o${nfsflags}${nfslock+,$nfslock} \
+ $nfsserver:$nfspath $NEWROOT
+fi
-# we're NFSv{2,3} or auto and NFSv4 failed. We don't support using locks
-# on NFSv{2,3} because that requires a helper to transfer the rpcbind state
-# rpcbind to the new root
+# NFSv{2,3} doesn't support using locks as it requires a helper to transfer
+# the rpcbind state to the new root
+#
[ -z "$nfslock" -o "$nfslock" = "lock" ] &&
echo "Locks unsupported on NFSv{2,3}, using nolock" 1>&2
-mount -t nfs -onolock,$nfsflags $nfsserver:$nfspath /sysroot && nfs_done
-exit 0
+exec mount -t nfs -onolock,$nfsflags $nfsserver:$nfspath $NEWROOT
diff --git a/modules.d/95nfs/parse-nfsroot.sh b/modules.d/95nfs/parse-nfsroot.sh
new file mode 100755
index 0000000..5201e4b
--- /dev/null
+++ b/modules.d/95nfs/parse-nfsroot.sh
@@ -0,0 +1,48 @@
+#!/bin/bash
+
+# We're 90-nfs.sh to catch root=/dev/nfs
+#
+# Preferred format:
+# root=nfs[4]:[server:]path[:options]
+#
+# If server is unspecified it will be pulled from one of the following
+# sources, in order:
+# static ip= option on kernel command line
+# DHCP next-server option
+# DHCP server-id option
+#
+# Legacy formats:
+# root=nfs[4]
+# root=/dev/nfs[4] nfsroot=[server:]path[,options]
+#
+# Plain "root=nfs" interprets DHCP root-path option as [ip:]path[:options]
+#
+# NFSv4 is only used if explicitly listed; default is NFSv3
+#
+
+case "$root" in
+ nfs|dhcp|'')
+ if getarg nfsroot= > /dev/null; then
+ root=nfs:$(getarg nfsroot=)
+ fi
+ ;;
+ nfs4)
+ if getarg nfsroot= > /dev/null; then
+ root=nfs4:$(getarg nfsroot=)
+ fi
+ ;;
+ /dev/nfs|/dev/nfs4)
+ if getarg nfsroot= > /dev/null; then
+ root=${root#/dev/}:$(getarg nfsroot=)
+ else
+ root=${root#/dev/}
+ fi
+ ;;
+esac
+
+case "$root" in
+ nfs|nfs4|nfs:*|nfs4:*)
+ rootok=1
+ netroot=nfs
+ ;;
+esac
diff --git a/modules.d/99base/dracut-lib b/modules.d/99base/dracut-lib
index 7078827..e3f4794 100644
--- a/modules.d/99base/dracut-lib
+++ b/modules.d/99base/dracut-lib
@@ -20,3 +20,19 @@ source_all() {
[ "$1" ] && [ -d "/$1" ] || return
for f in "/$1"/*.sh; do [ -f "$f" ] && . "$f"; done
}
+
+check_occurances() {
+ # Count the number of times the character $ch occurs in $str
+ # Return 0 if the count matches the expected number, 1 otherwise
+ local str="$1"
+ local ch="$2"
+ local expected="$3"
+ local count=0
+
+ while [ "${str#*$ch}" != "${str}" ]; do
+ str="${str#*$ch}"
+ count=$(( $count + 1 ))
+ done
+
+ [ $count -eq $expected ]
+}
--
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] 28+ messages in thread* [RFC PATCH 9/9] Add NBD support
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (7 preceding siblings ...)
2009-06-01 4:53 ` [RFC PATCH 8/9] nfsroot: move to netroot framework David Dillow
@ 2009-06-01 4:59 ` David Dillow
[not found] ` <2b117123ecd2d93cec8598593e966029dfb4777e.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
2009-06-01 8:58 ` [RFC PATCH 0/9] netroot: modular support for network root devices Seewer Philippe
9 siblings, 1 reply; 28+ messages in thread
From: David Dillow @ 2009-06-01 4:59 UTC (permalink / raw)
To: initramfs
This adds basic support for root on a network block device to
the netroot framework.
Signed-off-by: David Dillow <dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
---
modules.d/95nbd/check | 11 ++++
modules.d/95nbd/install | 7 +++
modules.d/95nbd/nbd-netroot.sh | 11 ++++
modules.d/95nbd/nbdroot | 96 ++++++++++++++++++++++++++++++++++++++
modules.d/95nbd/parse-nbdroot.sh | 49 +++++++++++++++++++
5 files changed, 174 insertions(+), 0 deletions(-)
create mode 100755 modules.d/95nbd/check
create mode 100755 modules.d/95nbd/install
create mode 100755 modules.d/95nbd/nbd-netroot.sh
create mode 100755 modules.d/95nbd/nbdroot
create mode 100755 modules.d/95nbd/parse-nbdroot.sh
diff --git a/modules.d/95nbd/check b/modules.d/95nbd/check
new file mode 100755
index 0000000..f94d63b
--- /dev/null
+++ b/modules.d/95nbd/check
@@ -0,0 +1,11 @@
+#!/bin/sh
+# We depend on network modules being loaded
+[ "$1" = "-d" ] && echo network
+
+# If hostonly was requested, fail the check if we are not actually
+# booting from root.
+[ "$1" = "-h" ] && ! egrep -q '/ /dev/nbd[0-9]*' /proc/mounts && exit 1
+
+# If our prerequisites are not met, fail anyways.
+which nbd-client >/dev/null 2>&1 || exit 1
+exit 0
diff --git a/modules.d/95nbd/install b/modules.d/95nbd/install
new file mode 100755
index 0000000..3a80da1
--- /dev/null
+++ b/modules.d/95nbd/install
@@ -0,0 +1,7 @@
+#!/bin/bash
+
+inst nbd-client
+inst_hook cmdline 90 "$moddir/parse-nbdroot.sh"
+inst_hook netroot 90 "$moddir/nbd-netroot.sh"
+inst "$moddir/nbdroot" "/sbin/nbdroot"
+instmods nbd
diff --git a/modules.d/95nbd/nbd-netroot.sh b/modules.d/95nbd/nbd-netroot.sh
new file mode 100755
index 0000000..74b3da8
--- /dev/null
+++ b/modules.d/95nbd/nbd-netroot.sh
@@ -0,0 +1,11 @@
+#!/bin/sh # for highlighting
+
+if [ "$root" = "dhcp" ]; then
+ if [ -n "$new_root_path" -a -z "${new_root_path%%nbd:*}" ]; then
+ root="$new_root_path"
+ fi
+fi
+
+if [ -z "${root%nbd:*}" ]; then
+ handler=/sbin/nbdroot
+fi
diff --git a/modules.d/95nbd/nbdroot b/modules.d/95nbd/nbdroot
new file mode 100755
index 0000000..51120c2
--- /dev/null
+++ b/modules.d/95nbd/nbdroot
@@ -0,0 +1,96 @@
+#!/bin/sh
+
+. /lib/dracut-lib
+
+PATH=$PATH:/sbin:/usr/sbin
+
+# XXX needs error handling like ifup/dhclient-script
+
+if getarg rdnetdebug; then
+ exec > /tmp/nbdroot.$1.$$.out
+ exec 2>> /tmp/nbdroot.$1.$$.out
+ set -x
+fi
+
+# root is in the form root=nbd:server:port:fstype:fsopts:nbdopts
+netif="$1"
+root="$2"
+
+root=${root#nbd:}
+nbdserver=${root%%:*}; root=${root#*:}
+nbdport=${root%%:*}; root=${root#*:}
+nbdfstype=${root%%:*}; root=${root#*:}
+nbdflags=${root%%:*}
+nbdopts=${root#*:}
+
+if [ "$nbdopts" = "$nbdflags" ]; then
+ unset nbdopts
+fi
+if [ "$nbdflags" = "$nbdfstype" ]; then
+ unset nbdflags
+fi
+if [ "$nbdfstype" = "$nbdport" ]; then
+ unset nbdfstype
+fi
+if [ -z "$nbdfstype" ]; then
+ nbdfstype=auto
+fi
+
+# look through the NBD options and pull out the ones that need to
+# go before the host etc. Append a ',' so we know we terminate the loop
+nbdopts=${nbdopts},
+while [ -n "$nbdopts" ]; do
+ f=${nbdopts%%,*}
+ nbdopts=${nbdopts#*,}
+ if [ -z "$f" ]; then
+ break
+ fi
+ if [ -z "${f%bs=*}" -o -z "${f%timeout=*}" ]; then
+ preopts="$preopts $f"
+ continue
+ fi
+ opts="$opts $f"
+done
+
+# look through the flags and see if any are overridden by the command line
+nbdflags=${nbdflags},
+while [ -n "$nbdflags" ]; do
+ f=${nbdflags%%,*}
+ nbdflags=${nbdflags#*,}
+ if [ -z "$f" ]; then
+ break
+ fi
+ if [ "$f" = "ro" -o "$f" = "rw" ]; then
+ nbdrw=$f
+ continue
+ fi
+ fsopts=${fsopts+$fsopts,}$f
+done
+
+getarg ro && nbdrw=ro
+getarg rw && nbdrw=rw
+fsopts=${fsopts+$fsopts,}${nbdrw}
+
+modprobe nbd || exit 1
+
+# XXX better way to wait for the device to be made?
+i=0
+while [ ! -b /dev/nbd0 ]; do
+ [ $i -ge 20 ] && exit 1
+ sleep 0.1
+ i=$(( $i + 1))
+done
+
+# XXX netroot expects to have the handler mount things, but we should
+# XXX allow LVM, LUKS, etc over nbd
+
+nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
+
+if ! mount -t $nbdfstype -o$fsopts /dev/nbd0 $NEWROOT; then
+ # Mount failed, clean up after ourselves so if we try a different
+ # interface it can succeed
+ nbd-client -d /dev/nbd0
+ exit 1
+fi
+
+exit 0
diff --git a/modules.d/95nbd/parse-nbdroot.sh b/modules.d/95nbd/parse-nbdroot.sh
new file mode 100755
index 0000000..4bedaab
--- /dev/null
+++ b/modules.d/95nbd/parse-nbdroot.sh
@@ -0,0 +1,49 @@
+#!/bin/dash
+
+# It'd be nice if this could share rules with 99-block.sh, but since
+# the kernel side adds nbd{1..16} when the module is loaded -- before
+# they are associated with a server -- we cannot use the udev add rule
+# to find it
+#
+# XXX actually we could, if we move to root=XXX and netroot=XXX, then
+# you could do root=LABEL=/ nbdroot=XXX, or netroot=nbd:XXX
+#
+# However, we need to be 90-nbd.sh to catch root=/dev/nbd*
+#
+# Preferred format:
+# root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
+#
+# nbdopts is a comma seperated list of options to give to nbd-client
+#
+#
+# Legacy formats:
+# nbdroot=srv,port
+# nbdroot=srv:port[:fstype[:rootflags[:nbdopts]]]
+# root=dhcp nbdroot=srv:port[:fstype[:rootflags[:nbdopts]]]
+# root=nbd nbdroot=srv:port[:fstype[:rootflags[:nbdopts]]]
+#
+
+case "$root" in
+ nbd|dhcp|'')
+ if getarg nbdroot= > /dev/null; then
+ root=nbd:$(getarg nbdroot=)
+ fi
+ ;;
+esac
+
+# Convert the Debian style to our syntax, but avoid matches on fs arguments
+case "$root" in
+ nbd:*,*)
+ if check_occurances "$root" ',' 1 && check_occurances "$root" ':' 1;
+ then
+ root=${root%*,}:${root#*,}
+ fi
+ ;;
+esac
+
+if [ "${root%%:*}" = "nbd" ]; then
+ # XXX validate options here?
+ # XXX generate udev rules?
+ rootok=1
+ netroot=nbd
+fi
--
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] 28+ messages in thread* Re: [RFC PATCH 0/9] netroot: modular support for network root devices
[not found] ` <cover.1243833882.git.dave-i1Mk8JYDVaaSihdK6806/g@public.gmane.org>
` (8 preceding siblings ...)
2009-06-01 4:59 ` [RFC PATCH 9/9] Add NBD support David Dillow
@ 2009-06-01 8:58 ` Seewer Philippe
9 siblings, 0 replies; 28+ messages in thread
From: Seewer Philippe @ 2009-06-01 8:58 UTC (permalink / raw)
To: David Dillow; +Cc: initramfs
Looks good!
David Dillow wrote:
> This builds on the NFS root work to allow other network methods to hook
> into the parsing and network infrastructure. One network interface is
> configured at a time, but if we don't find a root there, it may not be
> unconfigured -- this should probably be added.
This is a definite must. Actually, to support multiple interfaces we
should even go so far and ensure that there is only one interface
configured at any one time.
--> Consider the following case: Two interfaces and both receive a valid
default route via dhcp. If we allow both interfaces to be configured
after receiving the dhcp-reply, the second default-route will go byebye.
I suggest to move the actual interface (de-)configuration into the
netroot script.
Regards,
Philippe
--
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] 28+ messages in thread