1999-12-24 00:16:03 +00:00
|
|
|
.\" -*- nroff-fill -*-
|
|
|
|
.\" $FreeBSD$
|
2013-10-01 18:41:53 +00:00
|
|
|
.Dd October 1, 2013
|
2001-04-18 08:25:26 +00:00
|
|
|
.Dt PICOBSD 8
|
2010-04-14 19:08:06 +00:00
|
|
|
.Os
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh NAME
|
2001-06-20 15:01:17 +00:00
|
|
|
.Nm picobsd
|
2006-01-31 21:21:02 +00:00
|
|
|
.Nd building small FreeBSD disk images
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh SYNOPSIS
|
|
|
|
.Nm
|
2002-03-18 12:04:52 +00:00
|
|
|
.Op Ar options
|
2006-01-31 21:21:02 +00:00
|
|
|
.Op Ar config-name Op Ar site-name
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh DESCRIPTION
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
1999-12-24 00:16:03 +00:00
|
|
|
.Nm
|
2002-07-14 14:58:11 +00:00
|
|
|
utility is a script which produces a minimal implementation of
|
2001-06-20 15:01:17 +00:00
|
|
|
.Fx
|
|
|
|
(historically called
|
|
|
|
.Nm PicoBSD )
|
2006-01-31 21:21:02 +00:00
|
|
|
which typically fits on a small media such as a floppy disk,
|
|
|
|
or can be downloaded as a
|
2001-06-20 15:01:17 +00:00
|
|
|
single image file from some media such as CDROM, flash memory, or through
|
2013-10-07 16:49:53 +00:00
|
|
|
etherboot.
|
2001-06-20 15:01:17 +00:00
|
|
|
.Pp
|
2002-07-14 14:58:11 +00:00
|
|
|
The
|
2002-03-18 12:04:52 +00:00
|
|
|
.Nm
|
2002-07-14 14:58:11 +00:00
|
|
|
utility was originally created to build simple standalone systems
|
2002-02-15 07:47:39 +00:00
|
|
|
such as firewalls or bridges, but because of the ability to
|
|
|
|
cross-build images with different source trees than the one
|
|
|
|
in the server, it can be extremely useful to developers to
|
|
|
|
test their code without having to reinstall the system.
|
|
|
|
.Pp
|
2006-01-31 21:21:02 +00:00
|
|
|
The boot media (historically a floppy disk, but also small
|
|
|
|
CDROM or USB keys) contains a boot loader and a
|
2002-12-12 17:26:04 +00:00
|
|
|
compressed kernel which includes a memory file system.
|
2001-06-20 15:01:17 +00:00
|
|
|
Depending on the media, it might also contain a number of
|
|
|
|
additional files, which can be updated at run time, and are
|
2002-12-12 17:26:04 +00:00
|
|
|
used to override/update those in the memory file system.
|
2001-06-20 15:01:17 +00:00
|
|
|
.Pp
|
|
|
|
The system loads the kernel in the normal way, uncompresses
|
2002-12-12 17:26:04 +00:00
|
|
|
the memory file system and mounts it as root.
|
2001-06-20 15:01:17 +00:00
|
|
|
It then updates the memory
|
2002-12-12 17:26:04 +00:00
|
|
|
file system with files from the boot media (if present),
|
2001-06-20 15:01:17 +00:00
|
|
|
and executes a specialized version of
|
1999-12-24 00:16:03 +00:00
|
|
|
.Pa /etc/rc .
|
2002-03-18 12:04:52 +00:00
|
|
|
The boot media (floppy, etc.) is
|
|
|
|
required for loading only, and typically used read-only.
|
|
|
|
After the boot phase, the system runs entirely from RAM.
|
2001-06-20 15:01:17 +00:00
|
|
|
.Pp
|
|
|
|
The following options are available (but also check the
|
|
|
|
.Nm
|
2009-06-25 09:28:04 +00:00
|
|
|
script for more details).
|
|
|
|
The most important options for common operations are
|
|
|
|
.Fl src ,
|
|
|
|
.Fl init ,
|
|
|
|
.Fl n and
|
2012-05-24 02:24:03 +00:00
|
|
|
.Fl v .
|
2002-03-18 12:04:52 +00:00
|
|
|
.Bl -tag -width indent
|
2009-06-25 09:28:04 +00:00
|
|
|
.\"
|
|
|
|
.It Fl -all_in_mfs
|
|
|
|
Put the entire contents of the file system in the
|
|
|
|
memory file system image which is contained in the
|
|
|
|
kernel.
|
|
|
|
This is the default behaviour, and is
|
|
|
|
extremely useful as the kernel itself can be loaded,
|
|
|
|
using
|
2013-10-07 16:49:53 +00:00
|
|
|
etherboot
|
2009-06-25 09:28:04 +00:00
|
|
|
or
|
|
|
|
.Xr pxeboot 8 ,
|
|
|
|
.\"
|
|
|
|
.It Fl c , Fl clean
|
|
|
|
Clean the product of previous builds.
|
|
|
|
.\"
|
|
|
|
.It Fl -cfg Ar file
|
|
|
|
Specify a file that contains additional config commands.
|
|
|
|
.\"
|
|
|
|
.It Fl -floppy_size Ar size
|
|
|
|
Set the size of the disk image.
|
|
|
|
Typical values for a floppy disk are 1440 or 2880,
|
|
|
|
but other values can be used for other media (flash memories,
|
|
|
|
CDROM, network booted kernels).
|
|
|
|
Note that this option is overridden by the content of the
|
|
|
|
config files (config in the image tree, or the one
|
|
|
|
specified with
|
|
|
|
.Fl Fl cfg )
|
|
|
|
.\"
|
|
|
|
.It Fl -init
|
|
|
|
When used together with the
|
|
|
|
.Fl -src
|
|
|
|
option, this initializes the
|
|
|
|
.Ao Ar SRC_PATH Ac Ns Pa /../usr
|
|
|
|
subtree as necessary to subsequently build
|
|
|
|
.Nm
|
|
|
|
images.
|
|
|
|
.\"
|
|
|
|
.It Fl -iso
|
2012-05-24 02:24:03 +00:00
|
|
|
Generate an ISO image,
|
|
|
|
.Pa picobsd.iso ,
|
|
|
|
in addition to the disk image
|
|
|
|
.Pa picobsd.bin .
|
2009-06-25 09:28:04 +00:00
|
|
|
.\"
|
|
|
|
.It Fl -modules
|
|
|
|
Also build kernel modules.
|
|
|
|
These are not stored on the
|
|
|
|
.Nm
|
|
|
|
image but are left available in the build directory.
|
|
|
|
.\"
|
|
|
|
.It Fl n
|
|
|
|
Make the script non-interactive, skipping the initial menu
|
|
|
|
and proceeding with the build process without requiring user input.
|
|
|
|
.\"
|
|
|
|
.It Fl -no_all_in_mfs
|
|
|
|
Leaves files contained in the
|
|
|
|
.Pa floppy.tree
|
|
|
|
on the
|
|
|
|
.Nm
|
|
|
|
image, so they can be loaded separately
|
|
|
|
from the kernel (and updated individually to
|
|
|
|
customize the image).
|
|
|
|
.\"
|
|
|
|
.It Fl -no_loader
|
|
|
|
Omit /boot/loader, just rely on boot2 to load the kernel.
|
|
|
|
This saves some space but may have problems with kernels > 4MB.
|
|
|
|
.\"
|
|
|
|
.It Fl -objdir Ar directory
|
|
|
|
Specify a directory with the result of a previous buildworld.
|
|
|
|
This saves the need for an
|
|
|
|
.Fl Fl init
|
|
|
|
call before creating an image.
|
|
|
|
.\"
|
2002-02-15 07:47:39 +00:00
|
|
|
.It Fl -src Ar SRC_PATH
|
|
|
|
Use the source tree at
|
|
|
|
.Ar SRC_PATH
|
|
|
|
instead the one at
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pa /usr/src .
|
2006-01-31 21:21:02 +00:00
|
|
|
This can be useful for cross-building
|
|
|
|
.Nm
|
|
|
|
images.
|
2002-03-15 09:02:26 +00:00
|
|
|
When using this option, you must also create and initialize the subtree at
|
2002-03-18 12:04:52 +00:00
|
|
|
.Ao Ar SRC_PATH Ac Ns Pa /../usr
|
|
|
|
with the correct header files, libraries, and tools (such as the
|
2002-02-15 07:47:39 +00:00
|
|
|
.Xr config 8
|
|
|
|
program) that are necessary for the cross-build (see the
|
|
|
|
.Fl -init
|
2009-06-25 09:28:04 +00:00
|
|
|
option).
|
2002-02-15 07:47:39 +00:00
|
|
|
The source files are unmodified by the
|
2002-03-18 12:04:52 +00:00
|
|
|
.Nm
|
|
|
|
script.
|
|
|
|
However the source tree is not completely read-only,
|
2002-02-15 07:47:39 +00:00
|
|
|
because
|
|
|
|
.Xr config 8
|
|
|
|
expects the kernel configuration file to be in one of
|
|
|
|
its subdirectories, and also the process of initializing the
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pa usr
|
2002-02-15 07:47:39 +00:00
|
|
|
subtree touches some parts of the source tree (this is a bug
|
|
|
|
in the release build scripts which might go away with time).
|
2009-06-25 09:28:04 +00:00
|
|
|
.\"
|
2001-06-20 15:01:17 +00:00
|
|
|
.It Fl v
|
2002-03-15 09:02:26 +00:00
|
|
|
Make the script verbose, showing
|
|
|
|
commands to be executed and waiting for user
|
2002-03-18 12:04:52 +00:00
|
|
|
input before executing each of them.
|
|
|
|
Useful for debugging.
|
|
|
|
as a fully functional system.
|
2001-06-20 15:01:17 +00:00
|
|
|
.El
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh ENVIRONMENT
|
2002-03-15 09:02:26 +00:00
|
|
|
As a result of extreme size limitations, the
|
2001-06-20 15:01:17 +00:00
|
|
|
.Nm
|
2000-11-14 11:20:58 +00:00
|
|
|
environment differs from the normal
|
|
|
|
.Fx
|
|
|
|
in a number of ways:
|
1999-12-24 00:16:03 +00:00
|
|
|
.Bl -bullet
|
|
|
|
.It
|
|
|
|
There are no dynamic libraries, and there is no directory
|
|
|
|
.Pa /usr/lib .
|
|
|
|
As a result, only static executables may be executed.
|
|
|
|
.It
|
|
|
|
In order to reduce the size of the executables, all executables on a specific
|
|
|
|
floppy are joined together as a single executable built with
|
2000-03-24 01:15:04 +00:00
|
|
|
.Xr crunchgen 1 .
|
1999-12-24 00:16:03 +00:00
|
|
|
.It
|
|
|
|
Some programs are supplied in minimalistic versions, specifically
|
|
|
|
.Nm ns ,
|
|
|
|
a cut-down version of
|
2001-06-20 15:01:17 +00:00
|
|
|
.Xr netstat 1 ,
|
1999-12-24 00:16:03 +00:00
|
|
|
and
|
|
|
|
.Nm vm ,
|
|
|
|
a cut-down version of
|
2001-06-20 15:01:17 +00:00
|
|
|
.Xr vmstat 8 .
|
1999-12-24 00:16:03 +00:00
|
|
|
.El
|
2002-03-18 12:04:52 +00:00
|
|
|
.Sh BUILDING PicoBSD
|
1999-12-24 00:16:03 +00:00
|
|
|
The
|
|
|
|
.Nm
|
|
|
|
sources reside in the hierarchy
|
|
|
|
.Pa /usr/src/release/picobsd .
|
|
|
|
In the following discussion, all relative path names are relative to this
|
2002-03-18 12:04:52 +00:00
|
|
|
directory.
|
2006-01-31 21:21:02 +00:00
|
|
|
.Pp
|
|
|
|
The supported build script is
|
2001-06-20 15:01:17 +00:00
|
|
|
.Pa /usr/src/release/picobsd/build/picobsd
|
2006-01-31 21:21:02 +00:00
|
|
|
which can be run from anywhere, and relies on the
|
|
|
|
.Xr sysutils/makefs
|
|
|
|
port to build a filesystem without requiring
|
|
|
|
.Xr mdconfig
|
|
|
|
or root privileges to mount a filesystem.
|
2002-02-15 07:47:39 +00:00
|
|
|
When run in interactive mode (the default without the
|
2006-01-31 21:21:02 +00:00
|
|
|
.Fl n
|
2002-02-15 07:47:39 +00:00
|
|
|
option), the script will let you configure the various parameters
|
2006-09-18 15:24:20 +00:00
|
|
|
used to build the PicoBSD image.
|
|
|
|
An image is configured
|
2006-01-31 21:21:02 +00:00
|
|
|
using the files and directories described below.
|
|
|
|
The base system contains a template, called
|
|
|
|
.Pa bridge
|
2006-09-18 15:24:20 +00:00
|
|
|
for historical reasons,
|
2006-01-31 21:21:02 +00:00
|
|
|
that can be used as a base for building various kinds
|
|
|
|
of network appliances.
|
2001-06-20 15:01:17 +00:00
|
|
|
.Pp
|
2006-01-31 21:21:02 +00:00
|
|
|
You can define your own PicoBSD configuration, by creating a directory
|
2002-03-18 12:04:52 +00:00
|
|
|
with a name of your choice (e.g.\&
|
|
|
|
.Pa FOO )
|
|
|
|
which contains
|
|
|
|
some of the following files and directories.
|
|
|
|
For more
|
2002-02-15 07:47:39 +00:00
|
|
|
information on how to construct these files, look at one
|
|
|
|
of the standard
|
2002-03-18 12:04:52 +00:00
|
|
|
.Nm
|
2002-02-15 07:47:39 +00:00
|
|
|
configurations as a reference.
|
2002-03-18 12:04:52 +00:00
|
|
|
.Bl -tag -width indent
|
2001-06-20 15:01:17 +00:00
|
|
|
.It Pa PICOBSD
|
2002-03-18 12:04:52 +00:00
|
|
|
The kernel configuration file (required).
|
|
|
|
This is a mostly standard
|
2002-02-15 07:47:39 +00:00
|
|
|
kernel configuration file, possibly stripped down by removing
|
|
|
|
unnecessary drivers and options to reduce the kernel's size.
|
|
|
|
.Pp
|
|
|
|
To be recognised as a
|
|
|
|
.Nm
|
|
|
|
kernel config file, the file must also contain the line
|
2002-03-18 12:04:52 +00:00
|
|
|
beginning with
|
|
|
|
.Dq Li #PicoBSD
|
|
|
|
below, and a matching
|
|
|
|
.Dv MD_ROOT_SIZE
|
2002-02-15 07:47:39 +00:00
|
|
|
option:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#marker def_sz init MFS_inodes floppy_inodes
|
|
|
|
#PicoBSD 4200 init 8192 32768
|
|
|
|
options MD_ROOT_SIZE=4200 # same as def_sz
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-12-12 17:26:04 +00:00
|
|
|
This informs the script of the size of the memory file system and
|
2002-03-15 09:02:26 +00:00
|
|
|
provides a few other details on how to build the image.
|
2001-06-20 15:01:17 +00:00
|
|
|
.It Pa crunch.conf
|
2002-03-18 12:04:52 +00:00
|
|
|
.Xr crunchgen 1
|
|
|
|
configuration (required).
|
2002-03-21 03:15:47 +00:00
|
|
|
It contains the list of directories containing program sources,
|
|
|
|
the list of binaries to be built, and the list of libraries that
|
|
|
|
these programs use.
|
2002-03-18 12:04:52 +00:00
|
|
|
See the
|
2002-02-15 07:47:39 +00:00
|
|
|
.Xr crunchgen 1
|
2002-03-21 03:15:47 +00:00
|
|
|
manpage for the exact details on the syntax of this file.
|
|
|
|
.Pp
|
|
|
|
The following issues are particularly important when dealing
|
|
|
|
with
|
|
|
|
.Nm
|
|
|
|
configurations:
|
|
|
|
.Bl -bullet
|
|
|
|
.It
|
2002-05-30 10:09:15 +00:00
|
|
|
We can pass build options to those makefiles which understand
|
2002-03-21 03:15:47 +00:00
|
|
|
that, in order to reduce the size of the programs.
|
|
|
|
This is achieved with a line of the form
|
2002-05-30 10:09:15 +00:00
|
|
|
.Pp
|
2004-12-21 12:49:24 +00:00
|
|
|
.Dl "buildopts -DNO_PAM -DRELEASE_CRUNCH ..."
|
2002-03-21 03:15:47 +00:00
|
|
|
.It
|
|
|
|
When providing the list of directories where source files are, it
|
|
|
|
is convenient to list the following entry first:
|
2002-05-30 10:09:15 +00:00
|
|
|
.Pp
|
|
|
|
.Dl "srcdirs /usr/src/release/picobsd/tinyware"
|
|
|
|
.Pp
|
2002-03-21 03:15:47 +00:00
|
|
|
so that
|
2002-05-30 10:09:15 +00:00
|
|
|
.Nm Ns -specific
|
|
|
|
versions of the programs will be found there.
|
2002-03-21 03:15:47 +00:00
|
|
|
.It
|
|
|
|
The string
|
2002-05-30 10:09:15 +00:00
|
|
|
.Dq Li @__CWD__@
|
2002-03-21 03:15:47 +00:00
|
|
|
is replaced with the full pathname of the directory where the
|
|
|
|
.Nm
|
2004-07-03 18:29:24 +00:00
|
|
|
configuration resides (i.e., the one where we find
|
2002-03-21 03:15:47 +00:00
|
|
|
.Pa PICOBSD , crunch.conf ,
|
|
|
|
and so on).
|
|
|
|
This can be useful to refer source code that resides within a
|
2002-05-30 10:09:15 +00:00
|
|
|
configuration, e.g.\&
|
|
|
|
.Pp
|
|
|
|
.Dl "srcdirs @__CWD__@/src"
|
2002-03-21 03:15:47 +00:00
|
|
|
.El
|
2001-06-20 15:01:17 +00:00
|
|
|
.It Pa config
|
2002-03-18 12:04:52 +00:00
|
|
|
Shell variables, sourced by the
|
|
|
|
.Nm
|
|
|
|
script (optional).
|
2002-03-21 03:15:47 +00:00
|
|
|
The most important variables here are:
|
2002-05-30 10:09:15 +00:00
|
|
|
.Bl -tag -width ".Va MY_DEVS"
|
2002-03-21 03:15:47 +00:00
|
|
|
.It Va MY_DEVS
|
2002-05-30 10:09:15 +00:00
|
|
|
(Not used in
|
|
|
|
.Fx 5.0
|
|
|
|
where we have
|
|
|
|
.Xr devfs 5 ) .
|
2002-03-21 03:15:47 +00:00
|
|
|
Should be set to the list of devices to be created in the
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pa /dev
|
|
|
|
directory of the image (it is really the argument passed to
|
2002-03-18 12:04:52 +00:00
|
|
|
.Xr MAKEDEV 8 ,
|
2002-03-21 03:15:47 +00:00
|
|
|
so refer to that manpage for the names).
|
|
|
|
.It Va fd_size
|
|
|
|
Size (in kilobytes) of the
|
|
|
|
.Nm
|
|
|
|
image.
|
2002-03-09 20:16:06 +00:00
|
|
|
By default,
|
2002-03-18 12:04:52 +00:00
|
|
|
.Va fd_size
|
|
|
|
is set to 1440
|
2002-03-09 20:16:06 +00:00
|
|
|
which produces an image suitable for a standard floppy.
|
|
|
|
.Pp
|
2004-07-03 18:29:24 +00:00
|
|
|
If you plan to store the image on a CDROM (e.g.\& using
|
2002-03-18 12:04:52 +00:00
|
|
|
the
|
|
|
|
.Dq "El Torito"
|
|
|
|
floppy emulation), you can set
|
|
|
|
.Va fd_size
|
|
|
|
equal to 2880.
|
2002-03-15 09:02:26 +00:00
|
|
|
If you are planning to dump the image onto a hard disk
|
|
|
|
(either in a partition or on the whole disk), you
|
|
|
|
are not restricted to one of the standard floppy sizes.
|
2002-03-09 20:16:06 +00:00
|
|
|
Using a large image size per se does not waste RAM at runtime,
|
|
|
|
because only the files that are actually loaded from the image
|
|
|
|
contribute to the memory usage.
|
2002-03-21 03:15:47 +00:00
|
|
|
.It Va import_files
|
2002-05-30 10:09:15 +00:00
|
|
|
Contains a list of files to be imported in the floppy tree.
|
2002-12-12 17:26:04 +00:00
|
|
|
Absolute names refer to the standard file system, relative
|
2002-03-21 03:15:47 +00:00
|
|
|
names refer to the root of the source tree being used
|
2002-05-30 10:09:15 +00:00
|
|
|
(i.e.\&
|
|
|
|
.Va SRC_PATH/.. ) .
|
2002-03-21 03:15:47 +00:00
|
|
|
You can normally use this option if you want to import
|
|
|
|
files such as shared libraries, or databases, without
|
|
|
|
having to replicate them first in your configuration
|
|
|
|
under the
|
|
|
|
.Pa floppy.tree/
|
|
|
|
directory.
|
|
|
|
.El
|
2001-06-20 15:01:17 +00:00
|
|
|
.It Pa floppy.tree.exclude
|
2002-03-21 03:15:47 +00:00
|
|
|
List of files from the standard floppy tree which
|
|
|
|
we do not want to be copied (optional).
|
2001-06-20 15:01:17 +00:00
|
|
|
.It Pa floppy.tree/
|
2002-03-18 12:04:52 +00:00
|
|
|
Local additions to the standard floppy tree (optional).
|
2002-03-21 03:15:47 +00:00
|
|
|
The content of this subtree will be copied as-is into the
|
|
|
|
floppy image.
|
2002-03-18 12:04:52 +00:00
|
|
|
.It Pa floppy.tree. Ns Aq Ar site-name
|
2002-03-21 03:15:47 +00:00
|
|
|
Same as above, but site-specific (optional).
|
1999-12-24 00:16:03 +00:00
|
|
|
.El
|
2001-06-20 15:01:17 +00:00
|
|
|
.Pp
|
|
|
|
More information on the build process can be found in the
|
2002-02-15 07:47:39 +00:00
|
|
|
comments in the
|
2002-03-18 12:04:52 +00:00
|
|
|
.Nm
|
2001-06-20 15:01:17 +00:00
|
|
|
script.
|
|
|
|
.Sh USING ALTERNATE SOURCE TREES
|
2002-03-15 09:02:26 +00:00
|
|
|
The build script can be instructed to use an alternate source tree
|
2001-06-20 15:01:17 +00:00
|
|
|
using the
|
2002-02-15 07:47:39 +00:00
|
|
|
.Fl -src Ar SRC_PATH
|
2001-06-20 15:01:17 +00:00
|
|
|
option.
|
|
|
|
The tree that you specify must contain full sources for the kernel
|
|
|
|
and for all programs that you want to include in your image.
|
2002-03-18 12:04:52 +00:00
|
|
|
As an example, to cross-build the
|
|
|
|
.Pa bridge
|
|
|
|
floppy
|
2002-02-15 07:47:39 +00:00
|
|
|
using RELENG_4 sources, you can do the following:
|
|
|
|
.Bd -literal -offset indent
|
2002-03-18 12:04:52 +00:00
|
|
|
cd <some_empty_directory>
|
|
|
|
mkdir FOO
|
|
|
|
(cd FOO; cvs -d<my_repository> co -rRELENG_4 src)
|
|
|
|
picobsd --src FOO/src --init # this is needed only once
|
|
|
|
picobsd --src FOO/src -n -v bridge
|
2002-02-15 07:47:39 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
If the build is successful, the directory
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pa build_dir-bridge/
|
2002-02-15 07:47:39 +00:00
|
|
|
will contain a
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pa kernel
|
2013-10-07 16:49:53 +00:00
|
|
|
that can be downloaded with etherboot, a floppy image called
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pa picobsd.bin ,
|
2002-02-15 07:47:39 +00:00
|
|
|
plus the products of the compilation in other directories.
|
|
|
|
If you want to modify the source tree in
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pa FOO/src ,
|
2002-02-15 07:47:39 +00:00
|
|
|
a new image can be produced by simply running
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pp
|
|
|
|
.Dl "picobsd --src FOO/src -n -v bridge"
|
2002-02-15 07:47:39 +00:00
|
|
|
.Pp
|
|
|
|
whereas if the change affects include files or libraries
|
2006-01-31 21:21:02 +00:00
|
|
|
you first need to update them, e.g.\& by re-running
|
2002-02-15 07:47:39 +00:00
|
|
|
.Pp
|
2002-03-18 12:04:52 +00:00
|
|
|
.Dl "picobsd --src FOO/src --init # this is needed only once"
|
2002-02-15 07:47:39 +00:00
|
|
|
.Pp
|
2002-03-18 12:04:52 +00:00
|
|
|
as you would normally do for any change of this kind.
|
2002-03-09 20:16:06 +00:00
|
|
|
.Sh INSTALLING PicoBSD
|
2002-03-18 12:04:52 +00:00
|
|
|
.Ss Floppy Install
|
2002-03-09 20:16:06 +00:00
|
|
|
Historically,
|
|
|
|
.Nm
|
|
|
|
is run from a floppy disk, where it can be installed with a simple
|
|
|
|
.Pp
|
2002-03-18 12:04:52 +00:00
|
|
|
.Dl "dd if=picobsd.bin of=/dev/rfd0"
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pp
|
2002-03-18 12:04:52 +00:00
|
|
|
and the floppy is ready to boot.
|
|
|
|
.Ss Hard Disk Install
|
2002-03-09 20:16:06 +00:00
|
|
|
The same process can be used to store the image on a hard disk
|
|
|
|
(entire volume or one of the slices):
|
|
|
|
.Bd -literal -offset indent
|
2013-10-01 18:41:53 +00:00
|
|
|
dd if=picobsd.bin of=/dev/ada2
|
|
|
|
dd if=picobsd.bin of=/dev/ada2s3
|
|
|
|
dd if=picobsd.bin of=/dev/ada2 oseek=NN
|
2002-03-09 20:16:06 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
|
|
|
The first form will install the image on the entire disk, and it
|
2002-03-15 09:02:26 +00:00
|
|
|
should work in the same way as for a floppy.
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pp
|
2002-03-15 09:02:26 +00:00
|
|
|
The second form will install the image
|
2002-03-09 20:16:06 +00:00
|
|
|
on slice number 3 (which should be large enough to store the
|
2002-03-18 12:04:52 +00:00
|
|
|
contents of the image).
|
|
|
|
However, the process will only have success if the
|
2002-03-09 20:16:06 +00:00
|
|
|
partition does not contain a valid disklabel, otherwise the kernel will
|
2002-03-18 12:04:52 +00:00
|
|
|
likely prevent overwriting the label.
|
|
|
|
In this case you can use the
|
|
|
|
third form, replacing
|
|
|
|
.Ar NN
|
|
|
|
with the actual start of the partition
|
2002-03-15 09:02:26 +00:00
|
|
|
(which you can determine using
|
2015-09-02 14:08:43 +00:00
|
|
|
.Xr gpart 8 ) .
|
2002-03-15 09:02:26 +00:00
|
|
|
Note that after saving the image to the slice, it will not yet be
|
2002-03-18 12:04:52 +00:00
|
|
|
recognised.
|
|
|
|
You have to use the
|
|
|
|
.Xr disklabel 8
|
|
|
|
command to properly initialize the label (do not ask why!).
|
2002-03-09 20:16:06 +00:00
|
|
|
One way to do this is
|
|
|
|
.Bd -literal -offset indent
|
2013-10-01 18:41:53 +00:00
|
|
|
disklabel -w ada0s2 auto
|
|
|
|
disklabel -e ada0s2
|
2002-03-09 20:16:06 +00:00
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-03-18 12:04:52 +00:00
|
|
|
and from the editor enter a line corresponding to the actual partition, e.g.\&
|
2002-03-09 20:16:06 +00:00
|
|
|
if the image has 2.88MB (5760 sectors) you need to enter the following
|
|
|
|
line for the partition:
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pp
|
|
|
|
.Dl "a: 5760 0 4.2BSD 512 4096"
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pp
|
|
|
|
At this point the partition is bootable.
|
|
|
|
Note that the image size can be smaller than the slice size
|
2002-03-18 12:04:52 +00:00
|
|
|
(indicated as partition
|
|
|
|
.Dq Li c: ) .
|
|
|
|
.Ss CDROM Install
|
2009-06-25 09:28:04 +00:00
|
|
|
.Nm
|
|
|
|
can produce an ISO image named picobsd.iso,
|
|
|
|
which does not use
|
2002-03-18 12:04:52 +00:00
|
|
|
.Dq "El Torito"
|
2009-06-25 09:28:04 +00:00
|
|
|
emulation, so it has no size restrictions.
|
|
|
|
Installing means just burning a media with the file.
|
2002-03-18 12:04:52 +00:00
|
|
|
.Ss Booting From The Network
|
2002-03-09 20:16:06 +00:00
|
|
|
Yet another way to use
|
|
|
|
.Nm
|
|
|
|
is to boot the image off the network.
|
|
|
|
For this purpose you should use the uncompressed kernel which is
|
2002-03-18 12:04:52 +00:00
|
|
|
available as a byproduct of the compilation.
|
|
|
|
Refer to the documentation
|
2002-03-09 20:16:06 +00:00
|
|
|
for network booting for more details, the
|
|
|
|
.Nm
|
|
|
|
kernel is bootable as a standard
|
|
|
|
.Fx
|
|
|
|
kernel.
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh BOOTING PicoBSD
|
|
|
|
To boot
|
2000-11-20 18:41:33 +00:00
|
|
|
.Nm ,
|
2002-03-18 12:04:52 +00:00
|
|
|
insert the floppy and reset the machine.
|
|
|
|
The boot procedure is similar to the
|
2000-11-14 11:20:58 +00:00
|
|
|
standard
|
|
|
|
.Fx
|
2002-03-09 20:16:06 +00:00
|
|
|
boot.
|
|
|
|
Booting from a floppy is normally rather slow (in the order of 1-2
|
|
|
|
minutes), things are much faster if you store your image on
|
|
|
|
a hard disk, Compact Flash, or CDROM.
|
1999-12-24 00:16:03 +00:00
|
|
|
.Pp
|
2013-10-07 16:49:53 +00:00
|
|
|
You can also use etherboot to load the preloaded, uncompressed kernel image
|
2001-06-20 15:01:17 +00:00
|
|
|
which is a byproduct of the
|
1999-12-24 00:16:03 +00:00
|
|
|
.Nm
|
2001-06-20 15:01:17 +00:00
|
|
|
build.
|
|
|
|
In this case
|
|
|
|
the load time is a matter of a few seconds, even on a 10Mbit/s
|
|
|
|
ethernet.
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pp
|
1999-12-24 00:16:03 +00:00
|
|
|
After booting,
|
|
|
|
.Nm
|
2002-12-12 17:26:04 +00:00
|
|
|
loads the root file system from the memory file system, starts
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pa /sbin/init ,
|
|
|
|
and passes control to a first startup script,
|
|
|
|
.Pa /etc/rc .
|
|
|
|
The latter populates the
|
|
|
|
.Pa /etc
|
|
|
|
and
|
|
|
|
.Pa /root
|
|
|
|
directories with the default files, then tries to identify the boot
|
2002-03-18 12:04:52 +00:00
|
|
|
device (floppy, hard disk partition) and possibly override the contents
|
2002-12-12 17:26:04 +00:00
|
|
|
of the root file system with files read from the boot device.
|
2002-03-09 20:16:06 +00:00
|
|
|
This allows you to store local configuration on the same media.
|
|
|
|
After this phase the boot device is no longer used, unless the
|
|
|
|
user specifically does it.
|
|
|
|
.Pp
|
|
|
|
After this, control is transferred to a second script,
|
2002-03-15 09:02:26 +00:00
|
|
|
.Pa /etc/rc1
|
|
|
|
(which can be overridden from the boot device).
|
|
|
|
This script tries to associate a hostname to the system by using
|
2002-03-09 20:16:06 +00:00
|
|
|
the MAC address of the first ethernet interface as a key, and
|
|
|
|
.Pa /etc/hosts
|
|
|
|
as a lookup table.
|
|
|
|
Then control is passed to the main user configuration script,
|
|
|
|
.Pa /etc/rc.conf ,
|
|
|
|
which is supposed to override the value of a number of configuration
|
|
|
|
variables which have been pre-set in
|
|
|
|
.Pa /etc/rc.conf.defaults .
|
|
|
|
You can use the
|
2002-03-18 12:04:52 +00:00
|
|
|
.Va hostname
|
2002-03-09 20:16:06 +00:00
|
|
|
variable to create different configurations from the same file.
|
|
|
|
After taking control back,
|
2002-03-15 09:02:26 +00:00
|
|
|
.Pa /etc/rc1
|
|
|
|
completes the initializations, and as part of this
|
2002-03-09 20:16:06 +00:00
|
|
|
it configures network interfaces and optionally calls the
|
|
|
|
firewall configuration script,
|
|
|
|
.Pa /etc/rc.firewall ,
|
|
|
|
where the user can store his own firewall configuration.
|
|
|
|
.Pp
|
|
|
|
Note that by default
|
|
|
|
.Nm
|
2002-03-15 09:02:26 +00:00
|
|
|
runs entirely from main memory, and has no swap space, unless you
|
2002-03-09 20:16:06 +00:00
|
|
|
explicitly request it.
|
|
|
|
The boot device is also not used anymore after
|
|
|
|
.Pa /etc/rc1
|
2002-03-15 09:02:26 +00:00
|
|
|
takes control, again, unless you explicitly request it.
|
2002-03-09 20:16:06 +00:00
|
|
|
.Sh CONFIGURING a PicoBSD system
|
|
|
|
The operation of a
|
1999-12-24 00:16:03 +00:00
|
|
|
.Nm
|
2002-03-09 20:16:06 +00:00
|
|
|
system can be configured through a few files which are read at boot
|
|
|
|
time, very much like a standard
|
|
|
|
.Fx
|
2002-03-18 12:04:52 +00:00
|
|
|
system.
|
|
|
|
There are, however, some minor differences to reduce the
|
2002-03-09 20:16:06 +00:00
|
|
|
number of files to store and/or customize, thus saving space.
|
|
|
|
Among the files to configure we have the following:
|
2002-03-18 12:04:52 +00:00
|
|
|
.Bl -tag -width indent
|
2002-03-09 20:16:06 +00:00
|
|
|
.It Pa /etc/hosts
|
|
|
|
Traditionally, this file contains the IP-to-hostname mappings.
|
2002-03-18 12:04:52 +00:00
|
|
|
In addition to this, the
|
|
|
|
.Nm
|
|
|
|
version of this file also contains
|
2002-03-09 20:16:06 +00:00
|
|
|
a mapping between Ethernet (MAC) addresses and hostnames, as follows:
|
|
|
|
.Bd -literal -offset indent
|
|
|
|
#ethertable start of the ethernet->hostname mapping
|
|
|
|
# mac_address hostname
|
|
|
|
# 00:12:34:56:78:9a pinco
|
|
|
|
# 12:34:56:* pallino
|
|
|
|
# * this-matches-all
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-03-18 12:04:52 +00:00
|
|
|
where the line containing
|
|
|
|
.Dq Li #ethertable
|
|
|
|
marks the start of the table.
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pp
|
|
|
|
If the MAC address is not found, the script will prompt you to
|
2002-03-15 09:02:26 +00:00
|
|
|
enter a hostname and IP address for the system, and this
|
|
|
|
information will be stored in the
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pa /etc/hosts
|
|
|
|
file (in memory) so you can simply store them on disk later.
|
|
|
|
.Pp
|
|
|
|
Note that you can use wildcards in the address part, so a line
|
|
|
|
like the last one in the example will match any MAC address and
|
|
|
|
avoid the request.
|
|
|
|
.It Pa /etc/rc.conf
|
|
|
|
This file contains a number of variables which control the
|
|
|
|
operation of the system, such as interface configuration,
|
2002-03-15 09:02:26 +00:00
|
|
|
router setup, network service startup, etc.
|
2002-03-09 20:16:06 +00:00
|
|
|
For the exact list and meaning of these variables see
|
|
|
|
.Pa /etc/rc.conf.defaults .
|
|
|
|
.Pp
|
|
|
|
It is worth mentioning that some of the variables let you
|
2002-03-18 12:04:52 +00:00
|
|
|
overwrite the contents of some files in
|
2002-03-09 20:16:06 +00:00
|
|
|
.Pa /etc .
|
|
|
|
This option is available at the moment for
|
|
|
|
.Pa /etc/host.conf
|
|
|
|
and
|
2002-03-15 09:02:26 +00:00
|
|
|
.Pa /etc/resolv.conf ,
|
2002-05-31 22:26:19 +00:00
|
|
|
whose contents are generally very short and suitable for this
|
2002-03-09 20:16:06 +00:00
|
|
|
type of updating.
|
|
|
|
In case you use these variables, remember to use newlines
|
2002-03-18 12:04:52 +00:00
|
|
|
as appropriate, e.g.\&
|
2002-03-09 20:16:06 +00:00
|
|
|
.Bd -literal -offset indent
|
|
|
|
host_conf="# this goes into /etc/host.conf
|
|
|
|
hosts
|
|
|
|
bind"
|
|
|
|
.Ed
|
|
|
|
.Pp
|
2002-03-15 09:02:26 +00:00
|
|
|
Although not mandatory, in this file you should only set the
|
2002-03-09 20:16:06 +00:00
|
|
|
variables indicated in
|
|
|
|
.Pa /etc/rc.conf.defaults ,
|
|
|
|
and avoid starting services which depend on having the network running.
|
|
|
|
This can be done at a later time: if you set
|
2002-03-18 12:04:52 +00:00
|
|
|
.Va firewall_enable Ns = Ns Qq Li YES ,
|
2002-03-09 20:16:06 +00:00
|
|
|
the
|
|
|
|
.Pa /etc/rc.firewall
|
|
|
|
script will be run after configuring the network interfaces,
|
|
|
|
so you can set up your firewall and safely start network services or enable
|
|
|
|
things such as routing and bridging.
|
|
|
|
.It Pa /etc/rc.firewall
|
|
|
|
This script can be used to configure the
|
2002-03-18 12:04:52 +00:00
|
|
|
.Xr ipfw 4
|
2002-03-09 20:16:06 +00:00
|
|
|
firewall.
|
|
|
|
On entry, the
|
2002-03-18 12:04:52 +00:00
|
|
|
.Va fwcmd
|
2002-03-09 20:16:06 +00:00
|
|
|
variable is set to the pathname of the firewall command,
|
2002-03-18 12:04:52 +00:00
|
|
|
.Va firewall_type
|
2002-03-09 20:16:06 +00:00
|
|
|
contains the value set in
|
|
|
|
.Pa /etc/rc.conf ,
|
|
|
|
and
|
2002-03-18 12:04:52 +00:00
|
|
|
.Va hostname
|
2002-03-09 20:16:06 +00:00
|
|
|
contains the name assigned to the host.
|
|
|
|
.El
|
|
|
|
.Pp
|
|
|
|
There is a small script called
|
|
|
|
.Nm update
|
|
|
|
which can be used to edit and/or save to disk a copy of the files
|
2002-03-15 09:02:26 +00:00
|
|
|
you have modified after booting.
|
2002-03-09 20:16:06 +00:00
|
|
|
The script takes one or more absolute pathnames, runs the
|
|
|
|
editor on the files passed as arguments, and then saves a
|
|
|
|
compressed copy of the files on the disk (mounting and
|
|
|
|
unmounting the latter around the operation).
|
|
|
|
.Pp
|
|
|
|
If invoked without arguments,
|
|
|
|
.Nm update
|
|
|
|
edits and saves
|
2002-03-18 12:04:52 +00:00
|
|
|
.Pa rc.conf , rc.firewall ,
|
2002-03-09 20:16:06 +00:00
|
|
|
and
|
|
|
|
.Pa master.passwd .
|
|
|
|
.Pp
|
|
|
|
If one of the arguments is
|
|
|
|
.Pa /etc
|
|
|
|
(the directory name alone),
|
|
|
|
then the command saves to disk (without editing)
|
|
|
|
all the files in the directory for which a copy
|
2004-07-03 18:29:24 +00:00
|
|
|
already exists on disk (e.g.\& as a result of a previous update).
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh SEE ALSO
|
|
|
|
.Xr crunchgen 1 ,
|
2002-03-18 12:04:52 +00:00
|
|
|
.Xr mdconfig 8 ,
|
2011-07-12 14:18:54 +00:00
|
|
|
.Xr nanobsd 8 ,
|
2012-03-29 05:02:12 +00:00
|
|
|
.Xr swapon 8
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh AUTHORS
|
2000-11-22 09:35:58 +00:00
|
|
|
.An -nosplit
|
2014-06-23 08:27:27 +00:00
|
|
|
.An Andrzej Bialecki Aq Mt abial@FreeBSD.org ,
|
2001-06-20 15:01:17 +00:00
|
|
|
with subsequent work on the scripts by
|
2014-06-23 08:27:27 +00:00
|
|
|
.An Luigi Rizzo Aq Mt luigi@iet.unipi.it
|
2001-06-20 15:01:17 +00:00
|
|
|
and others.
|
|
|
|
Man page and
|
|
|
|
.Pa Makefiles
|
|
|
|
created by
|
2014-06-23 08:27:27 +00:00
|
|
|
.An Greg Lehey Aq Mt grog@lemis.com .
|
1999-12-24 00:16:03 +00:00
|
|
|
.Sh BUGS
|
2009-06-25 09:28:04 +00:00
|
|
|
Documentation is still incomplete.
|