xref: /illumos-gate/usr/src/man/man7/loader.7 (revision 012e6ce759c490003aed29439cc47d3d73a99ad3)
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 30, 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, partition or file name.
199In case of x86 BIOS boot, the file must be copy of MBR or PBR.
200For UEFI boot, the file is efi application.
201.Pp
202.It Ic echo Xo
203.Op Fl n
204.Op Aq message
205.Xc
206Displays text on the screen.
207A new line will be printed unless
208.Fl n
209is specified.
210.Pp
211.It Ic heap
212Displays memory usage statistics.
213For debugging purposes only.
214.Pp
215.It Ic help Op topic Op subtopic
216Shows help messages read from
217.Pa /boot/loader.help .
218The special topic
219.Em index
220will list the topics available.
221.Pp
222.It Ic include Ar file Op Ar
223Process script files.
224Each file, in turn, is completely read into memory,
225and then each of its lines is passed to the command line interpreter.
226If any error is returned by the interpreter, the include
227command aborts immediately, without reading any other files, and
228returns an error itself (see
229.Sx ERRORS ) .
230.Pp
231.It Ic load Xo
232.Op Fl t Ar type
233.Ar file Cm ...
234.Xc
235Loads a kernel or file of opaque contents tagged as being of the type
236.Ar type .
237Kernel and modules can be either in a.out or ELF format.
238Any arguments passed after the name of the file to be loaded
239will be passed as arguments to that file.
240.Pp
241.It Ic ls Xo
242.Op Fl l
243.Op Ar path
244.Xc
245Displays a listing of files in the directory
246.Ar path ,
247or the root directory if
248.Ar path
249is not specified.
250If
251.Fl l
252is specified, file sizes will be shown too.
253.Pp
254.It Ic lsdev Op Fl v
255Lists all of the devices from which it may be possible to load modules.
256In addition to disks and partitions, ZFS pools are also listed.
257If
258.Fl v
259is specified, more details are printed.
260For ZFS pools the output resembles
261.Nm zpool Cm status
262output.
263.Pp
264.It Ic lsmod Op Fl v
265Displays loaded modules.
266If
267.Fl v
268is specified, more details are shown.
269.Pp
270.It Ic lszfs Ar filesystem
271A ZFS extended command that can be used to explore the ZFS filesystem
272hierarchy in a pool.
273Lists the immediate children of the
274.Ar filesystem .
275The filesystem hierarchy is rooted at a filesystem with the same name
276as the pool.
277.Pp
278.It Ic more Ar file Op Ar
279Display the files specified, with a pause at each
280.Va screen-#rows
281displayed.
282.Pp
283.It Ic read Xo
284.Op Fl t Ar seconds
285.Op Fl p Ar prompt
286.Op Va variable
287.Xc
288Reads a line of input from the terminal, storing it in
289.Va variable
290if specified.
291A timeout can be specified with
292.Fl t ,
293though it will be canceled at the first key pressed.
294A prompt may also be displayed through the
295.Fl p
296flag.
297.Pp
298.It Ic reboot Op Fl f
299Immediately reboots the system.
300On a
301.Sy UEFI
302system, if the
303.Fl f
304flag is set, or the
305.Va BOOT_TO_FW_UI
306environment variable exists, and the firmware supports this feature,
307the system will automatically enter the firmware setup after reboot.
308.Pp
309.It Ic set Ar variable
310.It Ic set Ar variable Ns = Ns Ar value
311Set loader's environment variables.
312.Pp
313.It Ic show Op Va variable
314Displays the specified variable's value, or all variables and their
315values if
316.Va variable
317is not specified.
318.Pp
319.It Ic unload
320Remove all modules from memory.
321.Pp
322.It Ic unset Va variable
323Removes
324.Va variable
325from the environment.
326.Pp
327.It Ic \&?
328Lists available commands.
329.El
330.Ss ZFS Features
331.Nm
332supports the following format for specifying ZFS filesystems which
333can be used wherever
334.Nm
335refers to a device specification:
336.Pp
337.Ar zfs:pool/filesystem:
338.Pp
339where
340.Pa pool/filesystem
341is a ZFS filesystem name as described in
342.Xr zfs 8 .
343.Ss Builtin Environment Variables
344The
345.Nm
346has actually two different kinds of
347.Sq environment
348variables.
349There are ANS Forth's
350.Em environmental queries ,
351and a separate space of environment variables used by builtins, which
352are not directly available to Forth words.
353It is the latter type that this section covers.
354.Pp
355Environment variables can be set and unset through the
356.Ic set
357and
358.Ic unset
359builtins, and can have their values interactively examined through the
360use of the
361.Ic show
362builtin.
363Their values can also be accessed as described in
364.Sx BUILTIN PARSER .
365.Pp
366Notice that these environment variables are not inherited by any shell
367after the system has been booted.
368.Pp
369A few variables are set automatically by
370.Nm .
371Others can affect the behavior of either
372.Nm
373or the kernel at boot.
374Some options may require a value,
375while others define behavior just by being set.
376Both types of builtin variables are described below.
377.Bl -tag -width bootfile
378.It Va autoboot_delay
379Number of seconds
380.Ic autoboot
381will wait before booting.
382If this variable is not defined,
383.Ic autoboot
384will default to 10 seconds.
385.Pp
386If set to
387.Dq Li NO ,
388no
389.Ic autoboot
390will be automatically attempted after processing
391.Pa /boot/loader.rc ,
392though explicit
393.Ic autoboot Ns 's
394will be processed normally, defaulting to 10 seconds delay.
395.Pp
396If set to
397.Dq Li 0 ,
398no delay will be inserted, but user still will be able to interrupt
399.Ic autoboot
400process and escape into the interactive mode by pressing some key
401on the console while kernel and
402modules are being loaded.
403.Pp
404If set to
405.Dq Li -1 ,
406no delay will be inserted and
407.Nm
408will engage interactive mode only if
409.Ic autoboot
410has failed for some reason.
411.It Va boot_ask
412Will set
413.Xr kernel 8
414.Fl a
415option.
416.It Va boot_debug
417Will set
418.Xr kernel 8
419.Fl d
420option.
421.It Va boot_kmdb
422Will set
423.Xr kernel 8
424.Fl k
425option.
426.It Va boot_reconfigure
427Will set
428.Xr kernel 8
429.Fl r
430option.
431.It Va boot_single
432Will set
433.Xr kernel 8
434.Fl s
435option.
436.It Va boot_verbose
437Will set
438.Xr kernel 8
439.Fl v
440option.
441.It Va boot-args
442Will set custom arguments for the kernel.
443If set in
444.Nm
445configuration, the
446.Nm
447startup will parse the
448.Va boot-args
449value to set boot prefixed variables listed above, any unrecognized options
450are added to kernel command line verbatim.
451.It Va bootfile
452The name of the kernel.
453.It Va chain_disk
454If set, contains the device or file name used with
455.Cm chain
456command and will cause chain command menu entry to appear on
457.Nm
458main menu.
459The alternate method to use chain loader is to add menu entries
460into
461.Xr menu.lst 5
462file.
463.It Va console
464Defines the current console or consoles.
465Multiple consoles may be specified.
466In that case, the first listed console will become the default console for
467the
468.Xr kernel 8 .
469.It Va currdev
470Selects the default device.
471Syntax for devices is odd.
472.It Va interpret
473Has the value
474.Dq Li ok
475if the Forth's current state is interpreting.
476.It Va screen-#rows
477Define the number of lines on the screen, to be used by the pager.
478.It Va module_path
479Sets the list of directories which will be searched for modules
480named in a load command or implicitly required by a dependency.
481The default value for this variable is
482.Dq Li /platform/i86pc/${ISADIR}
483.It Va prompt
484Value of
485.Nm Ns 's
486prompt.
487Defaults to
488.Dq Li "${interpret}" .
489If variable
490.Va prompt
491is unset, the default prompt is
492.Ql > .
493.It Va os_console
494If set, the value is used to set
495.Xr kernel 8
496.Va console
497property.
498.El
499.Pp
500Other variables are used for loader or to set kernel properties or for
501informational purposes.
502.Ss Builtin Parser
503When a builtin command is executed, the rest of the line is taken
504by it as arguments, and it is processed by a special parser which
505is not used for regular Forth commands.
506.Pp
507This special parser applies the following rules to the parsed text:
508.Bl -enum
509.It
510All backslash characters are preprocessed.
511.Bl -bullet
512.It
513\eb , \ef , \er , \en and \et are processed as in C.
514.It
515\es is converted to a space.
516.It
517\ev is converted to
518.Tn ASCII
51911.
520.It
521\ez is just skipped.
522Useful for things like
523.Dq \e0xf\ez\e0xf .
524.It
525\e0xN and \e0xNN are replaced by the hex N or NN.
526.It
527\eNNN is replaced by the octal NNN
528.Tn ASCII
529character.
530.It
531\e" , \e' and \e$ will escape these characters, preventing them from
532receiving special treatment in Step 2, described below.
533.It
534\e\e will be replaced with a single \e .
535.It
536In any other occurrence, backslash will just be removed.
537.El
538.It
539Every string between non-escaped quotes or double-quotes will be treated
540as a single word for the purposes of the remaining steps.
541.It
542Replace any
543.Li $VARIABLE
544or
545.Li ${VARIABLE}
546with the value of the environment variable
547.Va VARIABLE .
548.It
549Space-delimited arguments are passed to the called builtin command.
550Spaces can also be escaped through the use of \e\e .
551.El
552.Pp
553An exception to this parsing rule exists, and is described in
554.Sx Builtins And FORTH .
555.Ss Builtins And FORTH
556All builtin words are state-smart, immediate words.
557If interpreted, they behave exactly as described previously.
558If they are compiled, though,
559they extract their arguments from the stack instead of the command line.
560.Pp
561If compiled, the builtin words expect to find, at execution time, the
562following parameters on the stack:
563.D1 Ar addrN lenN ... addr2 len2 addr1 len1 N
564where
565.Ar addrX lenX
566are strings which will compose the command line that will be parsed
567into the builtin's arguments.
568Internally, these strings are concatenated in from 1 to N,
569with a space put between each one.
570.Pp
571If no arguments are passed, a 0
572.Em must
573be passed, even if the builtin accepts no arguments.
574.Pp
575While this behavior has benefits, it has its trade-offs.
576If the execution token of a builtin is acquired (through
577.Ic '
578or
579.Ic ['] ) ,
580and then passed to
581.Ic catch
582or
583.Ic execute ,
584the builtin behavior will depend on the system state
585.Bf Em
586at the time
587.Ic catch
588or
589.Ic execute
590is processed!
591.Ef
592This is particularly annoying for programs that want or need to
593handle exceptions.
594In this case, the use of a proxy is recommended.
595For example:
596.Dl : (boot) boot ;
597.Ss FICL
598.Tn FICL
599is a Forth interpreter written in C, in the form of a forth
600virtual machine library that can be called by C functions and vice
601versa.
602.Pp
603In
604.Nm ,
605each line read interactively is then fed to
606.Tn FICL ,
607which may call
608.Nm
609back to execute the builtin words.
610The builtin
611.Ic include
612will also feed
613.Tn FICL ,
614one line at a time.
615.Pp
616The words available to
617.Tn FICL
618can be classified into four groups.
619The
620.Tn ANS
621Forth standard words, extra
622.Tn FICL
623words, extra
624.Fx
625words, and the builtin commands;
626the latter were already described.
627The
628.Tn ANS
629Forth standard words are listed in the
630.Sx STANDARDS
631section.
632The words falling in the two other groups are described in the
633following subsections.
634.Ss FICL Extra Words
635.Bl -tag -width wid-set-super
636.It Ic .env
637.It Ic .ver
638.It Ic -roll
639.It Ic 2constant
640.It Ic >name
641.It Ic body>
642.It Ic compare
643This is the STRING word set's
644.Ic compare .
645.It Ic compile-only
646.It Ic endif
647.It Ic forget-wid
648.It Ic parse-word
649.It Ic sliteral
650This is the STRING word set's
651.Ic sliteral .
652.It Ic wid-set-super
653.It Ic w@
654.It Ic w!
655.It Ic x.
656.It Ic empty
657.It Ic cell-
658.It Ic -rot
659.El
660.Ss Loader Extra Words
661.Bl -tag -width XXXXXXXX
662.It Ic \&$ Pq --
663Evaluates the remainder of the input buffer, after having printed it first.
664.It Ic \&% Pq --
665Evaluates the remainder of the input buffer under a
666.Ic catch
667exception guard.
668.It Ic .#
669Works like
670.Ic \&.
671but without outputting a trailing space.
672.It Ic fclose Pq Ar fd --
673Closes a file.
674.It Ic fkey Pq Ar fd -- char
675Reads a single character from a file.
676.It Ic fload Pq Ar fd --
677Processes a file
678.Em fd .
679.It Ic fopen Pq Ar addr len mode Li -- Ar fd
680Opens a file.
681Returns a file descriptor, or \-1 in case of failure.
682The
683.Ar mode
684parameter selects whether the file is to be opened for read access, write
685access, or both.
686The constants
687.Dv O_RDONLY , O_WRONLY ,
688and
689.Dv O_RDWR
690are defined in
691.Pa /boot/forth/support.4th ,
692indicating read only, write only, and read-write access, respectively.
693.It Xo
694.Ic fread
695.Pq Ar fd addr len -- len'
696.Xc
697Tries to read
698.Em len
699bytes from file
700.Em fd
701into buffer
702.Em addr .
703Returns the actual number of bytes read, or -1 in case of error or end of
704file.
705.It Ic heap? Pq -- Ar cells
706Return the space remaining in the dictionary heap, in cells.
707This is not related to the heap used by dynamic memory allocation words.
708.It Ic inb Pq Ar port -- char
709Reads a byte from a port.
710.It Ic isvirtualized? Pq -- Ar addr len flag | Ar flag
711Returns
712.Ic true
713and string with virtualization engine name or
714.Ic false .
715.It Ic key Pq -- Ar char
716Reads a single character from the console.
717.It Ic key? Pq -- Ar flag
718Returns
719.Ic true
720if there is a character available to be read from the console.
721.It Ic ms Pq Ar u --
722Waits
723.Em u
724microseconds.
725.It Ic outb Pq Ar port char --
726Writes a byte to a port.
727.It Ic seconds Pq -- Ar u
728Returns the number of seconds since midnight.
729.It Ic tib> Pq -- Ar addr len
730Returns the remainder of the input buffer as a string on the stack.
731.El
732.Ss Loader Extra Framebuffer Words
733.Bl -tag -width XXXXXXXX
734.It Ic fb-bezier Pq Ar x1 y1 x2 y2 x3 y3 width --
735Draws a quadratic Bezier curve in the current foreground color using the
736three provided points and specified line with.
737.It Ic fb-drawrect Pq Ar x1 y1 x2 y2 fill --
738Draws a rectangle to the screen with the top left at
739.Em (x1,y1)
740and the bottom right at
741.Em (x2,y2)
742, using the current foreground color.
743If
744.Em fill
745is
746.Ic true
747then the rectangle will be filled in.
748.It Ic fb-line Pq Ar x1 y1 x2 y2 width --
749Draws a line from
750.Em (x1,y1)
751to
752.Em (x2,y2)
753in the current foreground color and with the specified width.
754.It Ic fb-putimage Pq Ar flags x1 y1 x2 y2 addr len -- flag
755Outputs an image to the screen.
756Returns
757.Ic true
758if the image was able to be written and
759.Ic false
760otherwise.
761Only truecolor PNG images are supported and the path to the file
762must be provided through the
763.Em addr
764and
765.Em len
766arguments on the stack.
767The image will be displayed in the rectangular screen region with the top left
768at
769.Em (x1,y1)
770and the bottom right at
771.Em (x2,y2)
772.
773.Pp
774Either
775.Em x2
776or
777.Em y2
778can be set to "0" which causes it to be calculated to maintain the aspect
779ratio of the image.
780If both are "0" then the native resolution of the image will be used.
781.Pp
782If
783.Em x1
784is "0", then the image will be placed as far over to the right of the
785screen as possible.
786Similarly, if
787.Em y1
788is "0", then the image will be placed as far down the screen as possible.
789.Pp
790Flags is a bitfield; the following bits are defined:
791.Bl -tag -width XXXXX -offset indent
792.It 1
793Draw a single pixel border around the image in the current foreground color.
794.It 2
795Do not scroll the image with the rest of the screen.
796.It 128
797Output diagnostic information (for debugging).
798.El
799.It Ic fb-setpixel Pq Ar x y --
800Colors the pixel at
801.Em (x,y)
802with the current foreground color.
803.It Ic term-drawrect Pq Ar x1 y1 x2 y2 --
804Draws a rectangle with rounded corners using terminal coordinates and the
805current foreground color.
806.El
807.Ss Loader Defined Environmental Queries
808.Bl -tag -width Ds
809.It arch-i386
810.Ic TRUE
811if the architecture is IA32.
812.It loader_version
813.Nm
814version.
815.El
816.Ss Errors
817The following values are thrown by
818.Nm :
819.Bl -tag -width XXXXX -offset indent
820.It 100
821Any type of error in the processing of a builtin.
822.It -1
823.Ic Abort
824executed.
825.It -2
826.Ic Abort"
827executed.
828.It -56
829.Ic Quit
830executed.
831.It -256
832Out of interpreting text.
833.It -257
834Need more text to succeed -- will finish on next run.
835.It -258
836.Ic Bye
837executed.
838.It -259
839Unspecified error.
840.El
841.Sh FILES
842.Bl -tag -width /boot/defaults/loader.conf -compact
843.It Pa /boot/defaults/loader.conf
844.It Pa /boot/conf.d/*
845.It Pa /boot/loader.conf
846.It Pa /boot/loader.conf.local
847.Nm
848configuration files, as described in
849.Xr loader.conf 5 .
850.It Pa /boot/loader.help
851Loaded by
852.Ic help .
853Contains the help messages.
854.It Pa /boot/loader.rc
855.Nm
856bootstrapping script.
857.It Pa /boot/forth/loader.4th
858Extra builtin-like words.
859.It Pa /boot/forth/support.4th
860.Pa loader.conf
861processing words.
862.It Pa /boot/loader
863.Nm
864itself.
865.El
866.Sh EXAMPLES
867Boot in single user mode:
868.Pp
869.Dl boot -s
870.Pp
871Load the kernel, a boot_archive, and then autoboot in five seconds.
872Notice that a kernel must be loaded before any other
873.Ic load
874command is attempted.
875.Bd -literal -offset indent
876load /platform/i86pc/kernel/amd64/unix
877load -t rootfs /platform/i86pc/amd64/boot_archive
878autoboot 5
879.Ed
880.Pp
881Set the default device used for loading a kernel from a ZFS filesystem:
882.Bd -literal -offset indent
883set currdev=zfs:rpool/ROOT/knowngood:
884.Ed
885.Sh NOTES
886Although setting the
887.Va currdev
888as shown in the example above is supported, it is advisable to use loader
889beadm command or boot environment menu instead.
890The reason is, the beadm or menu selection will also instruct loader to clean up
891the currently set configuration and load configuration from the new boot
892environment.
893.Sh SEE ALSO
894.Xr btxld 1onbld ,
895.Xr loader.conf 5 ,
896.Xr menu.lst 5 ,
897.Xr boot 8
898.Sh STANDARDS
899For the purposes of ANS Forth compliance, loader is an
900.Bf Em
901ANS Forth System with Environmental Restrictions, Providing
902.Ef
903.Bf Li
904.No .( ,
905.No :noname ,
906.No ?do ,
907parse, pick, roll, refill, to, value, \e, false, true,
908.No <> ,
909.No 0<> ,
910compile\&, , erase, nip, tuck
911.Ef
912.Em and
913.Li marker
914.Bf Em
915from the Core Extensions word set, Providing the Exception Extensions
916word set, Providing the Locals Extensions word set, Providing the
917Memory-Allocation Extensions word set, Providing
918.Ef
919.Bf Li
920\&.s,
921bye, forget, see, words,
922\&[if],
923\&[else]
924.Ef
925.Em and
926.Li [then]
927.Bf Em
928from the Programming-Tools extension word set, Providing the
929Search-Order extensions word set.
930.Ef
931