aboutsummaryrefslogtreecommitdiff
path: root/handbook/booting.sgml
blob: b395b40a2463434b2f8738c7ac4a792cf092b949 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
<!-- This is a SGML version of the text on FreeBSD boot procedures
     made by Poul-Henning Kamp <phk@FreeBSD.ORG>
     
     This conversion has been made by Ollivier Robert.

     $Id: booting.sgml,v 1.1 1995-04-28 19:48:56 jfieber Exp $
-->
<!DOCTYPE linuxdoc PUBLIC "-//Linux//DTD linuxdoc//EN">

  <article>

      <title>Boot overview</title>
      <author>Poul-Henning Kamp, <tt/&lt;phk@login.dknet.dk&gt;/</author>
      <date>v1.1, April 26th</date>
      <abstract>
        Booting FreeBSD is essentially a three step: Load the kernel,
        determine the root filesystem and initialize user-land things. This
        leads to some interesting possibilities as shown below...
      </abstract>

    <toc>

    <sect>Loading a kernel
      <p>
        We presently have three basic mechanisms for loading the kernel:
        <enum>
          <item>biosboot
          <item>dosboot
          <item>netboot
        </enum>
        Each will be described in detail below.  They all pass some
        information to the kernel to help the kernel decide what to do
        next.

      <sect1>Biosboot
        <p>
          Biosboot is our ``bootblocks'', it consists of two files, which
          will be installed in the first 8Kbytes of the floppy or hard-disk
          slice to be booted from.

          Biosboot can load a kernel from a FreeBSD filesystem.

      <sect1>Dosboot
        <p>
          Dosboot was written by DI. Christian Gusenbauer, and is
          unfortunately at this time one of the few pieces of code that
          isn't compilable under FreeBSD itself because it is written for
          MicroSoft compilers.

          Dosboot will boot the kernel from a MS-DOS file or from a FreeBSD
          filesystem partition on the disk.  It attempts to negotiate with
          the various and strange kinds of memory manglers that lurk in
          high memory on MS/DOS systems and usually wins them for it's
          case.

      <sect1>Netboot
        <p>
          Netboot will try to find a supported ethernet card, and use
          BOOTP, TFTP and NFS to find a kernel file to boot.

    <sect>Determine the root filesystem
      <p>
        Once the kernel is loaded and the boot-code jumps to it, the kernel
        will initialize itself, trying to determine what hardware is
        present and so on, and then it needs to find a root filesystem.

        Presently we support the following types of rootfilesystems:
        <itemize>
          <item>UFS
          <item>MSDOS
          <item>MFS
          <item>CD9660
          <item>NFS
        </itemize>

      <sect1>UFS
        <p>
          This is the most normal type of root filesystem. It can reside on
          a floppy or on harddisk.

      <sect1>MSDOS
        <p>
          While this is technically possible, it isn't particular useful,
          because of ``FAT'' filesystems inability to make links, device
          nodes and such ``UNIXisms''.

      <sect1>MFS
        <p>
          This is actually a UFS filesystem which has been compiled into
          the kernel.  That means that the kernel does not really need any
          disks/floppies or other HW to function.

      <sect1>CD9660
        <p>
          This is for using a CD-ROM as root filesystem.

      <sect1>NFS
        <p>
          This is for using a fileserver as root filesystem, basically
          making it a diskless machine.

    <sect>Initialize user-land things
      <p>
        To get the user-land going, when the kernel has finished
        initialization, it will create a with ``<tt/pid == 1/'' and execute
        a program on the rootfilesystem, this program is normally
        ``<tt>/sbin/init</tt>''.

        You can substitute any program for /sbin/init, as long as you keep
        in mind that:

        there is no stdin/out/err unless you open it yourself, if you exit,
        the machine panics signal handling is special for ``<tt/pid ==
        1/''.


    <sect>Interesting combinations
      <p>
        Boot a kernel with a MFS in it with a special <tt>/sbin/init</tt>
        which...
        <descrip>	
          <tag/A -- Using DOS/
            <itemize>
              <item>mounts your <tt/C:/ as <tt>/C:</tt>
              <item>Attaches <tt>C:/freebsd.fs</tt> on <tt>/dev/vn0</tt>
              <item>mounts <tt>/dev/vn0</tt> as <tt>/rootfs</tt>
              <item>makes symlinks<newline>
                <tt>/rootfs/bin -&gt; /bin</tt><newline>
                <tt>/rootfs/etc -&gt; /etc</tt><newline>
                <tt>/rootfs/sbin -&gt; /sbin</tt><newline>
                ...<newline>
            </itemize>
            
            Now you run FreeBSD without repartitioning your hard disk...

          <tag/B -- Using NFS/

            NFS mounts your <tt>server:&tilde;you/FreeBSD</tt> as
            <tt>/nfs</tt>, chroots to <tt>/nfs</tt> and executes
            <tt>/sbin/init</tt> there

            Now you run FreeBSD diskless, even though you don't control
            the NFS server...

          <tag/C -- Start an X-server/

            Now you have an Xterminal, which is better than that dingy
            X-under-windows-so-slow-you-can-see-what-it-does thing that
            your boss insist is better than forking our money on HW.

          <tag/D -- Using a tape/
            Takes a copy of <tt>/dev/rwd0</tt> and writes it to a remote tape
            station or fileserver.

            Now you finally got that backup you should have made a year
            ago...

          <tag>E -- Acts as a firewall/web-server/what do I know...</tag>

            This is particular interesting since you can boot from a write-
            protected floppy, but still write to your root filesystem...
        </descrip>
  </article>