*BSD News Article 68200


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.mira.net.au!inquo!in-news.erinet.com!imci5!imci4!newsfeed.internetmci.com!solaris.cc.vt.edu!usenet
From: mmead@neon.Glock.COM (matthew c. mead)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: Can boot manager be added after *BSD installed?
Date: 10 May 1996 13:58:59 GMT
Organization: Glock Telecommunications
Lines: 129
Message-ID: <MMEAD.96May10095859@neon.Glock.COM>
References: <4mu73c$j6n@mark.ucdavis.edu>
NNTP-Posting-Host: neon.glock.com
In-reply-to: white's message of 10 May 1996 01:45:16 GMT
Cc: white <mdwhite@ucdavis.edu>

In article <4mu73c$j6n@mark.ucdavis.edu> white <mdwhite@ucdavis.edu> writes:


> Hi, I have done a network install of freeBSD 2.1 on my system
> but screwed up the boot manager portion (i.e. all the files
> are there, but I can't boot freeBSD).  Do I have to do a
> re-install or is it possible to just to the boot manager part.
> Sorry if this is a stupid question, but I can't seem to 
> find the information about this stuff again.

> Oh, I have a fairly unusual configuration.  I have a small
> (250M) drive as my C: drive (or drive 0 if you perfer) with
> DOS/WIN and a 1G drive with FreeBSD as the D: drive (the
> C: is of course the master and bootable, whereas D: is 
> jumpered as slave).  I thought I remembered reading that
> the Boot Manager would allow this configuration, but cannot
> find it again.  Any help would be appreciated.

> P.S. If the advice is to look in the FAQ or read the FreeBSD
> handbook, could you refer to the particular section that is
> supposed to contain the material?  Thanks again.

	Yes, the boot manager will help you in this situation.  A couple of
questions.  Do you have FreeBSD installed *only* on your second disk, or is
there a root partition on the first disk?  I'm assuming the former.
					   ^^^^^^^^^^^^^^^^^^^^^^^^

	First, put this code (you might want to rename it to fit the 8.3
filename limitation of dos) on a dos disk so that you can access it once
in FreeBSD:

----- write_bteasy.c -----
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <dialog.h>
#include <sys/types.h>
#include <sys/wait.h>
#include "libdisk.h"

u_char bteasy17[] = {
    51,192,142,192,142,216,142,208,188,0,124,252,139,244,191,0,6,185,0,1,242,
    165,234,96,6,0,0,139,213,88,162,72,7,60,53,116,28,180,16,246,228,5,174,
    4,150,246,68,4,255,116,62,198,4,128,232,218,0,138,116,1,139,76,2,235,8,
    232,207,0,185,1,0,50,209,187,0,124,184,1,2,205,19,114,30,129,191,254,1,
    85,170,117,22,234,0,124,0,0,128,250,129,116,2,178,128,139,234,66,128,242,
    179,136,22,58,7,191,190,7,185,4,0,198,6,45,7,49,50,246,136,45,138,69,4,
    60,0,116,35,60,5,116,31,254,198,190,42,7,232,113,0,190,72,7,70,70,139,28,
    10,255,116,5,50,125,4,117,243,141,183,114,7,232,90,0,131,199,16,254,6,45,
    7,226,203,128,62,117,4,2,116,11,190,59,7,10,246,117,10,205,24,235,172,190,
    42,7,232,57,0,232,54,0,50,228,205,26,139,218,131,195,96,180,1,205,22,180,
    0,117,11,205,26,59,211,114,242,160,72,7,235,10,205,22,138,196,60,28,116,
    243,4,246,60,49,114,214,60,53,119,210,80,190,40,7,187,27,6,83,252,172,80,
    36,127,180,14,205,16,88,168,128,116,242,195,86,184,1,3,187,0,6,185,1,0,
    50,246,205,19,94,198,6,72,7,63,195,13,138,13,10,70,48,32,46,32,46,32,46,
    160,100,105,115,107,32,49,13,10,10,68,101,102,97,117,108,116,58,32,70,63,
    160,0,1,0,4,0,6,3,7,7,10,10,99,14,100,14,101,20,128,20,129,25,130,30,147,
    36,165,39,159,43,117,47,82,47,219,50,64,55,242,61,0,100,111,243,72,80,70,
    211,79,115,178,85,110,105,248,78,111,118,101,108,236,77,105,110,105,248,
    76,105,110,117,248,65,109,111,101,98,225,66,83,196,66,83,68,233,80,67,73,
    216,67,80,205,86,101,110,105,248,68,111,115,115,101,227,63,191,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
    0,85,170
};

void main(int argc, char **argv) {
    struct disk	*hd;

    if (argc != 2) {
	fprintf(stderr, "usage: %s device_name\n\n", argv[0]);
	fprintf(stderr, "where device_name is the entry corresponding\n");
	fprintf(stderr, "to the disk you want to put the bootmanager on.\n");
	exit(1);
    }

    hd = Open_Disk(argv[1]);
    Set_Boot_Mgr(hd, bteasy17);
    Write_Disk(hd);
}
----- write_bteasy.c -----

	Take your install boot floppy, and get it to the boot prompt by
booting from it, at that prompt, type wd(1,a)/kernel.  This should boot you
into FreeBSD.  Next, you're going to need the srelease.* src distribution.
If you don't have that installed in /usr/src/release, get it and install it
there.  You will probably also need ssbin.* to be installed in /usr/src.
Go into /usr/src/release/libdisk, and do a make to create the libdisk.a
library.  If this fails on dkcksum, copy /usr/src/sbin/disklabel/dkcksum.c
into /usr/src/release/libdisk, and try running make again.  At this point
you should have a working libdisk.

	Next, you need to build the write_bteasy.c source into a program.
I use something like this:

cc -I/usr/src/release/libdisk -L/usr/src/release/libdisk -o write_bteasy write_bteasy.c -ldisk

	Assuming this compilation works properly, go ahead and execute
these commands:

./write_bteasy wd0
./write_bteasy wd1

	This will install the bteasy 1.7 boot manager on the master boot
records of both your small DOS master drive, and your FreeBSD slave drive.
When you boot the machine, it will give you a choice of DOS, or second
disk, to get to FreeBSD you hit second disk, and then select BSD from the
menu that the boot manager on your slave disk presents.  To boot DOS, you
pick DOS.

	Now, after all this explanation, if your small first disk has a
bootable FreeBSD root partition on it, you will only need to
./write_bteasy wd0, and then select between DOS and FreeBSD.  Also note
that you will need to boot into FreeBSD a little differently - at the
floppy's boot prompt, you'll use wd(0,a)/kernel, instead of what I
suggested above.

	Hope this helps!



-matt

-- 
Matthew C. Mead

mmead@Glock.COM
http://www.Glock.COM/~mmead/