Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/common ramdisk-zfsroot: Remove the module loading magic

branches:  trunk
changeset: 745240:2d3fb254817c
user:      roy <>
date:      Tue Feb 25 20:05:10 2020 +0000

ramdisk-zfsroot: Remove the module loading magic

It's been determined that it's too magical and it's either the job
of the bootloader or you compile it into the kernel yourself.

This entry works in /boot.cfg:

menu=Boot ZFS Root:load solaris;load zfs;fs /ramdisk-zfsroot.fs;boot


 distrib/common/zfsroot.rc |  31 +++++++------------------------
 1 files changed, 7 insertions(+), 24 deletions(-)

diffs (57 lines):

diff -r 959ef254d9b6 -r 2d3fb254817c distrib/common/zfsroot.rc
--- a/distrib/common/zfsroot.rc Tue Feb 25 19:34:37 2020 +0000
+++ b/distrib/common/zfsroot.rc Tue Feb 25 20:05:10 2020 +0000
@@ -1,40 +1,24 @@
-#      $NetBSD: zfsroot.rc,v 1.3 2020/02/23 10:51:12 roy Exp $
+#      $NetBSD: zfsroot.rc,v 1.4 2020/02/25 20:05:10 roy Exp $
-echo "Starting root on ZFS boot strapper"
-# Abort on any error
-set -e
+# 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?
-# Assumption - the root pool is set to legacy mount.
-# Assumption - the boot device is named boot.
-# Could use /dev/dk0, /dev/wd0a, etc instead.
-# XXX Can be exposed by sysctl kern.boot_device?
 # 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
-# Avoid having the solaris and zfs modules in ramdisk directly.
-# Means we don't need to update the ramdisk with the kernel modules
-# or load them from boot.cfg so it's less pain for the user.
-#bootdev="$(/sbin/sysctl -n kern.boot_device)"
-modpath="$(/sbin/sysctl -n kern.module.path)"
-echo "Loading needed kernel modules from $bootdev:$modpath"
-/sbin/mount -o ro "$bootdev" /mnt
-for m in solaris zfs; do
-       /sbin/modload "/mnt/$modpath/$m/$m.kmod"
-/sbin/umount /mnt
 # FIXME XXX Sometimes zpool import gets SIGBUS
 # Ensure that we are in a writable directory to try and capture a coredump
 # Not that we actually get a coredump ....
@@ -46,5 +30,4 @@
 echo "Mounting $rpool/$rroot to /altroot"
 /sbin/mount -t zfs "$rpool/$rroot" /altroot;
-echo "Pivoting to /altroot, welcome to root on ZFS"
 /sbin/sysctl -w init.root=/altroot

Home | Main Index | Thread Index | Old Index