Initial import from FreeBSD RELENG_4:
[games.git] / sbin / i386 / nextboot / nextboot.8
1 .\" $FreeBSD: src/sbin/i386/nextboot/nextboot.8,v 1.11.2.5 2003/01/05 19:19:39 semenu Exp $
2 .Dd July 9, 1996
3 .Dt NEXTBOOT 8
4 .Os
5 .Sh NAME
6 .Nm nextboot
7 .Nd install a default bootstring block on the boot disk
8 .Sh SYNOPSIS
9 .Nm
10 .Op Fl b
11 .Ar filename bootstring
12 .Ar
13 .Nm
14 .Op Fl ed
15 .Ar filename
16 .Sh DESCRIPTION
17 The
18 .Fx
19 program
20 .Nm
21 controls the actions of the boot blocks at the time of the next boot.
22 If compiled with the correct option,
23 the boot blocks will check the nameblock for a magic number and a
24 default name to use for booting.
25 If compiled to do so they will also
26 delete the name from the block, ensuring that if the boot should fail,
27 then it will not be tried again.
28 It is the job of
29 .Pa /etc/rc
30 to use
31 .Nm
32 to re-install the string if that boot is found to have succeeded.
33 This allows a one-time only boot string to be used for such applications
34 as remote debugging, and installation of new, untrusted kernels.
35 The nameblock is defined at compile time to be the second physical block
36 on the disk.
37 .Pp
38 The following options are available:
39 .Bl -tag -width indent
40 .It Fl b
41 Is used for bootstrapping (initially configuring) the nameblock.
42 Without
43 this,
44 .Nm
45 will refuse to write to a block that does not already contain the magic
46 number.
47 .It Fl d
48 Disable (temporarily) an existing name block by changing a bit
49 in the magic number.
50 .It Fl e
51 Restore the good magic number on a block disabled by
52 .Fl d .
53 .El
54 .Pp
55 The
56 .Fl e
57 and
58 .Fl d
59 flags are mutually exclusive.
60 .Sh DESCRIPTION
61 .Nm Nextboot
62 first checks that the disk has an fdisk table and checks that none of the
63 partitions defined in that table include the nameblock.
64 If the name block is
65 shown to be unused, it will install the bootstrings given as arguments,
66 one after the other, each preceded by a small magic number, and NULL
67 terminated.
68 The end of the list of strings is delimited by a sequence of
69 0xff bytes.
70 If the boot blocks are compiled to write back the nameblock
71 after each boot, it will zero out the supplied names as it uses them,
72 one per boot,
73 until it reaches the 0xff, at which time it will revert to the compiled in
74 boot string.
75 At this time the nameblock will contain only zeroed out names.
76 .Pp
77 An example of usage might be:
78 .Bd -literal
79    nextboot -b  /dev/rad0 1:da(0,a)/kernel.experimental ad(0,a)/kernel.old
80 .Ed
81 .Pp
82 Which would instruct the boot blocks at the next boot,
83 to try boot the experimental kernel off the SCSI disk.
84 If for any reason this failed, the next boot attempt would
85 boot the kernel
86 .Pa /kernel.old
87 off the IDE drive.  (Assuming the write-back option were enabled) If this
88 in turn failed.
89 The compiled in default would be used.
90 .Pp
91 If the write-back feature is disabled, the nextboot program is a convenient way
92 to change the default boot string.
93 Note, that should the file specified in
94 the nameblock be non-existent, then the name compiled into the boot blocks
95 will be used for the boot rather than the next name in the nameblock.
96 The
97 nameblock is only consulted
98 .Em once
99 per boot.
100 .Sh SEE ALSO
101 .Xr boot 8 ,
102 .Xr disklabel 8 ,
103 .Xr fdisk 8
104 .Sh BUGS
105 This program works only in conjunction with the legacy boot code.
106 .Pp
107 The entire program should be made more user-friendly.
108 The option of whether to write back or not should be stored on the
109 disk and not a compile time option.
110 I want to rethink this at some
111 later stage to make it co-exist with disks that do not have
112 a fdisk partitioning table (i.e. purely disklabel'd systems).
113 .Pp
114 Whether to write back or not should be specified at run-time in the nameblock
115 so that the boot blocks need not be altered to get this feature.