diff --git a/usr.sbin/boot0cfg/boot0cfg.8 b/usr.sbin/boot0cfg/boot0cfg.8 index e949cc76c249..bb73d753d058 100644 --- a/usr.sbin/boot0cfg/boot0cfg.8 +++ b/usr.sbin/boot0cfg/boot0cfg.8 @@ -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! diff --git a/usr.sbin/boot0cfg/boot0cfg.c b/usr.sbin/boot0cfg/boot0cfg.c index 67d0c882d216..20fdcc34e90c 100644 --- a/usr.sbin/boot0cfg/boot0cfg.c +++ b/usr.sbin/boot0cfg/boot0cfg.c @@ -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 @@ -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(",");