freebsd-nq/release/picobsd/doc/src/how2build.html
Ben Smithurst 37cc56f575 Remove <center> tags from with <title> section.
PR:		20002
Submitted by:	James Johnson <bonk1138@msn.com>
Approved by:	patrick (from freebsd-small mailing list)
2000-07-18 15:20:55 +00:00

197 lines
7.2 KiB
HTML

<html>
<! $FreeBSD$ >
<head>
<title>PicoBSD Development Kit</title>
</head>
<body>
<h1><center> How to build your own version
of PicoBSD?
</center></h1>
<ol>
<li>
<p> Beginning with version 0.4, PicoBSD sources are maintained as
part of official FreeBSD CVS repository, so
you can find them in src/release/picobsd.</p>
</li>
<li>
Become root. You'll need to mount and unmount various volumes.
</li>
<li>
Make sure you are running kernel with support for vn(4) devices.
If you run plain GENERIC (just as it was installed on your system),
you'll need to recompile you kernel and reinstall it. See the
appropriate entries in The Handbook (/usr/share/doc/handbook).
</li>
<li> Change working directory (<code>cd build</code>) and run the
<code>./build</code> script. Select target language, size of MFS and
one of pre-canned setups (personal dialup, dialin server or
router-like). Details of each setup are contained in dial/,
router/, isp/ and net/ directories respectively. You should at least
check <code>${TYPE}/config/PICOBSD</code> file to make sure it contains
the drivers you want.
<p> You can also choose a special type called 'custom'. You'll need to
supply the full path to your own custom config tree constructed
exactly like one of the standard config directories. Also, you'll
probably want to adjust the number of inodes on MFS - see the
<code>stage1</code> script and look for <code>INODES=</code>.</p>
<p> I also recommend to adjust the ISA devices parameters to
match the ones of your hardware - though PicoBSD can save the
changes from UserConfig, this way it will produce smaller
<code>/kernel.config</code> file.</p>
</li>
<li> I assume you will use 1.44MB floppy. If not, please edit the file
<code>build/stage3</code>.
</li>
<li> There are several directories which contain some sources and config
files:
<pre>
build/ main build directory; you MUST cd here!
dial/ config files for dialup setup
conf/ kernel config file
crunch1/ crunch of system programs
mfs.tree/ contains the MFS configuration
lang/ contains language-dependent files
floppy.tree/ contains the startup floppy hierarchy
isp/ config files for dialin server setup
... (as above)
net/ config files for router-like setup
... (as above)
tinyware/ collection of small system utilities
tools/ additional tools them needed during build
</pre>
<p> There are no <code>/etc/passwd</code> nor <code>/etc/pwd.db</code>
files on the "dial" floppy - in case of other types, they are
reconstructed from <code>/etc/master.passwd</code> on each startup
(and then put on MFS with the rest of <code>/etc</code>).
In case of "dial" type floppy, you don't need them at all.</p>
<p> NOTE: thanks to the above, the floppy is needed only during startup,
and then only if you want to synchronize (possibly changed) MFS /etc
with the one on the floppy. It means that you can pull off the floppy
from the drive as soon as <code>login:</code> prompt appears.
In other words, it is almost equal to read-only floppy.</p>
</li>
<li> Edit the set of installed programs.
<ul>
<li> Go to <code>${TYPE}/crunch1</code> directory, and edit it
to suit your needs. Keep in mind that floppies aren't made
of rubber... :-)
</li>
<li> There are some patches included in these directories, which
are applied during build process to some of the Makefiles in
your <code>/usr/src</code>. These patches attempt to decrease
the size of some programs by cutting off rarely/unlikely used
parts. The patches are reversed when you do a
<code>make clean</code> (or <code>build/clean</code>
for that matter).
<p> NOTE: patches may fail to apply, if your sources are too
different from the ones I used. Don't worry: they are so
straightforward that you can apply them by hand.</p>
</li>
<li> In order to have a functioning system you MUST include at
least <code>/stand/init</code>, or <code>/stand/oinit</code>,
or <code>/stand/sysinstall</code> in
your <code>crunch.conf</code>. Of course these can be your
own programs... But if you install the stock
<code>/sbin/init</code>, you
also have to install some others, like sh, getty, login etc...
<p> This release of PicoBSD contains a small replacement for
init(8), called 'oinit'. You can find it in TinyWare
collection. The main building script allows you to use it
instead of normal init(8). <b>Be sure to read the oinit's docs
before you decide to use it!</b></p>
</li>
</ul>
</li>
<li> Make sure that the system you're running has /dev/[r]vn0* entries in
/dev directory (if not, you can make them with 'MAKEDEV vn0'), AND
that your running kernel has built-in vnode driver (there should be a
line in your kernel config file stating 'pseudo-device vn xxx').
</li>
<li> You'll need at least 9MB of free disk space, and free /mnt directory.
</li>
<li> Do a <code>cd build/</code> and fire off the <code>./build</code>
script. Select the build parameters or 'n' for 'no change'. If all
is well, after some time (like 10-30m) you end up with a
'picobsd.bin' file in this directory.
<p> WARNING: make sure you don't have stale <code>.depend</code> files
around!!! You may encounter many strange errors during build process
in that case.</p>
<p> If there were any errors, please execute each script by hand and try
to find what causes this error. Most often this will be one of the
following reasons:</p>
<ul>
<li> <code>crunchgen</code> can't find the source directory for a
program 'proggy':
<ul>
<li> make sure that the source directory for 'proggy' is called
'proggy', otherwise the crunchgen won't find it
</li>
<li> make sure that the Makefile allows crunchgen to deduce the
set of objects to build. You can manually add an OBJS= ...
to the program's Makefile.
</li>
</ul>
</li>
<li> crunch fails to build.
<ul>
<li> check your system source tree for stale .depend files and/or
objects (*.o)
</li>
<li> see if the individual programs can be built using original
Makefiles. If not, cvsup the correct sources.
</li>
</ul>
</li>
<li> /: write failed - file system is full
<ul>
<li> this one is obvious - you wanted to put too many programs on
the MFS and/or the target floppy. Or, you really don't have
any space left on the root partition.. :-)
</li>
<li> also, you can check if the
MFS size is correctly reported while it's still mounted (right
after <code>stage1</code> script ends).
</li>
</ul>
<li> the build process displays "Preparing MFS" and then
silently stops. In this case check if you're running it as
root, and that you run kernel with support for vn(4)
devices. Also, you can add 'set -x' at hte beginning
of the scripts to see exactly where they stop.
</li>
</ul>
You can also remove <code>2>&amp;1</code> redirections from Makefiles
to see the stderr.
</li>
<li> Transfer this file to the floppy:
<pre>
dd if=picobsd.bin of=/dev/rfd0
</pre>
(The 'build' script asks you if you want to do this.)
</li>
</ol>
<p>That's all. You're welcome to change and improve these scripts. If you
stumble upon something which looks like a good idea to have it here, let me
know.</p>
<p>If, for some reason, the scripts don't work for you at all, also let me
know.</p>
<hr>
<i>Last modified:
@DATE@
<p><A HREF="mailto:abial@freebsd.org">&lt;abial@freebsd.org&gt;</a></i></p>
</body>
</html>