Add the DragonFly cvs id and perform general cleanups on cvs/rcs/sccs ids. Most
[dragonfly.git] / release / picobsd / doc / src / how2build.html
1 <html>
2 <! $FreeBSD: src/release/picobsd/doc/src/how2build.html,v 1.7.2.1 2000/11/07 23:36:45 joe Exp $ >
3 <! $DragonFly: src/release/picobsd/doc/src/Attic/how2build.html,v 1.2 2003/06/17 04:27:20 dillon Exp $ >
4 <head>
5 <title>PicoBSD Development Kit</title>
6 </head>
7 <body>
8 <h1><center>            How to build your own version
9                                 of PicoBSD?
10 </center></h1>
11
12 <ol>
13 <li>
14 <p>     Beginning with version 0.4, PicoBSD sources are maintained as
15         part of official FreeBSD CVS repository, so 
16         you can find them in src/release/picobsd.</p>
17 </li>
18 <li>
19         Become root. You'll need to mount and unmount various volumes.
20 </li>
21 <li>
22         Make sure you are running kernel with support for vn(4) devices.
23         If you run plain GENERIC (just as it was installed on your system),
24         you'll need to recompile you kernel and reinstall it. See the
25         appropriate entries in The Handbook (/usr/share/doc/handbook).
26 </li>
27 <li>    Change working directory (<code>cd build</code>) and run the
28         <code>./build</code> script. Select target language, size of MFS and
29         one of pre-canned setups (personal dialup, dialin server or
30         router-like). Details of each setup are contained in dial/,
31         router/, isp/ and net/ directories respectively. You should at least
32         check <code>${TYPE}/config/PICOBSD</code> file to make sure it contains
33         the drivers you want.
34
35 <p>     You can also choose a special type called 'custom'. You'll need to
36         supply the full path to your own custom config tree constructed
37         exactly like one of the standard config directories. Also, you'll
38         probably want to adjust the number of inodes on MFS - see the
39         <code>stage1</code> script and look for <code>INODES=</code>.</p>
40
41 <p>     I also recommend to adjust the ISA devices parameters to
42         match the ones of your hardware - though PicoBSD can save the
43         changes from UserConfig, this way it will produce smaller
44         <code>/kernel.config</code> file.</p>
45 </li>
46 <li>    I assume you will use 1.44MB floppy. If not, please edit the file
47         <code>build/stage3</code>.
48 </li>
49 <li>    There are several directories which contain some sources and config
50         files:
51 <pre>
52         build/                  main build directory; you MUST cd here!
53         dial/                   config files for dialup setup
54                 conf/           kernel config file
55                 crunch1/        crunch of system programs
56                 mfs.tree/       contains the MFS configuration
57                 lang/           contains language-dependent files
58                 floppy.tree/    contains the startup floppy hierarchy
59
60         isp/                    config files for dialin server setup
61                 ...             (as above)
62         net/                    config files for router-like setup
63                 ...             (as above)
64         tinyware/               collection of small system utilities
65         tools/                  additional tools them needed during build
66 </pre>
67 <p>     There are no <code>/etc/passwd</code> nor <code>/etc/pwd.db</code>
68         files on the "dial" floppy - in case of other types, they are
69         reconstructed from <code>/etc/master.passwd</code> on each startup
70         (and then put on MFS with the rest of <code>/etc</code>).
71         In case of "dial" type floppy, you don't need them at all.</p>
72
73 <p>     NOTE: thanks to the above, the floppy is needed only during startup,
74         and then only if you want to synchronize (possibly changed) MFS /etc
75         with the one on the floppy. It means that you can pull off the floppy
76         from the drive as soon as <code>login:</code> prompt appears. 
77         In other words, it is almost equal to read-only floppy.</p>
78 </li>
79 <li>    Edit the set of installed programs.
80 <ul>
81 <li>            Go to <code>${TYPE}/crunch1</code> directory, and edit it
82                 to suit your needs. Keep in mind that floppies aren't made
83                 of rubber... :-)
84 </li>
85 <li>            There are some patches included in these directories, which
86                 are applied during build process to some of the Makefiles in
87                 your <code>/usr/src</code>. These patches attempt to decrease
88                 the size of some programs by cutting off rarely/unlikely used
89                 parts. The patches are reversed when you do a
90                 <code>make clean</code> (or <code>build/clean</code>
91                 for that matter).
92 <p>             NOTE: patches may fail to apply, if your sources are too
93                 different from the ones I used. Don't worry: they are so
94                 straightforward that you can apply them by hand.</p>
95 </li>
96 <li>            In order to have a functioning system you MUST include at
97                 least <code>/stand/init</code>, or <code>/stand/oinit</code>,
98                  or <code>/stand/sysinstall</code> in
99                 your <code>crunch.conf</code>. Of course these can be your
100                 own programs... But if you install the stock
101                 <code>/sbin/init</code>, you
102                 also have to install some others, like sh, getty, login etc...
103 <p>             This release of PicoBSD contains a small replacement for
104                 init(8), called 'oinit'. You can find it in TinyWare
105                 collection. The main building script allows you to use it
106                 instead of normal init(8). <b>Be sure to read the oinit's docs
107                 before you decide to use it!</b></p>
108 </li>
109 </ul>
110 </li>
111 <li>    Make sure that the system you're running has /dev/[r]vn0* entries in
112         /dev directory (if not, you can make them with 'MAKEDEV vn0'), AND
113         that your running kernel has built-in vnode driver (there should be a
114         line in your kernel config file stating 'pseudo-device vn xxx').
115 </li>
116 <li>    You'll need at least 9MB of free disk space, and free /mnt directory.
117 </li>
118 <li>    Do a <code>cd build/</code> and fire off the <code>./build</code>
119         script. Select the build parameters or 'n' for 'no change'. If all
120         is well, after some time (like 10-30m) you end up with a
121         'picobsd.bin' file in this directory.
122
123 <p>     WARNING: make sure you don't have stale <code>.depend</code> files
124         around!!! You may encounter many strange errors during build process
125         in that case.</p>
126
127 <p>     If there were any errors, please execute each script by hand and try
128         to find what causes this error. Most often this will be one of the
129         following reasons:</p>
130 <ul>
131 <li>            <code>crunchgen</code> can't find the source directory for a
132                 program 'proggy':
133 <ul>
134 <li>            make sure that the source directory for 'proggy' is called
135                   'proggy', otherwise the crunchgen won't find it
136 </li>
137 <li>            make sure that the Makefile allows crunchgen to deduce the
138                   set of objects to build. You can manually add an OBJS= ...
139                   to the program's Makefile.
140 </li>
141 </ul>
142 </li>
143 <li>            crunch fails to build.
144 <ul>
145 <li>            check your system source tree for stale .depend files and/or
146                   objects (*.o)
147 </li>
148 <li>            see if the individual programs can be built using original
149                   Makefiles. If not, cvsup the correct sources.
150 </li>
151 </ul>
152 </li>
153 <li>            /: write failed - file system is full
154 <ul>
155 <li>            this one is obvious - you wanted to put too many programs on
156                 the MFS and/or the target floppy. Or, you really don't have
157                 any space left on the root partition.. :-)
158 </li>
159 <li>            also, you can check if the
160                 MFS size is correctly reported while it's still mounted (right
161                 after <code>stage1</code> script ends).
162 </li>
163 </ul>
164 <li>            the build process displays "Preparing MFS" and then
165                 silently stops. In this case check if you're running it as
166                 root, and that you run kernel with support for vn(4)
167                 devices. Also, you can add 'set -x' at hte beginning
168                 of the scripts to see exactly where they stop.
169 </li>
170 </ul>
171
172         You can also remove <code>2>&amp;1</code> redirections from Makefiles
173         to see the stderr.
174 </li>
175 <li>    Transfer this file to the floppy:
176 <pre>
177                 dd if=picobsd.bin of=/dev/rfd0
178 </pre>
179
180         (The 'build' script asks you if you want to do this.)
181 </li>
182 </ol>
183
184 <p>That's all. You're welcome to change and improve these scripts. If you
185  stumble upon something which looks like a good idea to have it here, let me
186  know.</p>
187
188 <p>If, for some reason, the scripts don't work for you at all, also let me
189  know.</p>
190
191 <hr>
192 <i>Last modified:
193 @DATE@
194
195 <p><A HREF="mailto:abial@freebsd.org">&lt;abial@freebsd.org&gt;</a></i></p>
196 </body>
197 </html>