Jun 201999

Installing 3.2-release [the hard way]

This article details how I installed 3.2-release on a box which initially refused to take any 3.* versions but was quite happy on 2.2.8.

The background

I was given an old DEC box which had an onboard NCR PCI SCSI bus.  I could install 2.2.8 on the box but not 3.* and not even current would install.  The problem was that the system wasn’t scanning for the PCI bus.

For the technical minded, here’s something which might mean something to you:

$ dmesg
Copyright (c) 1992-1998 FreeBSD Inc.
Copyright (c) 1982, 1986, 1989, 1991, 1993
   The Regents of the University of California.  All rights reserved.

FreeBSD 2.2.8-RELEASE #0: Mon Nov 30 06:34:08 GMT 1998
CPU: i486DX (486-class CPU)
real memory  = 33554432 (32768K bytes)
avail memory = 30334976 (29624K bytes)
Probing for devices on PCI bus 0:
chip0 <intel 82424ZX (Saturn) cache DRAM controller> rev 2 on pci0:0:0
ncr0 <ncr 53c810 fast10 scsi> rev 1 int a irq 11 on pci0:1:0
ncr0 waiting for scsi devices to settle
(ncr0:0:0): "DEC RZ25M    (C) DEC 0680" type 0 fixed SCSI 2
sd0(ncr0:0:0): Direct-Access 
sd0(ncr0:0:0): 10.0 MB/s (100 ns, offset 8)
510MB (1046206 512 byte sectors)
(ncr0:1:0): "SEAGATE ST5660N 0592" type 0 fixed SCSI 2
sd1(ncr0:1:0): Direct-Access 
sd1(ncr0:1:0): 10.0 MB/s (100 ns, offset 8)
520MB (1065664 512 byte sectors)
(ncr0:6:0): "NEC CD-ROM DRIVE:841 1.0" type 5 removable SCSI 2

You can clearly see that the ncr SCSI device is found and works fine.  However, we had no such luck with 3.*.

The patch

One of the FreeBSD developers took up my problem and sent me a patch.    Here’s the patch:
Index: pcibus.c
RCS file: /usr/cvs/src/sys/i386/isa/pcibus.c,v
retrieving revision 1.41
diff -C2 -r1.41 pcibus.c
*** pcibus.c    1997/12/20 09:04:25     1.41
--- pcibus.c    1999/06/07 11:58:58
*** 260,265 ****

!       cfgmech = 0;
!       devmax = 0;
        return (cfgmech);
--- 260,265 ----

!       cfgmech = 2;
!       devmax = 16;
        return (cfgmech);

The kernel

I used this patch to modify /usr/src/sys/i386/isa/pcibus.c.  Then I created a custom kernel.  For more information on creating a custom kernel, refer to the Configuring the FreeBSD Kernel section in the FreeBSD handbook.   Pay special attention to the section on Building and Installing a Custom Kernel.  In short, I did the following:
# cd /usr/src/sys/i386/conf
# config NCR
# cd ../../compile/NCR
# make depend
# make

But wait?  How did I create that kernel in the first place?  I didn’t have 3.2-Release installed, so how could I create a 3.2-Release kernel?  This is a classic chicken-and-egg situation.  The answer is easy: I asked someone who has 3.2-Release to create the kernel for me.

So.  Now I have a patched 3.2-Release kernel.  But what use was it?

Details of the boot floppies

If you look at the boot floppies for 3.2-RELEASE, you’ll see the following on the first floppy:
# mount /dev/fd0 /mnt
# cd /mnt
# ls
boot              boot.config     kernel.config   kernel.gz

That kernel.gz file is just a plan old kernel which has been gzip’d.  There’s nothing special about.  It’s just a GENERIC kernel which anyone can create.  For that matter, you could replace that file with your own kernel and it would still work as a boot floppy.  So I just replaced that kernel with my own.  You might also be interested in compiling a kernel on another machine.

If you are doing the above, you may wish to add the following option into your kernel:

options         INTRO_USERCONFIG      #imply -c and show intro screen

This option forces the visual configuration screen.  This can be useful but it not recommended for the final kernel.

NOTE: during my install, when I tried to mount the floppy, I encountered the following error:
# mount /dev/fd0 /mnt
mount: Operation not permitted

OUCH!  For details on how I solved that problem see Filesystem is not clean – run fsck

Replacing the kernel

Here’s how I replaced the boot floppy kernel with my own.  Remember I created a new kernel above.
# cd /usr/src/sys/compile/NCR
# gzip kernel >> kernel.gz
# mount /dev/fd0 /mnt
# cp kernel.gz /mnt
# umount /mnt

Installing 3.2

Well, this was actually the easy part.  I’ve got this down to a routine now.   I followed the same strategy as I did for Installing FreeBSD to replace Windows 95.  That’s pretty straight forward.  I was actually installing from a local FTP server which contained only the bin directory for 3.2-RELEASE.

The important difference is that before I rebooted, I used the "emergency holographic shell" that’s created on vty4 to replace the default 3.2-Release kernel with my own custom 3.2-release kernel.  Here’s how I did that.

REMEMBER to take out the second floppy and put in the first floppy before doing this.   The first floppy contains kernel.gz.  If you don’t, all you’ll find is mfsroot.gz, which is of no use to you for this exercise.

# cd /
# chflags noschg kernel
# cp kernel kernel.orginal.3.2-RELEASE
# mount /dev/fd0 /mnt
# cp /mnt/kernel.gz .
# umount /mnt
# gunzip kernel.gz
# chflags schg kernel

Then I went back to the install and did an exit.  The system then shutdown and rebooted.  And I had 3.2-Release installed!


But there were problems

During the shutdown, I briefly saw a message which said something about "vinvalbuf" or something similar to that.  When the system booted up, I saw messages about / not being shut down properly.  I’ve sent a message off to the -questions mailing list and I’ll add a post script if I learn anything more.