diff options
| -rw-r--r-- | lib/libdisk/Makefile | 6 | ||||
| -rw-r--r-- | lib/libdisk/disk.c | 14 | ||||
| -rw-r--r-- | lib/libdisk/libdisk.h | 4 | ||||
| -rw-r--r-- | lib/libdisk/write_ia64_disk.c | 8 | 
4 files changed, 31 insertions, 1 deletions
| diff --git a/lib/libdisk/Makefile b/lib/libdisk/Makefile index 0ea14baf632f..95e6444ff9e5 100644 --- a/lib/libdisk/Makefile +++ b/lib/libdisk/Makefile @@ -16,7 +16,11 @@ SRCS	+=	write_pc98_disk.c  SRCS	+=	write_i386_disk.c  .endif -.if ${MACHINE} == "alpha" +.if ${MACHINE_ARCH} == "ia64" +SRCS	+=	write_ia64_disk.c +.endif + +.if ${MACHINE_ARCH} == "alpha"  SRCS	+=	write_alpha_disk.c  .endif diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c index 119493e5ee1a..3675b4497dc6 100644 --- a/lib/libdisk/disk.c +++ b/lib/libdisk/disk.c @@ -778,6 +778,10 @@ Debug_Disk(struct disk *d)  #elif defined(__alpha__)  	printf("  boot1=%p, bootmgr=%p\n",  		d->boot1, d->bootmgr); +#elif defined(__ia64__) +	printf("\n"); +#else +/* Should be: error "Debug_Disk: unknown arch"; */  #endif  	Debug_Chunk(d->chunks);  } @@ -791,9 +795,13 @@ Free_Disk(struct disk *d)  	if(d->bootipl) free(d->bootipl);  	if(d->bootmenu) free(d->bootmenu);  #else +#if !defined(__ia64__)  	if(d->bootmgr) free(d->bootmgr);  #endif +#endif +#if !defined(__ia64__)  	if(d->boot1) free(d->boot1); +#endif  #if defined(__i386__)  	if(d->boot2) free(d->boot2);  #endif @@ -868,6 +876,7 @@ void  Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s)  #endif  { +#if !defined(__ia64__)  #ifdef PC98  	if (bootipl_size % d->sector_size != 0)  		return; @@ -908,6 +917,7 @@ Set_Boot_Mgr(struct disk *d, const u_char *b, const size_t s)  		memcpy(d->bootmgr, b, s);  	}  #endif +#endif  }  int @@ -927,6 +937,10 @@ Set_Boot_Blocks(struct disk *d, const u_char *b1, const u_char *b2)  	d->boot1 = malloc(15 * 512);  	if(!d->boot1) return -1;  	memcpy(d->boot1, b1, 15 * 512); +#elif defined(__ia64__) +	/* nothing */ +#else +/* Should be: #error "Set_Boot_Blocks: unknown arch"; */  #endif  	return 0;  } diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index a015828f6027..bf9b54d40a69 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -38,10 +38,14 @@ struct disk {  	u_char		*bootmenu;  	size_t		bootmenu_size;  #else +#if !defined(__ia64__)  	u_char		*bootmgr;  	size_t		bootmgr_size;  #endif +#endif +#if !defined(__ia64__)  	u_char		*boot1; +#endif  #if defined(__i386__)		/* the i386 needs extra help... */  	u_char		*boot2;  #endif diff --git a/lib/libdisk/write_ia64_disk.c b/lib/libdisk/write_ia64_disk.c index 6922776e19b7..833a642dc691 100644 --- a/lib/libdisk/write_ia64_disk.c +++ b/lib/libdisk/write_ia64_disk.c @@ -38,11 +38,13 @@ Write_FreeBSD(int fd, const struct disk *new, const struct disk *old, const stru  		memcpy(buf + 512 * i, p, 512);  		free(p);  	} +#if !defined(__ia64__)  	if(new->boot1)  		memcpy(buf, new->boot1, 512);  	if(new->boot2)  		memcpy(buf + 512, new->boot2, BBSIZE-512); +#endif  	dl = (struct disklabel *)(buf + 512 * LABELSECTOR + LABELOFFSET);  	Fill_Disklabel(dl, new, old, c1); @@ -65,6 +67,7 @@ Write_Int32(u_int32_t *p, u_int32_t v)      bp[3] = (v >> 24) & 0xff;  } +#if !defined(__ia64__)  /*   * Special install-time configuration for the i386 boot0 boot manager.   */ @@ -78,6 +81,7 @@ Cfg_Boot_Mgr(u_char *mbr, int edd)  	    mbr[0x1bb] &= 0x7f;	/* Packet mode off */      }  } +#endif  int  Write_Disk(const struct disk *d1) @@ -180,17 +184,21 @@ Write_Disk(const struct disk *d1)  				dp[i].dp_flag = 0x80;  	mbr = read_block(fd, 0, d1->sector_size); +#if !defined(__ia64__)  	if (d1->bootmgr) {  		memcpy(mbr, d1->bootmgr, DOSPARTOFF);  		Cfg_Boot_Mgr(mbr, need_edd);          } +#endif  	memcpy(mbr + DOSPARTOFF, dp, sizeof *dp * NDOSPART);  	mbr[512-2] = 0x55;  	mbr[512-1] = 0xaa;  	write_block(fd, 0, mbr, d1->sector_size); +#if !defined(__ia64__)  	if (d1->bootmgr && d1->bootmgr_size > d1->sector_size)  	  for(i = 1; i * d1->sector_size <= d1->bootmgr_size; i++)  	    write_block(fd, i, &d1->bootmgr[i * d1->sector_size], d1->sector_size); +#endif  	close(fd);  	return 0; | 
