summaryrefslogtreecommitdiff
path: root/sbin/disklabel
diff options
context:
space:
mode:
Diffstat (limited to 'sbin/disklabel')
-rw-r--r--sbin/disklabel/disklabel.54
-rw-r--r--sbin/disklabel/disklabel.864
-rw-r--r--sbin/disklabel/disklabel.c36
-rw-r--r--sbin/disklabel/pathnames.h2
4 files changed, 65 insertions, 41 deletions
diff --git a/sbin/disklabel/disklabel.5 b/sbin/disklabel/disklabel.5
index 7698a6331071..8090bdc5d53d 100644
--- a/sbin/disklabel/disklabel.5
+++ b/sbin/disklabel/disklabel.5
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)disklabel.5.5 8.1 (Berkeley) 6/5/93
-.\" $Id: disklabel.5,v 1.4 1998/06/04 06:49:12 charnier Exp $
+.\" $Id$
.\"
.Dd June 5, 1993
.Dt DISKLABEL 5
@@ -142,7 +142,7 @@ struct disklabel {
* the disklabel is read off the disk or in-core copy.
* d_boot0 and d_boot1 are the (optional) names of the
* primary (block 0) and secondary (block 1-15) bootstraps
- * as found in /boot. These are returned when using
+ * as found in /usr/mdec. These are returned when using
* getdiskbyname(3)
to retrieve the values from /etc/disktab.
*/
diff --git a/sbin/disklabel/disklabel.8 b/sbin/disklabel/disklabel.8
index 9dfca468e1dd..91362465ec18 100644
--- a/sbin/disklabel/disklabel.8
+++ b/sbin/disklabel/disklabel.8
@@ -33,7 +33,7 @@
.\" SUCH DAMAGE.
.\"
.\" @(#)disklabel.8 8.2 (Berkeley) 4/19/94
-.\" $Id: disklabel.8,v 1.9 1998/11/28 09:43:31 rnordier Exp $
+.\" $Id: disklabel.8,v 1.7 1997/06/23 04:02:17 steve Exp $
.\"
.Dd April 19, 1994
.Dt DISKLABEL 8
@@ -116,7 +116,7 @@ option to install bootstrap code.
These variants are described later.
.Pp
The first form of the command (read) is used to examine the label on the named
-disk drive (e.g. da0 or /dev/rda0c).
+disk drive (e.g. sd0 or /dev/rsd0c).
It will display all of the parameters associated with the drive
and its partition layout.
Unless the
@@ -135,7 +135,7 @@ The second form of the command, with the
flag, is used to write a standard label on the designated drive.
The required arguments to
.Nm
-are the drive to be labeled (e.g. da0), and
+are the drive to be labeled (e.g. sd0), and
the drive type as described in the
.Xr disktab 5
file.
@@ -251,19 +251,25 @@ indicates the primary boot program and
the secondary boot program.
If the names are not explicitly given, standard boot programs will be used.
The boot programs are located in
-.Pa /boot .
+.Pa /usr/mdec .
The names of the programs are taken from the ``b0'' and ``b1'' parameters
of the
.Xr disktab 5
entry for the disk if
.Ar disktype
was given and its disktab entry exists and includes those parameters.
-Otherwise, the default boot image names are used, these being:
-.Pa /boot/boot1
+Otherwise, boot program names are derived from the name of the disk.
+These names are of the form
+.Pa basename Ns boot
+for the primary (or only) bootstrap, and
+.Pf boot Pa basename
+for the secondary bootstrap;
+for example,
+.Pa /usr/mdec/sdboot
and
-.Pa /boot/boot2
-for the standard stage1 and stage2 boot images (details may vary
-on architectures like the Alpha, where only a single-stage boot is used).
+.Pa /usr/mdec/bootsd
+if the disk device is
+.Em sd0 .
.Pp
The first of the three boot-installation forms is used to install
bootstrap code without changing the existing label.
@@ -275,55 +281,55 @@ except that they will install bootstrap code in addition to a new label.
.Sh FILES
.Bl -tag -width Pa -compact
.It Pa /etc/disktab
-.It Pa /boot/
-.It Pa /boot/boot<n>
+.It Pa /usr/mdec/ Ns Em xx Ns boot
+.It Pa /usr/mdec/boot Ns Em xx
.El
.Sh EXAMPLES
-.Dl disklabel da0
+.Dl disklabel sd0
.Pp
-Display the in-core label for da0 as obtained via
-.Pa /dev/rda0c .
+Display the in-core label for sd0 as obtained via
+.Pa /dev/rsd0c .
.Pp
-.Dl disklabel -w -r /dev/rda0c da2212 foo
+.Dl disklabel -w -r /dev/rsd0c sd2212 foo
.Pp
-Create a label for da0 based on information for ``da2212'' found in
+Create a label for sd0 based on information for ``sd2212'' found in
.Pa /etc/disktab .
Any existing bootstrap code will be clobbered.
.Pp
-.Dl disklabel -e -r da0
+.Dl disklabel -e -r sd0
.Pp
-Read the on-disk label for da0, edit it and reinstall in-core as well
+Read the on-disk label for sd0, edit it and reinstall in-core as well
as on-disk.
Existing bootstrap code is unaffected.
.Pp
-.Dl disklabel -r -w da0 auto
+.Dl disklabel -r -w sd0 auto
.Pp
-Try to auto-detect the required information from da0, and write a new
+Try to auto-detect the required information from sd0, and write a new
label to the disk. Use another disklabel -e command to edit the
partitioning and file system information.
.Pp
-.Dl disklabel -R da0 mylabel
+.Dl disklabel -R sd0 mylabel
.Pp
-Restore the on-disk and in-core label for da0 from information in
+Restore the on-disk and in-core label for sd0 from information in
.Pa mylabel .
Existing bootstrap code is unaffected.
.Pp
-.Dl disklabel -B da0
+.Dl disklabel -B sd0
.Pp
-Install a new bootstrap on da0.
+Install a new bootstrap on sd0.
The boot code comes from
-.Pa /boot/boot1
+.Pa /usr/mdec/sdboot
and possibly
-.Pa /boot/boot2 .
+.Pa /usr/mdec/bootsd .
On-disk and in-core labels are unchanged.
.Pp
-.Dl disklabel -w -B /dev/rda0c -b newboot da2212
+.Dl disklabel -w -B /dev/rsd0c -b newboot sd2212
.Pp
Install a new label and bootstrap.
-The label is derived from disktab information for ``da2212'' and
+The label is derived from disktab information for ``sd2212'' and
installed both in-core and on-disk.
The bootstrap code comes from the file
-.Pa /boot/newboot .
+.Pa /usr/mdec/newboot .
.Sh SEE ALSO
.Xr disklabel 5 ,
.Xr disktab 5
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index ff04e4b9d17c..be60d542768a 100644
--- a/sbin/disklabel/disklabel.c
+++ b/sbin/disklabel/disklabel.c
@@ -46,7 +46,7 @@ static char sccsid[] = "@(#)disklabel.c 8.2 (Berkeley) 1/7/94";
/* from static char sccsid[] = "@(#)disklabel.c 1.2 (Symmetric) 11/28/85"; */
#endif
static const char rcsid[] =
- "$Id: disklabel.c,v 1.23 1998/10/23 18:57:39 bde Exp $";
+ "$Id: disklabel.c,v 1.20 1998/08/21 23:44:16 gpalmer Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -76,6 +76,12 @@ static const char rcsid[] =
* for the label on such machines.
*/
+#ifdef tahoe
+#define RAWPARTITION 'a'
+#else
+#define RAWPARTITION 'c'
+#endif
+
#ifndef BBSIZE
#define BBSIZE 8192 /* size of boot area, with label */
#endif
@@ -226,7 +232,7 @@ main(argc, argv)
dkname = argv[0];
if (dkname[0] != '/') {
- (void)sprintf(np, "%sr%s%c", _PATH_DEV, dkname, 'a' + RAW_PART);
+ (void)sprintf(np, "%sr%s%c", _PATH_DEV, dkname, RAWPARTITION);
specname = np;
np += strlen(specname) + 1;
} else
@@ -477,7 +483,7 @@ l_perror(s)
case ESRCH:
warnx("%s: no disk label on disk;", s);
fprintf(stderr,
- "use \"disklabel -r\" to install initial label\n");
+ "use \"disklabel -r\" to install initial label\n");
break;
case EINVAL:
@@ -490,8 +496,8 @@ l_perror(s)
break;
case EXDEV:
- warnx("%s: '%c' partition must start at beginning of disk",
- s, 'a' + RAW_PART);
+ warnx(
+ "%s: labeled partition or 'a' partition must start at beginning of disk", s);
break;
default:
@@ -595,13 +601,25 @@ makebootarea(boot, dp, f)
*np++ = '\0';
if (!xxboot) {
- (void)sprintf(boot0, "%s/boot1", _PATH_BOOTDIR);
- xxboot = boot0;
+ (void)sprintf(np, "%s/%sboot",
+ _PATH_BOOTDIR, dkbasename);
+ if (access(np, F_OK) < 0 && dkbasename[0] == 'r')
+ dkbasename++;
+ xxboot = np;
+ (void)sprintf(xxboot, "%s/%sboot",
+ _PATH_BOOTDIR, dkbasename);
+ np += strlen(xxboot) + 1;
}
#if NUMBOOT > 1
if (!bootxx) {
- (void)sprintf(boot1, "%s/boot2", _PATH_BOOTDIR);
- bootxx = boot1;
+ (void)sprintf(np, "%s/boot%s",
+ _PATH_BOOTDIR, dkbasename);
+ if (access(np, F_OK) < 0 && dkbasename[0] == 'r')
+ dkbasename++;
+ bootxx = np;
+ (void)sprintf(bootxx, "%s/boot%s",
+ _PATH_BOOTDIR, dkbasename);
+ np += strlen(bootxx) + 1;
}
#endif
}
diff --git a/sbin/disklabel/pathnames.h b/sbin/disklabel/pathnames.h
index a24bdefe68d1..def3297d205e 100644
--- a/sbin/disklabel/pathnames.h
+++ b/sbin/disklabel/pathnames.h
@@ -35,6 +35,6 @@
#include <paths.h>
-#define _PATH_BOOTDIR "/boot"
+#define _PATH_BOOTDIR "/usr/mdec"
#undef _PATH_TMP
#define _PATH_TMP "/tmp/EdDk.aXXXXXX"