Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/lib/libsa Add "root" command to provide a BTINFO_ROOTDEV...
details: https://anonhg.NetBSD.org/src/rev/183f25a1e7e5
branches: trunk
changeset: 983609:183f25a1e7e5
user: mlelstv <mlelstv%NetBSD.org@localhost>
date: Sun May 30 05:59:22 2021 +0000
description:
Add "root" command to provide a BTINFO_ROOTDEVICE parameter.
diffstat:
sys/arch/i386/stand/boot/boot2.c | 22 +++++++++++++++++++++-
sys/arch/i386/stand/efiboot/boot.c | 24 +++++++++++++++++++++++-
sys/arch/i386/stand/lib/biosdisk.c | 3 ++-
sys/arch/i386/stand/lib/biosdisk.h | 3 ++-
sys/arch/i386/stand/lib/exec.c | 5 ++++-
sys/lib/libsa/bootcfg.c | 5 ++++-
sys/lib/libsa/bootcfg.h | 3 ++-
7 files changed, 58 insertions(+), 7 deletions(-)
diffs (233 lines):
diff -r a3373a1f40da -r 183f25a1e7e5 sys/arch/i386/stand/boot/boot2.c
--- a/sys/arch/i386/stand/boot/boot2.c Sun May 30 05:40:56 2021 +0000
+++ b/sys/arch/i386/stand/boot/boot2.c Sun May 30 05:59:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot2.c,v 1.74 2020/07/15 12:36:30 kim Exp $ */
+/* $NetBSD: boot2.c,v 1.75 2021/05/30 05:59:22 mlelstv Exp $ */
/*-
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -83,6 +83,9 @@
#include <vbe.h>
#include "devopen.h"
+#ifdef _STANDALONE
+#include <bootinfo.h>
+#endif
#ifdef SUPPORT_PS2
#include <biosmca.h>
#endif
@@ -130,6 +133,7 @@
void command_pkboot(char *);
void command_dev(char *);
void command_consdev(char *);
+void command_root(char *);
#ifndef SMALL
void command_menu(char *);
#endif
@@ -147,6 +151,7 @@
{ "pkboot", command_pkboot },
{ "dev", command_dev },
{ "consdev", command_consdev },
+ { "root", command_root },
#ifndef SMALL
{ "menu", command_menu },
#endif
@@ -450,6 +455,9 @@
#endif
"dev [dev:]\n"
"consdev {pc|{com[0123]|com[0123]kbd|auto}[,{speed}]}\n"
+ "root {spec}\n"
+ " spec can be disk, e.g. wd0, sd0\n"
+ " or string like wedge:name\n"
"vesa {modenum|on|off|enabled|disabled|list}\n"
#ifndef SMALL
"menu (reenters boot menu, if defined in boot.cfg)\n"
@@ -610,6 +618,18 @@
printf("invalid console device.\n");
}
+void
+command_root(char *arg)
+{
+ struct btinfo_rootdevice *biv = &bi_root;
+
+ strncpy(biv->devname, arg, sizeof(biv->devname));
+ if (biv->devname[sizeof(biv->devname)-1] != '\0') {
+ biv->devname[sizeof(biv->devname)-1] = '\0';
+ printf("truncated to %s\n",biv->devname);
+ }
+}
+
#ifndef SMALL
/* ARGSUSED */
void
diff -r a3373a1f40da -r 183f25a1e7e5 sys/arch/i386/stand/efiboot/boot.c
--- a/sys/arch/i386/stand/efiboot/boot.c Sun May 30 05:40:56 2021 +0000
+++ b/sys/arch/i386/stand/efiboot/boot.c Sun May 30 05:59:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: boot.c,v 1.17 2019/09/26 12:21:03 nonaka Exp $ */
+/* $NetBSD: boot.c,v 1.18 2021/05/30 05:59:22 mlelstv Exp $ */
/*-
* Copyright (c) 2016 Kimihiro Nonaka <nonaka%netbsd.org@localhost>
@@ -38,6 +38,10 @@
#include "biosdisk.h"
#include "devopen.h"
+#ifdef _STANDALONE
+#include <bootinfo.h>
+#endif
+
int errno;
int boot_biosdev;
daddr_t boot_biossector;
@@ -65,6 +69,7 @@
void command_boot(char *);
void command_pkboot(char *);
void command_consdev(char *);
+void command_root(char *);
void command_dev(char *);
void command_devpath(char *);
void command_efivar(char *);
@@ -88,6 +93,7 @@
{ "boot", command_boot },
{ "pkboot", command_pkboot },
{ "consdev", command_consdev },
+ { "root", command_root },
{ "dev", command_dev },
{ "devpath", command_devpath },
{ "efivar", command_efivar },
@@ -396,6 +402,9 @@
"pkboot [dev:][filename] [-12acdqsvxz]\n"
"dev [dev:]\n"
"consdev {pc|com[0123][,{speed}]|com,{ioport}[,{speed}]}\n"
+ "root {spec}\n"
+ " spec can be disk, e.g. wd0, sd0\n"
+ " or string like wedge:name\n"
"devpath\n"
"efivar\n"
"gop [{modenum|list}]\n"
@@ -590,6 +599,19 @@
printf("invalid console device.\n");
}
+void
+command_root(char *arg)
+{
+ struct btinfo_rootdevice *biv = &bi_root;
+
+ strncpy(biv->devname, arg, sizeof(biv->devname));
+ if (biv->devname[sizeof(biv->devname)-1] != '\0') {
+ biv->devname[sizeof(biv->devname)-1] = '\0';
+ printf("truncated to %s\n",biv->devname);
+ }
+}
+
+
#ifndef SMALL
/* ARGSUSED */
void
diff -r a3373a1f40da -r 183f25a1e7e5 sys/arch/i386/stand/lib/biosdisk.c
--- a/sys/arch/i386/stand/lib/biosdisk.c Sun May 30 05:40:56 2021 +0000
+++ b/sys/arch/i386/stand/lib/biosdisk.c Sun May 30 05:59:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: biosdisk.c,v 1.54 2019/12/17 01:37:53 manu Exp $ */
+/* $NetBSD: biosdisk.c,v 1.55 2021/05/30 05:59:23 mlelstv Exp $ */
/*
* Copyright (c) 1996, 1998
@@ -186,6 +186,7 @@
struct btinfo_bootdisk bi_disk;
struct btinfo_bootwedge bi_wedge;
+struct btinfo_rootdevice bi_root;
#define MBR_PARTS(buf) ((char *)(buf) + offsetof(struct mbr_sector, mbr_parts))
diff -r a3373a1f40da -r 183f25a1e7e5 sys/arch/i386/stand/lib/biosdisk.h
--- a/sys/arch/i386/stand/lib/biosdisk.h Sun May 30 05:40:56 2021 +0000
+++ b/sys/arch/i386/stand/lib/biosdisk.h Sun May 30 05:59:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: biosdisk.h,v 1.12 2019/09/13 02:19:46 manu Exp $ */
+/* $NetBSD: biosdisk.h,v 1.13 2021/05/30 05:59:23 mlelstv Exp $ */
/*
* Copyright (c) 1996
@@ -43,6 +43,7 @@
extern struct btinfo_bootdisk bi_disk;
extern struct btinfo_bootwedge bi_wedge;
+extern struct btinfo_rootdevice bi_root;
int biosdisk_strategy(void *, int, daddr_t, size_t, void *, size_t *);
int biosdisk_open(struct open_file *, ...);
diff -r a3373a1f40da -r 183f25a1e7e5 sys/arch/i386/stand/lib/exec.c
--- a/sys/arch/i386/stand/lib/exec.c Sun May 30 05:40:56 2021 +0000
+++ b/sys/arch/i386/stand/lib/exec.c Sun May 30 05:59:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: exec.c,v 1.76 2020/04/04 19:50:54 christos Exp $ */
+/* $NetBSD: exec.c,v 1.77 2021/05/30 05:59:23 mlelstv Exp $ */
/*
* Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
@@ -122,6 +122,7 @@
#define MAXMODNAME 32 /* from <sys/module.h> */
extern struct btinfo_console btinfo_console;
+extern struct btinfo_rootdevice bi_root;
boot_module_t *boot_modules;
bool boot_modules_enabled = true;
@@ -477,6 +478,8 @@
BI_ALLOC(BTINFO_MAX);
BI_ADD(&btinfo_console, BTINFO_CONSOLE, sizeof(struct btinfo_console));
+ if (bi_root.devname[0])
+ BI_ADD(&bi_root, BTINFO_ROOTDEVICE, sizeof(struct btinfo_rootdevice));
howto = boothowto;
diff -r a3373a1f40da -r 183f25a1e7e5 sys/lib/libsa/bootcfg.c
--- a/sys/lib/libsa/bootcfg.c Sun May 30 05:40:56 2021 +0000
+++ b/sys/lib/libsa/bootcfg.c Sun May 30 05:59:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootcfg.c,v 1.5 2020/06/27 17:22:12 jmcneill Exp $ */
+/* $NetBSD: bootcfg.c,v 1.6 2021/05/30 05:59:23 mlelstv Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -80,6 +80,7 @@
* timeout: Timeout in seconds (overrides that set by installboot)
* default: the default menu option to use if Return is pressed
* consdev: the console device to use
+ * root: the root device to use
* format: how menu choices are displayed: (a)utomatic, (n)umbers or (l)etters
* clear: whether to clear the screen or not
*
@@ -222,6 +223,8 @@
bootcfg_info.def = atoi(value) - 1;
} else if (!strncmp(key, "consdev", 7)) {
bootcfg_info.consdev = value;
+ } else if (!strncmp(key, "root", 4)) {
+ bootcfg_info.root = value;
} else if (!strncmp(key, BOOTCFG_CMD_LOAD, 4)) {
command(BOOTCFG_CMD_LOAD, value);
} else if (!strncmp(key, "format", 6)) {
diff -r a3373a1f40da -r 183f25a1e7e5 sys/lib/libsa/bootcfg.h
--- a/sys/lib/libsa/bootcfg.h Sun May 30 05:40:56 2021 +0000
+++ b/sys/lib/libsa/bootcfg.h Sun May 30 05:59:22 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: bootcfg.h,v 1.3 2019/03/31 20:08:45 christos Exp $ */
+/* $NetBSD: bootcfg.h,v 1.4 2021/05/30 05:59:23 mlelstv Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -42,6 +42,7 @@
char *banner[BOOTCFG_MAXBANNER]; /* Banner text */
char *command[BOOTCFG_MAXMENU]; /* Menu commands per entry*/
char *consdev; /* Console device */
+ char *root; /* Root specification */
int def; /* Default menu option */
char *desc[BOOTCFG_MAXMENU]; /* Menu text per entry */
int nummenu; /* Number of menu items */
Home |
Main Index |
Thread Index |
Old Index