Sun May 30 05:59:23 2021 UTC ()
Add "root" command to provide a BTINFO_ROOTDEVICE parameter.


(mlelstv)
diff -r1.74 -r1.75 src/sys/arch/i386/stand/boot/boot2.c
diff -r1.17 -r1.18 src/sys/arch/i386/stand/efiboot/boot.c
diff -r1.54 -r1.55 src/sys/arch/i386/stand/lib/biosdisk.c
diff -r1.12 -r1.13 src/sys/arch/i386/stand/lib/biosdisk.h
diff -r1.76 -r1.77 src/sys/arch/i386/stand/lib/exec.c
diff -r1.5 -r1.6 src/sys/lib/libsa/bootcfg.c
diff -r1.3 -r1.4 src/sys/lib/libsa/bootcfg.h

cvs diff -r1.74 -r1.75 src/sys/arch/i386/stand/boot/boot2.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/boot/boot2.c 2020/07/15 12:36:30 1.74
+++ src/sys/arch/i386/stand/boot/boot2.c 2021/05/30 05:59:22 1.75
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: boot2.c,v 1.74 2020/07/15 12:36:30 kim Exp $ */ 1/* $NetBSD: boot2.c,v 1.75 2021/05/30 05:59:22 mlelstv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -73,26 +73,29 @@ @@ -73,26 +73,29 @@
73 73
74#include <lib/libsa/stand.h> 74#include <lib/libsa/stand.h>
75#include <lib/libsa/bootcfg.h> 75#include <lib/libsa/bootcfg.h>
76#include <lib/libsa/ufs.h> 76#include <lib/libsa/ufs.h>
77#include <lib/libkern/libkern.h> 77#include <lib/libkern/libkern.h>
78 78
79#include <libi386.h> 79#include <libi386.h>
80#include <bootmod.h> 80#include <bootmod.h>
81#include <bootmenu.h> 81#include <bootmenu.h>
82#include <biosdisk.h> 82#include <biosdisk.h>
83#include <vbe.h> 83#include <vbe.h>
84#include "devopen.h" 84#include "devopen.h"
85 85
 86#ifdef _STANDALONE
 87#include <bootinfo.h>
 88#endif
86#ifdef SUPPORT_PS2 89#ifdef SUPPORT_PS2
87#include <biosmca.h> 90#include <biosmca.h>
88#endif 91#endif
89 92
90extern struct x86_boot_params boot_params; 93extern struct x86_boot_params boot_params;
91 94
92extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[]; 95extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
93 96
94int errno; 97int errno;
95 98
96int boot_biosdev; 99int boot_biosdev;
97daddr_t boot_biossector; 100daddr_t boot_biossector;
98 101
@@ -120,43 +123,45 @@ char *sprint_bootsel(const char *); @@ -120,43 +123,45 @@ char *sprint_bootsel(const char *);
120static void bootit(const char *, int); 123static void bootit(const char *, int);
121void print_banner(void); 124void print_banner(void);
122void boot2(int, uint64_t); 125void boot2(int, uint64_t);
123 126
124void command_help(char *); 127void command_help(char *);
125#if LIBSA_ENABLE_LS_OP 128#if LIBSA_ENABLE_LS_OP
126void command_ls(char *); 129void command_ls(char *);
127#endif 130#endif
128void command_quit(char *); 131void command_quit(char *);
129void command_boot(char *); 132void command_boot(char *);
130void command_pkboot(char *); 133void command_pkboot(char *);
131void command_dev(char *); 134void command_dev(char *);
132void command_consdev(char *); 135void command_consdev(char *);
 136void command_root(char *);
133#ifndef SMALL 137#ifndef SMALL
134void command_menu(char *); 138void command_menu(char *);
135#endif 139#endif
136void command_modules(char *); 140void command_modules(char *);
137void command_multiboot(char *); 141void command_multiboot(char *);
138 142
139const struct bootblk_command commands[] = { 143const struct bootblk_command commands[] = {
140 { "help", command_help }, 144 { "help", command_help },
141 { "?", command_help }, 145 { "?", command_help },
142#if LIBSA_ENABLE_LS_OP 146#if LIBSA_ENABLE_LS_OP
143 { "ls", command_ls }, 147 { "ls", command_ls },
144#endif 148#endif
145 { "quit", command_quit }, 149 { "quit", command_quit },
146 { "boot", command_boot }, 150 { "boot", command_boot },
147 { "pkboot", command_pkboot }, 151 { "pkboot", command_pkboot },
148 { "dev", command_dev }, 152 { "dev", command_dev },
149 { "consdev", command_consdev }, 153 { "consdev", command_consdev },
 154 { "root", command_root },
150#ifndef SMALL 155#ifndef SMALL
151 { "menu", command_menu }, 156 { "menu", command_menu },
152#endif 157#endif
153 { "modules", command_modules }, 158 { "modules", command_modules },
154 { "load", module_add }, 159 { "load", module_add },
155 { "multiboot", command_multiboot }, 160 { "multiboot", command_multiboot },
156 { "vesa", command_vesa }, 161 { "vesa", command_vesa },
157 { "splash", splash_add }, 162 { "splash", splash_add },
158 { "rndseed", rnd_add }, 163 { "rndseed", rnd_add },
159 { "fs", fs_add }, 164 { "fs", fs_add },
160 { "userconf", userconf_add }, 165 { "userconf", userconf_add },
161 { NULL, NULL }, 166 { NULL, NULL },
162}; 167};
@@ -440,26 +445,29 @@ command_help(char *arg) @@ -440,26 +445,29 @@ command_help(char *arg)
440#else 445#else
441 " dev syntax is (hd|fd|cd)[N[x]]n" 446 " dev syntax is (hd|fd|cd)[N[x]]n"
442#endif 447#endif
443#ifndef NO_GPT 448#ifndef NO_GPT
444 " or NAME=gpt_label\n" 449 " or NAME=gpt_label\n"
445#endif 450#endif
446 " (ex. \"hd0a:netbsd.old -s\")\n" 451 " (ex. \"hd0a:netbsd.old -s\")\n"
447 "pkboot [dev:][filename] [-12acdqsvxz]\n" 452 "pkboot [dev:][filename] [-12acdqsvxz]\n"
448#if LIBSA_ENABLE_LS_OP 453#if LIBSA_ENABLE_LS_OP
449 "ls [dev:][path]\n" 454 "ls [dev:][path]\n"
450#endif 455#endif
451 "dev [dev:]\n" 456 "dev [dev:]\n"
452 "consdev {pc|{com[0123]|com[0123]kbd|auto}[,{speed}]}\n" 457 "consdev {pc|{com[0123]|com[0123]kbd|auto}[,{speed}]}\n"
 458 "root {spec}\n"
 459 " spec can be disk, e.g. wd0, sd0\n"
 460 " or string like wedge:name\n"
453 "vesa {modenum|on|off|enabled|disabled|list}\n" 461 "vesa {modenum|on|off|enabled|disabled|list}\n"
454#ifndef SMALL 462#ifndef SMALL
455 "menu (reenters boot menu, if defined in boot.cfg)\n" 463 "menu (reenters boot menu, if defined in boot.cfg)\n"
456#endif 464#endif
457 "modules {on|off|enabled|disabled}\n" 465 "modules {on|off|enabled|disabled}\n"
458 "load {path_to_module}\n" 466 "load {path_to_module}\n"
459 "multiboot [dev:][filename] [<args>]\n" 467 "multiboot [dev:][filename] [<args>]\n"
460 "splash {path_to_image_file}\n" 468 "splash {path_to_image_file}\n"
461 "userconf {command}\n" 469 "userconf {command}\n"
462 "rndseed {path_to_rndseed_file}\n" 470 "rndseed {path_to_rndseed_file}\n"
463 "help|?\n" 471 "help|?\n"
464 "quit\n"); 472 "quit\n");
465} 473}
@@ -600,26 +608,38 @@ command_consdev(char *arg) @@ -600,26 +608,38 @@ command_consdev(char *arg)
600 if (speed < 0) 608 if (speed < 0)
601 goto error; 609 goto error;
602 boot_params.bp_conspeed = speed; 610 boot_params.bp_conspeed = speed;
603 } 611 }
604 612
605 initio(cdp->tag); 613 initio(cdp->tag);
606 print_banner(); 614 print_banner();
607 return; 615 return;
608 } 616 }
609error: 617error:
610 printf("invalid console device.\n"); 618 printf("invalid console device.\n");
611} 619}
612 620
 621void
 622command_root(char *arg)
 623{
 624 struct btinfo_rootdevice *biv = &bi_root;
 625
 626 strncpy(biv->devname, arg, sizeof(biv->devname));
 627 if (biv->devname[sizeof(biv->devname)-1] != '\0') {
 628 biv->devname[sizeof(biv->devname)-1] = '\0';
 629 printf("truncated to %s\n",biv->devname);
 630 }
 631}
 632
613#ifndef SMALL 633#ifndef SMALL
614/* ARGSUSED */ 634/* ARGSUSED */
615void 635void
616command_menu(char *arg) 636command_menu(char *arg)
617{ 637{
618 638
619 if (bootcfg_info.nummenu > 0) { 639 if (bootcfg_info.nummenu > 0) {
620 /* Does not return */ 640 /* Does not return */
621 doboottypemenu(); 641 doboottypemenu();
622 } else { 642 } else {
623 printf("No menu defined in boot.cfg\n"); 643 printf("No menu defined in boot.cfg\n");
624 } 644 }
625} 645}

cvs diff -r1.17 -r1.18 src/sys/arch/i386/stand/efiboot/boot.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/efiboot/boot.c 2019/09/26 12:21:03 1.17
+++ src/sys/arch/i386/stand/efiboot/boot.c 2021/05/30 05:59:22 1.18
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: boot.c,v 1.17 2019/09/26 12:21:03 nonaka Exp $ */ 1/* $NetBSD: boot.c,v 1.18 2021/05/30 05:59:22 mlelstv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2016 Kimihiro Nonaka <nonaka@netbsd.org> 4 * Copyright (c) 2016 Kimihiro Nonaka <nonaka@netbsd.org>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -28,26 +28,30 @@ @@ -28,26 +28,30 @@
28 28
29#include "efiboot.h" 29#include "efiboot.h"
30 30
31#include <sys/bootblock.h> 31#include <sys/bootblock.h>
32#include <sys/boot_flag.h> 32#include <sys/boot_flag.h>
33#include <machine/limits.h> 33#include <machine/limits.h>
34 34
35#include "bootcfg.h" 35#include "bootcfg.h"
36#include "bootmod.h" 36#include "bootmod.h"
37#include "bootmenu.h" 37#include "bootmenu.h"
38#include "biosdisk.h" 38#include "biosdisk.h"
39#include "devopen.h" 39#include "devopen.h"
40 40
 41#ifdef _STANDALONE
 42#include <bootinfo.h>
 43#endif
 44
41int errno; 45int errno;
42int boot_biosdev; 46int boot_biosdev;
43daddr_t boot_biossector; 47daddr_t boot_biossector;
44 48
45extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[]; 49extern const char bootprog_name[], bootprog_rev[], bootprog_kernrev[];
46 50
47extern struct x86_boot_params boot_params; 51extern struct x86_boot_params boot_params;
48extern char twiddle_toggle; 52extern char twiddle_toggle;
49 53
50static const char * const names[][2] = { 54static const char * const names[][2] = {
51 { "netbsd", "netbsd.gz" }, 55 { "netbsd", "netbsd.gz" },
52 { "onetbsd", "onetbsd.gz" }, 56 { "onetbsd", "onetbsd.gz" },
53 { "netbsd.old", "netbsd.old.gz" }, 57 { "netbsd.old", "netbsd.old.gz" },
@@ -55,49 +59,51 @@ static const char * const names[][2] = { @@ -55,49 +59,51 @@ static const char * const names[][2] = {
55 59
56#define NUMNAMES __arraycount(names) 60#define NUMNAMES __arraycount(names)
57#define DEFFILENAME names[0][0] 61#define DEFFILENAME names[0][0]
58 62
59#ifndef EFIBOOTCFG_FILENAME 63#ifndef EFIBOOTCFG_FILENAME
60#define EFIBOOTCFG_FILENAME "esp:/EFI/NetBSD/boot.cfg" 64#define EFIBOOTCFG_FILENAME "esp:/EFI/NetBSD/boot.cfg"
61#endif 65#endif
62 66
63void command_help(char *); 67void command_help(char *);
64void command_quit(char *); 68void command_quit(char *);
65void command_boot(char *); 69void command_boot(char *);
66void command_pkboot(char *); 70void command_pkboot(char *);
67void command_consdev(char *); 71void command_consdev(char *);
 72void command_root(char *);
68void command_dev(char *); 73void command_dev(char *);
69void command_devpath(char *); 74void command_devpath(char *);
70void command_efivar(char *); 75void command_efivar(char *);
71void command_gop(char *); 76void command_gop(char *);
72#if LIBSA_ENABLE_LS_OP 77#if LIBSA_ENABLE_LS_OP
73void command_ls(char *); 78void command_ls(char *);
74#endif 79#endif
75void command_memmap(char *); 80void command_memmap(char *);
76#ifndef SMALL 81#ifndef SMALL
77void command_menu(char *); 82void command_menu(char *);
78#endif 83#endif
79void command_modules(char *); 84void command_modules(char *);
80void command_multiboot(char *); 85void command_multiboot(char *);
81void command_text(char *); 86void command_text(char *);
82void command_version(char *); 87void command_version(char *);
83 88
84const struct bootblk_command commands[] = { 89const struct bootblk_command commands[] = {
85 { "help", command_help }, 90 { "help", command_help },
86 { "?", command_help }, 91 { "?", command_help },
87 { "quit", command_quit }, 92 { "quit", command_quit },
88 { "boot", command_boot }, 93 { "boot", command_boot },
89 { "pkboot", command_pkboot }, 94 { "pkboot", command_pkboot },
90 { "consdev", command_consdev }, 95 { "consdev", command_consdev },
 96 { "root", command_root },
91 { "dev", command_dev }, 97 { "dev", command_dev },
92 { "devpath", command_devpath }, 98 { "devpath", command_devpath },
93 { "efivar", command_efivar }, 99 { "efivar", command_efivar },
94 { "fs", fs_add }, 100 { "fs", fs_add },
95 { "gop", command_gop }, 101 { "gop", command_gop },
96 { "load", module_add }, 102 { "load", module_add },
97#if LIBSA_ENABLE_LS_OP 103#if LIBSA_ENABLE_LS_OP
98 { "ls", command_ls }, 104 { "ls", command_ls },
99#endif 105#endif
100 { "memmap", command_memmap }, 106 { "memmap", command_memmap },
101#ifndef SMALL 107#ifndef SMALL
102 { "menu", command_menu }, 108 { "menu", command_menu },
103#endif 109#endif
@@ -386,26 +392,29 @@ command_help(char *arg) @@ -386,26 +392,29 @@ command_help(char *arg)
386 "boot [dev:][filename] [-12acdqsvxz]\n" 392 "boot [dev:][filename] [-12acdqsvxz]\n"
387#ifndef NO_RAIDFRAME 393#ifndef NO_RAIDFRAME
388 " dev syntax is (hd|fd|cd|raid)[N[x]]\n" 394 " dev syntax is (hd|fd|cd|raid)[N[x]]\n"
389#else 395#else
390 " dev syntax is (hd|fd|cd)[N[x]]\n" 396 " dev syntax is (hd|fd|cd)[N[x]]\n"
391#endif 397#endif
392#ifndef NO_GPT 398#ifndef NO_GPT
393 " or NAME=gpt_label\n" 399 " or NAME=gpt_label\n"
394#endif 400#endif
395 " (ex. \"hd0a:netbsd.old -s\")\n" 401 " (ex. \"hd0a:netbsd.old -s\")\n"
396 "pkboot [dev:][filename] [-12acdqsvxz]\n" 402 "pkboot [dev:][filename] [-12acdqsvxz]\n"
397 "dev [dev:]\n" 403 "dev [dev:]\n"
398 "consdev {pc|com[0123][,{speed}]|com,{ioport}[,{speed}]}\n" 404 "consdev {pc|com[0123][,{speed}]|com,{ioport}[,{speed}]}\n"
 405 "root {spec}\n"
 406 " spec can be disk, e.g. wd0, sd0\n"
 407 " or string like wedge:name\n"
399 "devpath\n" 408 "devpath\n"
400 "efivar\n" 409 "efivar\n"
401 "gop [{modenum|list}]\n" 410 "gop [{modenum|list}]\n"
402 "load {path_to_module}\n" 411 "load {path_to_module}\n"
403#if LIBSA_ENABLE_LS_OP 412#if LIBSA_ENABLE_LS_OP
404 "ls [dev:][path]\n" 413 "ls [dev:][path]\n"
405#endif 414#endif
406 "memmap [{sorted|unsorted|compact}]\n" 415 "memmap [{sorted|unsorted|compact}]\n"
407#ifndef SMALL 416#ifndef SMALL
408 "menu (reenters boot menu, if defined in boot.cfg)\n" 417 "menu (reenters boot menu, if defined in boot.cfg)\n"
409#endif 418#endif
410 "modules {on|off|enabled|disabled}\n" 419 "modules {on|off|enabled|disabled}\n"
411 "multiboot [dev:][filename] [<args>]\n" 420 "multiboot [dev:][filename] [<args>]\n"
@@ -580,26 +589,39 @@ command_consdev(char *arg) @@ -580,26 +589,39 @@ command_consdev(char *arg)
580 if (sep2 != NULL) 589 if (sep2 != NULL)
581 goto error; 590 goto error;
582 } 591 }
583 } 592 }
584 efi_consinit(cdp->tag, ioport, speed); 593 efi_consinit(cdp->tag, ioport, speed);
585 print_banner(); 594 print_banner();
586 return; 595 return;
587 } 596 }
588 } 597 }
589error: 598error:
590 printf("invalid console device.\n"); 599 printf("invalid console device.\n");
591} 600}
592 601
 602void
 603command_root(char *arg)
 604{
 605 struct btinfo_rootdevice *biv = &bi_root;
 606
 607 strncpy(biv->devname, arg, sizeof(biv->devname));
 608 if (biv->devname[sizeof(biv->devname)-1] != '\0') {
 609 biv->devname[sizeof(biv->devname)-1] = '\0';
 610 printf("truncated to %s\n",biv->devname);
 611 }
 612}
 613
 614
593#ifndef SMALL 615#ifndef SMALL
594/* ARGSUSED */ 616/* ARGSUSED */
595void 617void
596command_menu(char *arg) 618command_menu(char *arg)
597{ 619{
598 620
599 if (bootcfg_info.nummenu > 0) { 621 if (bootcfg_info.nummenu > 0) {
600 /* Does not return */ 622 /* Does not return */
601 doboottypemenu(); 623 doboottypemenu();
602 } else 624 } else
603 printf("No menu defined in boot.cfg\n"); 625 printf("No menu defined in boot.cfg\n");
604} 626}
605#endif /* !SMALL */ 627#endif /* !SMALL */

cvs diff -r1.54 -r1.55 src/sys/arch/i386/stand/lib/biosdisk.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/biosdisk.c 2019/12/17 01:37:53 1.54
+++ src/sys/arch/i386/stand/lib/biosdisk.c 2021/05/30 05:59:23 1.55
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: biosdisk.c,v 1.54 2019/12/17 01:37:53 manu Exp $ */ 1/* $NetBSD: biosdisk.c,v 1.55 2021/05/30 05:59:23 mlelstv Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996, 1998 4 * Copyright (c) 1996, 1998
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -176,26 +176,27 @@ const struct gpt_part gpt_parts[] = { @@ -176,26 +176,27 @@ const struct gpt_part gpt_parts[] = {
176 { &GET_ms_ldm_data, "Microsoft LDM data" }, 176 { &GET_ms_ldm_data, "Microsoft LDM data" },
177 { &GET_linux_data, "Linux data" }, 177 { &GET_linux_data, "Linux data" },
178 { &GET_linux_raid, "Linux RAID" }, 178 { &GET_linux_raid, "Linux RAID" },
179 { &GET_linux_swap, "Linux Swap" }, 179 { &GET_linux_swap, "Linux Swap" },
180 { &GET_linux_lvm, "Linux LVM" }, 180 { &GET_linux_lvm, "Linux LVM" },
181 { &GET_apple_hfs, "Apple HFS" }, 181 { &GET_apple_hfs, "Apple HFS" },
182 { &GET_apple_ufs, "Apple UFS" }, 182 { &GET_apple_ufs, "Apple UFS" },
183 { &GET_bios, "BIOS Boot (GRUB)" }, 183 { &GET_bios, "BIOS Boot (GRUB)" },
184}; 184};
185#endif /* NO_GPT */ 185#endif /* NO_GPT */
186 186
187struct btinfo_bootdisk bi_disk; 187struct btinfo_bootdisk bi_disk;
188struct btinfo_bootwedge bi_wedge; 188struct btinfo_bootwedge bi_wedge;
 189struct btinfo_rootdevice bi_root;
189 190
190#define MBR_PARTS(buf) ((char *)(buf) + offsetof(struct mbr_sector, mbr_parts)) 191#define MBR_PARTS(buf) ((char *)(buf) + offsetof(struct mbr_sector, mbr_parts))
191 192
192#ifndef devb2cdb 193#ifndef devb2cdb
193#define devb2cdb(bno) (((bno) * DEV_BSIZE) / ISO_DEFAULT_BLOCK_SIZE) 194#define devb2cdb(bno) (((bno) * DEV_BSIZE) / ISO_DEFAULT_BLOCK_SIZE)
194#endif 195#endif
195 196
196static void 197static void
197dealloc_biosdisk(struct biosdisk *d) 198dealloc_biosdisk(struct biosdisk *d)
198{ 199{
199#ifndef NO_GPT 200#ifndef NO_GPT
200 int i; 201 int i;
201 202

cvs diff -r1.12 -r1.13 src/sys/arch/i386/stand/lib/biosdisk.h (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/biosdisk.h 2019/09/13 02:19:46 1.12
+++ src/sys/arch/i386/stand/lib/biosdisk.h 2021/05/30 05:59:23 1.13
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: biosdisk.h,v 1.12 2019/09/13 02:19:46 manu Exp $ */ 1/* $NetBSD: biosdisk.h,v 1.13 2021/05/30 05:59:23 mlelstv Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1996 4 * Copyright (c) 1996
5 * Matthias Drochner. All rights reserved. 5 * Matthias Drochner. All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -33,26 +33,27 @@ struct biosdisk_partition { @@ -33,26 +33,27 @@ struct biosdisk_partition {
33 int fstype; 33 int fstype;
34#ifndef NO_GPT 34#ifndef NO_GPT
35 const struct gpt_part { 35 const struct gpt_part {
36 const struct uuid *guid; 36 const struct uuid *guid;
37 const char *name; 37 const char *name;
38 } *guid; 38 } *guid;
39 uint64_t attr; 39 uint64_t attr;
40 char *part_name; /* maximum BIOSDISK_PART_NAME_LEN */ 40 char *part_name; /* maximum BIOSDISK_PART_NAME_LEN */
41#endif 41#endif
42}; 42};
43 43
44extern struct btinfo_bootdisk bi_disk;  44extern struct btinfo_bootdisk bi_disk;
45extern struct btinfo_bootwedge bi_wedge; 45extern struct btinfo_bootwedge bi_wedge;
 46extern struct btinfo_rootdevice bi_root;
46 47
47int biosdisk_strategy(void *, int, daddr_t, size_t, void *, size_t *); 48int biosdisk_strategy(void *, int, daddr_t, size_t, void *, size_t *);
48int biosdisk_open(struct open_file *, ...); 49int biosdisk_open(struct open_file *, ...);
49int biosdisk_open_name(struct open_file *, const char *); 50int biosdisk_open_name(struct open_file *, const char *);
50int biosdisk_close(struct open_file *); 51int biosdisk_close(struct open_file *);
51int biosdisk_ioctl(struct open_file *, u_long, void *); 52int biosdisk_ioctl(struct open_file *, u_long, void *);
52int biosdisk_findpartition(int, daddr_t, int *, const char **); 53int biosdisk_findpartition(int, daddr_t, int *, const char **);
53int biosdisk_readpartition(int, daddr_t, daddr_t, 54int biosdisk_readpartition(int, daddr_t, daddr_t,
54 struct biosdisk_partition **, int *); 55 struct biosdisk_partition **, int *);
55 56
56struct RF_ComponentLabel_s; 57struct RF_ComponentLabel_s;
57int biosdisk_read_raidframe(int, daddr_t, struct RF_ComponentLabel_s *); 58int biosdisk_read_raidframe(int, daddr_t, struct RF_ComponentLabel_s *);
58 59

cvs diff -r1.76 -r1.77 src/sys/arch/i386/stand/lib/exec.c (expand / switch to unified diff)

--- src/sys/arch/i386/stand/lib/exec.c 2020/04/04 19:50:54 1.76
+++ src/sys/arch/i386/stand/lib/exec.c 2021/05/30 05:59:23 1.77
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: exec.c,v 1.76 2020/04/04 19:50:54 christos Exp $ */ 1/* $NetBSD: exec.c,v 1.77 2021/05/30 05:59:23 mlelstv Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -112,26 +112,27 @@ @@ -112,26 +112,27 @@
112#endif 112#endif
113 113
114#define BOOT_NARGS 6 114#define BOOT_NARGS 6
115 115
116#ifndef PAGE_SIZE 116#ifndef PAGE_SIZE
117#define PAGE_SIZE 4096 117#define PAGE_SIZE 4096
118#endif 118#endif
119 119
120#define MODULE_WARNING_SEC 5 120#define MODULE_WARNING_SEC 5
121 121
122#define MAXMODNAME 32 /* from <sys/module.h> */ 122#define MAXMODNAME 32 /* from <sys/module.h> */
123 123
124extern struct btinfo_console btinfo_console; 124extern struct btinfo_console btinfo_console;
 125extern struct btinfo_rootdevice bi_root;
125 126
126boot_module_t *boot_modules; 127boot_module_t *boot_modules;
127bool boot_modules_enabled = true; 128bool boot_modules_enabled = true;
128bool kernel_loaded; 129bool kernel_loaded;
129 130
130typedef struct userconf_command { 131typedef struct userconf_command {
131 char *uc_text; 132 char *uc_text;
132 size_t uc_len; 133 size_t uc_len;
133 struct userconf_command *uc_next; 134 struct userconf_command *uc_next;
134} userconf_command_t; 135} userconf_command_t;
135userconf_command_t *userconf_commands = NULL; 136userconf_command_t *userconf_commands = NULL;
136 137
137struct btinfo_framebuffer btinfo_framebuffer; 138struct btinfo_framebuffer btinfo_framebuffer;
@@ -467,26 +468,28 @@ exec_netbsd(const char *file, physaddr_t @@ -467,26 +468,28 @@ exec_netbsd(const char *file, physaddr_t
467 int error; 468 int error;
468#ifdef EFIBOOT 469#ifdef EFIBOOT
469 int i; 470 int i;
470#endif 471#endif
471 472
472#ifdef DEBUG 473#ifdef DEBUG
473 printf("exec: file=%s loadaddr=0x%lx\n", file ? file : "NULL", 474 printf("exec: file=%s loadaddr=0x%lx\n", file ? file : "NULL",
474 loadaddr); 475 loadaddr);
475#endif 476#endif
476 477
477 BI_ALLOC(BTINFO_MAX); 478 BI_ALLOC(BTINFO_MAX);
478 479
479 BI_ADD(&btinfo_console, BTINFO_CONSOLE, sizeof(struct btinfo_console)); 480 BI_ADD(&btinfo_console, BTINFO_CONSOLE, sizeof(struct btinfo_console));
 481 if (bi_root.devname[0])
 482 BI_ADD(&bi_root, BTINFO_ROOTDEVICE, sizeof(struct btinfo_rootdevice));
480 483
481 howto = boothowto; 484 howto = boothowto;
482 485
483 memset(marks, 0, sizeof(marks)); 486 memset(marks, 0, sizeof(marks));
484 487
485 if (has_prekern) { 488 if (has_prekern) {
486 error = common_load_prekern(file, &basemem, &extmem, loadaddr, 489 error = common_load_prekern(file, &basemem, &extmem, loadaddr,
487 floppy, marks); 490 floppy, marks);
488 } else { 491 } else {
489 error = common_load_kernel(file, &basemem, &extmem, loadaddr, 492 error = common_load_kernel(file, &basemem, &extmem, loadaddr,
490 floppy, marks); 493 floppy, marks);
491 } 494 }
492 if (error) { 495 if (error) {

cvs diff -r1.5 -r1.6 src/sys/lib/libsa/bootcfg.c (expand / switch to unified diff)

--- src/sys/lib/libsa/bootcfg.c 2020/06/27 17:22:12 1.5
+++ src/sys/lib/libsa/bootcfg.c 2021/05/30 05:59:23 1.6
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bootcfg.c,v 1.5 2020/06/27 17:22:12 jmcneill Exp $ */ 1/* $NetBSD: bootcfg.c,v 1.6 2021/05/30 05:59:23 mlelstv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -70,26 +70,27 @@ bootcfg_do_noop(const char *cmd, char *a @@ -70,26 +70,27 @@ bootcfg_do_noop(const char *cmd, char *a
70 * - If maxsz is < 0 boot.cfg will not be processed. 70 * - If maxsz is < 0 boot.cfg will not be processed.
71 * - If maxsz is = 0 no limit will be imposed but parsing may 71 * - If maxsz is = 0 no limit will be imposed but parsing may
72 * fail due to platform or other constraints e.g. maximum 72 * fail due to platform or other constraints e.g. maximum
73 * segment size. 73 * segment size.
74 * - If 0 < maxsz and boot.cfg exceeds maxsz it will not be 74 * - If 0 < maxsz and boot.cfg exceeds maxsz it will not be
75 * parsed, otherwise it will be parsed. 75 * parsed, otherwise it will be parsed.
76 * 76 *
77 * The recognised keywords are: 77 * The recognised keywords are:
78 * banner: text displayed instead of the normal welcome text 78 * banner: text displayed instead of the normal welcome text
79 * menu: Descriptive text:command to use 79 * menu: Descriptive text:command to use
80 * timeout: Timeout in seconds (overrides that set by installboot) 80 * timeout: Timeout in seconds (overrides that set by installboot)
81 * default: the default menu option to use if Return is pressed 81 * default: the default menu option to use if Return is pressed
82 * consdev: the console device to use 82 * consdev: the console device to use
 83 * root: the root device to use
83 * format: how menu choices are displayed: (a)utomatic, (n)umbers or (l)etters 84 * format: how menu choices are displayed: (a)utomatic, (n)umbers or (l)etters
84 * clear: whether to clear the screen or not 85 * clear: whether to clear the screen or not
85 * 86 *
86 * Example boot.cfg file: 87 * Example boot.cfg file:
87 * banner=Welcome to NetBSD 88 * banner=Welcome to NetBSD
88 * banner=Please choose the boot type from the following menu 89 * banner=Please choose the boot type from the following menu
89 * menu=Boot NetBSD:boot netbsd 90 * menu=Boot NetBSD:boot netbsd
90 * menu=Boot into single user mode:boot netbsd -s 91 * menu=Boot into single user mode:boot netbsd -s
91 * menu=:boot hd1a:netbsd -cs 92 * menu=:boot hd1a:netbsd -cs
92 * menu=Goto boot comand line:prompt 93 * menu=Goto boot comand line:prompt
93 * timeout=10 94 * timeout=10
94 * consdev=com0 95 * consdev=com0
95 * default=1 96 * default=1
@@ -212,26 +213,28 @@ perform_bootcfg(const char *conf, bootcf @@ -212,26 +213,28 @@ perform_bootcfg(const char *conf, bootcf
212 } 213 }
213 } else if (!strncmp(key, "banner", 6)) { 214 } else if (!strncmp(key, "banner", 6)) {
214 if (cbanner < BOOTCFG_MAXBANNER) 215 if (cbanner < BOOTCFG_MAXBANNER)
215 bootcfg_info.banner[cbanner++] = value; 216 bootcfg_info.banner[cbanner++] = value;
216 } else if (!strncmp(key, "timeout", 7)) { 217 } else if (!strncmp(key, "timeout", 7)) {
217 if (!isdigit(*value)) 218 if (!isdigit(*value))
218 bootcfg_info.timeout = -1; 219 bootcfg_info.timeout = -1;
219 else 220 else
220 bootcfg_info.timeout = atoi(value); 221 bootcfg_info.timeout = atoi(value);
221 } else if (!strncmp(key, "default", 7)) { 222 } else if (!strncmp(key, "default", 7)) {
222 bootcfg_info.def = atoi(value) - 1; 223 bootcfg_info.def = atoi(value) - 1;
223 } else if (!strncmp(key, "consdev", 7)) { 224 } else if (!strncmp(key, "consdev", 7)) {
224 bootcfg_info.consdev = value; 225 bootcfg_info.consdev = value;
 226 } else if (!strncmp(key, "root", 4)) {
 227 bootcfg_info.root = value;
225 } else if (!strncmp(key, BOOTCFG_CMD_LOAD, 4)) { 228 } else if (!strncmp(key, BOOTCFG_CMD_LOAD, 4)) {
226 command(BOOTCFG_CMD_LOAD, value); 229 command(BOOTCFG_CMD_LOAD, value);
227 } else if (!strncmp(key, "format", 6)) { 230 } else if (!strncmp(key, "format", 6)) {
228 printf("value:%c\n", *value); 231 printf("value:%c\n", *value);
229 switch (*value) { 232 switch (*value) {
230 case 'a': 233 case 'a':
231 case 'A': 234 case 'A':
232 bootcfg_info.menuformat = MENUFORMAT_AUTO; 235 bootcfg_info.menuformat = MENUFORMAT_AUTO;
233 break; 236 break;
234 237
235 case 'n': 238 case 'n':
236 case 'N': 239 case 'N':
237 case 'd': 240 case 'd':

cvs diff -r1.3 -r1.4 src/sys/lib/libsa/bootcfg.h (expand / switch to unified diff)

--- src/sys/lib/libsa/bootcfg.h 2019/03/31 20:08:45 1.3
+++ src/sys/lib/libsa/bootcfg.h 2021/05/30 05:59:23 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: bootcfg.h,v 1.3 2019/03/31 20:08:45 christos Exp $ */ 1/* $NetBSD: bootcfg.h,v 1.4 2021/05/30 05:59:23 mlelstv Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 2008 The NetBSD Foundation, Inc. 4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -32,26 +32,27 @@ @@ -32,26 +32,27 @@
32#define BOOTCFG_FILENAME "boot.cfg" 32#define BOOTCFG_FILENAME "boot.cfg"
33#define BOOTCFG_MAXMENU 20 33#define BOOTCFG_MAXMENU 20
34#define BOOTCFG_MAXBANNER 12 34#define BOOTCFG_MAXBANNER 12
35 35
36#define BOOTCFG_CMD_LOAD "load" 36#define BOOTCFG_CMD_LOAD "load"
37#define BOOTCFG_CMD_USERCONF "userconf" 37#define BOOTCFG_CMD_USERCONF "userconf"
38 38
39typedef void (*bootcfg_command)(const char *cmd, char *arg); 39typedef void (*bootcfg_command)(const char *cmd, char *arg);
40 40
41struct bootcfg_def { 41struct bootcfg_def {
42 char *banner[BOOTCFG_MAXBANNER]; /* Banner text */ 42 char *banner[BOOTCFG_MAXBANNER]; /* Banner text */
43 char *command[BOOTCFG_MAXMENU]; /* Menu commands per entry*/ 43 char *command[BOOTCFG_MAXMENU]; /* Menu commands per entry*/
44 char *consdev; /* Console device */ 44 char *consdev; /* Console device */
 45 char *root; /* Root specification */
45 int def; /* Default menu option */ 46 int def; /* Default menu option */
46 char *desc[BOOTCFG_MAXMENU]; /* Menu text per entry */ 47 char *desc[BOOTCFG_MAXMENU]; /* Menu text per entry */
47 int nummenu; /* Number of menu items */ 48 int nummenu; /* Number of menu items */
48 int timeout; /* Timeout in seconds */ 49 int timeout; /* Timeout in seconds */
49 int menuformat; /* Letters instead of numbers */ 50 int menuformat; /* Letters instead of numbers */
50 int clear; /* Clear the screen? */ 51 int clear; /* Clear the screen? */
51}; 52};
52extern struct bootcfg_def bootcfg_info; 53extern struct bootcfg_def bootcfg_info;
53 54
54int perform_bootcfg(const char *, bootcfg_command, const off_t); 55int perform_bootcfg(const char *, bootcfg_command, const off_t);
55void bootcfg_do_noop(const char *, char *); 56void bootcfg_do_noop(const char *, char *);
56 57
57#endif /* !_BOOTCFG_H */ 58#endif /* !_BOOTCFG_H */