diff options
author | Doug Rabson <dfr@FreeBSD.org> | 1998-08-17 07:43:54 +0000 |
---|---|---|
committer | Doug Rabson <dfr@FreeBSD.org> | 1998-08-17 07:43:54 +0000 |
commit | 130cd73a15b989816bcb7cc813c914d93568efde (patch) | |
tree | 1131b5dd767e045cad3105885d65d547f53823eb /sbin | |
parent | 83314c7206758231eb7efa07c2d40862b25524da (diff) | |
download | src-130cd73a15b989816bcb7cc813c914d93568efde.tar.gz src-130cd73a15b989816bcb7cc813c914d93568efde.zip |
Teach disklabel how to install a bootstrap on an alpha with SRM console.
Notes
Notes:
svn path=/head/; revision=38384
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/bsdlabel/bsdlabel.c | 39 | ||||
-rw-r--r-- | sbin/disklabel/disklabel.c | 39 |
2 files changed, 74 insertions, 4 deletions
diff --git a/sbin/bsdlabel/bsdlabel.c b/sbin/bsdlabel/bsdlabel.c index df940e9be326..bd55781fd27d 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 df940e9be326..bd55781fd27d 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; |