Finish implementing "setdrv" option. This is intended to be used

(with care) in those instances where boot0 is not passed the
correct drive number by the PC BIOS.  (The symptoms are a
"F5   Drive 0" line, even though the current drive is drive 0.)
This commit is contained in:
Robert Nordier 1999-02-26 14:57:17 +00:00
parent 5052aa25a1
commit ee6fb785cd
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=44297
2 changed files with 10 additions and 7 deletions

View File

@ -22,7 +22,7 @@
.\" OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
.\" EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
.\"
.\" $Id: boot0cfg.8,v 1.1.1.1 1999/02/21 21:23:42 rnordier Exp $
.\" $Id: boot0cfg.8,v 1.2 1999/02/22 09:36:54 rnordier Exp $
.\"
.Dd February 21, 1999
.Dt BOOT0CFG 8
@ -101,7 +101,7 @@ the conventional (CHS) interface, when accessing disk-related BIOS
services. The default is
.Sq nopacket .
.It setdrv
Causes the drive containing the disk to be referenced using drive
Forces the drive containing the disk to be referenced using drive
number definable by means of the -d option. The default is
.Sq nosetdrv .
.It update
@ -131,7 +131,7 @@ option may cause
.Sq boot0
to fail, depending on the nature of BIOS support.
.Pp
The
Use of the
.Sq setdrv
option is presently implemented
.Dq syntactically but not semantically .
option with an incorrect -d operand may cause the MBR to be written
to the wrong disk. Be careful!

View File

@ -26,7 +26,7 @@
#ifndef lint
static const char rcsid[] =
"$Id: boot0cfg.c,v 1.1.1.1 1999/02/21 21:23:42 rnordier Exp $";
"$Id: boot0cfg.c,v 1.2 1999/02/22 09:36:54 rnordier Exp $";
#endif /* not lint */
#include <sys/param.h>
@ -44,6 +44,7 @@ static const char rcsid[] =
#define MBRSIZE 512 /* master boot record size */
#define OFF_DRIVE 0x1ba /* offset: setdrv drive */
#define OFF_FLAGS 0x1bb /* offset: option flags */
#define OFF_TICKS 0x1bc /* offset: clock ticks */
#define OFF_PTBL 0x1be /* offset: partition table */
@ -154,6 +155,8 @@ main(int argc, char *argv[])
errx(1, "%s: bad magic", bpath);
memcpy(buf + OFF_PTBL, part, sizeof(part));
}
if (d_arg != -1)
buf[OFF_DRIVE] = d_arg;
if (o_flag) {
buf[OFF_FLAGS] &= o_and;
buf[OFF_FLAGS] |= o_or;
@ -185,7 +188,7 @@ main(int argc, char *argv[])
part[i].dp_size);
}
printf("\n");
printf("drive=0x0 options=");
printf("drive=0x%x options=", buf[OFF_DRIVE]);
for (i = 0; i < nopt; i++) {
if (i)
printf(",");