xref: /netbsd-src/share/man/man9/boothowto.9 (revision c99c81bb6658866d5d8a393c82115db533e9feed)
1.\"	$NetBSD: boothowto.9,v 1.8 2018/07/19 11:09:38 wiz Exp $
2.\"
3.\" Copyright (c) 2009 The NetBSD Foundation, Inc.
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
16.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
17.\" TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18.\" PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
19.\" BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
20.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
21.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
24.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
25.\" POSSIBILITY OF SUCH DAMAGE.
26.\"
27.Dd July 14, 2018
28.Dt BOOTHOWTO 9
29.Os
30.Sh NAME
31.Nm boothowto ,
32.Nm BOOT_FLAG
33.Nd flags passed to kernel during boot or shutdown
34.Sh SYNOPSIS
35.In sys/reboot.h
36.In sys/systm.h
37.Vt extern int boothowto;
38.In sys/boot_flag.h
39.Vt #define BOOT_FLAG(arg, retval) ...
40.Sh DESCRIPTION
41The
42.Va boothowto
43variable contains flags passed to the kernel by the boot loader (see
44.Xr boot 8 ) ,
45or the
46.Xr reboot 2
47system call.
48The value is interpreted as a bit mask, with bits defined by the
49.Dq Sy RB_ Ns No *
50and
51.Dq Sy AB_ Ns No *
52symbols in
53.In sys/reboot.h .
54The value is made available via the
55.Xr sysctl 7
56variable
57.Va kern.boothowto .
58.Pp
59The
60.Dv BOOT_FLAG
61macro defined in
62.In sys/boot_flag.h
63is used by many boot loaders to convert command line options into
64.Va boothowto
65flags.
66Note that not all boot loaders use this macro, and some boot loaders
67may have incompatible options.
68.Pp
69Where possible, flags set by the
70.Xr reboot 2
71system call will be passed to the new kernel after a reboot;
72the extent to which this is possible is machine dependent.
73.Pp
74In the following tables,
75each flag is listed with
76its symbolic name,
77the corresponding numeric value defined in
78.In sys/reboot.h ,
79and the option letter (if any) understood by the
80.Dv BOOT_FLAG
81macro.
82.
83.Ss Flags that affect booting or shutting down
84The following flags affect actions taken during system boot
85or shutdown.
86.Bl -column RB_INITNAMEA 0x00000000 \&-x
87.It Dv RB_AUTOBOOT Ta Li 0 Ta Ta
88The default if no other flags are set.
89Causes the system to boot in the normal way.
90.It Dv RB_ASKNAME Ta Li 0x00000001 Ta Fl a Ta
91This flag causes various parts of the system to prompt:
92.Bl -bullet -compact
93.It
94The boot loader may prompt for the name or location of the
95kernel to be booted.
96.It
97The kernel will prompt for the root file system device.
98.It
99The kernel will prompt for the root file system type.
100.It
101The kernel will prompt for the location of the dump device.
102.It
103The kernel will prompt for the path to the
104.Xr init 8
105program.
106.El
107Some subsystems set this flag when they are unable to automatically
108make a decision.
109.It Dv RB_SINGLE Ta Li 0x00000002 Ta Fl s Ta
110Boot in single-user mode.
111If this flag is set, the kernel passes the
112.Fl s
113option to
114.Xr init 8 .
115.It Dv RB_NOSYNC Ta Li 0x00000004 Ta Ta
116If this flag is set, then some parts of the shutdown process will
117be less graceful than usual:
118.Bl -bullet -compact
119.It
120Disks will not be synced
121(see
122.Xr sync 2
123and
124.Xr cpu_reboot 9 ) .
125.It
126Devices will not be detached (see
127.Xr autoconf 9 ) .
128.\" actually, see config_detach_all, but that is undocumented
129.It
130File systems will not be unmounted (see
131.Xr cpu_reboot 9 ,
132and
133.Xr vfs_shutdown 9 ) .
134.It
135The time of day clock will not be set (see
136.Xr resettodr 9 ) .
137.El
138.It Dv RB_HALT Ta Li 0x00000008 Ta Fl b Ta
139If this flag is set, then
140.Xr reboot 2
141will cause the system to halt instead of rebooting.
142This flag may be set at boot time, and cannot be cleared by
143.Xr reboot 2 .
144.It Dv RB_INITNAME Ta Li 0x00000010 Ta Ta
145This flag is obsolete.
146It was previously used to cause the kernel to prompt for the name of the
147.Xr init 8
148program, but that function is now controlled by the
149.Dv RB_ASKNAME
150flag.
151.It Dv RB_KDB Ta Li 0x00000040 Ta Fl d Ta
152Gives control to a kernel debugger early in the boot sequence.
153See
154.Xr ddb 4
155and
156.Dq "options KGDB"
157in
158.Xr options 4 .
159.It Dv RB_RDONLY Ta Li 0x00000080 Ta Ta
160This flag is deprecated.
161It previously caused the kernel to mount the root file system
162in read-only mode, but now that is the default, and this flag
163has no effect.
164.It Dv RB_DUMP Ta Li 0x00000100 Ta Ta
165Causes the kernel to dump memory to the dump device during shutdown.
166See
167.Xr savecore 8 ,
168.Xr cpu_reboot 9 ,
169and
170.Xr dumpsys 9 .
171.It Dv RB_MINIROOT Ta Li 0x00000200 Ta Fl m Ta
172This flag informs the kernel that a mini-root file system is present
173in memory.
174See
175.Xr md 4 ,
176and
177.Xr mdsetimage 8 .
178.It Dv RB_STRING Ta Li 0x00000400 Ta Ta
179This flag indicates that a boot string is present.
180The string may be provided by
181.Xr reboot 2
182and will be passed to the boot loader if possible.
183.It Dv RB_POWERDOWN Ta Li (RB_HALT|0x800) Ta Ta
184This flag is used in conjunction with
185.Dv RB_HALT .
186If this flag is set, then then system will be powered down if possible.
187If powerdown is not supported, then the system will halt.
188.It Dv RB_USERCONF Ta Li 0x00001000 Ta Fl c Ta
189This flag causes the kernel to invoke the
190.Xr userconf 4
191device configuration manager early in the boot sequence.
192.El
193.
194.Ss Flags that affect verbosity
195The following flags affect the verbosity of messages printed by the kernel.
196These flags are used by several functions described in
197.Xr kprintf 9
198to control whether output is sent to the console, the system log,
199.\" the /dev/log device driver is undocumented
200both, or neither.
201The use of flags that increase verbosity simultaneously with
202the use of flags that decrease verbosity,
203is not well defined.
204.Bl -column RB_INITNAMEA 0x00000000 \&-x
205.It Dv AB_NORMAL Ta Li 0 Ta Ta
206The default, if none of the other
207.Dv AB_*
208flags is set, is that ordinary kernel messages are sent
209both to the console and to the system log.
210.It Dv AB_QUIET Ta Li 0x00010000 Ta Fl q Ta
211Boot quietly.
212Ordinary kernel messages are sent to the system log,
213but not to the console.
214Messages printed with
215.Xr aprint_naive 9
216are sent to the console, but not to the system log.
217.It Dv AB_VERBOSE Ta Li 0x00020000 Ta Fl v Ta
218Boot verbosely.
219Some messages will be printed that would otherwise not be printed.
220Both ordinary kernel messages, and messages printed with
221.Xr aprint_verbose 9 ,
222will be sent both to the console and to the system log.
223If this flag is not set, then messages printed with
224.Xr aprint_verbose 9
225will be sent only to the system log.
226.It Dv AB_SILENT Ta Li 0x00040000 Ta Fl z Ta
227Boot silently.
228Most kernel messages will be sent only to the system log, not to the console.
229The
230.Fn aprint_*
231functions display a spinning symbol on the console.
232.It Dv AB_DEBUG Ta Li 0x00080000 Ta Fl x Ta
233Boot with debug messages.
234.El
235.
236.Ss Machine-dependent flags
237The following flags have machine-dependent meanings.
238.Bl -column RB_INITNAMEA 0x00000000 \&-x
239.It Dv RB_MD1 Ta Li 0x10000000 Ta Fl 1 Ta
240Some ports use this flag to disable multiprocessor mode,
241making them use only a single CPU.
242The zaurus port uses this flag to enable the serial console.
243.It Dv RB_MD2 Ta Li 0x20000000 Ta Fl 2 Ta
244The i386 and amd64 ports use this flag to disable
245.Xr acpi 4 .
246.It Dv RB_MD3 Ta Li 0x40000000 Ta Fl 3 Ta
247This flag is currently not used by any ports.
248.It Dv RB_MD4 Ta Li 0x80000000 Ta Fl 4 Ta
249This flag is currently not used by any ports.
250.El
251.
252.Sh SEE ALSO
253.\" sets boothowto
254.Xr reboot 2 ,
255.\" RB_KDB
256.Xr ddb 4 ,
257.\" RB_USERCONF
258.Xr userconf 4 ,
259.\" sysctl kern.boothowto
260.Xr sysctl 7 ,
261.\" sets boothowto
262.Xr boot 8 ,
263.Xr crash 8 ,
264.\" RB_SINGLE, RB_INITNAME
265.Xr init 8 ,
266.\" reboot/poweroff/halt calls reboot(2)
267.Xr reboot 8 ,
268.\" useful after RB_DUMP
269.Xr savecore 8 ,
270.\" RB_NOSYNC
271.Xr sync 8 ,
272.\" RB_NOSYNC, RB_HALT, RB_DUMP
273.Xr cpu_reboot 9 ,
274.\" aprint_*() functions use AB_* flags
275.Xr kprintf 9
276.Sh HISTORY
277The
278.Va boothowto
279variable appeared in
280.Bx 4.0 .
281The
282.Sy BOOT_FLAG
283macro appeared in
284.Nx 1.6 .
285.Pp
286The
287.Dv RB_DFLTROOT
288option is now
289.Em obsolete .
290