Browse Source

init: extended to handle UUID=, LABEL= and nfs:host:path as root=

0.2-maint
Alejandro Mery 15 years ago
parent
commit
b99e58d227
2 changed files with 48 additions and 9 deletions
  1. +16
    -0
      initramfs/etc_rc.d_rc.sysinit.sh
  2. +32
    -9
      initramfs/etc_rc.d_rc.trymount.sh

+ 16
- 0
initramfs/etc_rc.d_rc.sysinit.sh

@ -42,9 +42,25 @@ for x in $(cat /proc/cmdline | tr -d ";\"'"); do
esac
done
root_method=device
case "$root" in
nfs:*) root="${root#nfs:}"
root_method=nfs
;;
UUID=*|LABEL=*)
root_method=find
;;
/dev/*)
;;
*)
root="/dev/$root"
;;
esac
cat > /etc/conf/idunn <<EOT
rootfs="/rootfs"
root="$root"
root_method="$root_method"
root_mode="${root_mode:-ro}"
init="${init:-/sbin/init}"
initopt="$*"

+ 32
- 9
initramfs/etc_rc.d_rc.trymount.sh

@ -3,7 +3,7 @@
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: target/idunn/initramfs/etc_rc.d_rc.trymount.sh
# Copyright (C) 2008 The OpenSDE Project
# Copyright (C) 2008 - 2009 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
@ -27,19 +27,42 @@ if grep -q "^[^ ]* $rootfs " /proc/mounts; then
elif [ -n "$root" ]; then
. /etc/rc.d/functions.in
title "Mouting $root at $rootfs."
check /lib/udev/vol_id "$root" > /tmp/vol_id.$$
. /tmp/vol_id.$$
rm -f /tmp/vol_id.$$
root_type=
root_tag=
root_options="$root_mode"
if [ -n "$ID_FS_TYPE" ]; then
modprobe -q "$ID_FS_TYPE"
check mount -t "$ID_FS_TYPE" -o "$root_mode" "$root" "$rootfs"
case "$root_method" in
nfs)
root_type="$root_method"
root_options="$root_options,nolock,intr,tcp"
;;
find) # UUID= or LABEL=
root_tag="$root"
root=$(blkid -l -o device -t "$root_tag")
[ -z "$root" ] || root_type=$(blkid -l -o value -t TYPE "$root")
[ -z "$root_type" ] || root_tag="$root_tag, $root_type"
;;
device)
root_type=$(blkid -l -o value -t TYPE "$root")
;;
esac
if [ -z "$root" ]; then
title "Mounting $root_tag at $rootfs."
elif [ -z "$root_tag" ]; then
title "Mounting $root ($root_type) at $rootfs."
else
title "Mounting $root ($root_tag) at $rootfs."
fi
if [ -n "$root_type" ]; then
modprobe -q "$root_type"
check mount -t "$root_type" -o "$root_options" "$root" "$rootfs"
else
check false
fi
status
status
else
[ -z "$verbose" ] ||
cat <<-EOT >&2

Loading…
Cancel
Save