[comp.os.minix] minix 1.2 on 3.5" drives.

hartzell@boulder.Colorado.EDU (George Hartzell) (04/21/88)

I am looking into putting minix on a zenith 183 portable.  It has a 20
meg drive, an meg of expanded ram, and a 3.5" 720k floppy.  I have the
minix 1.2 distribution floppies (360k) and have them running on a
vanilla pc with no problems.  The pc has a 3.5" drive but it seems to me
that I have to (re)write the floppy driver to recognize it.  It tried
making a block special device with major=2 and minor=3, but it failed.
Does anyone out there know how to go about getting the stuff over to the
little disks?  While we're at it, does anyone have minix running on a 
zenith portable?  Is it compatible enough or am I wasting my time?
g.

George Hartzell			                 (303) 492-4535
MCD Biology, University of Colorado-Boulder, Boulder, CO 80309
hartzell@Boulder.Colorado.EDU  ..!{ncar,nbires}!boulder!hartzell
(bitnet hosts try: hartzell%boulder.colorado.edu@jvnca.csc.org)
George Hartzell			                 (303) 492-4535
MCD Biology, University of Colorado-Boulder, Boulder, CO 80309
hartzell@Boulder.Colorado.EDU  ..!{ncar,nbires}!boulder!hartzell
(bitnet hosts try: hartzell%boulder.colorado.edu@jvnca.csc.org)

cs002@unocss.UUCP (Stan Wileman) (04/21/88)

In article <5525@sigi.Colorado.EDU>, hartzell@boulder.Colorado.EDU
		(George Hartzell) writes:
> I am looking into putting minix on a zenith 183 portable.  ...
> 		...  Is it compatible enough or am I wasting my time?

Yes, MINIX runs well on the Zenith laptops.  I haven't any experience
with the Z-183 (with the builtin wini), but my external 20 MB wini on
the Z-181 works fine.  Now, for the fun part -- getting it there...

I moved MINIX from 5.25" to 3.5" diskettes using a procedure that should
work for most folks, especially those with both types of drives on the
same machine.  It involves three steps:
1. Create an MS-DOS file that contains a sector-for-sector image of a
   MINIX 5.25" floppy.
2. Copy this MS-DOS file to a machine that has 3.5" diskettes.  Note
   that this step is unnecessary if you have both 5.25" and 3.5" drives
   on the same machine; I don't, so I used a product called the "Brooklyn
   Bridge" to achieve the transfer; any asynchronous comm. program (Cross-
   talk, mirror, kermit, etc.) should be usable, but slower than the Bridge.
3. Copy the MINIX disk image from the MS-DOS file sector-for-sector to the
   3.5" disk (which was previously formatted).

Once you've transferred a boot disk, a root fs, and a /usr fs you should be
able to run MINIX on the Z-18?.  Note that the disks will be treated as
360K filesystems, but that's okay, since they have at least that much.  The
floppy driver in 1.2 handles the 3.5"-ers on the Z-181 without difficulty
(although I'm certain some parameter-tweaking could result in improved
performance :-)  You CAN make 720K filesystems by using mkfs and NO SOURCE
CODE CHANGES!  The only problem I've not found sufficient time to correct
is the keyboard encoding; the Z-18? machines use the extra "function" shift
key to get some of the codes normally found on a PC's keyboard, and they're
encoded in a way that's got my little mind buggered!

Incidentally, steps (1) and (3) in the procedure given above were accomplished
with a pair of complementary C programs that run under MS-DOS.  These were
compiled using MS C 4.0, but other compilers should work just as well.

GETDI.C
-------

/*
 * Make an image of the diskette in selected disk drive.
 * The order in which the information is written is
 *
 * Side 0, Track 0, Sector 1 ... Sector MAXSEC
 * Side 1, Track 0, Sector 1 ... Sector MAXSEC
 * Side 0, Track 1, Sector 1 ... Sector MAXSEC
 * ...
 * Side 1, Track MAXTRK, Sector 1 ... Sector MAXSEC
 *
 * The output file is always named DISK.ALL
 */

#include <stdio.h>
#include <dos.h>
#include <fcntl.h>

#define MAXSEC 9
#define MAXTRK 39

union REGS inregs;
union REGS outregs;
struct SREGS sregs;
char buffer[512*MAXSEC];	/* where to place the track copy */
int drive;
int trkno, headno;
int out;			/* output file descriptor */

main()
{
	int ok, tries;
	
	inregs.h.ah = 0;		/* reset disk system */
	int86(0x13, &inregs, &outregs);

	out = creat("C:DISK.ALL",0666);
	if (out < 0) {
		printf("Can't create C:DISK.ALL\n");
		exit(1);
	}
	close(out);
	out = open("C:DISK.ALL",O_WRONLY | O_BINARY);
	if (out < 0) {
		printf("Can't open C:DISK.ALL\n");
		exit(1);
	}
	printf("Drive: ");
	if (scanf("%d",&drive) != 1) exit(0);
	trkno = 0;
	headno = 0;
	
	printf("Reading track/head ");
	for (trkno=0;trkno<=MAXTRK;trkno++)
		for (headno=0;headno<2;headno++) {
			printf("%2d/%2d\b\b\b\b\b", trkno, headno);
			ok = 0;
			tries = 5;
			while (!ok && tries) {
				ok = !readtrk();
				tries--;
			}
			if (ok)	savetrk();
			else {
				printf("\nError reading diskette.\n");
				exit(1);
			}
		}
	
}


readtrk()
{
	int i,j;

	inregs.h.ah = 2;	/* read sector */
	inregs.h.al = MAXSEC;	/* read all of one track */	
	inregs.h.ch = trkno;	/* track 0 */
	inregs.h.cl = 1;	/* sector 1 */
	inregs.h.dh = headno;	/* head 0 */
	inregs.h.dl = drive;	/* drive 0 */

	segread(&sregs);	/* setup es same as ds */
	sregs.es = sregs.ds;
	inregs.x.bx = buffer;

	int86x(0x13, &inregs, &outregs, &sregs);	/* do it! */
	return(outregs.x.cflag);

}

savetrk()
{
	int i, n;
	
	for (i=0;i<MAXSEC;i++) {
		n = write(out,buffer+i*512,512);	/* save one sector */
		if (n != 512) {				/* test for an error */
			printf("\nError writing C:DISK.ALL\n");
			exit(1);
		}
	}
}


PUTDI.C
-------

/*
 * Write drive 1 from the contents of file DISK.ALL
 * The order in which the information is written is
 *
 * Side 0, Track 0, Sector 1 ... Sector MAXSEC
 * Side 1, Track 0, Sector 1 ... Sector MAXSEC
 * Side 0, Track 1, Sector 1 ... Sector MAXSEC
 * ...
 * Side 1, Track MAXTRK, Sector 1 ... Sector MAXSEC
 *
 */

#include <stdio.h>
#include <dos.h>
#include <fcntl.h>

#define MAXSEC 9
#define MAXTRK 39

union REGS inregs;
union REGS outregs;
struct SREGS sregs;
char buffer[512*MAXSEC];	/* where to place the track */
int drive;
int trkno, headno;
int in;				/* input file descriptor */

main()
{
	int ok, tries;
	
	inregs.h.ah = 0;		/* reset disk system */
	int86(0x13, &inregs, &outregs);

	in = open("DISK.ALL",O_RDONLY | O_BINARY);
	if (in < 0) {
		printf("Can't open DISK.ALL\n");
		exit(1);
	}
	printf("Drive: ");
	if (scanf("%d",&drive) != 1) exit(0);
	trkno = 0;
	headno = 0;
	
	printf("Writing cylinder/head ");
	for (trkno=0;trkno<=MAXTRK;trkno++)
		for (headno=0;headno<2;headno++) {
			printf("%2d/%2d\b\b\b\b\b", trkno, headno);
			gettrk();	/* get one track from DISK.ALL */
			ok = 0;
			tries = 5;
			while (!ok && tries) {
				ok = !writetrk();
				tries--;
			}
			if (!ok) {
				printf("Error writing disk.\n");
				exit(1);
			}
		}
}


writetrk()
{
	int i,j;

	inregs.h.ah = 3;	/* write sector */
	inregs.h.al = MAXSEC;	/* write all of one track */	
	inregs.h.ch = trkno;	/* track number */
	inregs.h.cl = 1;	/* sector 1 */
	inregs.h.dh = headno;	/* head number */
	inregs.h.dl = drive;	/* drive number */

	segread(&sregs);	/* setup es same as ds */
	sregs.es = sregs.ds;
	inregs.x.bx = buffer;

	int86x(0x13, &inregs, &outregs, &sregs);	/* do it! */
	return(outregs.x.cflag);
}

gettrk()
{
	int i, n;
	
	for (i=0;i<MAXSEC;i++) {
		n = read(in, buffer+i*512, 512);	/* read one sector */
		if (n != 512) {				/* test for an error */
			printf("\nError reading DISK.ALL\n");
			exit(1);
		}
	}
}

-------

Hope this helps; MINIX on a laptop is really cute in airports :-)


Stan Wileman					..!ihnp4!unocss!cs002 (UUCP)
U. of Nebraska at Omaha, Math/CS Dept.    cs002%zeus@crcvms.unl.edu (BITNET)

darrylo@hpsrli.HP.COM (Darryl Okahata) (04/22/88)

In comp.os.minix, hartzell@boulder.Colorado.EDU (George Hartzell) writes:

> I am looking into putting minix on a zenith 183 portable.  It has a 20
     [ ... ]
> Does anyone out there know how to go about getting the stuff over to the
> little disks?  While we're at it, does anyone have minix running on a 
> zenith portable?  Is it compatible enough or am I wasting my time?
> g.
> 
> George Hartzell			                 (303) 492-4535
> MCD Biology, University of Colorado-Boulder, Boulder, CO 80309
> hartzell@Boulder.Colorado.EDU  ..!{ncar,nbires}!boulder!hartzell
> (bitnet hosts try: hartzell%boulder.colorado.edu@jvnca.csc.org)

     Write a program to do a "disk image" copy of the 5 1/4" disk to the 3 1/2"
one.  By "disk image", I mean:

     Transfer head 0, track 0, sector 1 of the 5 1/4" disk to head 0, track 0,
	sector 1 of the 3 1/2" disk.
     Transfer head 0, track 0, sector 2 of the 5 1/4" disk to head 0, track 0,
	sector 2 of the 3 1/2" disk.
     Transfer head 0, track 0, sector 3 of the 5 1/4" disk to head 0, track 0,
	sector 3 of the 3 1/2" disk.
     Etc., ad nauseum.

This can be done, as the sector size on the 3 1/2" disk is the same size (512
bytes) as that on the 5 1/4" disk.

     Note that, as the 3 1/2" disk has many more sectors, many sectors on the
3 1/2" disk will not be used.  The only problem with this method is that your
3 1/2" disks look like 360K disks to Minix.  Once you've copied all of the
5 1/4" disks to 3 1/2" format, just boot normally (I assume that Minix works on
the Zenith).

     I wrote a program to do a disk image copy and was able to boot minix with
my portable.  I wrote the program using a very non-portable dialect of C, and I
don't know if I still have it.

     -- Darryl Okahata
	{hplabs!hpccc!, hpfcla!} hpsrla!darrylo
	CompuServe: 75206,3074

Disclaimer: the above is the author's personal opinion and is not the
opinion or policy of his employer or of the little green men that
have been following him all day.