From: Alex Hornung Date: Tue, 12 Jul 2011 17:13:05 +0000 (+0100) Subject: initrd - add tcplay root mount support X-Git-Tag: v2.12.0~334 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/ce55ad52ea58670c349f8eac2ec7535b91a42d7f initrd - add tcplay root mount support --- diff --git a/sbin/mkinitrd/mkinitrd.8 b/sbin/mkinitrd/mkinitrd.8 index 63ac6f6f44..221575ad92 100644 --- a/sbin/mkinitrd/mkinitrd.8 +++ b/sbin/mkinitrd/mkinitrd.8 @@ -103,8 +103,9 @@ new root in the initrd is specified in its general form below: vfs.root.realroot=":[arg1[:arg2[:argN]]]" .Ed .Pp -Currently, two types of real root are supported, -.Pa local +Currently, three types of real root are supported, +.Pa local , +.Pa tcplay and .Pa crypt . The @@ -125,6 +126,16 @@ be mounted as the new root. .Bd -literal -offset indent vfs.root.realroot="crypt:::[:]" .Ed +.Pp +The +.Pa tcplay +type allows to mount volumes supported by +.Xr tcplay 8 . +The device will be set up by prompting the user for his key, and this +volume will then be mounted as the new root. +.Bd -literal -offset indent +vfs.root.realroot="tcplay:::[:]" +.Ed .Sh EXAMPLES .Bd -literal -offset indent vfs.root.realroot="local:ufs:/dev/vg00/lv0[:OPTIONS]" diff --git a/sbin/mkinitrd/mkinitrd.sh b/sbin/mkinitrd/mkinitrd.sh index 1ed2843683..d8342e5863 100644 --- a/sbin/mkinitrd/mkinitrd.sh +++ b/sbin/mkinitrd/mkinitrd.sh @@ -34,7 +34,7 @@ TMP_DIR="/tmp" BOOT_DIR="/boot" INITRD_SIZE="15m" BIN_TOOLS="mkdir rm sh kill" -SBIN_TOOLS="mount mount_devfs mount_hammer mount_nfs mount_null mount_procfs mount_tmpfs umount iscontrol cryptsetup lvm sysctl udevd" +SBIN_TOOLS="mount mount_devfs mount_hammer mount_nfs mount_null mount_procfs mount_tmpfs umount iscontrol cryptsetup lvm sysctl udevd tcplay" INITRD_DIRS="bin boot dev etc mnt proc sbin tmp var new_root" CONTENT_DIRS="/usr/share/initrd" diff --git a/share/initrd/Makefile b/share/initrd/Makefile index 3f2bacaec8..d5f80ac44b 100644 --- a/share/initrd/Makefile +++ b/share/initrd/Makefile @@ -6,7 +6,7 @@ #add ${VAR_FILES} to FILES= #add a for loop for ${VAR_FILES} -ETC_FILES= rc rc.lvm2 rcmount_crypt +ETC_FILES= rc rc.lvm2 rcmount_crypt rcmount_tcplay FILES= ${ETC_FILES} .for file in ${ETC_FILES} diff --git a/share/initrd/rcmount_tcplay b/share/initrd/rcmount_tcplay new file mode 100755 index 0000000000..1798b7b1aa --- /dev/null +++ b/share/initrd/rcmount_tcplay @@ -0,0 +1,28 @@ +#!/bin/sh + +if [ ! -x /sbin/tcplay ]; then + return 1; +fi + +FSTYPE=$2 +MOUNTFROM=$3 +VOLUME=$4 +OPTIONS=$5 + +# Make sure that MOUNTFROM starts with /dev/ +substr="${MOUNTFROM##/dev/}" +if [ "$substr" = "$MOUNTFROM" ]; then + MOUNTFROM="/dev/$MOUNTFROM" +fi + +# Open crypto volume +/sbin/tcplay -m $VOLUME -d $MOUNTFROM $OPTIONS +if [ "$?" -ne "0" ]; then + return 2; +fi + +# Mount, as is expected, onto /new_root +mount -o ro -t $FSTYPE /dev/mapper/$VOLUME /new_root +if [ "$?" -ne "0" ]; then + return 3; +fi