*BSD News Article 30395


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!news.Hawaii.Edu!ames!elroy.jpl.nasa.gov!swrinde!ihnp4.ucsd.edu!usc!howland.reston.ans.net!spool.mu.edu!olivea!inews.intel.com!mwilley
From: mwilley@pcocd2.intel.com (Mark Willey - PCD)
Newsgroups: comp.os.386bsd.questions
Subject: answer: Getting *BSD to boot from wd1
Date: 6 May 1994 16:30:30 GMT
Organization: Intel Corporation
Lines: 242
Sender: mwilley@pcocd2 (Mark Willey - PCD)
Distribution: world
Message-ID: <2qdrb6$bto@inews.intel.com>
NNTP-Posting-Host: fiw206.fm.intel.com
Originator: mwilley@sedona


There's been a bunch of people asking about this lately again, so I thought
I'd post my solution to getting *BSD to boot from wd1.  This is what I did
for NetBSD 0.9.  YMMV.  Oh, does anybody know who the current FAQ maintaner
is?  I'll send him a copy so it can be included in the other FAQ entries on
the same topic, if he likes.

*****************************
* file: Net2wd1.doc Rev 1.0 *
*****************************

This document explains how to put NetBSD 0.9 on your wd1 drive.  This
allows you to put OS/2, or DOS, or whatever you want on your first
drive, and UNIX on your second drive, and select between the two via a boot
selector.

First things first -- this was written by Mark Willey.  The address
is willeyma@sage.cc.purdue.edu.  Use this information at your own
risk.  Free advice is worth a lot, but YMMV, of course.

Second thing -- ALWAYS ALWAYS ALWAYS ALWAYS ALWAYS make backup copies of
EVERYTHING EVERYTHING EVERYTHING EVERYTHING you change.  I'd suggest
putting the extension of .old on it and leaving it right beside the
modified file.  Sometimes, you may find yourslef in single-user mode, with
no editor partition mounted, and no cp command.  Your only hope is to do
"cat backup > save_my_computer".  You get the picture.  ;-)

I's suggest reading the FAQ.  That's what I read, and it got me though all
of this, with some difficulty.  Most of this is actually copied right from
the FAQ.  Good luck, and be a good netizen by helping someone else out in
turn.

Other hints - to select another kernel at bootup, when you see the first
message at boot:

>> WetBSD BOOT @ 0x%x: %d/%d k of memory  [%s]   (from printf in boot.c)
use options hd(1,...... to boot sd0 when wd0 is also installed

you can type in a new kernel, or device major, minor number, etc.  For
example, typing "onetbsd -s" will bring up single user on kernel onetbsd
(the standard backup name)

From the README.386BSD in the boot directory:
In answering the prompt from Boot2:
you can,
1/ leave it alone.. it will boot the indicated file from the first
partition of the first drive seen by the BIOS (C:)

2/ enter only "-s" to boot the default to single user mode

3/ enter only a filename (optionally with -s) to boot that kernel,

4/ enter a whole line of the form shown in the prompt. This allows you to
boot some other partition, possibly on the second drive, as root.

In the case you have two drives the same type (both scsi or bith IDE/ESDI),
wd(0,a)xxx
        will boot xxx from drive 0, a partition.
wd(1,a)xxx
        will boot xxx from drive 1, a partition.

similarly for sd.

The FAQ tells you how to make a bootable floppy.  Do this.  And, as the
slogan goes with free software....  "Use the Source, Luke..."  ;-)

also from that README...  (read it!)
Before you do this ensure you have a booting floppy with correct
disktab and bootblock files on it so that if it doesn't work, you can
re-disklabel from the floppy.

And one final thing, if you find yourself booted in single user, to make /
read-write, use the umount and mount commands, like it does in /etc/rc:

umount -a >/dev/null 2>&1
mount -a -t nonfs
rm -f /fastboot         # XXX (root now writeable

okay, here we go...
Requirements to start:

1) NetBSD 0.9 on a wd drive, configured as distributed, al la wd0.

2) A boot selector.

3) Another drive with YFOS installed.  (I know it works with OS/2 or DOS.)

4) A BOOT DISK FOR NetBSD!!!  (You hopefully won't need this, but it won't
      hurt!!!)

5) The 386BSD FAQ would be handy as well.

Sources for this stuff:
NetBSD 0.9
  sun-lamp.cs.berkeley.edu's closest MIRROR (don't clog sun-lamp)

Boot selector
  use OS/2's Boot Manager
  ftp OS-BS V2.0 Beta 8 at ftp.prz.tu-berlin.de:/pub/pc/os-bs
    ### also included in tar file at end of message, exec under DOS,OS/2 
  ftp booteasy ftp.tu-graz.ac.at:pub/386BSD/0.1/unofficial/booteasy

The FAQ
  ftp ftfm.mit.edu, and go up the appropriate path to get the FAQ for
    the comp.os.386bsd.questions newsgroup (also posted to said newsgroup)

Boot Disk
  the FAQ has good description for obtaining this

If you are using OS/2, you're in luck because it already comes
with a boot selector.  Other boot selectors that I know of that will do
this job are "booteasy" and "OS-BS".  I used OS-BS.  BTW, you need OS-BS
Ver 2.0, Beta8 or greater to be able to boot from the first drive to the
second drive.

Okay, step number one...  kernel configuration.  Basically, you need to
modify one the the kernel config files in /sys/arch/i386/conf to customize
your BSD kernel.  The main line that you will need to change is the one
that reads:

config          netbsd  root on wd0 swap on wd0

change to:

config          netbsd  root on wd1 swap on wd1

make sure you've got the wd1 controller defined, etc, like so:
controller      wdc0    at isa? port "IO_WD1" bio irq 14 vector wdintr
disk            wd0     at wdc0 drive 0
disk            wd1     at wdc0 drive 1

BTW, I used genericaha, or something like that as a base for my syste,
copied it to a new name (system name) and edited it from there...

Okay, now recompile the kernel.  Quick directions for this is:

  in the directory you modified the file from, type "config filename"
then do a "cd ../compile/filename"  then "make depend" then "make"
okay, now do a "cp /netbsd /onetbsd" and "cp netbsd /netbsd"
You better understand what this does before you do it, however!!!

Step 2 -- change your boot blocks.  in file /sys/arch/i386/boot/boot.c

loadstart:

        /***************************************************************\
        * As a default set it to the first partition of the first       *
        * floppy or hard drive                                          *
        \***************************************************************/
        part = unit = 0;
        maj = (drive&0x80 ? 0 : 2);             /* a good first bet */
        name = names[currname++];

Change to:

loadstart:

        /***************************************************************\
        * As a default set it to the first partition of the SECOND      *
        * floppy or hard drive                                          *
        \***************************************************************/
        part = 0;
        unit = (drive & 0x7F);          /* boot from wd0 or wd1 - mfw */
        maj = (drive&0x80 ? 0 : 2);             /* a good first bet   */
        name = names[currname++];

Now that you did this, you need to install these blocks on your drive.
to do this, look at the Makefile.  I kept making everything until it
worked.  ;-)  I think I did a "make all", and "make install", and "make
wd0".  Importnat -- edit the makefile for target wd0 to signify what kind
of drive you have.  I changed my pertinant line to:

        disklabel -r -w wd0 cp30254 newboot biosboot bootbios

I have a cp30254 hard drive.  I also needed to create the following
/etc/disktab entry:

cp30254|Connor Peripherals 250MB IDE:\
        :dt=ST506:ty=winchester:se#512:nt#10:ns#55:nc#895: \
        :pa#13750:oa#0:ta=4.2BSD:ba#4096:fa#512: \
        :pb#68750:ob#13750:tb=swap: \
        :pc#492250:oc#0: \
        :pe#409750:oe#82500:te=4.2BSD:be#4096:fe#512:

# FYI,
# a == root
# b == swap
# c == d == whole disk
# e == /var
# f == scratch
# h == /usr

Please do a "man disktab" for illumination.

If you don;t change this line, it may write a totally bogus label to your
disk, and you are hating life.  (floppy time!)

Okay, so if this all has been done, the next thing to do is change your
/etc/fstab entries so it knows where to mount your drives from.  (you might
want to reboot, using the onetbsd kernal, os make sure it works from wd0
still, first.

Change your /etc/fstab from this:  (or something like this)

/dev/wd0a / ufs rw 1 1
/dev/wd0b / swap sw 0 0
kernfs /kern kernfs rw 1 1
/dev/wd0e //usr ufs rw 1 2

to this:  (or something like this, as appropriate)

/dev/wd1a / ufs rw 1 1
/dev/wd1b / swap sw 0 0
kernfs /kern kernfs rw 1 1
/dev/wd1e //usr ufs rw 1 2

All right, now try putting your OS/2 or DOS disk as wd0, and set the
jumpers for your NetBSD drive for wd1, and try to boot DOS.  It works?
Good, now install your boot selector.  Look at their manuals for this step.
You may be ppresented with several NetBSD partitions to try.  Add them all,
and experimant to find out which one works.  I think it was the third one
on my system.  You can remove those entries from your menu at a later time,
if you wish.

Okay, I hope it works, and I know you hope it works, too.  If you do use
this advice, it's your own risk, of course.  I'd appriciate it of you would
let me know where this is unclear AT ALL, and how your results are.  I
especially would like it if someone would make additions to this to clarify
or add to this, and mail it back to me.  It'll help out other users, and
further Free Software.  (Yes, friends, we're on a mission...)

I have some files from my system available but don't include them on USENET
postings because they're just too darn big.  If you want them, send polite
email.  ;-)

Mark

-- 
------------------------------------------------------------------------
Mark Willey    Ask me about FREE UNIX+X11R5 for Intel PC.   916-356-5477
I speak for myself, not Intel.			mwilley@pcocd2.intel.com
------------------------------------------------------------------------