Commit Graph

12 Commits

Author SHA1 Message Date
Mitchell Horne
8859960436 loader: always install help files
Address two issues with current help file logic:

The existing condition prevents the common help file from being
installed when there are no additional help files defined. This results
in no loader.help on EFI platforms, for example.

Second, due to the fact that we build and install multiple loader types,
each successive install will clobber the previous loader.help. The
result is that we could lose type-specific commands, or possibly list
them in loaders that do not have such commands.

Instead, give each loader type a uniquely named help file. The EFI
loader will look for /boot/loader.help.efi, userboot will look for
/boot/loader.help.userboot, etc. The interpreter variant has no effect
on which help file is loaded.

This leaves the old /boot/loader.help unused.

Some credit for the final approach goes to Mathieu <sigsys@gmail.com>
for their version of the fix in https://reviews.freebsd.org/D22951.

PR:		267134
Reported by:	Daniel O'Connor <darius@dons.net.au>
Reviewed by:	imp
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D28591
2023-02-03 16:35:06 -04:00
Warner Losh
2101541ff1 stand: Move quit command to common commands
Since both EFI and the future kboot will benefit from a 'quit' command,
move it from efi/loader/main.c to common/commands.c. In EFI this command
exits back to the boot loader (which will cause the next BootXXXX in the
BootOrder list to be attempted). In kboot, this will exit back to
whatever called loader.kboot. In uboot this will cause a reset (which
will restart uboot, not quite a simple exit, but will look similar)
and in OFW it will execute OF_exit which should return to the
openfirmware prompt.

Sponsored by:		Netflix
2022-07-30 04:48:35 -06:00
Emmanuel Vadot
70661eaafa loader: Add a readtest command
readtest will simply load the file in memory, useful for timing
loading on some filesystems.

Reviewed by:	tsoome
MFC after:	2 weeks
Sponsored by:	Beckhoff Automation GmbH & Co. KG
Differential Revision:	https://reviews.freebsd.org/D33411
2021-12-16 11:50:31 +01:00
Toomas Soome
7b0d05d56d loader: loader_lua can run command_more twice
When we quit pager, the return value 1 is returned and command_more()
interprets it as error.

when lua loader gets error from command, it will try to
interpret it once more, so we get the same file shown once more.

There is no reason why we should return error from command_more().

MFC after:	1 week
2021-08-21 21:28:54 +03:00
Simon J. Gerraty
bbac74ca3c loader: ignore some variable settings if input unverified
libsecureboot can tell us if the most recent file opened was
verfied or not.
If it's state is VE_UNVERIFIED_OK, skip if variable
matches one of the restricted prefixes.

Reviewed by:	stevek
MFC after:	1 week
Sponsored by:	Juniper Networks
Differential Revision:	https://reviews.freebsd.org//D20909
2019-07-17 23:33:14 +00:00
Toomas Soome
b67d407ac7 loader: cstyle cleanup of command.c
just clean it up. no functional changes intended.

Reviewed by:	imp
Differential Revision:	https://reviews.freebsd.org/D15087
2018-04-16 14:10:19 +00:00
Toomas Soome
6d68f8acf4 loader: make sure we do not return garbage from help_getnext
Since we do free subtopic and desc in help_getnext(), we need to set them also
NULL, so we make sure we dont get double free().

Approved by:	bapt
Differential Revision:	https://reviews.freebsd.org/D15082
2018-04-16 12:46:14 +00:00
Toomas Soome
746dddb134 loader: command_errmsg should be const
Use const char * for command_errmsg.
2018-04-16 08:41:44 +00:00
Toomas Soome
faa5306390 loader: make sure we use snprintf() in commands.c
Safeguard against memory corruptions.
2018-04-16 08:15:50 +00:00
Toomas Soome
5276f60430 loader: provide values in help_getnext()
With r328289 we attempt to make sure we free the resources allocated in
help_getnext(), however, it is possible that we get no resources allocated
and help_getnext() will return early.

Make sure we have pointers set to NULL early in help_getnext().

Reported by:	Andy Fiddaman
2018-04-16 07:26:23 +00:00
Warner Losh
74ecc44117 Don't leak memory when displaying help.
Right now, we'll leak memory when we display a help topic because we
don't free t, s, d that we've just used when breaking out of the loop.
NB: coverity just reported t, but s and d also leak.

CID: 1007776
2018-01-23 18:01:27 +00:00
Warner Losh
ca987d4641 Move sys/boot to stand. Fix all references to new location
Sponsored by:	Netflix
2017-11-14 23:02:19 +00:00