zfsroot.rc revision 1.4
11.1Sroy#/bin/sh 21.1Sroy# 31.4Sroy# $NetBSD: zfsroot.rc,v 1.4 2020/02/25 20:05:10 roy Exp $ 41.2Sroy 51.4Sroy# Assumption - boot.cfg loads this ramdisk. 61.4Sroy# Assumption - The needed kernel modules: solaris and zfs; are either on this 71.4Sroy# ramdisk OR loaded by boot.cfg. 81.4Sroy# Finding the correct dev node to mount to get them is too magic. 91.4Sroy# NetBSD cannot build and distribute a kernel with ZFS builtin. 101.4Sroy# Assumption - the root pool is set to legacy mount. 111.1Sroy 121.1Sroy# Configurable - define the ZFS root pool and ROOT. 131.1Sroy# XXX Can these be set in boot.cfg? 141.1Sroyrpool=rpool 151.1Sroyrroot=ROOT 161.1Sroy 171.1Sroy# Setup some stuff incase things go south and we drop to the shell 181.1Sroyexport HOME=/ 191.1Sroyexport PATH=/sbin:/bin:/usr/sbin:/usr/bin 201.1Sroyumask 022 211.1Sroy 221.2Sroy# FIXME XXX Sometimes zpool import gets SIGBUS 231.2Sroy# Ensure that we are in a writable directory to try and capture a coredump 241.2Sroy# Not that we actually get a coredump .... 251.2Sroycd /tmp 261.2Sroy 271.2Sroyecho "Importing $rpool" 281.2Sroy/sbin/zpool import -f -N "$rpool" 291.2Sroy 301.2Sroyecho "Mounting $rpool/$rroot to /altroot" 311.2Sroy/sbin/mount -t zfs "$rpool/$rroot" /altroot; 321.2Sroy 331.2Sroy/sbin/sysctl -w init.root=/altroot 34