Subject: problems making an IDE drive bootable....
To: NetBSD/i386 Discussion List <port-i386@NetBSD.ORG>
From: Greg A. Woods <woods@weird.com>
List: port-i386
Date: 03/28/2001 23:35:27
I've got this little old Pentium box that's acting as my home router and
firewall.  I've recently upgraded it to 1.5F (2000/09/21), and then one
day soon after that I made a mistake (which I've recently posted about:
I over-wrote the first part of the main disk because /dev/rwd0d is not
protected when securelevel >= 1) and I had to re-install.

Ever since then I've been unable to make the damn thing boot from the
IDE drive again.  It did boot just fine before the accident and now it
just locks up with the HD activity light coming on full for a second or
so (after the floppy boot fails) and then flickering so fast it looks as
though it's on at half-brightness.  (the machine is operational using
the boot loader from a floppy with "boot wd0a:netbsd" for now.)

Tonight it crashed again (as it's been doing occasionally -- I'll have a
new -current release ready to try on it very soon) and so I had a chance
to experiment with the boot issue again.

Here's what I did:

1. I trashed the MBR and rebuilt it with fdisk:

	dd if=/dev/zero of=/dev/rwd0d count=1
	fdisk -i wd0
	fdisk -i -u wd0
	fdisk -a wd0

   I have tried various different configs using either the first fdisk
   partition or the last; explicitly specifying the full disk or just
   enought to cover /boot, etc..  The current fdisk partition table is:

	# fdisk wd0
	NetBSD disklabel disk geometry:
	cylinders: 723 heads: 13 sectors/track: 51 (663 sectors/cylinder)
	
	BIOS disk geometry:
	cylinders: 722 heads: 13 sectors/track: 51 (663 sectors/cylinder)
	
	Partition table:
	0: sysid 169 (NetBSD)
	    start 0, size 50000 (24 MB), flag 0x80
	        beg: cylinder    0, head   0, sector  1
	        end: cylinder   75, head   5, sector 20
	1: <UNUSED>
	2: <UNUSED>
	3: <UNUSED>

2. I reloaded the secondary boot program (always after re-initializing
   the MBR):

	cd /usr/mdec
	./installboot -v ./biosboot.sym /dev/rwd0a

   In fact I've tried three slightly different biosboot.sym versions
   (all of my own construction, but at least one of them was used
   successfully in the original install which booted fine off the drive,
   and another has been used on several working boot floppies).  In fact
   I used the floppies I built last week (which can themselves
   successfully load the kernel off this machines drive) and tried and
   installboot from them too, but still with no success.

If I leave no fdisk partition active (or forget to make it active in the
first place), the machine says "Invalid partition table" and requires a
hard reset.  If I make the appropriate partition active then it does the
weird flicker on the HD activity light.

Have I missed something really obvious?  Have I been playing with Suns
again for long enough that I've forgotten how PCs boot?

Here's the disklabel:

	# disklabel -r wd0
	# /dev/rwd0d:
	type: unknown
	disk: test486
	label: 
	flags:
	bytes/sector: 512
	sectors/track: 51
	tracks/cylinder: 13
	sectors/cylinder: 663
	cylinders: 722
	total sectors: 479349
	rpm: 3600
	interleave: 1
	trackskew: 0
	cylinderskew: 0
	headswitch: 0           # microseconds
	track-to-track seek: 0  # microseconds
	drivedata: 0 
	
	8 partitions:
	#        size   offset     fstype   [fsize bsize   cpg]
	  a:   419240       51     4.2BSD     1024  8192    16   # (Cyl.    0*- 632*)
	  b:    60058   419291       swap                        # (Cyl.  632*- 722)
	  c:   479298       51     unused        0     0         # (Cyl.    0*- 722)
	  d:   479349        0     unused        0     0         # (Cyl.    0 - 722)

One little thing does confuse me.  Fdisk insists that the disklabel disk
geometry has 723 heads even though the actual label clearly does not say
that.  Fdisk seems to be lying and is actually talking about the kernel
probe geometry and not the disklabel values.

Here's the dmesg output FYI:

# dmesg
NetBSD 1.5F (FWALL) #2: Mon Mar 12 03:58:47 EST 2001
    woods@proven:/work/woods/NetBSD-src/sys/arch/i386/compile/FWALL
cpu0: Intel Pentium (P54C) (586-class)
cpu0: features 1bf<FPU,VME,DE,PSE,TSC,MSR,MCE,CX8>
cpu0: features 1bf
total memory = 16000 KB
avail memory = 12208 KB
using 225 buffers containing 900 KB of memory
BIOS32 rev. 0 found at 0xfb370
PCI BIOS rev. 2.1 found at 0xfb3a0
pcibios: config mechanism [1][x], special cycles [1][x], last bus 0
PCI BIOS has 6 Interrupt Routing table entries
mainbus0 (root)
pnpbios0 at mainbus0: nodes 13, max len 164
pci0 at mainbus0 bus 0: configuration mode 1
pci0: i/o space, memory space enabled
pchb0 at pci0 dev 0 function 0
pchb0: Intel 82437VX System Controller (TVX) (rev. 0x02)
pcib0 at pci0 dev 7 function 0
pcib0: Intel 82371SB PCI-to-ISA Bridge (PIIX3) (rev. 0x01)
pciide0 at pci0 dev 7 function 1: Intel 82371SB IDE Interface (PIIX3) (rev. 0x00)
pciide0: bus-master DMA support present
pciide0: primary channel wired to compatibility mode
wd0 at pciide0 channel 0 drive 0: <QUANTUM LP240A GM240A01X>
wd0: drive supports 8-sector pio transfers, chs addressing
wd0: 234 MB, 723 cyl, 13 head, 51 sec, 512 bytes/sect x 479349 sectors
wd0: 32-bit data port
pciide0: primary channel interrupting at irq 14
wd0(pciide0:0:0): using PIO mode 0
pciide0: secondary channel wired to compatibility mode
wd1 at pciide0 channel 1 drive 0: <QUANTUM ELS127A>
wd1: drive supports 8-sector pio transfers, chs addressing
wd1: 122 MB, 919 cyl, 16 head, 17 sec, 512 bytes/sect x 249968 sectors
wd1: 32-bit data port
pciide0: secondary channel interrupting at irq 15
wd1(pciide0:1:0): using PIO mode 0
Intel 82371SB USB Host Controller (PIIX3) (USB serial bus, revision 0x01) at pci0 dev 7 function 2 not configured
rtk0 at pci0 dev 9 function 0: RealTek 8139 10/100BaseTX
rtk0: interrupting at irq 9
rtk0: Ethernet address 00:48:54:1e:10:e6
ukphy0 at rtk0 phy 7: Generic IEEE 802.3u media interface
ukphy0: OUI 0x000000, model 0x0000, rev. 0
ukphy0: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
rtk1 at pci0 dev 10 function 0: RealTek 8139 10/100BaseTX
rtk1: interrupting at irq 12
rtk1: Ethernet address 00:50:bf:16:94:30
ukphy1 at rtk1 phy 7: Generic IEEE 802.3u media interface
ukphy1: OUI 0x000000, model 0x0000, rev. 0
ukphy1: 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, auto
isa0 at pcib0
com0 at isa0 port 0x3f8-0x3ff irq 4: ns16550a, working fifo
com1 at isa0 port 0x2f8-0x2ff irq 3: ns16550a, working fifo
pckbc0 at isa0 port 0x60-0x64
pckbd0 at pckbc0 (kbd slot)
pckbc0: using irq 1 for kbd slot
wskbd0 at pckbd0: console keyboard
vga0 at isa0 port 0x3b0-0x3df iomem 0xa0000-0xbffff
wsdisplay0 at vga0: console (80x25, vt100 emulation), using wskbd0
lpt0 at isa0 port 0x378-0x37b irq 7
iy0 at isa0 port 0x360-0x36f irq 10: address 00:aa:00:cf:42:7c, rev. 1, 32 kB
pcppi0 at isa0 port 0x61
sysbeep0 at pcppi0
isapnp0 at isa0 port 0x279: ISA Plug 'n Play device support
npx0 at isa0 port 0xf0-0xff: using exception 16
fdc0 at isa0 port 0x3f0-0x3f7 irq 6 drq 2
fd0 at fdc0 drive 0: 1.44MB, 80 cyl, 2 head, 18 sec
isapnp0: no ISA Plug 'n Play devices found
biomask e965 netmask ff65 ttymask ffe7
boot device: wd0
root on wd0a dumps on wd0b
IP Filter: v3.4.9 initialized.  Default = pass all, Logging = enabled
wsdisplay0: screen 1 added (80x50, vt100 emulation)
wsdisplay0: screen 2 added (80x50, vt100 emulation)
wsdisplay0: screen 3 added (80x50, vt100 emulation)
wsdisplay0: screen 4 added (80x50, vt100 emulation)
wsdisplay0: screen 5 added (80x50, vt100 emulation)
wsdisplay0: screen 6 added (80x50, vt100 emulation)
wsdisplay0: screen 7 added (80x50, vt100 emulation)
wsmux1: connecting to wsdisplay0

-- 
							Greg A. Woods

+1 416 218-0098      VE3TCP      <gwoods@acm.org>      <robohack!woods>
Planix, Inc. <woods@planix.com>; Secrets of the Weird <woods@weird.com>