Re: FreeBSD's embedded agenda

From: John Birrell <jb_at_what-creek.com>
Date: Tue, 30 May 2006 04:02:20 +0000
On Mon, May 29, 2006 at 05:32:32PM -0400, Andrew Atrens wrote:
> So then we agree - write a driver that makes raw flash look like a CF,
> and does wear-levelling, gc, etc, under the hood. Then put whatever
> f/s you want on it. it's a start at least. Then build your kick-ass
> NAND-aware (or NOR aware or both) fs on top of that that makes use of
> some extensions that the driver provides.  Okay, that's quite the
> arm wave ... I must admit that I don't know so much about the existing
> fs<->disk interface...

Writing a NAND driver for FreeBSD using geom is a trivial matter. It
only takes a few days or a week at the most.

I don't really understand what all the fuss is here. I've built FreeBSD
embedded systems that are smaller than all the picobsd etc configurations
which all rely on choosing programs out of the standard FreeBSD tree and
putting them on a 'disk'.

The smallest embedded system using FreeBSD consists of just a kernel
and a threaded program which runs as 'init'. No other files are required
(subject to how you boot, so perhaps include the loader). You most
certainly don't need anything all from /etc. You don't need a shell.
You don't need shared libraries.

Try it! Build a kernel that does nothing other than have devices in
it to talk to a console and floppy disk. Boot from floppy using the
current loader and write a minimal app that will talk to the console.
Tell me how big the kernel and the app is. It won't take you longer
to do that to write all the messages you are posting here.

Configure your system to mount the root file system read-only and
any temporary data that you want to write, do it to a ram disk. Boot
the system, check that your 'init' program works and then just turn the
power off. It should boot up again next time without any problems.

You can make your 'init' program remount the disk in write mode if
it needs to change any config data. Then it can remount it again 
read-only and you're back in fail-safe mode.

I've done this with a FreeBSD based video recorder mounted to a race
motorcycle in the Australian Formula Xtreme series. When the rider
powered up his bike, the embedded FreeBSD system (which is just an
embedded board) booted and automatically started recording. When he
returned to the pits and turned off his bike, the FreeBSD system
detected the fact that the bike was turned off and went through it's
shutdown sequence, closing the video file which was on CF (not NAND
where the OS was) and then when the buffers were flushed, it toggled
an output bit which opened a relay contact and powered itself down.

This is all trivial to do with FreeBSD and has been since FreeBSD-4
when I first tried it. You end up with custom software to make your
'init' program have just the features that you want (and FreeBSD's
libraries aren't too convenient for that), but it's all do-able without
a million emails to a mailing list postulating on how to do it.

Just try it with what is in FreeBSD now.

Sigh.

--
John Birrell
Received on Tue May 30 2006 - 02:02:23 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:56 UTC