This library provides a single source of truth and centralized definition for all boot options that the kernel parses from the “kernel command line” passed via ZBI_TYPE_CMDLINE
.
See options.inc
for details on how to define a boot option. All options are defined in that file or in an additional $cpu.inc
file for architecture-specific options.
Code in the kernel uses the BootOptions
class to read boot option values. Each option is a simple member held in the internal form of its type (uint32_t
, bool
, enum Something
, etc.), so just accessing gBootOptions->my_option
is all that's required.
In ['physboot](../../phys) startup, each
ZBI_TYPE_CMDLINEitem is fed to
BootOptions::Set` to parse any recognized options and update the members.
physboot
hands off the BootOptions
structure to the kernel proper and that is the only means of accessing boot options inside the kernel.
To support this hand-off between physboot
and the kernel proper, all data types used in BootOptions
members are restricted to trivially-copyable data with no pointers.
The build generates two files, boot-options.json
and boot-options.md
in the (Zircon) root build directory. The JSON data provides information on each option supported by BootOptions
(and thus by the kernel) in a simple machine-readable form.
This information is formatted into Markdown along with a fixed header and footer to produce boot-options.md
. The build compares the generated file to //docs/gen/boot-options.md
. If they differ, the build breaks and shows a recommended cp
command to update the file in the source tree. Hence every update to options.inc
must be accompanied by a re-generation of the documentation.