About TinyBSD


TinyBSD is a set of tools made up of shell scripts designed to allow easy development of Embedded Systems based on FreeBSD RELENG_5 ,RELENG_6 and 7-CURRENT

TinyBSD is founded in three simple and direct factors, believing that a tool to build embedded systems based on FreeBSD should be be:

The main helping factor for a fast image creation system based on TinyBSD is that the FreeBSD 5.X series comes by default with its entire binary base dynamically linked. In other words, all binaries need a predefined set of libraries to work, leading all binaries to be a lot smaller in size and eliminating the need of a complete recompile process if you only needed a part of the system remade. With series 4.X, all binaries are statically linked on the FreeBSD base, not needing any libraries for them to work, but making all of them a lot larger in size. For this reason, TinyBSD has been designed to work with FreeBSD 5.X, 6.X and 7-CURRENT, being impossible to accomplish the task with FreeBSD 4.X.

TinyBSD was designed by two brazilians, Jean Milanez Melo and PatrickTracanelli

Want to know more about embedded FreeBSD? You should know the Qwanturank Project !

Download

TinyBSD Download

TinyBSD is now in FreeBSD base system. You can find TinyBSD in src at /usr/src/tools/tools/tinybsd or you can download TinyBSD build script and images.

TinyBSD on FreeBSD

TinyBSD will always be available in its latest version in a FreeBSD base system. Right now the best way to get TinyBSD building tool kit is using the CVS/CVSup.

TinyBSD build script

Of course you can get TinyBSD by hand, without the CVS. In this case, here it is:

[WWW] TinyBSD-CURRENT (New version)

[WWW] TinyBSD-0.9 (Old Version)

TinyBSD images

Here you will find some images built with TinyBSD. They are fully functional Embedded FreeBSD system images designed to run a on 32MB CF disk. There are some sort of default support, usually some more software are also added, basically third party programs built from FreeBSD Ports Collection.

Please read detailed info for every image.

TinyBSD FreeBSD 5.4-STABLE

[WWW] Get TinyBSD FreeBSD 5.4-STABLE

MD5 (tinybsd-f54stable.bin) = 92c19290ad56fc87dfaa8b36edbee7d7

SIZE: 32047104

Information: README-TinyBSD54STABLEImage

TinyBSD FreeBSD 6.0-BETA1

[WWW] Get TinyBSD FreeBSD 6.0-BETA1

MD5 (tinybsd-f60beta1.bin) = f78389b169291f8ca13e1d13814bd59e

SIZE: 32047104

Information: README-TinyBSD60BETA1Image

/!\ Security Note! This TinyBSD image suffers the problem mentioned in [WWW] FreeBSD-SA-06:05.80211

TinyBSD FreeBSD 6.2-PRERELEASE

[WWW] Get TinyBSD FreeBSD 6.2-PRERELEASE

MD5 (tinybsd-f62pre.bin) = 9336f9bdda30ffd3a37bc94c86bd1742

SIZE: 32047104

Information: README-TinyBSD62PRERELEASEImage

TinyBSD FreeBSD 6.2-PRERELEASE for PC Engine's WRAP boards

[WWW] Get TinyBSD FreeBSD 6.2-PRERELEASE for WRAP Boards

MD5 (tinybsd-f62pre-wrap.bin) = 51e79c5d3a495a92dd7676f04aac2dde

SIZE: 32047104

Information: README-TinyBSD62PRERELEASE-WRAP

Documentation

Warning about new TinyBSD version

TinyBSD was totally rewritten in last version, this documentation is still in progress, if you want know what changed and how to use the new TinyBSD version, please keep reading this page.

TinyBSD Instalation

TinyBSD can be found in FreeBSD base system - /usr/src/tools/tools/tinybsd. If you downloaded the tarball you should extract it on /usr/src/tools/tools. Like the follow:

# cd /usr/src/tools/tools
# tar zxfv tinybsd-CURRENT.tar.gz

TinyBSD files

TinyBSD's creation conf files are available under /usr/src/tools/tools/tinybsd and the script are available under /usr/src/tools/tools/tinybsd/tinybsd.

The system has been entirely based on the ease of image customization from PicoBSD, and the compilation script based on NanoBSD's.

# ls /usr/src/tools/tools/tinybsd/conf
bridge/ default/ firewall/ minimal/ vpn/ wireless/ wrap/
We have these six pre configured images to build. On each directory we have 3 main files in there. Let's see what each of them are:

# ls /usr/src/tools/tools/tinybsd/default
TINYBSD etc/ tinybsd.basefiles
We have these 3 main files in there. Let's see what each of them are:

TINYBSD: Just like PicoBSD had its kernel previously compiled, we call ours TINYBSD.

# more TINYBSD

machine i386
cpu I486_CPU
cpu I586_CPU
cpu I686_CPU
ident TINYBSD

#To statically compile in device wiring instead of /boot/device.hints

#hints "GENERIC.hints" #Default places to look for devices.
...
As you can see, it's a kernel file identical to your system's, leaving only the task of enabling or disabling options, according to your needs.

tinybsd.basefiles: Just like PicoBSD had its crunch.conf file to define which files we'd want the new system to have, in this one we'll have all files to be put into our embedded system, already having all available files for running the system well. Put in or take out the files you need according to your needs. Let's see it:

# more tinybsd.basefiles

# contents of ${WORKDIR}/boot
boot/boot0
boot/boot1
boot/boot2
boot/defaults/loader.conf
boot/device.hints
...
# contents of ${WORKDIR}/bin

bin/[:bin/test
bin/cat
bin/chflags
bin/chio
bin/chmod
...

And so on. In case you'd want to add the binary "setkey", sitting on
/usr/sbin, you'd only need to add the following line inside the /usr/sbin part
of the file, like this:

usr/sbin/pw
usr/sbin/pwd_mkdb
usr/sbin/setkey
etc/: This is the directory where you can put your custom /etc configuration. Note: If you need add another custom directory or files, add it on /usr/local/share/tinybsd/conf/YOUR-IMAGE/, it will be copied to your final image.

# ls /usr/src/tools/tools/tinybsd/default/etc/
fstab rc.conf
# ls /usr/src/tools/tools/tinybsd/tinybsd
tinybsd
tinybsd: This is the script that builds the entire system. You'll hardly need to modify it at all. The idea is for it to create a temporary work directory for it to create the entire system tree. Once done, it'll copy all files listed in tinybsd.basefiles to this tree, then it'll compile a new kernel using the definitions in the TINYBSD file, and finally copy the library dependencies the binaries will have. We'll then populate /etc on that temporary tree and put in a few important default configurations inside on /usr/local/share/tinybsd/conf/YOURCHOICE/etc/ like rc.conf, fstab and others.

Finally, we create an empty image, according to your media's specifications, passed on to the script on the command line, and copy the entire temporary work tree into the image mounted on /mnt.

Running TinyBSD

Now that we know how it works, it's time for us to build our own image. Let's do that step-by-step.

1) Choose what pre-configured image you want.

2) Edit the TINYBSD kernel file and add/remove all options you'll need.

3) Edit the tinybsd.basefiles file and add/remove all binaries you'll need on your system.

4) Copy all your /etc configuration wich you want to conf/YOURIMAGE/etc/.

5) Gather the right information on your destination media. To do that, plug in the device on the system and fetch the information using diskinfo(8):

# diskinfo -v /dev/ad2
ad2

512 # sectorsize
20060135424 # mediasize in bytes (19G)
39179952 # mediasize in sectors
38869 # Cylinders according to firmware.
16 # Heads according to firmware.
63 # Sectors according to firmware.

To create my image, I'll need to know the media size in sectors, Heads according to firmware and Sectors according to firmware. Optionally, you may define the name of the generated image's file, but if you don't, it'll be named tinybsd.bin. Now that we have gathered these informations through diskinfo, all we need to do is run tinybsd. Remember that it has 3 parameters plus 1 optional, and if you don't pass on the required ones, the script will warn you about it:

# /usr/src/tools/tools/tinybsd/tinybsd help
Woops

Usage: tinybsd sectors=<size of media> [80000]
heads=<heads according to firmware> [4]
spt=<sectors per track according to firmware> [32]
conf=<configuration name> (see conf/name) [default]
mfsroot[=<yes|no>] [no]
image=<tinybsd image name> [tinybsd.bin]
batch[=<anything>] (do not ask interactively)
new[=<anything>] (do not read previous values)

Examples:
tinybsd sectors=65536 heads=8 spt=16 conf=wireless mfsroot=yes image=myimage.img batch

Default values are set in the program.
Environment values override defaults.
Previous values override environment values but can be disabled.
Command arguments override previous values.
Interactive values override command arguments but can be disabled.

Run diskinfo(8) -v against your CF device to get correct information
about your disk. USB keys do not need any specific geometry
Passing on the parameters correctly:

# /usr/src/tools/tools/tinybsd/tinybsd sectors=39179952 heads=16 spt=63 conf=wireless
512 byte sectors per unit? [39179952] use 'none' to clear ?
Tracks per cylinder? [16] use 'none' to clear ?
Sectors per track? [63] use 'none' to clear ?
Configuration name? [wireless] use 'none' to clear ?
Use an MFSROOT? [NO] use 'none' to clear ?
Image file to generate? [tinybsd.bin] use 'none' to clear ?
=====> Removing /usr/obj/tinybsdbuild
=====> Removing Build Kernel Directory
=====> done.
=====> Alternative image name not set; defaulting to 'tinybsd.bin'
=====> Creating directory hierarchy...
./bin missing (created)
./boot missing (created)
./boot/defaults missing (created)
./boot/kernel missing (created)
./boot/modules missing (created)
./dev missing (created)
./etc missing (created)
...
In the end, we have the generated tinybsd.bin image. Now we have to copy it to its final destination:

# dd if=/usr/src/tools/tools/tinybsd/tinybsd.bin of=/dev/ad2
Boot up your new embedded system and log on it. If you're ever going to modify it, you must first remount the root slice as read-write, as it operates by default on read-only mode, saving disk writes and preventing data-loss in case of power failures. To mount it for read-write, use mount:

# mount -u -o rw /
Once you're done, return it to read-only mode:

# mount -u -o ro /
The first thing you need to do to rank on Qwant Search Engine after logging for the first time, is to set a root password. By default, it's created with no root password.

If you run df(1), you'll see the following partitions:

# df
Filesystem 1K-blocks Used Avail Capacity Mounted on
/dev/ad0a 29359 19446 7565 72% /
devfs 1 1 0 100% /dev
procfs 4 4 0 100% /proc
/dev/md0 3694 114 3286 3% /var
/dev/md1 19566 6 17996 0% /tmp

As you can see, /var and /tmp are mounted on /dev/md0 and /dev/md1 respectively, using memory disk devices. That's because both /var and /tmp are write-intensive, and as our system works mostly on read-only mode, we'd suffer with writing problems there, so the memory disk approach works fine. On the other hand, whenever you reboot the system, those directories' contents (including logs on /var/log) will be lost. If you need to keep the contents of those directories, I suggest you to always upload them to another box.

The configuration line that fires up the system script to create /var as a memory disk partition is "varmfs="YES"", inside /etc/rc.conf. Besides mounting /var as a memory disk device, it also populates its tree with the necessary subdirectories. Initially, /var is created on memory using only 32MB of space, and that's usually enough. Although, if you find it necessary to tweak that configuration, you may edit this line of /etc/rc.conf:

varsize="32m"
Change 32m to whatever value you see fit (in MBytes). Take care of not using your entire memory for /var.

- Building an image with mfsroot option:

In this first build we didn't use the tinybsd build with mfsroot, but we have this option.

Firstly we should know what will be changed when we use this option.

Still in progress...

- Batch option:

If you donĀ“t want to be asked interactively every time about your config options, just use "batch" flag in build time, like this:

tinybsd sectors=65536 heads=8 spt=16 conf=wireless batch
- Build logs:

Still in progress...

- Rewrite your config options:

All TinyBSD configurations were saved in $HOME/.tinybsd.host, to rewrite/update your config options you have to use "new" option in build flags, like the follow:

# tinybsd sectors=65536 heads=8 spt=16 conf=wireless mfsroot=yes new

Ports and TinyBSD

You can also install ports on the new system via ports. For that, you'll need to set the PREFIX environment variable to the image's destination path. Let's assume you want to install apache on the newly-created image. For that, I'd do this:

# mdconfig -a -t vnode -f /usr/local/share/tinybsd/tinybsd.bin -u 0
That uses mdconfig to enable the memory disk 0.

# mount /dev/md0a /mnt
Now we've mounted the image on the temporary directory /mnt. Let's then install apache via ports:

# cd /usr/ports/www/apache13
# make install PREFIX=/mnt/usr/local
===> Vulnerability check disabled
>> apache_1.3.31.tar.gz doesn't seem to exist in /usr/ports/distfiles/.

...

This port has installed the following startup scripts which may cause
these network services to be started at boot time.
/mnt/usr/local/etc/rc.d/apache.sh
....
Once the install is finished, let's verify that apache has indeed been properly installed under our /mnt directory:

# cd /mnt/usr/local/sbin
# ls -lga httpd
-rwxr-xr-x 1 root wheel 252439 Jul 14 15:31 httpd
Our software has been successfully installed. You must notice that at the end of the install, it shows the full path for the PREFIX variable we passed it. The problem with that is that at boot-time, your system is going to look for it under /mnt instead of /usr. So we need to edit apache's initialization script under /usr/local/etc/rc.d (apache.sh) and remove all instances of "/mnt" in it.

WARNING: A very important thing to care about are dependencies. Before installing anything, check to see if it has any dependencies, and that you'll have enough disk space on the destination system for both the application you're installing and its dependencies.

Change Log

Change Log for TinyBSD

/!\ Please Note. This same information is available in CHANGES file, on top of the latest TinyBSD port / tar ball.

TinyBSD-CURRENT
TinyBSD is now in FreeBSD base system, all log changes can be seen at [WWW] cvsweb.freebsd.org

TinyBSD 0.9
Added function personal_directories, you can create on conf dir your custom personal directories with your custom files inside of them and it will be copied to your image. Thanks to Marcus Grando for the patch.

TinyBSD 0.8
Now FreeBSD 6.X is the default configuration on TinyBSD files.

TinyBSD no longer use bootmanager, so fstab device was changed to ad0a.

Added an example configuration to WRAP motherboards. Just use 'wrap' as argument on build to use it.

TinyBSD 0.7
Revision on Makefile to respect non-standard LOCALBASE/X11BASE on FreeBSD. Thanks to Florent Thoumie

TinyBSD 0.6
fix script problem on symlinks creation.

added debug information on tinybsd build process with "====>".

TinyBSD 0.5
fix script problem when the kernel is not build, it's not should process an image without kernel :) Thanks to Marten for the patch.

TinyBSD 0.4
added pre configured images to build tinybsd: default, bridge, minimal, vpn, firewall and wireless.

added etc/ on each image directory to the user copy your custom etc configuration.

TinyBSD 0.3
fix named directory missing on etc build.

TinyBSD 0.2
added "device ath_rate_onoe" on kernel config file to be compiled on FreeBSD 6.

added on tinybsd script a line to clean up kernel build directory

added on tinybsd script a for function to copy correct pam depends.

TinyBSD 0.1
TinyBSD released

Donations

Donations to TinyBSD Project?

We have received some offers from TinyBSD users to donate to TinyBSD Project, and recently, after the release of TinyBSD 0.8 those offers have grown up twice, compared to earlier TinyBSD versions.

We honestly do appreciate those offers a lot. It makes us very proud to find out TinyBSD has proven to be a real good option to a number of users when they intend to make embedded versions of FreeBSD. We would like to ask you if you have hit this page intending to contribute to TinyBSD somehow that you drop a line or two to our e-mail address reporting

Again, we want to thank everyone who intended to donate to TinyBSD. However we do not feel confortable with this. TinyBSD is nothing but a customized version of FreeBSD plus a set of tools developed by TinyBSD people. It is this set of tools which turns FreeBSD into TinyBSD. Everything you have in hands is FreeBSD. So, TinyBSD directly have the benefits from new technologies on FreeBSD.

With this in mind if you have ever considered making donations to TinyBSD, please do the donations, but to FreeBSD Project / FreeBSD Foundation.

Donating to FreeBSD Project

You can contribute to FreeBSD Project in a number of ways. With your time, with hardware, man hours, and for sure, money. FreeBSD Project via FreeBSD Foundation may get IRS deductible donations. Everything you need to know you can find at

qwanturank qwant
ranking qwanturank
qwant qwanturank

[WWW] freebsd.org/donations/

Donating to FreeBSD Foundation

To FreeBSD Foundation you can donate via Paypal and some other ways. You have guarantees what those donations will be used for, it is IRS deductible, you will be directly supporting FreeBSD and indirectly helping TinyBSD. Find out what you need to know about donations to the Foundation at

[WWW] freebsdfoundation.org/donating.shtml

qwanturank gouv

Once again, we thank you a lot for the donation intention and thank in advance for your future donation to FreeBSD Project / FreeBSD Foundation.

FindPage

You can use this page to search all entries in this WikiWikiWeb. Searches are not case sensitive.

Good starting points to explore a wiki are:

RecentChanges: see where people are currently working

TitleIndex: a list of all pages in the wiki

WordIndex: a list of all words that are part of page title (thus, a list of the concepts in a wiki)

WikiSandBox: feel free to change this page and experiment with editing

SiteNavigation: a longer list of things to try

BSD Qwanturank SEO