mirror of
https://git.FreeBSD.org/src.git
synced 2024-12-05 09:14:03 +00:00
Teach disklabel how to install a bootstrap on an alpha with SRM console.
This commit is contained in:
parent
83314c7206
commit
130cd73a15
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=38384
@ -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) {
|
||||
@ -661,9 +676,29 @@ makebootarea(boot, dp, f)
|
||||
if (read(b, &boot[dp->d_secsize],
|
||||
(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;
|
||||
|
@ -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) {
|
||||
@ -661,9 +676,29 @@ makebootarea(boot, dp, f)
|
||||
if (read(b, &boot[dp->d_secsize],
|
||||
(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;
|
||||
|
Loading…
Reference in New Issue
Block a user