Subject: Re: bootable 3.0_BETA CD-ROM image
To: None <port-sgimips@NetBSD.org>
From: Izumi Tsutsui <tsutsui@ceres.dti.ne.jp>
List: port-sgimips
Date: 09/14/2005 00:45:09
In article <050912201528.M0201510@mirage.ceres.dti.ne.jp>
I wrote:

> It also causes problem that the CD image can't be mounted
> via vnd(4) because the default b_secsize of vnd(4) is 512
> and it doesn't match with p_offset. But now, I notice
> we can specify secsize on vnconfig(8). Hmm.
> I haven't tried it, but if it works we could choose this way...

It just works. A new patch is attached.

BTW, in <sys/bootblock.h> SGI_BOOT_BLOCK_SIZE_VOLHDR is 3135,
but is there any reason of this value? It can't be aligned
with 2048bytes/sector though we can specify volhdr size on
sgivol(8)...
---
Izumi Tsutsui

Index: sys/arch/sgimips/sgimips/disksubr.c
===================================================================
RCS file: /cvsroot/src/sys/arch/sgimips/sgimips/disksubr.c,v
retrieving revision 1.15
diff -u -r1.15 disksubr.c
--- sys/arch/sgimips/sgimips/disksubr.c	3 Jun 2005 18:55:12 -0000	1.15
+++ sys/arch/sgimips/sgimips/disksubr.c	13 Sep 2005 15:44:07 -0000
@@ -311,7 +311,9 @@
 	if (mipsvh_cksum(vh))
 		return ("sgimips disk label corrupted");
 
+#if 0 /* ARCS ignores dp_secbytes and it may be wrong; use default instead */
 	lp->d_secsize    = vh->dp.dp_secbytes;
+#endif
 	lp->d_nsectors   = vh->dp.dp_secs;
 	lp->d_ntracks    = vh->dp.dp_trks0;
 	lp->d_ncylinders = vh->dp.dp_cyls;
@@ -331,6 +333,9 @@
 
 		lpp = &lp->d_partitions[bp];
 		lpp->p_offset = vh->partitions[mp].first;
+		/* XXX ARCS ignores dp_secbytes on calculating offsets */
+		if (lp->d_secsize > DEV_BSIZE)
+			lpp->p_offset /= lp->d_secsize / DEV_BSIZE;
 		lpp->p_size = vh->partitions[mp].blocks;
 		lpp->p_fstype = partition_map[i].bsd_type;
 		if (lpp->p_fstype == FS_BSDFFS) {
@@ -369,7 +374,11 @@
 	vh->dp.dp_shd0 = 0;
 	vh->dp.dp_trks0 = lp->d_ntracks;
 	vh->dp.dp_secs = lp->d_nsectors;
+#if 0 /* ARCS ignores dp_secbytes; leave it default */
 	vh->dp.dp_secbytes = lp->d_secsize;
+#else
+	vh->dp.dp_secbytes = SGI_BOOT_BLOCK_BLOCKSIZE;
+#endif
 	vh->dp.dp_interleave = lp->d_interleave;
 	vh->dp.dp_nretries = 22;
 
@@ -379,6 +388,10 @@
 
 		lpp = &lp->d_partitions[bp];
 		vh->partitions[mp].first = lpp->p_offset;
+		/* XXX ARCS ignores dp_secbytes on calculating offsets */
+		if (lp->d_secsize > SGI_BOOT_BLOCK_BLOCKSIZE)
+			vh->partitions[mp].first *=
+			    lp->d_secsize / SGI_BOOT_BLOCK_BLOCKSIZE;
 		vh->partitions[mp].blocks = lpp->p_size;
 		vh->partitions[mp].type = partition_map[i].mips_type;
 	}