Subject: Re: Success of NetBSD on weird IDE disks (was Re: Installation problems)
To: None <hvozda@netcom.com>
From: Chuck Cranor <chuck@dworkin.wustl.edu>
List: port-i386
Date: 10/27/1995 11:21:45
>On Thu, 26 Oct 95 15:25:47 GMT  richard.ellis@kpmg.co.uk wrote:
>While I have a had a a problem installing on a >1Gb disk recently myself
>I'm starting to see a pattern here.  All of the disks have a 
>natural geo of X CYL 16 HD 63 SPT and BIOS geo of Y CYL 64 HD 63 SPT.

>Has anyone out there gotten NetBSD to install on such a disk?  There
>seems to be quite a few of us with failures on this type of IDE disk...

hi eric-

    i've had some trouble in this area too, but i have managed to work
it out for two specific cases:

[1] 100mhz pentium with 1GB IDE drive with DOS and NetBSD on the same disk.
[2] 133mhz pentium with 2GB SCSI drive with DOS, FreeBSD, and NetBSD on 
	the same disk.

Here are the details on these cases, for your reference:

For the IDE system, my objective was to get DOS and NetBSD to live
together on the same disk.   I first tried installing NetBSD 1.0.   I 
could not get it to work (disk controller errors).    I then switched to 
the NetBSD -current snapshot on ftp.netbsd.org in pub/NetBSD/arch/i386 
(the one from May should work).    

My 1GB IDE disk has 2100cyl/16head/63sec, but DOS thought it had 
525/64/63 (translated geometry).   I tried installing NetBSD with 
the translated geometry, but I was not able to get it to work 
(almost got it, but couldn't get bootblock to be installed properly).   
So, I went in the setup menu and turned off the translated geometry.   
At that point the BIOS could only see part of the disk (first 1024 cyls).

To install I first booted DOS, ran fdisk and deleted all fdisk-partitions.
I then created a new DOS fdisk partition and installed DOS on it.   Next
I ran pfdisk and created a NetBSD fdisk-partition.   "pfdisk" saw the
"truncated" geometry: 1023/16/63 (I think?).    DOS fdisk allocated 
cyl's 0 to 609 for DOS.   I used pfdisk to allocate cyls 610 to 1023
for NetBSD.    I then booted off the NetBSD boot floppy and followed
the install instructions, giving NetBSD the real geometry (2100/16/63)
and making sure the root filesystem fell within the 1023 cyl boundary.
After NetBSD got installed properly, I installed OS-BS so that I could
choose which OS I wanted to run at boot time.



My objective for the SCSI system was to get DOS, FreeBSD, and NetBSD
installed all on the same 2GB disk  (DOS=200MB, FreeBSD=300MB, NetBSD=1500MB).
On this SCSI system I had the Adaptec 2940 PCI SCSI controller, and a
seagate ST32430N (hawk) 2GB drive.   DOS was seeing this drive as
261/255/63, but NetBSD's boot up message was showing it as 3992/9/116.

Because the driver for the 2940 just went in the tree, I updated
the IDE system to NetBSD 1.1_ALPHA and tried to generate my own
boot floppy (ran "make" in src/distrib/i386/floppies).    After fixing
the "strcmp" libkern error in the -current boot blocks I found that
my system would no longer boot.    My guess is that either the boot block
code in the 1.1 tree doesn't work properly or I don't understand how
to build a floppy properly ("make" in that directory isn't enough?).   To 
fix this I reverted to the boot floppy image from the May snapshot.   I then
built an INSTALL kernel on my IDE system with the 2940 driver in it, mounted 
the snapshot boot floppy and replaced the INSTALL kernel with the one I 
just built.

I tried to follow what I did on the IDE system (e.g. turn off translation
with SCSISelect) on the SCSI system, but I couldn't get it to work.     
What did work was to use the translated geometry (261/255/63) for everything.
However, the NetBSD install tools could not handle this geometry ("newfs"
kept failing!).    To work around this I suggest using the FreeBSD
install tools.     Here is the procedure I used:

 - boot DOS: run fdisk, delete all partition info.   create DOS partition
	(200MB in my case) and install DOS  (used standard gateway2000 stuff
	here).
 - run pfdisk and create two new fdisk partitions.    mark the one you want
	FreeBSD on as ID 164 (invalid ID), and mark the one you want NetBSD
	on as ID 165.    In my case I had DOS on cyl 0 to 25, FreeBSD
	on cyl 26 to 63, and NetBSD on 64 to 260.
 - boot FreeBSD boot floppy (I used the latest SNAPSHOT floppy).   Make like
	you are going to install FreeBSD in the NetBSD area (express install).
	The fdisk stuff should be ok.   Choose the filesystem sizes you want
	for NetBSD using the FreeBSD tool.    Keep going through the install
	procedure until you see it newfs and disklabel your system (I waited
	until it started ftp'ing stuff).   Then abort the install.
 - boot NetBSD boot floppy, swap in inst floppy, and say "n" to abort the
	install questions (*don't* let netbsd try and "newfs" your system...
	let freebsd do that).    you should be able to mount the filesystems
	that freebsd created.    mount the filesystems, and "rm -rf" all
	the freebsd stuff.
 - you could probably ftp the all the tar files at this point, but since I 
	had a precompiled 1.1 source tree on my IDE system, I just nfs mount'd
	it, set DESTDIR to /mnt (where I mounted the blank freebsd filesystems)
	and did a "make distribution" in src/etc.   [if you do this you will
	need a writable /tmp for "pax" when it does "make install" in 
	/usr/src/include]
 - I then used "disklabel" to install the bootblocks from the floppy, not
	wanting to risk trying the 1.1_ALPHA ones.
 - I then shut down, booted DOS, and ran pfdisk.   I swap'd fdisk-IDs on the 
	FreeBSD and NetBSD partitions so that NetBSD I just installed was 
	164 (invalid) and the FreeBSD area was 165.    I then installed 
	FreeBSD on the FreeBSD area (no special instructions required here).

When I installed FreeBSD it seems to have installed some "standard" boot
manager that lets me choose DOS or BSD.    I haven't figured out how to
get two 165 fdisk-partitions on at the same time, so I have a DOS script
that runs pfdisk and toggles which BSD has ID 165.



I've also noted that FreeBSD has a driver for the ATAPI CD ROM drive.
Has anyone ported it to NetBSD?


Also, does anyone have a working driver for BSD for the Ensoniq 
soundscape sound card?

Anyway, hope this is helpful.    I will include fdisk/disklabel output
below for those who are interested.

chuck


fdisk/disklabel output for my IDE system:
******* Working on device /dev/rwd0d *******
parameters extracted from in-core disklabel are:
cylinders=2100 heads=16 sectors/track=63 (1008 sectors/cylinder)

Figures below won't work with BIOS for partitions not in cylinder 1
parameters to be used for BIOS calculations are:
cylinders=2100 heads=16 sectors/track=63 (1008 sectors/cylinder)

Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 0 is:
sysid 6 (Primary 'big' DOS (> 32MB))
    start 63, size 614817 (300 MB), flag 80
        beg: cylinder    0, head   1, sector  1
        end: cylinder  609, head  15, sector 63
The data for partition 1 is:
<UNUSED>
The data for partition 2 is:
<UNUSED>
The data for partition 3 is:
sysid 165 (NetBSD or 386BSD)
    start 614880, size 1501920 (733 MB), flag 0
        beg: cylinder  610, head   0, sector  1
        end: cylinder 1023, head  15, sector 63
# /dev/rwd0d:
type: ST506
disk: mywd
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 16
sectors/cylinder: 1008
cylinders: 2100
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0 

6 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:    32256   614880    4.2BSD     1024  8192    16   # (Cyl.  610 - 641)
  b:    64512   647136      swap                        # (Cyl.  642 - 705)
  c:  1500912   614880    unused        0     0         # (Cyl.  610 - 2098)
  d:  2116800        0    unused        0     0         # (Cyl.    0 - 2099)
  e:  1404144   711648    4.2BSD     1024  8192    16   # (Cyl.  706 - 2098)
  f:   614817       63     MSDOS                        # (Cyl.    0*- 609*)



fdisk/disklabel info for SCSI system:
******* Working on device /dev/rsd0d *******
parameters extracted from in-core disklabel are:
cylinders=261 heads=255 sectors/track=63 (16065 sectors/cylinder)

parameters to be used for BIOS calculations are:
cylinders=261 heads=255 sectors/track=63 (16065 sectors/cylinder)

Warning: BIOS sector numbering starts with sector 1
Information from DOS bootblock is:
The data for partition 0 is:
sysid 6 (Primary 'big' DOS (> 32MB))
    start 63, size 417627 (203 MB), flag 0
        beg: cylinder    0, head   1, sector  1
        end: cylinder   25, head 254, sector 63
The data for partition 1 is:
sysid 164 (unknown)
    start 417690, size 610470 (298 MB), flag 0
        beg: cylinder   26, head   0, sector  1
        end: cylinder   63, head 254, sector 63
The data for partition 2 is:
sysid 165 (NetBSD or 386BSD)
    start 1028160, size 3164805 (1545 MB), flag 80
        beg: cylinder   64, head   0, sector  1
        end: cylinder  260, head 254, sector 63
The data for partition 3 is:
<UNUSED>
# /dev/rsd0d:
type: SCSI
disk: sd0s3
label: 
flags:
bytes/sector: 512
sectors/track: 63
tracks/cylinder: 255
sectors/cylinder: 16065
cylinders: 261
rpm: 3600
interleave: 1
trackskew: 0
cylinderskew: 0
headswitch: 0           # milliseconds
track-to-track seek: 0  # milliseconds
drivedata: 0 

8 partitions:
#        size   offset    fstype   [fsize bsize   cpg]
  a:    80325  1028160    4.2BSD        0     0     0   # (Cyl.   64 - 68)
  b:   160650  1108485      swap                        # (Cyl.   69 - 78)
  c:  3164805  1028160    unused        0     0         # (Cyl.   64 - 260)
  d:  4192965        0    unused        0     0         # (Cyl.    0 - 260)
  e:  2923830  1269135    4.2BSD        0     0     0   # (Cyl.   79 - 260)
  f:   417627       63     MSDOS                        # (Cyl.    0*- 25*)

-- 
Chuck Cranor, Graduate Student
Computer and Communications Research Center
Washington University, St. Louis MO  USA
E-Mail: chuck@maria.wustl.edu / cranor@udel.edu