aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Malone <dwmalone@FreeBSD.org>2000-08-17 18:42:13 +0000
committerDavid Malone <dwmalone@FreeBSD.org>2000-08-17 18:42:13 +0000
commit81e309b71b5ec511d2f10df722f487f51e6aa1ee (patch)
tree7246a4c32362719b10349c444d5fd19b01af5af9
parent83e6c3a4016f580b20bdac3856868cf6d2909922 (diff)
Notes
-rw-r--r--usr.sbin/boot0cfg/boot0cfg.89
-rw-r--r--usr.sbin/boot0cfg/boot0cfg.c23
2 files changed, 28 insertions, 4 deletions
diff --git a/usr.sbin/boot0cfg/boot0cfg.8 b/usr.sbin/boot0cfg/boot0cfg.8
index a56356a2801e..07643da90d86 100644
--- a/usr.sbin/boot0cfg/boot0cfg.8
+++ b/usr.sbin/boot0cfg/boot0cfg.8
@@ -38,6 +38,7 @@
.Op Fl f Ar file
.Op Fl m Ar mask
.Op Fl o Ar options
+.Op Fl s Ar slice
.Op Fl t Ar ticks
.Ar disk
.Sh DESCRIPTION
@@ -118,6 +119,14 @@ and to save slice selection information.) This is the default; a
.Sq noupdate
option causes the MBR to be treated as read-only.
.El
+.It Fl s Ar slice
+Set the default boot selection to
+.Ar slice .
+Values between 1 and 4 refer to slices; a value of 5 refers to the
+option of booting from a second disk. This would normally be used in
+conjunction with the
+.Sq noupdate
+option.
.It Fl t Ar ticks
Set the timeout value to
.Ar ticks .
diff --git a/usr.sbin/boot0cfg/boot0cfg.c b/usr.sbin/boot0cfg/boot0cfg.c
index 77244367f537..ac60c69c840d 100644
--- a/usr.sbin/boot0cfg/boot0cfg.c
+++ b/usr.sbin/boot0cfg/boot0cfg.c
@@ -45,6 +45,7 @@ static const char rcsid[] =
#define MBRSIZE 512 /* master boot record size */
#define OFF_VERSION 0x1b0 /* offset: version number */
+#define OFF_OPT 0x1b9 /* offset: default boot option */
#define OFF_DRIVE 0x1ba /* offset: setdrv drive */
#define OFF_FLAGS 0x1bb /* offset: option flags */
#define OFF_TICKS 0x1bc /* offset: clock ticks */
@@ -93,17 +94,17 @@ main(int argc, char *argv[])
int boot0_size, mbr_size;
const char *bpath, *fpath, *disk;
int B_flag, v_flag, o_flag;
- int d_arg, m_arg, t_arg;
+ int d_arg, m_arg, s_arg, t_arg;
int o_and, o_or;
int up, c;
bpath = "/boot/boot0";
fpath = NULL;
B_flag = v_flag = o_flag = 0;
- d_arg = m_arg = t_arg = -1;
+ d_arg = m_arg = s_arg = t_arg = -1;
o_and = 0xff;
o_or = 0;
- while ((c = getopt(argc, argv, "Bvb:d:f:m:o:t:")) != -1)
+ while ((c = getopt(argc, argv, "Bvb:d:f:m:o:s:t:")) != -1)
switch (c) {
case 'B':
B_flag = 1;
@@ -127,6 +128,9 @@ main(int argc, char *argv[])
stropt(optarg, &o_and, &o_or);
o_flag = 1;
break;
+ case 's':
+ s_arg = argtoi(optarg, 1, 5, 's');
+ break;
case 't':
t_arg = argtoi(optarg, 1, 0xffff, 't');
break;
@@ -138,7 +142,8 @@ main(int argc, char *argv[])
if (argc != 1)
usage();
disk = mkrdev(*argv);
- up = B_flag || d_arg != -1 || m_arg != -1 || o_flag || t_arg != -1;
+ up = B_flag || d_arg != -1 || m_arg != -1 || o_flag || s_arg != -1
+ || t_arg != -1;
/* open the disk and read in the existing mbr */
mbr_size = read_mbr(disk, &mbr, !B_flag);
@@ -176,6 +181,10 @@ main(int argc, char *argv[])
boot0[OFF_FLAGS] |= o_or;
}
+ /* set the default boot selection */
+ if (s_arg != -1)
+ boot0[OFF_OPT] = s_arg - 1;
+
/* set the timeout */
if (t_arg != -1)
mk2(boot0 + OFF_TICKS, t_arg);
@@ -285,6 +294,12 @@ display_mbr(u_int8_t *mbr)
printf("%s", opttbl[i].tok);
}
printf("\n");
+ printf("default_selection=F%d (", mbr[OFF_OPT] + 1);
+ if (mbr[OFF_OPT] < 4)
+ printf("Slice %d", mbr[OFF_OPT] + 1);
+ else
+ printf("Drive 1");
+ printf(")\n");
}
/*