tree: ac9c9ba53b10b2a040fd767aede9e81e1841ece5 [path history] [tgz]
  1. include/
  2. tests/
  3. boot-options.cc
  4. BUILD.gn
  5. console.cc
  6. enum.h
  7. markdown.py
  8. OWNERS
  9. postamble.md
  10. preamble.md
  11. README.md
  12. tool.cc
  13. word-view.cc
zircon/kernel/lib/boot-options/README.md

Zircon Kernel Boot Options

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.

BootOptions class

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 toBootOptions::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.

Documentation and JSON generation

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.