]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
MFC r336244, r336246-r336247: Standardize boot arg parsing
authorkevans <kevans@FreeBSD.org>
Wed, 20 Feb 2019 19:19:24 +0000 (19:19 +0000)
committerkevans <kevans@FreeBSD.org>
Wed, 20 Feb 2019 19:19:24 +0000 (19:19 +0000)
commit867c0643d415b25960cffc049e532446a8a8d008
tree85ecc898c7d0d33c529a32951b6941b6ad27660b
parent1fc41abb2fa6dba03aea53f70f98000435814f72
MFC r336244, r336246-r336247: Standardize boot arg parsing

r336244:
Create helper functions for parsing boot args.

boot_parse_arg to parse a single arg
boot_parse_cmdline to parse a command line string
boot_parse_args to parse all the args in a vector
boot_howto_to_env Convert howto bits to env vars
boot_env_to_howto Return howto mask mased on what's set in the environment.

All these routines return an int that's the bitmask of the args
translated to RB_* flags. As a special case, the 'S' flag sets the
comconsole_speed env var. Any arg that looks like a=b will set the env
key 'a' to value 'b'. If =b is omitted, 'a' is set to '1'.  This
should help us reduce the number of redundant copies of these routines
in the tree.  It should also give a more uniform experience between
platforms.

Also, invent a new flag RB_PROBE that's set when 'P' is parsed.  On
x86 + BIOS, this means 'probe for the keyboard, and if it's not there
set both RB_MULTIPLE and RB_SERIAL (which means show the output on
both video and serial consoles, but make serial primary).  Others it
may be some similar concept of probing, but it's loader dependent
what, exactly, it means.

These routines are suitable for /boot/loader and/or the kernel,
though they may not be suitable for the tightly hand-rolled-for-space
environments like boot2.

r336246:
Eliminate boot loader copies of boot arg parsing.

Eliminate 4 of the copies of the arg parsing in /boot/laoder
by using boot_parse_cmdline.

r336247:
Transition to boot_env_to_howto and boot_howto_to_env in the boot
loader.
14 files changed:
stand/common/boot.c
stand/common/bootstrap.h
stand/common/metadata.c
stand/efi/loader/bootinfo.c
stand/efi/loader/main.c
stand/i386/libi386/bootinfo.c
stand/libsa/Makefile
stand/userboot/userboot/bootinfo.c
sys/arm/arm/machdep_boot.c
sys/conf/files
sys/kern/subr_boot.c [new file with mode: 0644]
sys/sys/boot.h
sys/sys/reboot.h
sys/x86/xen/pv.c