BOOTHOWTO(9)

πŸ“¦ version 11.0, in nixpkgs unstable

🌸 NAME 🌸

okay so welcome to BOOTHOWTO(9), straight outta the Kernel Developer's Manual πŸ’– The icons here are boothowto and BOOT_FLAG, and they're literally all about flags passed to the kernel during boot or shutdown. periodt.


✨ SYNOPSIS ✨

#include <sys/reboot.h>
#include <sys/systm.h>

extern int boothowto;

#include <sys/boot_flag.h>

#define BOOT_FLAG(arg, retval) ...

πŸ’… DESCRIPTION πŸ’…

The boothowto variable is lowkey a little bag of flags that the boot loader hands to the kernel (see boot(8)), or that come in through the reboot(2) system call. The value is interpreted as a bit mask, with bits defined by the RB_* and AB_* symbols in <sys/reboot.h>. It's also made available via the sysctl(7) variable kern.boothowto. iykyk.

The BOOT_FLAG macro lives in <sys/boot_flag.h>, and lots of boot loaders use it to turn command line options into boothowto flags. Note that not all boot loaders use this macro, and some boot loaders may have incompatible options. so like... vibe check your boot loader, bestie.

Where possible, flags set by the reboot(2) system call will be passed to the new kernel after a reboot; the extent to which this is possible is machine dependent.

The lists below give each flag's symbolic name, the corresponding numeric value defined in <sys/reboot.h>, and the BOOT_FLAG option letter (if any) understood by the macro. obsessed with a complete inventory, honestly.

πŸŽ€ Flags that affect booting or shutting down πŸŽ€

The following flags affect actions taken during system boot or shutdown.

  • RB_AUTOBOOT β€” value 0 β€” BOOT_FLAG letter: none β€” The default if no other flags are set. Causes the system to boot in the normal way.
  • RB_ASKNAME β€” value 0x00000001 β€” BOOT_FLAG letter: -a β€” This flag causes various parts of the system to prompt:
    • The boot loader may prompt for the name or location of the kernel to be booted.
    • The kernel will prompt for the root file system device.
    • The kernel will prompt for the root file system type.
    • The kernel will prompt for the location of the dump device.
    • The kernel will prompt for the path to the init(8) program.

Some subsystems set this flag when they are unable to automatically make a decision.

  • RB_SINGLE β€” value 0x00000002 β€” BOOT_FLAG letter: -s β€” Boot in single-user mode. If this flag is set, the kernel passes the -s option to init(8).
  • RB_NOSYNC β€” value 0x00000004 β€” BOOT_FLAG letter: none β€” If this flag is set, then some parts of the shutdown process will be less graceful than usual:
  • RB_HALT β€” value 0x00000008 β€” BOOT_FLAG letter: -b β€” If this flag is set, then reboot(2) will cause the system to halt instead of rebooting. This flag may be set at boot time, and cannot be cleared by reboot(2).
  • RB_INITNAME β€” value 0x00000010 β€” BOOT_FLAG letter: none β€” This flag is obsolete. It was previously used to cause the kernel to prompt for the name of the init(8) program, but that function is now controlled by the RB_ASKNAME flag.
  • RB_KDB β€” value 0x00000040 β€” BOOT_FLAG letter: -d β€” Gives control to a kernel debugger early in the boot sequence. See ddb(4) and options KGDB in options(4).
  • RB_RDONLY β€” value 0x00000080 β€” BOOT_FLAG letter: none β€” This flag is deprecated. It previously caused the kernel to mount the root file system in read-only mode, but now that is the default, and this flag has no effect.
  • RB_DUMP β€” value 0x00000100 β€” BOOT_FLAG letter: none β€” Causes the kernel to dump memory to the dump device during shutdown. See savecore(8), cpu_reboot(9), and dumpsys(9).
  • RB_MINIROOT β€” value 0x00000200 β€” BOOT_FLAG letter: -m β€” This flag informs the kernel that a mini-root file system is present in memory. See md(4), and mdsetimage(8).
  • RB_STRING β€” value 0x00000400 β€” BOOT_FLAG letter: none β€” This flag indicates that a boot string is present. The string may be provided by reboot(2) and will be passed to the boot loader if possible.
  • RB_POWERDOWN β€” value (RB_HALT|0x800) β€” BOOT_FLAG letter: none β€” This flag is used in conjunction with RB_HALT. If this flag is set, then the system will be powered down if possible. If powerdown is not supported, then the system will halt.
  • RB_USERCONF β€” value 0x00001000 β€” BOOT_FLAG letter: -c β€” This flag causes the kernel to invoke the userconf(4) device configuration manager early in the boot sequence.

🌈 Flags that affect verbosity 🌈

The following flags affect the verbosity of messages printed by the kernel. These flags are used by several functions described in kprintf(9) to control whether output is sent to the console, the system log, both, or neither.

⚠️ bestie, this part matters: the use of flags that increase verbosity simultaneously with the use of flags that decrease verbosity is not well defined. like, don't mix and match and expect a clean vibe.
  • AB_NORMAL β€” value 0 β€” BOOT_FLAG letter: none β€” The default, if none of the other AB_* flags is set, is that ordinary kernel messages are sent both to the console and to the system log.
  • AB_QUIET β€” value 0x00010000 β€” BOOT_FLAG letter: -q β€” Boot quietly. Ordinary kernel messages are sent to the system log, but not to the console. Messages printed with aprint_naive(9) are sent to the console, but not to the system log.
  • AB_VERBOSE β€” value 0x00020000 β€” BOOT_FLAG letter: -v β€” Boot verbosely. Some messages will be printed that would otherwise not be printed. Both ordinary kernel messages, and messages printed with aprint_verbose(9), will be sent both to the console and to the system log. If this flag is not set, then messages printed with aprint_verbose(9) will be sent only to the system log.
  • AB_SILENT β€” value 0x00040000 β€” BOOT_FLAG letter: -z β€” Boot silently. Most kernel messages will be sent only to the system log, not to the console. The aprint_*() functions display a spinning symbol on the console.
  • AB_DEBUG β€” value 0x00080000 β€” BOOT_FLAG letter: -x β€” Boot with debug messages.

πŸ¦‹ Machine-dependent flags πŸ¦‹

The following flags have machine-dependent meanings.

  • RB_MD1 β€” value 0x10000000 β€” BOOT_FLAG letter: -1 β€” Some ports use this flag to disable multiprocessor mode, making them use only a single CPU. The zaurus port uses this flag to enable the serial console.
  • RB_MD2 β€” value 0x20000000 β€” BOOT_FLAG letter: -2 β€” The i386 and amd64 ports use this flag to disable acpi(4).
  • RB_MD3 β€” value 0x40000000 β€” BOOT_FLAG letter: -3 β€” This flag is currently not used by any ports.
  • RB_MD4 β€” value 0x80000000 β€” BOOT_FLAG letter: -4 β€” This flag is currently not used by any ports.

πŸ‘‘ SEE ALSO πŸ‘‘

okay bestie, go read: reboot(2), ddb(4), userconf(4), sysctl(7), boot(8), crash(8), init(8), reboot(8), savecore(8), sync(8), cpu_reboot(9), kprintf(9).


πŸŽ€ HISTORY πŸŽ€

The boothowto variable appeared in 4.0BSD. The BOOT_FLAG macro appeared in NetBSD 1.6.

The RB_DFLTROOT option is now obsolete.


this iconic little page was brought to you by Debian, dated July 14, 2018, and it's literally BOOTHOWTO(9) β€” mwah πŸ’–

πŸ“¦ where this page comes from