This commit was manufactured by cvs2svn to create tag 'FreeBSD-release/1.0'.
[unix-history] / sys / i386 / boot / README.386BSD
CommitLineData
15637ed4
RG
1This Boot code is different from the original boot code that came with
2386BSD in that it uses the BIOS to load the kernel and to provide all i/o
3services. The advantage ofthis is that the same boot code exactly, can run
4on any device that is supported by the BIOS. (That's most of them)
5This is important for the 'generic scsi' project because it means we can
6write drivers for new scsi adapters without having to develop an new
7set of boot blocks for each.
8
9At this point you should read the first part of README.MACH... come back here
10when you have done that:
11
12In normal operation, when co-existing with other operating systems, the
13following operations occur:
14
151/ the BIOS loads the first block of the disk (called the Master Boot Record
16or MBR) and if it has the correct magic numbers, jumps into it:
17
182/ The MBR code, looks at the Partition table that is embedded within it,
19to detirmine which is the partition to boot from. If you are using the os-bs
20bootblocks (highly recommended) then it will give you a menu to choose from.
21
223/ The MBR will load the first record of the selected partition and
23if it has (the same) magic numbers, jumps into it. In 386bsd this is the
24first stage boot, (or boot1) it is represented in /usr/mdec by
25wdboot, asboot and sdboot. If the disk has been set up without DOS partitioning
26then this block will be at block zero, and will have been loaded directly by
27the BIOS.
28
294/ Boot1 will look at block0 (which might be itself if there are no DOS
30partitions) and will find the 386bsd partition, and using the information
31regarding the start position of that partition, will load the next 13 sectors
32or so, to around 90000 (640k - 64k). and will jump into it at the appropriate
33entry point. Since boot1 and boot2 were compiled together as one file
34and then split later, boot1 knows the exact position within boot2 of the
35entry point.
36
37Boot 1 also contains a compiled in DOS partition table
38(in case it is at block 0), which contains a 386bsd partition starting
39at 0. This ensures that the same code can work whether or not
40boot1 is at block 0.
41
425/ Boot2 asks the user for a boot device, partition and filename, and then
43loads the MBR of the selected device. This may or may not be the device
44which was originally used to boot the first MBR. The partition table
45of the new MBR is searched for a 386bsd partition, and if one is found,
46that is then in turn searched for the disklabel. This could all be on the
47second disk at this point, if the user selected it.
48
496/On finding the disklabel, boot2 can find the correct unix partition
50within the 386bsd partition, and using cutdown filesystem code,
51look for the file to boot (e.g. 386bsd).
52
537/ Boot2 loads this file starting at the location specified by the a.out header,
54(see later) and leaps into it at the location specified in he header.
55
56if the file does not exist or cannot be loaded, boot2 goes back to step 5.
57
58386bsd is now running and will hopefully start vm etc. and get to multi-user
59mode.
60
61##########################################################################
62During all these steps, all i/o is performed using the BIOS. This has a number
63of side effects:
64
651/ Since BIOS disk calls are specified in terms of cylinder,head and sector,
66and the BIOS read the disk information from either the CMOS or from some other
67location which is un-available to us, we must use the cyl,head,sec information
68that is given in the MBR, rather than the start address in the MBR, because
69we cannot guarentee that we can corectly calculate C,H,S from the start address.
70
71Therefore, the C,H,S information in the MBR must be as correct for this boot
72to work as it would be for DOS to boot. For example, adaptec BIOS routines
73assume a layout of 64 heads and 32 sectors giving 1MB per ficticious cylinder.
74You must use these figures to calculate the correct values. Luckily, the DOS
75fdisk program will do all this for you if you tell it to give you a DOS
76partition, and you can change it to a 386BSD partition later. If you use
77no DOS partitioning, then the compiled in table in Boot1 will do just fine.
78
79If you want to do it by hand remember that BIOS counts sectors starting at 1.
80(cylinders and heads start at 0 (??))
81
822/ you cannot overwrite the bottom 4k of ram until you have finished ALL
83bios calls, as BIOS uses this area as scratch memory.
84
853/ Since BIOS runs in REAL mode, and Boot2 runs in protected mode,
86Boot 2 switches back to real mode just before each BIOS call and then
87back to protected mode on each return. Touch this at your peril.!
88
89#########################################################################
90In answering the prompt from Boot2:
91you can,
921/ leave it alone.. it will boot the indicated file from the first
93partition of the first drive seen by the BIOS (C:)
94
952/ enter only "-s" to boot the default to single user mode
96
973/ enter only a filename (optionally with -s) to boot that kernel,
98
994/ enter a whole line of the form shown in the prompt. This allows you to
100boot some other partition, possibly on the second drive, as root.
101
102
103##########################################################################
104In the case you have two drives the same type (both scsi or bith IDE/ESDI),
105wd(0,a)xxx
106 will boot xxx from drive 0, a partition.
107wd(1,a)xxx
108 will boot xxx from drive 1, a partition.
109
110similarly for sd.
111
112if you have one wd drive and one scsi drive, then you MUST
113use device 'hd'
114
115otherwise the following will happen:
116
117with wd0 and sd0, you specify sd1 or wd1 to indicate the 2nd drive.
118it boots the kernel correctly, then tells the kernel to use sd1 as root.
119you however may not have an sd1, and problems arise.
120
121hd is special in that the kernel is always told to use unit 0,
122The correct TYPE of device will be specified too, so the kernel
123will be told either sd0 or wd0.
124
125Whether sd or wd is specified to the kernel is read from the disklabel,
126so ensure that all SCSI disks have type SCSI in their disklabel or the
127boot code will assume they are ESDI or IDE. (Remember, because it is
128working through the BIOS it has ho idea what kind of disk it is.
129
130##########################################################################
131Installing:
132The makefile supplied has a target install which will create the
133files wdboot,bootwd ,sdboot and bootsd in /usr/mdec.
134BEWARE these will overwrite the existing wdboot and bootwd. (so back
135them up)
136
137there are also targets wd and sd which wil only do one of them
138
139The commented out targets wd0 and sd0 are examples of how to
140load the new bootblocks, however,make sure you change the
141device type and label to suit your drive if you uncomment them.
142(see 'man disklabel')
143
144If you already have made partitions using the old bootblocks
145these should install painlessly.
146
147Before you do this ensure you have a booting floppy with correct
148disktab and bootblock files on it so that if it doesn't work, you can
149re-disklabel from the floppy.
78ed81a3 150
151$Id$