Date: Fri, 8 Jun 2001 19:10:11 -0700 (PDT) From: "Bruce R. Montague" <brucem@dsl3i239.cruzio.com> To: freebsd-small@freebsd.org Subject: Dirty PicoBSD build notes. Message-ID: <200106090210.f592AB900946@dsl3i239.cruzio.com>
index | next in thread | raw e-mail
re:
> I get the feeling there is a way to write
> a kernel config file by hand...
Very quick, very dirty, verify before use PicoBSD
customization doc. Many who know a lot more may
have some better input.
-------
* Assure you have a version of the host FreeBSD
system with the "vn" device in its config file:
"pseudo-device vn"
You may have to rebuild the "/dev/vn*" dir entries...
-------
* cd "/usr/src/release/picobsd" and create a new
dir with the name you want for "your" picobsd system.
Into this dir, copy one of the existing template
picobsd config dir's contents. The templates are
also in "/usr/src/release/picobsd"; they are "bridge",
"custom", "net", "dial", "install", "isp", and
"router". I think I've typically used bridge, net,
and router. These may not work "as-is", treat them
as starter kits. You may want to test their state
by building your starter kit. To build the picobsd
kit in subdir "router", for instance:
>su
>cd /usr/src/release/picobsd/build
>set path = (. $path)
>picobsd router
Insert a floppy and hit return twice at the two
menus. After a successful picobsd build, in addition
to putting a bootable image on the floppy, there
will be a bootable file named "kernel" in
"/usr/src/release/picobsd/build/build_dir-router"
and a binary image of the bootable floppy in
"picobsd.bin" in the same subdir. The subdir name
will depend on the name of your conf dir.
PicoBSD puts all executables and an image of a
RAM-based root filesystem into a single "kernel"
ELF file. The "kernel" file in the _floppy image_
is compressed (PicoBSD will "uncompress itself" on
boot). The "kernel" file in the subdir is not
compressed.
If your config dir is named "mysys", you would do
a "picobsd mysys" above to build your system. The
build results would be left in a subdir named
"build_dir-mysys".
In your config dir, edit file PICOBSD to contain
your desired FreeBSD kernel options and devices, in
file "config" add your desired "/dev" device nodes,
in file "crunch.conf" put the executables that you
want to include. Specify your script files using a
subdir named "floppy.tree" in your conf dir (also
use file "floppy.tree.exclude" to eliminate files
from the default "floppy.tree" in "/usr/src/release/picobsd/").
The files in the subdir "/usr/src/release/picobsd/mfs_mtree"
are included in the root file system built into the
kernel file using the root tree structure specified
by the "mfs.mtree" file in your config directory.
=========================================
Elaborations
=========================================
------
* The "/usr/src/release/picobsd/build/picobsd" script
does all the heavy lifting. Read this file for the
"real" documentation". See the header of this file
for usage documentation. This script is, amoung
other things, a wrapper for a FreeBSD kernel build.
It creates a "virtual disk device" using a file and
makes this (file) a bootable FreeBSD (picobsd) disk,
by putting a root file system, boot blocks, and a
kernel in this "device's" "/" dir. Startup scripts
are included in the memory-based filesystem included
internal to the kernel itself.
------
* The picoBSD build cycle builds a floppy "image"
file and then at the very end does a block-block
copy of this image to floppy, using dd (disk dup).
You do not need to build or use the floppy image,
the "kernel" file can be netbooted, booted from
flash, etc..
-------
* As the picobsd script header doc indicates, each
picobsd config directory contains:
* A FreeBSD kernel config file named "PICOBSD". Edit
this to include desired kernel options, in particular
you will often want to specify drivers (devices).
The "PICOBSD" config file is a normal FreeBSD config
file with the addition of a comment line starting
with "#PicoBSD". This line is processed as args by the
"picobsd" script.
* Edit a file named "config" to list device nodes
to be created in "/dev". Add any device node names you
need to the MY_DEVS string.
* Edit the "crunch.conf" file to control the crunchgen
of the system image. This indicates which executables
to include in the single kernel ELF file. Add
"srcdirs", "progs", and "libs" as needed. The "progs"
statements specify all the executables that you
require. The "srcdirs" are where the program's
"Makefile"s are found. The crunchgen in effect renames
all the program's "main()"'s and creates a single
"main()" with a little stub code that dispatches
to the real entry-point based on the arg0 cmd-line
name. Because of this, "links" are important in
the picobsd file tree (so as to provide desired
names).
* A default "/usr/src/release/picobsd/floppy.tree"
subdir contains files to put in the floppy file
system. Each config dir can have a "floppy.tree.exclude"
file that indicates paths of default files _not_ to
include. Each conf dir can have its own "floppy.tree"
subdir tree, containing its own "/etc/rc" and
"/etc/rc.filewall" scripts, etc.
These "floppy.tree" files are typically "/etc" files
that you may want to edit on the floppy.
A default "/usr/src/release/picobsd/mfs_tree" contains
the files built into the root file system in the
kernel image.
Each config dir should contain a "mfs.mtree" file
which specifies (ala mtree) a map of the directory
structure you want to create in the memory-based
file system.
Once the system boots, the ram file system is volatile
and files can be edited, etc.. Such modifications
will be lost, of course, at reboot. The floppy can
be mounted as a normal filesystem (both from a host
and by picobsd after picobsd boots). This enables
presistent (re)editing of startup scripts (put "ed"
in your crunch.conf if you are a minimalist). Note
that there is no easy way to permanently edit a file
included in the kernel image (mfs_tree). The current
default "rc" scripts in "release/picobsd" copy the
/etc files from the floppy into the /etc from the
mfs_tree at the start of boot script processing,
enabling overwriting a file to be updated.
-----
* To completely clean up a picobsd build, for example,
after a build using "picobsd net":
* cd /usr/src/sys/compile
and delete the "PICOBSD-net" build directory.
* cd /usr/src/sys/i386/conf
and delete the "PICOBSD-net" config file.
* cd /usr
and delete the "obj-pico" subdirectory.
* cd /usr/src/release/picobsd/build
and delete the "build_dir-net" subdirectory
* cd /tmp
and delete the "picobsd.XXXXXXXXXX" (temp
name) subdirectory(s).
and delete the "reply.XXXXXXXXXX" temporary file(s).
Note that only one "obj-pico" subdirectory is created,
that is, there are not versions created based on the
name of your build.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-small" in the body of the message
home |
help
Want to link to this message? Use this
URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200106090210.f592AB900946>
