xref: /illumos-gate/usr/src/man/man7/loader.7 (revision 11845c326ad8c691a402c512ccf50d1792fd6aab)
1.\" Copyright (c) 1999 Daniel C. Sobral
2.\" Copyright 2019 OmniOS Community Edition (OmniOSce) Association.
3.\" All rights reserved.
4.\"
5.\" Redistribution and use in source and binary forms, with or without
6.\" modification, are permitted provided that the following conditions
7.\" are met:
8.\" 1. Redistributions of source code must retain the above copyright
9.\"    notice, this list of conditions and the following disclaimer.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24.\" SUCH DAMAGE.
25.\"
26.Dd March 01, 2023
27.Dt LOADER 7
28.Os
29.Sh NAME
30.Nm loader
31.Nd kernel bootstrapping final stage
32.Sh DESCRIPTION
33The
34.Nm
35is the final stage of
36.Nm illumos Ns 's
37kernel bootstrapping process.
38The actual name for the stage depends on the platform.
39On IA32 (i386) architectures with BIOS firmware, it is a
40.Pa BTX
41client and named
42.Nm loader .
43It is linked statically to libstand and usually located in the directory
44.Pa /boot .
45.Pp
46.Nm
47supports booting from
48.Cm ZFS ,
49.Cm UFS ,
50.Cm PCFS ,
51.Cm HSFS
52and
53.Cm NFS
54file systems.
55Additionally,
56.Nm
57can load files from the
58.Cm TFTP
59file service.
60The NFS and TFTP based boot is enabled via
61.Xr pxeboot 7 .
62The
63.Nm
64also does support uncompressing gzip files while reading.
65The uncompression will happen automatically if the compressed file is stored
66without .gz suffix or if the file is accessed by leaving out the .gz suffix from
67the name.
68If the file is referred by full name, including .gz suffix, then the file
69content is read as is and the uncompression is not performed.
70.Pp
71.Nm
72provides a scripting language that can be used to
73automate tasks, do pre-configuration or assist in recovery
74procedures.
75This scripting language is roughly divided in
76two main components.
77The smaller one is a set of commands
78designed for direct use by the casual user, called "builtin
79commands" for historical reasons.
80The main drive behind these commands is user-friendliness.
81The bigger component is an
82.Tn ANS
83Forth compatible Forth interpreter based on FICL, by
84.An John Sadler .
85.Pp
86During initialization,
87.Nm
88will probe for a console and set the
89.Va console
90variable, or set it to serial console
91.Pq Do Li ttya Dc - Dq Li ttyd
92if the previous boot stage used that.
93If multiple consoles are selected, they will be listed separated by commas.
94Then, devices are probed,
95.Va currdev
96and
97.Va loaddev
98are set, and
99.Va screen-#cols ,
100.Va screen-#rows ,
101and
102.Va ISADIR
103are set.
104Next,
105.Tn FICL
106is initialized, the builtin words are added to its vocabulary.
107The inner interpreter
108.Nm
109will use with
110.Tn FICL
111is then set to
112.Ic interpret ,
113which is
114.Tn FICL Ns 's
115default.
116After that,
117.Pa /boot/loader.rc
118is processed if available.
119These files are processed through the
120.Ic include
121command, which reads all of them into memory before processing them,
122making disk changes possible.
123.Pp
124At this point, if an
125.Ic autoboot
126has not been tried, and if
127.Va autoboot_delay
128is not set to
129.Dq Li NO
130(not case sensitive), then an
131.Ic autoboot
132will be tried.
133If the system gets past this point,
134.Va prompt
135will be set and
136.Nm
137will engage interactive mode.
138Please note that historically even when
139.Va autoboot_delay
140is set to
141.Dq Li 0
142user will be able to interrupt autoboot process by pressing some key
143on the console while kernel and modules are being loaded.
144In some
145cases such behaviour may be undesirable, to prevent it set
146.Va autoboot_delay
147to
148.Dq Li -1 ,
149in this case
150.Nm
151will engage interactive mode only if
152.Ic autoboot
153has failed.
154.Ss Builtin Commands
155In
156.Nm ,
157builtin commands take parameters from the command line.
158If an error condition occurs, an exception will be generated,
159which can be intercepted using
160.Tn ANS
161Forth exception handling
162words.
163If not intercepted, an error message will be displayed and
164the interpreter's state will be reset, emptying the stack and restoring
165interpreting mode.
166.Pp
167The builtin commands available are:
168.Pp
169.Bl -tag -width Ds -compact
170.It Ic autoboot Op Ar seconds Op Ar prompt
171Proceeds to bootstrap the system after a number of seconds, if not
172interrupted by the user.
173Displays a countdown prompt
174warning the user the system is about to be booted,
175unless interrupted by a key press.
176The kernel will be loaded first if necessary.
177Defaults to 10 seconds.
178.Pp
179.It Ic bcachestat
180Displays statistics about disk cache usage.
181For debugging only.
182.Pp
183.It Ic boot
184.It Ic boot Ar kernelname Op Cm ...
185.It Ic boot Fl flag Cm ...
186Immediately proceeds to bootstrap the system, loading the kernel
187if necessary.
188Any flags or arguments are passed to the kernel, but they
189must precede the kernel name, if a kernel name is provided.
190.Pp
191.Em WARNING :
192The behavior of this builtin is changed if
193.Xr loader.4th 7
194is loaded.
195.Pp
196.It Ic chain Ar device
197Chain load another boot loader from the specified device.
198Device can be either disk name or partition.
199.Pp
200.It Ic echo Xo
201.Op Fl n
202.Op Aq message
203.Xc
204Displays text on the screen.
205A new line will be printed unless
206.Fl n
207is specified.
208.Pp
209.It Ic heap
210Displays memory usage statistics.
211For debugging purposes only.
212.Pp
213.It Ic help Op topic Op subtopic
214Shows help messages read from
215.Pa /boot/loader.help .
216The special topic
217.Em index
218will list the topics available.
219.Pp
220.It Ic include Ar file Op Ar
221Process script files.
222Each file, in turn, is completely read into memory,
223and then each of its lines is passed to the command line interpreter.
224If any error is returned by the interpreter, the include
225command aborts immediately, without reading any other files, and
226returns an error itself (see
227.Sx ERRORS ) .
228.Pp
229.It Ic load Xo
230.Op Fl t Ar type
231.Ar file Cm ...
232.Xc
233Loads a kernel or file of opaque contents tagged as being of the type
234.Ar type .
235Kernel and modules can be either in a.out or ELF format.
236Any arguments passed after the name of the file to be loaded
237will be passed as arguments to that file.
238.Pp
239.It Ic ls Xo
240.Op Fl l
241.Op Ar path
242.Xc
243Displays a listing of files in the directory
244.Ar path ,
245or the root directory if
246.Ar path
247is not specified.
248If
249.Fl l
250is specified, file sizes will be shown too.
251.Pp
252.It Ic lsdev Op Fl v
253Lists all of the devices from which it may be possible to load modules.
254In addition to disks and partitions, ZFS pools are also listed.
255If
256.Fl v
257is specified, more details are printed.
258For ZFS pools the output resembles
259.Nm zpool Cm status
260output.
261.Pp
262.It Ic lsmod Op Fl v
263Displays loaded modules.
264If
265.Fl v
266is specified, more details are shown.
267.Pp
268.It Ic lszfs Ar filesystem
269A ZFS extended command that can be used to explore the ZFS filesystem
270hierarchy in a pool.
271Lists the immediate children of the
272.Ar filesystem .
273The filesystem hierarchy is rooted at a filesystem with the same name
274as the pool.
275.Pp
276.It Ic more Ar file Op Ar
277Display the files specified, with a pause at each
278.Va screen-#rows
279displayed.
280.Pp
281.It Ic read Xo
282.Op Fl t Ar seconds
283.Op Fl p Ar prompt
284.Op Va variable
285.Xc
286Reads a line of input from the terminal, storing it in
287.Va variable
288if specified.
289A timeout can be specified with
290.Fl t ,
291though it will be canceled at the first key pressed.
292A prompt may also be displayed through the
293.Fl p
294flag.
295.Pp
296.It Ic reboot Op Fl f
297Immediately reboots the system.
298On a
299.Sy UEFI
300system, if the
301.Fl f
302flag is set, or the
303.Va BOOT_TO_FW_UI
304environment variable exists, and the firmware supports this feature,
305the system will automatically enter the firmware setup after reboot.
306.Pp
307.It Ic set Ar variable
308.It Ic set Ar variable Ns = Ns Ar value
309Set loader's environment variables.
310.Pp
311.It Ic show Op Va variable
312Displays the specified variable's value, or all variables and their
313values if
314.Va variable
315is not specified.
316.Pp
317.It Ic unload
318Remove all modules from memory.
319.Pp
320.It Ic unset Va variable
321Removes
322.Va variable
323from the environment.
324.Pp
325.It Ic \&?
326Lists available commands.
327.El
328.Ss ZFS Features
329.Nm
330supports the following format for specifying ZFS filesystems which
331can be used wherever
332.Nm
333refers to a device specification:
334.Pp
335.Ar zfs:pool/filesystem:
336.Pp
337where
338.Pa pool/filesystem
339is a ZFS filesystem name as described in
340.Xr zfs 8 .
341.Ss Builtin Environment Variables
342The
343.Nm
344has actually two different kinds of
345.Sq environment
346variables.
347There are ANS Forth's
348.Em environmental queries ,
349and a separate space of environment variables used by builtins, which
350are not directly available to Forth words.
351It is the latter type that this section covers.
352.Pp
353Environment variables can be set and unset through the
354.Ic set
355and
356.Ic unset
357builtins, and can have their values interactively examined through the
358use of the
359.Ic show
360builtin.
361Their values can also be accessed as described in
362.Sx BUILTIN PARSER .
363.Pp
364Notice that these environment variables are not inherited by any shell
365after the system has been booted.
366.Pp
367A few variables are set automatically by
368.Nm .
369Others can affect the behavior of either
370.Nm
371or the kernel at boot.
372Some options may require a value,
373while others define behavior just by being set.
374Both types of builtin variables are described below.
375.Bl -tag -width bootfile
376.It Va autoboot_delay
377Number of seconds
378.Ic autoboot
379will wait before booting.
380If this variable is not defined,
381.Ic autoboot
382will default to 10 seconds.
383.Pp
384If set to
385.Dq Li NO ,
386no
387.Ic autoboot
388will be automatically attempted after processing
389.Pa /boot/loader.rc ,
390though explicit
391.Ic autoboot Ns 's
392will be processed normally, defaulting to 10 seconds delay.
393.Pp
394If set to
395.Dq Li 0 ,
396no delay will be inserted, but user still will be able to interrupt
397.Ic autoboot
398process and escape into the interactive mode by pressing some key
399on the console while kernel and
400modules are being loaded.
401.Pp
402If set to
403.Dq Li -1 ,
404no delay will be inserted and
405.Nm
406will engage interactive mode only if
407.Ic autoboot
408has failed for some reason.
409.It Va boot_ask
410Will set
411.Xr kernel 8
412.Fl a
413option.
414.It Va boot_debug
415Will set
416.Xr kernel 8
417.Fl d
418option.
419.It Va boot_kmdb
420Will set
421.Xr kernel 8
422.Fl k
423option.
424.It Va boot_reconfigure
425Will set
426.Xr kernel 8
427.Fl r
428option.
429.It Va boot_single
430Will set
431.Xr kernel 8
432.Fl s
433option.
434.It Va boot_verbose
435Will set
436.Xr kernel 8
437.Fl v
438option.
439.It Va boot-args
440Will set custom arguments for the kernel.
441If set in
442.Nm
443configuration, the
444.Nm
445startup will parse the
446.Va boot-args
447value to set boot prefixed variables listed above, any unrecognized options
448are added to kernel command line verbatim.
449.It Va bootfile
450The name of the kernel.
451.It Va console
452Defines the current console or consoles.
453Multiple consoles may be specified.
454In that case, the first listed console will become the default console for
455the
456.Xr kernel 8 .
457.It Va currdev
458Selects the default device.
459Syntax for devices is odd.
460.It Va interpret
461Has the value
462.Dq Li ok
463if the Forth's current state is interpreting.
464.It Va screen-#rows
465Define the number of lines on the screen, to be used by the pager.
466.It Va module_path
467Sets the list of directories which will be searched for modules
468named in a load command or implicitly required by a dependency.
469The default value for this variable is
470.Dq Li /platform/i86pc/${ISADIR}
471.It Va prompt
472Value of
473.Nm Ns 's
474prompt.
475Defaults to
476.Dq Li "${interpret}" .
477If variable
478.Va prompt
479is unset, the default prompt is
480.Ql > .
481.It Va os_console
482If set, the value is used to set
483.Xr kernel 8
484.Va console
485property.
486.El
487.Pp
488Other variables are used for loader or to set kernel properties or for
489informational purposes.
490.Ss Builtin Parser
491When a builtin command is executed, the rest of the line is taken
492by it as arguments, and it is processed by a special parser which
493is not used for regular Forth commands.
494.Pp
495This special parser applies the following rules to the parsed text:
496.Bl -enum
497.It
498All backslash characters are preprocessed.
499.Bl -bullet
500.It
501\eb , \ef , \er , \en and \et are processed as in C.
502.It
503\es is converted to a space.
504.It
505\ev is converted to
506.Tn ASCII
50711.
508.It
509\ez is just skipped.
510Useful for things like
511.Dq \e0xf\ez\e0xf .
512.It
513\e0xN and \e0xNN are replaced by the hex N or NN.
514.It
515\eNNN is replaced by the octal NNN
516.Tn ASCII
517character.
518.It
519\e" , \e' and \e$ will escape these characters, preventing them from
520receiving special treatment in Step 2, described below.
521.It
522\e\e will be replaced with a single \e .
523.It
524In any other occurrence, backslash will just be removed.
525.El
526.It
527Every string between non-escaped quotes or double-quotes will be treated
528as a single word for the purposes of the remaining steps.
529.It
530Replace any
531.Li $VARIABLE
532or
533.Li ${VARIABLE}
534with the value of the environment variable
535.Va VARIABLE .
536.It
537Space-delimited arguments are passed to the called builtin command.
538Spaces can also be escaped through the use of \e\e .
539.El
540.Pp
541An exception to this parsing rule exists, and is described in
542.Sx Builtins And FORTH .
543.Ss Builtins And FORTH
544All builtin words are state-smart, immediate words.
545If interpreted, they behave exactly as described previously.
546If they are compiled, though,
547they extract their arguments from the stack instead of the command line.
548.Pp
549If compiled, the builtin words expect to find, at execution time, the
550following parameters on the stack:
551.D1 Ar addrN lenN ... addr2 len2 addr1 len1 N
552where
553.Ar addrX lenX
554are strings which will compose the command line that will be parsed
555into the builtin's arguments.
556Internally, these strings are concatenated in from 1 to N,
557with a space put between each one.
558.Pp
559If no arguments are passed, a 0
560.Em must
561be passed, even if the builtin accepts no arguments.
562.Pp
563While this behavior has benefits, it has its trade-offs.
564If the execution token of a builtin is acquired (through
565.Ic '
566or
567.Ic ['] ) ,
568and then passed to
569.Ic catch
570or
571.Ic execute ,
572the builtin behavior will depend on the system state
573.Bf Em
574at the time
575.Ic catch
576or
577.Ic execute
578is processed!
579.Ef
580This is particularly annoying for programs that want or need to
581handle exceptions.
582In this case, the use of a proxy is recommended.
583For example:
584.Dl : (boot) boot ;
585.Ss FICL
586.Tn FICL
587is a Forth interpreter written in C, in the form of a forth
588virtual machine library that can be called by C functions and vice
589versa.
590.Pp
591In
592.Nm ,
593each line read interactively is then fed to
594.Tn FICL ,
595which may call
596.Nm
597back to execute the builtin words.
598The builtin
599.Ic include
600will also feed
601.Tn FICL ,
602one line at a time.
603.Pp
604The words available to
605.Tn FICL
606can be classified into four groups.
607The
608.Tn ANS
609Forth standard words, extra
610.Tn FICL
611words, extra
612.Fx
613words, and the builtin commands;
614the latter were already described.
615The
616.Tn ANS
617Forth standard words are listed in the
618.Sx STANDARDS
619section.
620The words falling in the two other groups are described in the
621following subsections.
622.Ss FICL Extra Words
623.Bl -tag -width wid-set-super
624.It Ic .env
625.It Ic .ver
626.It Ic -roll
627.It Ic 2constant
628.It Ic >name
629.It Ic body>
630.It Ic compare
631This is the STRING word set's
632.Ic compare .
633.It Ic compile-only
634.It Ic endif
635.It Ic forget-wid
636.It Ic parse-word
637.It Ic sliteral
638This is the STRING word set's
639.Ic sliteral .
640.It Ic wid-set-super
641.It Ic w@
642.It Ic w!
643.It Ic x.
644.It Ic empty
645.It Ic cell-
646.It Ic -rot
647.El
648.Ss Loader Extra Words
649.Bl -tag -width XXXXXXXX
650.It Ic \&$ Pq --
651Evaluates the remainder of the input buffer, after having printed it first.
652.It Ic \&% Pq --
653Evaluates the remainder of the input buffer under a
654.Ic catch
655exception guard.
656.It Ic .#
657Works like
658.Ic \&.
659but without outputting a trailing space.
660.It Ic fclose Pq Ar fd --
661Closes a file.
662.It Ic fkey Pq Ar fd -- char
663Reads a single character from a file.
664.It Ic fload Pq Ar fd --
665Processes a file
666.Em fd .
667.It Ic fopen Pq Ar addr len mode Li -- Ar fd
668Opens a file.
669Returns a file descriptor, or \-1 in case of failure.
670The
671.Ar mode
672parameter selects whether the file is to be opened for read access, write
673access, or both.
674The constants
675.Dv O_RDONLY , O_WRONLY ,
676and
677.Dv O_RDWR
678are defined in
679.Pa /boot/forth/support.4th ,
680indicating read only, write only, and read-write access, respectively.
681.It Xo
682.Ic fread
683.Pq Ar fd addr len -- len'
684.Xc
685Tries to read
686.Em len
687bytes from file
688.Em fd
689into buffer
690.Em addr .
691Returns the actual number of bytes read, or -1 in case of error or end of
692file.
693.It Ic heap? Pq -- Ar cells
694Return the space remaining in the dictionary heap, in cells.
695This is not related to the heap used by dynamic memory allocation words.
696.It Ic inb Pq Ar port -- char
697Reads a byte from a port.
698.It Ic isvirtualized? Pq -- Ar addr len flag | Ar flag
699Returns
700.Ic true
701and string with virtualization engine name or
702.Ic false .
703.It Ic key Pq -- Ar char
704Reads a single character from the console.
705.It Ic key? Pq -- Ar flag
706Returns
707.Ic true
708if there is a character available to be read from the console.
709.It Ic ms Pq Ar u --
710Waits
711.Em u
712microseconds.
713.It Ic outb Pq Ar port char --
714Writes a byte to a port.
715.It Ic seconds Pq -- Ar u
716Returns the number of seconds since midnight.
717.It Ic tib> Pq -- Ar addr len
718Returns the remainder of the input buffer as a string on the stack.
719.El
720.Ss Loader Extra Framebuffer Words
721.Bl -tag -width XXXXXXXX
722.It Ic fb-bezier Pq Ar x1 y1 x2 y2 x3 y3 width --
723Draws a quadratic Bezier curve in the current foreground color using the
724three provided points and specified line with.
725.It Ic fb-drawrect Pq Ar x1 y1 x2 y2 fill --
726Draws a rectangle to the screen with the top left at
727.Em (x1,y1)
728and the bottom right at
729.Em (x2,y2)
730, using the current foreground color.
731If
732.Em fill
733is
734.Ic true
735then the rectangle will be filled in.
736.It Ic fb-line Pq Ar x1 y1 x2 y2 width --
737Draws a line from
738.Em (x1,y1)
739to
740.Em (x2,y2)
741in the current foreground color and with the specified width.
742.It Ic fb-putimage Pq Ar flags x1 y1 x2 y2 addr len -- flag
743Outputs an image to the screen.
744Returns
745.Ic true
746if the image was able to be written and
747.Ic false
748otherwise.
749Only truecolor PNG images are supported and the path to the file
750must be provided through the
751.Em addr
752and
753.Em len
754arguments on the stack.
755The image will be displayed in the rectangular screen region with the top left
756at
757.Em (x1,y1)
758and the bottom right at
759.Em (x2,y2)
760.
761.Pp
762Either
763.Em x2
764or
765.Em y2
766can be set to "0" which causes it to be calculated to maintain the aspect
767ratio of the image.
768If both are "0" then the native resolution of the image will be used.
769.Pp
770If
771.Em x1
772is "0", then the image will be placed as far over to the right of the
773screen as possible.
774Similarly, if
775.Em y1
776is "0", then the image will be placed as far down the screen as possible.
777.Pp
778Flags is a bitfield; the following bits are defined:
779.Bl -tag -width XXXXX -offset indent
780.It 1
781Draw a single pixel border around the image in the current foreground color.
782.It 2
783Do not scroll the image with the rest of the screen.
784.It 128
785Output diagnostic information (for debugging).
786.El
787.It Ic fb-setpixel Pq Ar x y --
788Colors the pixel at
789.Em (x,y)
790with the current foreground color.
791.It Ic term-drawrect Pq Ar x1 y1 x2 y2 --
792Draws a rectangle with rounded corners using terminal coordinates and the
793current foreground color.
794.El
795.Ss Loader Defined Environmental Queries
796.Bl -tag -width Ds
797.It arch-i386
798.Ic TRUE
799if the architecture is IA32.
800.It loader_version
801.Nm
802version.
803.El
804.Ss Errors
805The following values are thrown by
806.Nm :
807.Bl -tag -width XXXXX -offset indent
808.It 100
809Any type of error in the processing of a builtin.
810.It -1
811.Ic Abort
812executed.
813.It -2
814.Ic Abort"
815executed.
816.It -56
817.Ic Quit
818executed.
819.It -256
820Out of interpreting text.
821.It -257
822Need more text to succeed -- will finish on next run.
823.It -258
824.Ic Bye
825executed.
826.It -259
827Unspecified error.
828.El
829.Sh FILES
830.Bl -tag -width /boot/defaults/loader.conf -compact
831.It Pa /boot/defaults/loader.conf
832.It Pa /boot/conf.d/*
833.It Pa /boot/loader.conf
834.It Pa /boot/loader.conf.local
835.Nm
836configuration files, as described in
837.Xr loader.conf 5 .
838.It Pa /boot/loader.help
839Loaded by
840.Ic help .
841Contains the help messages.
842.It Pa /boot/loader.rc
843.Nm
844bootstrapping script.
845.It Pa /boot/forth/loader.4th
846Extra builtin-like words.
847.It Pa /boot/forth/support.4th
848.Pa loader.conf
849processing words.
850.It Pa /boot/loader
851.Nm
852itself.
853.El
854.Sh EXAMPLES
855Boot in single user mode:
856.Pp
857.Dl boot -s
858.Pp
859Load the kernel, a boot_archive, and then autoboot in five seconds.
860Notice that a kernel must be loaded before any other
861.Ic load
862command is attempted.
863.Bd -literal -offset indent
864load /platform/i86pc/kernel/amd64/unix
865load -t rootfs /platform/i86pc/amd64/boot_archive
866autoboot 5
867.Ed
868.Pp
869Set the default device used for loading a kernel from a ZFS filesystem:
870.Bd -literal -offset indent
871set currdev=zfs:rpool/ROOT/knowngood:
872.Ed
873.Sh NOTES
874Although setting the
875.Va currdev
876as shown in the example above is supported, it is advisable to use loader
877beadm command or boot environment menu instead.
878The reason is, the beadm or menu selection will also instruct loader to clean up
879the currently set configuration and load configuration from the new boot
880environment.
881.Sh SEE ALSO
882.Xr btxld 1onbld ,
883.Xr loader.conf 5 ,
884.Xr boot 8
885.Sh STANDARDS
886For the purposes of ANS Forth compliance, loader is an
887.Bf Em
888ANS Forth System with Environmental Restrictions, Providing
889.Ef
890.Bf Li
891.No .( ,
892.No :noname ,
893.No ?do ,
894parse, pick, roll, refill, to, value, \e, false, true,
895.No <> ,
896.No 0<> ,
897compile\&, , erase, nip, tuck
898.Ef
899.Em and
900.Li marker
901.Bf Em
902from the Core Extensions word set, Providing the Exception Extensions
903word set, Providing the Locals Extensions word set, Providing the
904Memory-Allocation Extensions word set, Providing
905.Ef
906.Bf Li
907\&.s,
908bye, forget, see, words,
909\&[if],
910\&[else]
911.Ef
912.Em and
913.Li [then]
914.Bf Em
915from the Programming-Tools extension word set, Providing the
916Search-Order extensions word set.
917.Ef
918