1 .\" Copyright (c) 1999 Daniel C. Sobral
2 .\" All rights reserved.
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\" notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\" notice, this list of conditions and the following disclaimer in the
11 .\" documentation and/or other materials provided with the distribution.
13 .\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
14 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
17 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25 .\" $FreeBSD: src/sys/boot/common/loader.8,v 1.57 2003/06/29 20:57:55 brueffer Exp $
27 .\" Note: The date here should be updated whenever a non-trivial
28 .\" change is made to the manual page.
34 .Nd kernel bootstrapping final stage
40 kernel bootstrapping process.
41 It is implemented as a
44 is linked statically to
54 directory exist on the boot file system, then
56 is prepended to all relative file names used by
58 This makes it possible to locate all files used by
64 directory on the boot file system.
65 If boot and root are the same file system, then files used by
69 If boot and root are different file systems, then files used by
73 on the boot file system, which is mounted as
75 on the root file system when the kernel is running.
77 During initialization,
79 will probe for a console and set the
81 variable, or set it to serial console
83 if the previous boot stage used that.
84 Then, devices are probed,
93 is processed if available, and, failing that,
95 is read for historical reasons.
96 These files are processed through the
98 command, which reads all of them into memory before processing them,
99 making disk changes possible.
103 has not been tried, and if
107 (not case sensitive), then an
110 If the system gets past this point,
114 will engage interactive mode.
118 builtin commands take parameters from the command line.
120 The builtin commands available are:
122 .Bl -tag -width indent -compact
123 .It Ar variable Ns = Ns Ar value
128 Value is always assigned to local variable
132 is in list of known kernel environment variables or
134 it is also assigned to the kernel environment variable of the given name.
141 the assignment described above, will assign to a local variable and
142 if it seems applicable, also snoop assignment to kernel environment variable.
144 .Sx ENVIRONMENT VARIABLES AND LOCAL VARIABLES .
146 .It Ic autoboot Op Ar delay Op Ar prompt
147 Proceeds to bootstrap the system after a number of seconds, if not
148 interrupted by the user.
149 Displays a countdown prompt
150 warning the user the system is about to be booted,
151 unless interrupted by a key press.
152 The kernel will be loaded first if necessary.
153 Defaults to 10 seconds.
156 Displays statistics about disk cache usage.
159 .It Ic boot Oo Fl Ns Ar flag ... Oc Op Ar kernelname
160 Immediately proceeds to bootstrap the system, loading the kernel
162 Any flags or arguments are passed to the kernel, but they
163 must precede the kernel name, if a kernel name is provided.
164 Flags are described in
167 .It Ic cd Op Ar directory
168 Change working directory to
172 .It Ic echo Oo Fl n Oc Op Ar message
173 Displays text on the screen.
174 A new line will be printed unless
179 Displays memory usage statistics.
180 For debugging purposes only.
182 .It Ic help Op Ar topic Op Ar subtopic
183 Shows help messages read from
188 will list all topics available.
191 Process script files.
192 Each file, in turn, is completely read into memory,
193 and then each of its lines is passed to the command line interpreter.
194 If any error is returned by the interpreter, the include
195 command aborts immediately, without reading any other files, and
196 returns an error itself.
198 .It Ic load Oo Fl t Ar type Oc Ar file Op Ar argument ...
199 Loads a kernel, kernel loadable module (kld), or file of opaque
200 contents tagged as being of the type
202 Kernel and modules can be either in a.out or
205 Any arguments passed after the name of the file to be loaded
206 will be passed as arguments to that file.
207 Currently, argument passing does not work for the kernel.
210 Load kernel and all modules specified by MODULE_load variables.
212 .It Ic local Op Ar local_variable ...
213 Displays the specified variable's value, or all local variables and their
218 .It Ic ls Oo Fl l Oc Op Ar path
219 Displays a listing of files in the directory
221 or the root directory if
226 is specified, file sizes will be shown too.
232 prefix indicates a disk slice or partition from which it may be
233 possible to load modules.
236 is specified, more details,
237 like disk slice or partition size and position, are printed.
240 Displays loaded modules.
243 is specified, more details are shown.
245 .It Ic lunset Ar local_variable
246 Unset local variable: discard value and remove variable.
248 .It Ic lunsetif Ar local_variable env_variable
253 is true, i.e.\& set to 1 or
259 .It Ic menuadd Ar command_line
260 Add script line for current menu bullet.
263 Clear all menu bullets.
265 .It Ic menuitem Ar key description
266 Start new menu bullet.
267 When running menu system, a line with
271 is displayed, and bullet is choosen by pressing
275 Display the files specified, with a pause at each
279 .It Ic optcd Op Ar directory
280 Change working directory to
286 but ignores errors while changing directory.
289 Process script files.
293 but ignores errors while executing commands in included files.
295 .It Ic pnpscan Op Fl v
296 Scans for Plug-and-Play devices.
297 This is not functional at present.
300 Show working directory.
302 .It Ic read Oo Fl t Ar seconds Oc Oo Fl p Ar prompt Oc Op Ar env_variable
303 Reads a line of input from the terminal, storing it in
306 A timeout can be specified with
308 though it will be canceled at the first key pressed.
309 A prompt may also be displayed through the
314 Immediately reboots the system.
316 .It Ic set Ar env_variable
317 .It Ic set Ar env_variable Ns = Ns Ar value
320 environment variables.
322 .It Ic show Op Ar env_variable
323 Displays the specified kernel environment variable's value,
324 or all variables and their values if
329 Remove all modules from memory.
331 .It Ic unset Ar env_variable
334 from the environment.
337 List most available commands with short help.
339 .Ss ENVIRONMENT VARIABLES AND LOCAL VARIABLES
342 has actually two different kinds of variables.
344 kernel environment variables, which is visible to the kernel when it is run,
345 and a separate space of local variables used by
347 which are not available to the kernel.
349 Environment variables can be set and unset through the
353 builtins, and can have their values interactively examined through the
358 Notice that these environment variables are not inherited by any shell
359 after the system has been booted, but can be examined by
362 A few variables are set automatically by
364 Others can affect the behavior of either
366 or the kernel at boot.
367 Some options may require a value,
368 while others define behavior just by being set.
369 Both types of variables are described below.
370 .Bl -tag -width indent
372 Unset this to disable automatic loading of the ACPI module.
373 .It Va autoboot_delay
376 will wait before booting.
377 If this variable is not defined,
379 will default to 10 seconds.
385 will be automatically attempted after processing
389 will be processed normally, defaulting to 10 seconds delay.
391 Instructs the kernel to prompt the user for the name of the root device
392 when the kernel is booted.
394 Instructs the kernel to start in the DDB debugger, rather than
395 proceeding to initialize when booted.
397 Selects gdb-remote mode for the kernel debugger by default.
399 Prevents the kernel from initiating a multi-user startup; instead single-user
400 mode will be entered when the kernel has finished device probing.
401 .It Va boot_userconfig
402 Requests that the kernel's interactive device configuration program
403 be run when the kernel is booted.
405 Setting this variable causes extra debugging information to be printed
406 by the kernel especially during the boot phase.
408 List of semicolon-separated search path for bootable kernels.
410 .Dq Li kernel;kernel.old .
412 Defines the current console.
414 Selects the default device.
415 Syntax for devices is odd.
417 Unset this to disable automatic loading of the EHCI module.
419 Sets the list of binaries which the kernel will try to run as the initial
421 The first matching binary is used.
423 .Dq Li /sbin/init:/sbin/oinit:/sbin/init.bak .
425 Define the number of lines on the screen, to be used by the pager.
427 Sets the list of directories which will be searched for modules named in a
429 command or implicitly required by a dependency.
430 The default value for this variable is
432 which first searches the current working directory and then
435 Sets the number of IDE disks as a workaround for some problems in
436 finding the root disk at boot.
437 This has been deprecated in favor of
445 .It Va root_disk_unit
446 If the code which detects the disk unit number for the root disk is
447 confused, e.g.\& by a mix of
454 gaps in the sequence (e.g.\& no primary slave), the unit number can
455 be forced by setting this variable.
457 By default the value of
459 is used to set the root file system
460 when the kernel is booted.
461 This can be overridden by setting
465 The name of a device where the kernel can save a crash dump in case
467 This automatically sets the
474 Other variables are used to override kernel tunable parameters.
477 tunables are available:
478 .Bl -tag -width indent
480 Set irqX's destination to the given
483 If the specified value is larger than the last
485 then the first CPUID will be used.
486 This variable should not be used if
488 support is not compiled into kernel.
490 Limit the amount of physical memory the system will use.
491 By default the size is in bytes, but the
492 .Cm k , K , m , M , g
496 are also accepted and indicate kilobytes, megabytes and gigabytes
498 An invalid suffix will result in the variable being ignored by the
500 .It Va hw.usb.hack_defer_exploration
501 The USB keyboard will sometimes not attach properly unless you set this
503 .It Va kern.emergency_intr_enable
504 Setting this to 1 enables emergency interrupt polling.
506 handlers are executed periodically.
507 This mode is very expensive and should
508 only be used to get a system accessible when interrupt routing is
510 It is primarily used by kernel developers to debug new systems.
511 .It Va kern.emergency_intr_freq
512 Set the polling rate for the emergency interrupt polling code.
513 The default is 10 (hz) to dissuade casual use.
514 If you are doing real work
515 with emergency interrupt polling mode enabled, it is recommended
516 that you use a frequency between 100hz and 300hz.
518 Set the size of a number of statically allocated system tables; see
520 for a description of how to select an appropriate value for this tunable.
521 When set, this tunable replaces the value declared in the kernel
522 compile-time configuration file.
523 .It Va kern.ipc.nmbclusters
524 Set the number of mbuf clusters to be allocated.
525 The value cannot be set below the default
526 determined when the kernel was compiled.
530 Toggles the mmx optimizations for the bcopy/copyin/copyout routines
531 .It Va kern.vm.kmem.size
532 Sets the size of kernel memory (bytes).
533 This overrides the value determined when the kernel was compiled.
534 .It Va kern.maxswzone
537 to be used to hold swap
538 meta information, which directly governs the
539 maximum amount of swap the system can support.
540 This value is specified in bytes of KVA space
541 and defaults to around 70MBytes.
543 to not reduce this value such that the actual
544 amount of configured swap exceeds \(12 the
545 kernel-supported swap.
546 The default 70MB allows
547 the kernel to support a maximum of (approximately)
548 14GB of configured swap.
549 Only mess around with
550 this parameter if you need to greatly extend the
552 reservation for other resources such as the
556 .Va VM_SWZONE_SIZE_MAX .
557 .It Va kern.maxbcache
558 Limits the amount of KVM reserved for use by the
559 buffer cache, specified in bytes.
560 The default maximum is 200MB.
561 This parameter is used to
562 prevent the buffer cache from eating too much
564 in large-memory machine configurations.
565 Only mess around with this parameter if you need to
568 reservation for other resources
569 such as the swap zone or
572 the NBUF parameter will override this limit.
574 .Va VM_BCACHE_SIZE_MAX .
575 .It Va machdep.disable_mtrrs
580 .It Va net.inet.tcp.tcbhashsize
581 Overrides the compile-time set value of
583 or the preset default of 512.
584 Must be a power of 2.
585 .It Va vfs.root.mountfrom
586 Specify root file system.
587 A semicolon separated list of file systems to try
588 as the kernel root file system.
589 File system format is file system type and disk store,
591 This variable needs to be set when using boot-only partition, which is
592 typically mounted on root file system as
595 One file system example:
600 multi volume example:
601 .Dl hammer:da8s1a:da9s1a
603 Several file systems, boot list, example:
604 .Dl ufs:da0s1a;hammer:ad1s1d
606 Each file system in the list will be tried in the order specified
607 until the mount succeeds.
610 prompt is displayed for manual entry.
612 You may not specify devtab labels here but you can specify paths available to
615 .Dl hammer:serno/L41JYE0G.s1d
618 .Bl -tag -width /boot/defaults/dloader.menu -compact
619 .It Pa /boot/boot.conf
621 bootstrapping script.
626 .It Pa /boot/defaults/dloader.menu
628 menu setup commands -- do not change this file.
629 .It Pa /boot/defaults/loader.conf
631 configuration file, see
633 -- do not change this file.
634 .It Pa /boot/dloader.menu
637 .It Pa /boot/dloader.rc
639 bootstrapping script.
640 .It Pa /boot/loader.conf
641 .It Pa /boot/loader.conf.local
643 configuration files, see
645 .It Pa /boot/loader.help
646 help messages, used by
651 Boot in single user mode:
656 Load kernel's user configuration file.
657 Notice that a kernel must be loaded before any other
659 command is attempted.
660 .Bd -literal -offset indent
662 load -t userconfig_script kernel.conf
665 Load the kernel, a splash screen, and then autoboot in five seconds.
666 .Bd -literal -offset indent
669 load -t splash_image_data chuckrulez.bmp
673 Set the disk unit of the root device to 2, and then boot.
674 This would be needed in a system with two IDE disks,
675 with the second IDE disk hardwired to
679 .Bd -literal -offset indent
697 dloader was introduced and
706 .An Michael Smith Aq msmith@FreeBSD.org .
708 dloader was written by
709 .An Matthew Dillon Aq dillon@backplane.com .