mirror of
https://github.com/freebsd/freebsd-src
synced 2024-09-06 17:18:32 +00:00
Transition to boot_env_to_howto and boot_howto_to_env in the boot
loader. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16205
This commit is contained in:
parent
4569e91328
commit
c96ac12e5c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=336247
|
@ -160,30 +160,6 @@ autoboot_maybe()
|
|||
autoboot(-1, NULL); /* try to boot automatically */
|
||||
}
|
||||
|
||||
int
|
||||
bootenv_flags()
|
||||
{
|
||||
int i, howto;
|
||||
char *val;
|
||||
|
||||
for (howto = 0, i = 0; howto_names[i].ev != NULL; i++) {
|
||||
val = getenv(howto_names[i].ev);
|
||||
if (val != NULL && strcasecmp(val, "no") != 0)
|
||||
howto |= howto_names[i].mask;
|
||||
}
|
||||
return (howto);
|
||||
}
|
||||
|
||||
void
|
||||
bootenv_set(int howto)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; howto_names[i].ev != NULL; i++)
|
||||
if (howto & howto_names[i].mask)
|
||||
setenv(howto_names[i].ev, "YES", 1);
|
||||
}
|
||||
|
||||
static int
|
||||
autoboot(int timeout, char *prompt)
|
||||
{
|
||||
|
|
|
@ -63,8 +63,6 @@ int parse(int *argc, char ***argv, const char *str);
|
|||
/* boot.c */
|
||||
void autoboot_maybe(void);
|
||||
int getrootmount(char *rootdev);
|
||||
int bootenv_flags(void);
|
||||
void bootenv_set(int);
|
||||
|
||||
/* misc.c */
|
||||
char *unargv(int argc, char *argv[]);
|
||||
|
|
|
@ -101,7 +101,7 @@ md_getboothowto(char *kargs)
|
|||
|
||||
/* Parse kargs */
|
||||
howto = boot_parse_cmdline(kargs);
|
||||
howto |= bootenv_flags();
|
||||
howto |= boot_env_to_howto();
|
||||
#if defined(__sparc64__)
|
||||
if (md_bootserial() != -1)
|
||||
howto |= RB_SERIAL;
|
||||
|
|
|
@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$");
|
|||
#include <sys/param.h>
|
||||
#include <sys/linker.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/boot.h>
|
||||
#include <machine/cpufunc.h>
|
||||
#include <machine/elf.h>
|
||||
#include <machine/metadata.h>
|
||||
|
@ -59,12 +60,6 @@ int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp);
|
|||
|
||||
extern EFI_SYSTEM_TABLE *ST;
|
||||
|
||||
static const char howto_switches[] = "aCdrgDmphsv";
|
||||
static int howto_masks[] = {
|
||||
RB_ASKNAME, RB_CDROM, RB_KDB, RB_DFLTROOT, RB_GDB, RB_MULTIPLE,
|
||||
RB_MUTE, RB_PAUSE, RB_SERIAL, RB_SINGLE, RB_VERBOSE
|
||||
};
|
||||
|
||||
static int
|
||||
bi_getboothowto(char *kargs)
|
||||
{
|
||||
|
@ -73,7 +68,8 @@ bi_getboothowto(char *kargs)
|
|||
char *console;
|
||||
int howto;
|
||||
|
||||
howto = bootenv_flags();
|
||||
howto = boot_parse_cmdline(kargs);
|
||||
howto |= boot_env_to_howto();
|
||||
|
||||
console = getenv("console");
|
||||
if (console != NULL) {
|
||||
|
@ -83,21 +79,6 @@ bi_getboothowto(char *kargs)
|
|||
howto |= RB_MUTE;
|
||||
}
|
||||
|
||||
/* Parse kargs */
|
||||
if (kargs == NULL)
|
||||
return (howto);
|
||||
|
||||
opts = strchr(kargs, '-');
|
||||
while (opts != NULL) {
|
||||
while (*(++opts) != '\0') {
|
||||
sw = strchr(howto_switches, *opts);
|
||||
if (sw == NULL)
|
||||
break;
|
||||
howto |= howto_masks[sw - howto_switches];
|
||||
}
|
||||
opts = strchr(opts, '-');
|
||||
}
|
||||
|
||||
return (howto);
|
||||
}
|
||||
|
||||
|
|
|
@ -28,11 +28,13 @@
|
|||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
#include <stand.h>
|
||||
|
||||
#include <sys/disk.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/reboot.h>
|
||||
#include <sys/boot.h>
|
||||
#include <stdint.h>
|
||||
#include <stand.h>
|
||||
#include <string.h>
|
||||
#include <setjmp.h>
|
||||
#include <disk.h>
|
||||
|
@ -481,7 +483,7 @@ main(int argc, CHAR16 *argv[])
|
|||
|
||||
howto = parse_args(argc, argv, has_kbd);
|
||||
|
||||
bootenv_set(howto);
|
||||
boot_howto_to_env(howto);
|
||||
|
||||
/*
|
||||
* XXX we need fallback to this stuff after looking at the ConIn, ConOut and ConErr variables
|
||||
|
|
|
@ -44,7 +44,7 @@ bi_getboothowto(char *kargs)
|
|||
int vidconsole;
|
||||
|
||||
howto = boot_parse_cmdline(kargs);
|
||||
howto |= bootenv_flags();
|
||||
howto |= boot_env_to_howto();
|
||||
|
||||
/* Enable selected consoles */
|
||||
string = next = strdup(getenv("console"));
|
||||
|
@ -80,7 +80,7 @@ void
|
|||
bi_setboothowto(int howto)
|
||||
{
|
||||
|
||||
bootenv_set(howto);
|
||||
boot_howto_to_env(howto);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -44,7 +44,7 @@ bi_getboothowto(char *kargs)
|
|||
int vidconsole;
|
||||
|
||||
howto = boot_parse_cmdline(kargs);
|
||||
howto |= bootenv_flags();
|
||||
howto |= boot_env_to_howto();
|
||||
|
||||
/* Enable selected consoles */
|
||||
string = next = strdup(getenv("console"));
|
||||
|
@ -81,7 +81,7 @@ void
|
|||
bi_setboothowto(int howto)
|
||||
{
|
||||
|
||||
bootenv_set(howto);
|
||||
boot_howto_to_env(howto);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue