summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorskrll <skrll@NetBSD.org>2019-01-18 19:41:03 +0000
committerskrll <skrll@NetBSD.org>2019-01-18 19:41:03 +0000
commit8cc7a1acce4b855f2203cd88fa33a2deb2cee8d5 (patch)
tree742eef771e34f56d66884af565cd06ffa53f3e87 /sys
parentb8418ee75e5e97038362bcf5f74484bb8a5cee8f (diff)
Add support for "bootargs" environment variable from jmcneill@
Doesn't work with some (all?) u-boots.
Diffstat (limited to 'sys')
-rw-r--r--sys/stand/efiboot/boot.c24
-rw-r--r--sys/stand/efiboot/version3
2 files changed, 24 insertions, 3 deletions
diff --git a/sys/stand/efiboot/boot.c b/sys/stand/efiboot/boot.c
index a99d25c3865..927e832f907 100644
--- a/sys/stand/efiboot/boot.c
+++ b/sys/stand/efiboot/boot.c
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.14 2018/11/15 23:52:33 jmcneill Exp $ */
+/* $NetBSD: boot.c,v 1.15 2019/01/18 19:41:03 skrll Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka@netbsd.org>
@@ -73,11 +73,13 @@ static char default_device[32];
static char initrd_path[255];
static char dtb_path[255];
static char netbsd_path[255];
+static char netbsd_args[255];
#define DEFTIMEOUT 5
#define DEFFILENAME names[0]
int set_bootfile(const char *);
+int set_bootargs(const char *);
void command_boot(char *);
void command_dev(char *);
@@ -328,6 +330,15 @@ set_bootfile(const char *arg)
return 0;
}
+int
+set_bootargs(const char *arg)
+{
+ if (strlen(arg) + 1 > sizeof(netbsd_args))
+ return ERANGE;
+ strcpy(netbsd_args, arg);
+ return 0;
+}
+
void
print_banner(void)
{
@@ -376,6 +387,15 @@ read_env(void)
set_default_device(s);
FreePool(s);
}
+
+ s = efi_env_get("bootargs");
+ if (s) {
+#ifdef EFIBOOT_DEBUG
+ printf(">> Setting default boot args to '%s' from environment\n", s);
+#endif
+ set_bootargs(s);
+ FreePool(s);
+ }
}
void
@@ -401,7 +421,7 @@ boot(void)
if (c != '\r' && c != '\n' && c != '\0')
bootprompt(); /* does not return */
- exec_netbsd(netbsd_path, "");
+ exec_netbsd(netbsd_path, netbsd_args);
}
bootprompt(); /* does not return */
diff --git a/sys/stand/efiboot/version b/sys/stand/efiboot/version
index 98b0105794b..e03a23f97fc 100644
--- a/sys/stand/efiboot/version
+++ b/sys/stand/efiboot/version
@@ -1,4 +1,4 @@
-$NetBSD: version,v 1.8 2018/11/15 23:52:33 jmcneill Exp $
+$NetBSD: version,v 1.9 2019/01/18 19:41:03 skrll Exp $
NOTE ANY CHANGES YOU MAKE TO THE EFI BOOTLOADER HERE. The format of this
file is important - make sure the entries are appended on end, last item
@@ -12,3 +12,4 @@ is taken as the current.
1.5: EFI runtime support.
1.6: Add GPT support.
1.7: Add NFS support.
+1.8: Add support for "bootargs" environment variable.