summaryrefslogtreecommitdiffstats
path: root/sbin
diff options
context:
space:
mode:
authordfr <dfr@FreeBSD.org>1998-08-17 07:43:54 +0000
committerdfr <dfr@FreeBSD.org>1998-08-17 07:43:54 +0000
commit72c760c68b70c9d684c4ebfc7402e14a5119ac6b (patch)
tree1d5a757d03674ef232b62bd8a2af65167ad3be80 /sbin
parent8f925ed929380e35be82c0bea5775b4efb3adcee (diff)
downloadFreeBSD-src-72c760c68b70c9d684c4ebfc7402e14a5119ac6b.zip
FreeBSD-src-72c760c68b70c9d684c4ebfc7402e14a5119ac6b.tar.gz
Teach disklabel how to install a bootstrap on an alpha with SRM console.
Diffstat (limited to 'sbin')
-rw-r--r--sbin/bsdlabel/bsdlabel.c39
-rw-r--r--sbin/disklabel/disklabel.c39
2 files changed, 74 insertions, 4 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c
index df940e9..bd55781 100644
--- a/sbin/bsdlabel/bsdlabel.c
+++ b/sbin/bsdlabel/bsdlabel.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.16 1998/07/20 11:34:06 bde Exp $";
+ "$Id: disklabel.c,v 1.17 1998/07/25 16:19:10 bde Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -89,7 +89,7 @@ static const char rcsid[] =
#ifdef tahoe
#define NUMBOOT 0
#else
-#if defined(hp300) || defined(hp800)
+#if defined(hp300) || defined(hp800) || defined(__alpha__)
#define NUMBOOT 1
#else
#define NUMBOOT 2
@@ -398,6 +398,14 @@ writelabel(f, boot, lp)
#endif
int flag;
+#ifdef __alpha__
+ /*
+ * Generate the bootblock checksum for the SRM console.
+ */
+ u_long *p, sum;
+ int i;
+#endif
+
setbootflag(lp);
lp->d_magic = DISKMAGIC;
lp->d_magic2 = DISKMAGIC;
@@ -423,6 +431,13 @@ writelabel(f, boot, lp)
* disable after writing.
*/
flag = 1;
+
+#ifdef __alpha__
+ for (p = (u_long *)boot, i = 0, sum = 0; i < 63; i++)
+ sum += p[i];
+ p[63] = sum;
+#endif
+
if (ioctl(f, DIOCWLABEL, &flag) < 0)
warn("ioctl DIOCWLABEL");
if (write(f, boot, lp->d_bbsize) != lp->d_bbsize) {
@@ -662,8 +677,28 @@ makebootarea(boot, dp, f)
(int)(dp->d_bbsize-dp->d_secsize)) < 0)
err(4, "%s", bootxx);
#else
+#ifdef __alpha__
+ {
+
+ /*
+ * On the alpha, the primary bootstrap starts at the
+ * second sector of the boot area. The first sector
+ * contains the label and must be edited to contain the
+ * size and location of the primary bootstrap.
+ */
+ int n = read(b, boot + dp->d_secsize, (int)dp->d_bbsize);
+ u_long *lp;
+ if (n < 0)
+ err(4, "%s", xxboot);
+ lp = (u_long *) (boot + 480);
+ lp[0] = (n + dp->d_secsize - 1) / dp->d_secsize;
+ lp[1] = 1; /* start at sector 1 */
+ lp[2] = 0; /* flags (must be zero) */
+ }
+#else
if (read(b, boot, (int)dp->d_bbsize) < 0)
err(4, "%s", xxboot);
+#endif
if (fstat(b, &sb) != 0)
err(4, "%s", xxboot);
bootsize = (int)sb.st_size - dp->d_bbsize;
diff --git a/sbin/disklabel/disklabel.c b/sbin/disklabel/disklabel.c
index df940e9..bd55781 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.16 1998/07/20 11:34:06 bde Exp $";
+ "$Id: disklabel.c,v 1.17 1998/07/25 16:19:10 bde Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -89,7 +89,7 @@ static const char rcsid[] =
#ifdef tahoe
#define NUMBOOT 0
#else
-#if defined(hp300) || defined(hp800)
+#if defined(hp300) || defined(hp800) || defined(__alpha__)
#define NUMBOOT 1
#else
#define NUMBOOT 2
@@ -398,6 +398,14 @@ writelabel(f, boot, lp)
#endif
int flag;
+#ifdef __alpha__
+ /*
+ * Generate the bootblock checksum for the SRM console.
+ */
+ u_long *p, sum;
+ int i;
+#endif
+
setbootflag(lp);
lp->d_magic = DISKMAGIC;
lp->d_magic2 = DISKMAGIC;
@@ -423,6 +431,13 @@ writelabel(f, boot, lp)
* disable after writing.
*/
flag = 1;
+
+#ifdef __alpha__
+ for (p = (u_long *)boot, i = 0, sum = 0; i < 63; i++)
+ sum += p[i];
+ p[63] = sum;
+#endif
+
if (ioctl(f, DIOCWLABEL, &flag) < 0)
warn("ioctl DIOCWLABEL");
if (write(f, boot, lp->d_bbsize) != lp->d_bbsize) {
@@ -662,8 +677,28 @@ makebootarea(boot, dp, f)
(int)(dp->d_bbsize-dp->d_secsize)) < 0)
err(4, "%s", bootxx);
#else
+#ifdef __alpha__
+ {
+
+ /*
+ * On the alpha, the primary bootstrap starts at the
+ * second sector of the boot area. The first sector
+ * contains the label and must be edited to contain the
+ * size and location of the primary bootstrap.
+ */
+ int n = read(b, boot + dp->d_secsize, (int)dp->d_bbsize);
+ u_long *lp;
+ if (n < 0)
+ err(4, "%s", xxboot);
+ lp = (u_long *) (boot + 480);
+ lp[0] = (n + dp->d_secsize - 1) / dp->d_secsize;
+ lp[1] = 1; /* start at sector 1 */
+ lp[2] = 0; /* flags (must be zero) */
+ }
+#else
if (read(b, boot, (int)dp->d_bbsize) < 0)
err(4, "%s", xxboot);
+#endif
if (fstat(b, &sb) != 0)
err(4, "%s", xxboot);
bootsize = (int)sb.st_size - dp->d_bbsize;
OpenPOWER on IntegriCloud