NetBSD/distrib/common/zfsroot.rc

29 lines
876 B
Plaintext

#/bin/sh
#
# $NetBSD: zfsroot.rc,v 1.5 2020/04/14 12:14:59 roy Exp $
# Assumption - boot.cfg loads this ramdisk.
# Assumption - The needed kernel modules: solaris and zfs; are either on this
# ramdisk OR loaded by boot.cfg.
# Finding the correct dev node to mount to get them is too magic.
# NetBSD cannot build and distribute a kernel with ZFS builtin.
# Assumption - the root pool is set to legacy mount.
# Configurable - define the ZFS root pool and ROOT.
# XXX Can these be set in boot.cfg?
rpool=rpool
rroot=ROOT
# Setup some stuff incase things go south and we drop to the shell
export HOME=/
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
umask 022
echo "Importing $rpool"
/sbin/zpool import -f -N "$rpool"
echo "Mounting $rpool/$rroot to /altroot"
/sbin/mount -t zfs "$rpool/$rroot" /altroot;
/sbin/sysctl -w init.root=/altroot