On NetBSD/alpha, go out of the way to read the boot area's contents if -r
is specified, so that the boot blocks aren't clobbered when writing labels.
This commit is contained in:
parent
a54ad4c40d
commit
50f0c49606
@ -1,4 +1,4 @@
|
||||
# $NetBSD: Makefile,v 1.32 1999/04/09 16:00:17 kleink Exp $
|
||||
# $NetBSD: Makefile,v 1.33 1999/06/03 01:58:51 cgd Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 3/17/94
|
||||
|
||||
PROG= disklabel
|
||||
@ -23,4 +23,10 @@ CPPFLAGS+= -DNUMBOOT=1
|
||||
CPPFLAGS+= -DSTRICT_CYLINDER_ALIGNMENT
|
||||
.endif
|
||||
|
||||
.if (${MACHINE} == "alpha")
|
||||
# read in the old boot area even though we don't support writing the boot
|
||||
# area with disklabel(8).
|
||||
CPPFLAGS+= -DSAVEBOOTAREA
|
||||
.endif
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: disklabel.c,v 1.69 1999/05/03 09:45:01 christos Exp $ */
|
||||
/* $NetBSD: disklabel.c,v 1.70 1999/06/03 01:58:51 cgd Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1987, 1993
|
||||
@ -47,7 +47,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993\n\
|
||||
static char sccsid[] = "@(#)disklabel.c 8.4 (Berkeley) 5/4/95";
|
||||
/* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
|
||||
#else
|
||||
__RCSID("$NetBSD: disklabel.c,v 1.69 1999/05/03 09:45:01 christos Exp $");
|
||||
__RCSID("$NetBSD: disklabel.c,v 1.70 1999/06/03 01:58:51 cgd Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -881,6 +881,20 @@ makebootarea(boot, dp, f)
|
||||
lp = (struct disklabel *)
|
||||
(boot + (LABELSECTOR * dp->d_secsize) + LABELOFFSET);
|
||||
(void) memset(lp, 0, sizeof *lp);
|
||||
#ifdef SAVEBOOTAREA
|
||||
/*
|
||||
* We must read the current bootarea so we don't clobber the
|
||||
* existing boot block, if any.
|
||||
*/
|
||||
if (rflag) {
|
||||
off_t sectoffset = 0;
|
||||
|
||||
if (lseek(f, sectoffset, SEEK_SET) < 0 ||
|
||||
read(f, boot, BBSIZE) < BBSIZE)
|
||||
err(4, "%s", specname);
|
||||
(void) memset(lp, 0, sizeof *lp);
|
||||
}
|
||||
#endif
|
||||
#if NUMBOOT > 0
|
||||
/*
|
||||
* If we are not installing a boot program but we are installing a
|
||||
|
Loading…
Reference in New Issue
Block a user