Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/stand/efiboot Add support for "bootargs" environment var...



details:   https://anonhg.NetBSD.org/src/rev/06ad3db3a107
branches:  trunk
changeset: 838452:06ad3db3a107
user:      skrll <skrll%NetBSD.org@localhost>
date:      Fri Jan 18 19:41:03 2019 +0000

description:
Add support for "bootargs" environment variable from jmcneill@

Doesn't work with some (all?) u-boots.

diffstat:

 sys/stand/efiboot/boot.c  |  24 ++++++++++++++++++++++--
 sys/stand/efiboot/version |   3 ++-
 2 files changed, 24 insertions(+), 3 deletions(-)

diffs (78 lines):

diff -r 745d9953bcc2 -r 06ad3db3a107 sys/stand/efiboot/boot.c
--- a/sys/stand/efiboot/boot.c  Fri Jan 18 19:16:50 2019 +0000
+++ b/sys/stand/efiboot/boot.c  Fri Jan 18 19:41:03 2019 +0000
@@ -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@localhost>
@@ -73,11 +73,13 @@
 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 @@
        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 @@
                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 @@
                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 -r 745d9953bcc2 -r 06ad3db3a107 sys/stand/efiboot/version
--- a/sys/stand/efiboot/version Fri Jan 18 19:16:50 2019 +0000
+++ b/sys/stand/efiboot/version Fri Jan 18 19:41:03 2019 +0000
@@ -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 @@
 1.5:   EFI runtime support.
 1.6:   Add GPT support.
 1.7:   Add NFS support.
+1.8:   Add support for "bootargs" environment variable.



Home | Main Index | Thread Index | Old Index