xref: /illumos-gate/usr/src/man/man7/loader.7 (revision 8b6b46dcb073dba71917d6a7309f0df7bad798a2)
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.It Va twiddle_divisor
499Throttles the output of the
500.Sq twiddle
501I/O progress indicator displayed while loading the kernel and modules.
502This is useful on slow serial consoles where the time spent waiting for
503these characters to be written can add up to many seconds.
504The spinner is updated only once every
505.Va twiddle_divisor
506operations.
507The default value for
508.Va twiddle_divisor
509is 16.
510.El
511.Pp
512Other variables are used for loader or to set kernel properties or for
513informational purposes.
514.Ss Builtin Parser
515When a builtin command is executed, the rest of the line is taken
516by it as arguments, and it is processed by a special parser which
517is not used for regular Forth commands.
518.Pp
519This special parser applies the following rules to the parsed text:
520.Bl -enum
521.It
522All backslash characters are preprocessed.
523.Bl -bullet
524.It
525\eb , \ef , \er , \en and \et are processed as in C.
526.It
527\es is converted to a space.
528.It
529\ev is converted to
530.Tn ASCII
53111.
532.It
533\ez is just skipped.
534Useful for things like
535.Dq \e0xf\ez\e0xf .
536.It
537\e0xN and \e0xNN are replaced by the hex N or NN.
538.It
539\eNNN is replaced by the octal NNN
540.Tn ASCII
541character.
542.It
543\e" , \e' and \e$ will escape these characters, preventing them from
544receiving special treatment in Step 2, described below.
545.It
546\e\e will be replaced with a single \e .
547.It
548In any other occurrence, backslash will just be removed.
549.El
550.It
551Every string between non-escaped quotes or double-quotes will be treated
552as a single word for the purposes of the remaining steps.
553.It
554Replace any
555.Li $VARIABLE
556or
557.Li ${VARIABLE}
558with the value of the environment variable
559.Va VARIABLE .
560.It
561Space-delimited arguments are passed to the called builtin command.
562Spaces can also be escaped through the use of \e\e .
563.El
564.Pp
565An exception to this parsing rule exists, and is described in
566.Sx Builtins And FORTH .
567.Ss Builtins And FORTH
568All builtin words are state-smart, immediate words.
569If interpreted, they behave exactly as described previously.
570If they are compiled, though,
571they extract their arguments from the stack instead of the command line.
572.Pp
573If compiled, the builtin words expect to find, at execution time, the
574following parameters on the stack:
575.D1 Ar addrN lenN ... addr2 len2 addr1 len1 N
576where
577.Ar addrX lenX
578are strings which will compose the command line that will be parsed
579into the builtin's arguments.
580Internally, these strings are concatenated in from 1 to N,
581with a space put between each one.
582.Pp
583If no arguments are passed, a 0
584.Em must
585be passed, even if the builtin accepts no arguments.
586.Pp
587While this behavior has benefits, it has its trade-offs.
588If the execution token of a builtin is acquired (through
589.Ic '
590or
591.Ic ['] ) ,
592and then passed to
593.Ic catch
594or
595.Ic execute ,
596the builtin behavior will depend on the system state
597.Bf Em
598at the time
599.Ic catch
600or
601.Ic execute
602is processed!
603.Ef
604This is particularly annoying for programs that want or need to
605handle exceptions.
606In this case, the use of a proxy is recommended.
607For example:
608.Dl : (boot) boot ;
609.Ss FICL
610.Tn FICL
611is a Forth interpreter written in C, in the form of a forth
612virtual machine library that can be called by C functions and vice
613versa.
614.Pp
615In
616.Nm ,
617each line read interactively is then fed to
618.Tn FICL ,
619which may call
620.Nm
621back to execute the builtin words.
622The builtin
623.Ic include
624will also feed
625.Tn FICL ,
626one line at a time.
627.Pp
628The words available to
629.Tn FICL
630can be classified into four groups.
631The
632.Tn ANS
633Forth standard words, extra
634.Tn FICL
635words, extra
636.Fx
637words, and the builtin commands;
638the latter were already described.
639The
640.Tn ANS
641Forth standard words are listed in the
642.Sx STANDARDS
643section.
644The words falling in the two other groups are described in the
645following subsections.
646.Ss FICL Extra Words
647.Bl -tag -width wid-set-super
648.It Ic .env
649.It Ic .ver
650.It Ic -roll
651.It Ic 2constant
652.It Ic >name
653.It Ic body>
654.It Ic compare
655This is the STRING word set's
656.Ic compare .
657.It Ic compile-only
658.It Ic endif
659.It Ic forget-wid
660.It Ic parse-word
661.It Ic sliteral
662This is the STRING word set's
663.Ic sliteral .
664.It Ic wid-set-super
665.It Ic w@
666.It Ic w!
667.It Ic x.
668.It Ic empty
669.It Ic cell-
670.It Ic -rot
671.El
672.Ss Loader Extra Words
673.Bl -tag -width XXXXXXXX
674.It Ic \&$ Pq --
675Evaluates the remainder of the input buffer, after having printed it first.
676.It Ic \&% Pq --
677Evaluates the remainder of the input buffer under a
678.Ic catch
679exception guard.
680.It Ic .#
681Works like
682.Ic \&.
683but without outputting a trailing space.
684.It Ic fclose Pq Ar fd --
685Closes a file.
686.It Ic fkey Pq Ar fd -- char
687Reads a single character from a file.
688.It Ic fload Pq Ar fd --
689Processes a file
690.Em fd .
691.It Ic fopen Pq Ar addr len mode Li -- Ar fd
692Opens a file.
693Returns a file descriptor, or \-1 in case of failure.
694The
695.Ar mode
696parameter selects whether the file is to be opened for read access, write
697access, or both.
698The constants
699.Dv O_RDONLY , O_WRONLY ,
700and
701.Dv O_RDWR
702are defined in
703.Pa /boot/forth/support.4th ,
704indicating read only, write only, and read-write access, respectively.
705.It Xo
706.Ic fread
707.Pq Ar fd addr len -- len'
708.Xc
709Tries to read
710.Em len
711bytes from file
712.Em fd
713into buffer
714.Em addr .
715Returns the actual number of bytes read, or -1 in case of error or end of
716file.
717.It Ic heap? Pq -- Ar cells
718Return the space remaining in the dictionary heap, in cells.
719This is not related to the heap used by dynamic memory allocation words.
720.It Ic inb Pq Ar port -- char
721Reads a byte from a port.
722.It Ic isvirtualized? Pq -- Ar addr len flag | Ar flag
723Returns
724.Ic true
725and string with virtualization engine name or
726.Ic false .
727.It Ic key Pq -- Ar char
728Reads a single character from the console.
729.It Ic key? Pq -- Ar flag
730Returns
731.Ic true
732if there is a character available to be read from the console.
733.It Ic ms Pq Ar u --
734Waits
735.Em u
736microseconds.
737.It Ic outb Pq Ar port char --
738Writes a byte to a port.
739.It Ic seconds Pq -- Ar u
740Returns the number of seconds since midnight.
741.It Ic tib> Pq -- Ar addr len
742Returns the remainder of the input buffer as a string on the stack.
743.El
744.Ss Loader Extra Framebuffer Words
745.Bl -tag -width XXXXXXXX
746.It Ic fb-bezier Pq Ar x1 y1 x2 y2 x3 y3 width --
747Draws a quadratic Bezier curve in the current foreground color using the
748three provided points and specified line with.
749.It Ic fb-drawrect Pq Ar x1 y1 x2 y2 fill --
750Draws a rectangle to the screen with the top left at
751.Em (x1,y1)
752and the bottom right at
753.Em (x2,y2)
754, using the current foreground color.
755If
756.Em fill
757is
758.Ic true
759then the rectangle will be filled in.
760.It Ic fb-line Pq Ar x1 y1 x2 y2 width --
761Draws a line from
762.Em (x1,y1)
763to
764.Em (x2,y2)
765in the current foreground color and with the specified width.
766.It Ic fb-putimage Pq Ar flags x1 y1 x2 y2 addr len -- flag
767Outputs an image to the screen.
768Returns
769.Ic true
770if the image was able to be written and
771.Ic false
772otherwise.
773Only truecolor PNG images are supported and the path to the file
774must be provided through the
775.Em addr
776and
777.Em len
778arguments on the stack.
779The image will be displayed in the rectangular screen region with the top left
780at
781.Em (x1,y1)
782and the bottom right at
783.Em (x2,y2)
784.
785.Pp
786Either
787.Em x2
788or
789.Em y2
790can be set to "0" which causes it to be calculated to maintain the aspect
791ratio of the image.
792If both are "0" then the native resolution of the image will be used.
793.Pp
794If
795.Em x1
796is "0", then the image will be placed as far over to the right of the
797screen as possible.
798Similarly, if
799.Em y1
800is "0", then the image will be placed as far down the screen as possible.
801.Pp
802Flags is a bitfield; the following bits are defined:
803.Bl -tag -width XXXXX -offset indent
804.It 1
805Draw a single pixel border around the image in the current foreground color.
806.It 2
807Do not scroll the image with the rest of the screen.
808.It 128
809Output diagnostic information (for debugging).
810.El
811.It Ic fb-setpixel Pq Ar x y --
812Colors the pixel at
813.Em (x,y)
814with the current foreground color.
815.It Ic term-drawrect Pq Ar x1 y1 x2 y2 --
816Draws a rectangle with rounded corners using terminal coordinates and the
817current foreground color.
818.El
819.Ss Loader Defined Environmental Queries
820.Bl -tag -width Ds
821.It arch-i386
822.Ic TRUE
823if the architecture is IA32.
824.It loader_version
825.Nm
826version.
827.El
828.Ss Errors
829The following values are thrown by
830.Nm :
831.Bl -tag -width XXXXX -offset indent
832.It 100
833Any type of error in the processing of a builtin.
834.It -1
835.Ic Abort
836executed.
837.It -2
838.Ic Abort"
839executed.
840.It -56
841.Ic Quit
842executed.
843.It -256
844Out of interpreting text.
845.It -257
846Need more text to succeed -- will finish on next run.
847.It -258
848.Ic Bye
849executed.
850.It -259
851Unspecified error.
852.El
853.Sh FILES
854.Bl -tag -width /boot/defaults/loader.conf -compact
855.It Pa /boot/defaults/loader.conf
856.It Pa /boot/conf.d/*
857.It Pa /boot/loader.conf
858.It Pa /boot/loader.conf.local
859.Nm
860configuration files, as described in
861.Xr loader.conf 5 .
862.It Pa /boot/loader.help
863Loaded by
864.Ic help .
865Contains the help messages.
866.It Pa /boot/loader.rc
867.Nm
868bootstrapping script.
869.It Pa /boot/forth/loader.4th
870Extra builtin-like words.
871.It Pa /boot/forth/support.4th
872.Pa loader.conf
873processing words.
874.It Pa /boot/loader
875.Nm
876itself.
877.El
878.Sh EXAMPLES
879Boot in single user mode:
880.Pp
881.Dl boot -s
882.Pp
883Load the kernel, a boot_archive, and then autoboot in five seconds.
884Notice that a kernel must be loaded before any other
885.Ic load
886command is attempted.
887.Bd -literal -offset indent
888load /platform/i86pc/kernel/amd64/unix
889load -t rootfs /platform/i86pc/amd64/boot_archive
890autoboot 5
891.Ed
892.Pp
893Set the default device used for loading a kernel from a ZFS filesystem:
894.Bd -literal -offset indent
895set currdev=zfs:rpool/ROOT/knowngood:
896.Ed
897.Sh NOTES
898Although setting the
899.Va currdev
900as shown in the example above is supported, it is advisable to use loader
901beadm command or boot environment menu instead.
902The reason is, the beadm or menu selection will also instruct loader to clean up
903the currently set configuration and load configuration from the new boot
904environment.
905.Sh SEE ALSO
906.Xr btxld 1onbld ,
907.Xr loader.conf 5 ,
908.Xr menu.lst 5 ,
909.Xr boot 8
910.Sh STANDARDS
911For the purposes of ANS Forth compliance, loader is an
912.Bf Em
913ANS Forth System with Environmental Restrictions, Providing
914.Ef
915.Bf Li
916.No .( ,
917.No :noname ,
918.No ?do ,
919parse, pick, roll, refill, to, value, \e, false, true,
920.No <> ,
921.No 0<> ,
922compile\&, , erase, nip, tuck
923.Ef
924.Em and
925.Li marker
926.Bf Em
927from the Core Extensions word set, Providing the Exception Extensions
928word set, Providing the Locals Extensions word set, Providing the
929Memory-Allocation Extensions word set, Providing
930.Ef
931.Bf Li
932\&.s,
933bye, forget, see, words,
934\&[if],
935\&[else]
936.Ef
937.Em and
938.Li [then]
939.Bf Em
940from the Programming-Tools extension word set, Providing the
941Search-Order extensions word set.
942.Ef
943