summaryrefslogtreecommitdiff
path: root/stand/common
diff options
context:
space:
mode:
authorKyle Evans <kevans@FreeBSD.org>2018-06-09 15:10:39 +0000
committerKyle Evans <kevans@FreeBSD.org>2018-06-09 15:10:39 +0000
commit593e2c6ecec705b9fe0f6dcc366b5c1def7a1a7a (patch)
tree3b1dd02d61e87abc4867ce3c1339596052217f04 /stand/common
parent4a0f8b339eca10c1eb62bd21474d818ec877e8a5 (diff)
downloadsrc-test2-593e2c6ecec705b9fe0f6dcc366b5c1def7a1a7a.tar.gz
src-test2-593e2c6ecec705b9fe0f6dcc366b5c1def7a1a7a.zip
Notes
Diffstat (limited to 'stand/common')
-rw-r--r--stand/common/boot.c16
-rw-r--r--stand/common/bootstrap.h1
-rw-r--r--stand/common/metadata.c8
3 files changed, 18 insertions, 7 deletions
diff --git a/stand/common/boot.c b/stand/common/boot.c
index 2b2a71d59362..608c55da00b8 100644
--- a/stand/common/boot.c
+++ b/stand/common/boot.c
@@ -32,6 +32,8 @@ __FBSDID("$FreeBSD$");
*/
#include <stand.h>
+#include <sys/reboot.h>
+#include <sys/boot.h>
#include <string.h>
#include "bootstrap.h"
@@ -158,6 +160,20 @@ 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);
+}
+
static int
autoboot(int timeout, char *prompt)
{
diff --git a/stand/common/bootstrap.h b/stand/common/bootstrap.h
index 925f8d447cc9..f265bbafacc2 100644
--- a/stand/common/bootstrap.h
+++ b/stand/common/bootstrap.h
@@ -63,6 +63,7 @@ int parse(int *argc, char ***argv, const char *str);
/* boot.c */
void autoboot_maybe(void);
int getrootmount(char *rootdev);
+int bootenv_flags(void);
/* misc.c */
char *unargv(int argc, char *argv[]);
diff --git a/stand/common/metadata.c b/stand/common/metadata.c
index 7be125c00257..71c33eadb520 100644
--- a/stand/common/metadata.c
+++ b/stand/common/metadata.c
@@ -31,9 +31,7 @@ __FBSDID("$FreeBSD$");
#include <stand.h>
#include <sys/param.h>
-#include <sys/reboot.h>
#include <sys/linker.h>
-#include <sys/boot.h>
#if defined(LOADER_FDT_SUPPORT)
#include <fdt_platform.h>
#endif
@@ -100,7 +98,6 @@ md_getboothowto(char *kargs)
char *cp;
int howto;
int active;
- int i;
/* Parse kargs */
howto = 0;
@@ -153,10 +150,7 @@ md_getboothowto(char *kargs)
}
}
- /* get equivalents from the environment */
- for (i = 0; howto_names[i].ev != NULL; i++)
- if (getenv(howto_names[i].ev) != NULL)
- howto |= howto_names[i].mask;
+ howto |= bootenv_flags();
#if defined(__sparc64__)
if (md_bootserial() != -1)
howto |= RB_SERIAL;