tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: MNT Reform2 USB LCP flash



If you are able, try building a kernel with the patch below.

I suspect this should probably apply without too many problems
to any reasonably modern NetBSD kernel version, patch is to
src/sys/dev/scsipi/sd.c

If patch(1) won't just work on your kernel sources, just
edit that fike, search for "fabricating" then a few lines
under that you'll see where secs & heads are arbitrarily
set, then cyls = size/(64*32) ... when size (not the actual
var name) is < 64*32 (eg: if it happened to be 68), it is
easy to see how cyls gets to be 0.   Just test for that,
and set cyls = 1 if the division made 0.

Not sure yet if that will be a complete solution to the
problem, this kind of issue may occur elsewhere,  but it
should be a start.

kre



Index: sd.c
===================================================================
RCS file: /cvsroot/src/sys/dev/scsipi/sd.c,v
retrieving revision 1.335
diff -u -r1.335 sd.c
--- sd.c	28 Aug 2022 10:26:37 -0000	1.335
+++ sd.c	26 Jan 2024 08:38:34 -0000
@@ -1769,6 +1769,8 @@
 		dp->heads = 64;
 		dp->sectors = 32;
 		dp->cyls = dp->disksize / (64 * 32);
+		if (dp->cyls == 0)	/* very small devices */
+			dp->cyls = 1;	/* round up # cyls */
 	}
 	dp->rot_rate = 3600;
 


Home | Main Index | Thread Index | Old Index