Permalink
Browse files

Eliminate most kernel modules from loader.conf, they do not belong

there because they are not required to bootstrap FreeNAS, and are
slow due to limited access to hardware from loader.

Introduce a new rc.d script, earlykld, derived from /etc/rc.d/kld,
which loads certain important kernel modules that provides storage
access, potentionally useful for ix-fstab.

(cherry picked from commit f196867)
  • Loading branch information...
1 parent 5f6338f commit fab925e0a4150724cdc9fbb05678ade02784669c @delphij delphij committed Jun 28, 2013
Showing with 62 additions and 10 deletions.
  1. +4 −10 nanobsd/Files/boot/loader.conf
  2. +7 −0 nanobsd/Files/etc/rc.conf
  3. +50 −0 nanobsd/Files/etc/rc.d/earlykld
  4. +1 −0 nanobsd/Files/etc/rc.d/ix-fstab
@@ -6,17 +6,11 @@ loader_logo="freenas"
#Fix booting from USB device bug
kern.cam.boot_delay="30000"
-# FUSE (NTFS, etc) support
-fuse_load="YES"
-# GEOM support
-geom_mirror_load="YES"
-geom_stripe_load="YES"
-geom_raid3_load="YES"
-geom_raid5_load="YES"
-geom_gate_load="YES"
-geom_multipath_load="YES"
+# kernel modules: only load them in loader.conf if they are absolutely
+# necessary.
+
+# xhci is qualified as "critical" because this could be a boot device.
xhci_load="YES"
-dtraceall_load="YES"
# If the machine dies at boot before /etc/rc.d/sysctl is run, let the user do
# something.
@@ -50,3 +50,10 @@ geli_autodetach="NO"
dumpdev="AUTO"
dumpdir="/data/crash"
ix_textdump_enable="YES"
+
+# A set of storage supporting kernel modules, they must be loaded before ix-fstab.
+early_kld_list="geom_mirror geom_stripe geom_raid3 geom_raid5 geom_gate geom_multipath"
+
+# A set of kernel modules that can be loaded after mounting local filesystems.
+kld_list="dtraceall"
+
@@ -0,0 +1,50 @@
+#!/bin/sh
+
+# Copyright (c) 2011 Douglas Barton
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
+# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+# SUCH DAMAGE.
+#
+# PROVIDE: earlykld
+# BEFORE: fsck
+
+. /etc/rc.subr
+
+name="earlykld"
+
+start_cmd="${name}_start"
+stop_cmd=':'
+
+earlykld_start()
+{
+ [ -n "$early_kld_list" ] || return
+
+ local _kld
+
+ echo 'Loading early kernel modules:'
+ for _kld in $early_kld_list ; do
+ load_kld -e ${_kld}.ko $_kld
+ done
+}
+
+load_rc_config $name
+run_rc_command "$1"
@@ -4,6 +4,7 @@
#
# PROVIDE: ix-fstab
+# REQUIRE: earlykld
# BEFORE: fsck
. /etc/rc.subr

0 comments on commit fab925e

Please sign in to comment.