busybox and small scripting languages on FreeBSD ? (was Re: 80
Mb / enough for 7.x? OK to delete /stand/ and /modules/ ?)
koitsu at FreeBSD.org
Sat Aug 2 23:38:15 UTC 2008
On Sat, Aug 02, 2008 at 04:07:47PM -0700, Sam Leffler wrote:
> Luigi Rizzo wrote:
>> On Sat, Aug 02, 2008 at 11:39:20AM -0700, Sam Leffler wrote:
>>> I've been looking at nanobsd for a couple of applications and working
>>> to reduce the footprint of the images without hacking special rules.
>>> If we're ever to consider building images for flash parts (not
>>> compact flash) then we'll need to do a lot of work to pare down the
>>> bloat--or replace current apps w/ special purpose replacements a la
>>> busybox (not something I find appealing).
>> related to this thread -- does anyone have experience in trying
>> to build busybox on FreeBSD ?
> My last experience w/ busybox was >1 year ago and I'm not sure I was
> using anything close to up to date, but...it was utterly linux-specific.
> Given what it does and what I saw in the code I'd be more inclined to
> write one from scratch.
I've also dealt with Busybox under Linux, specifically on embedded
environments (Linksys WRT54G-series). And I agree -- the code is
absolutely *horrible*. It resembles years of multiple people hacking on
it, one line at a time, with code comments ranging from very few to
I found a major file descriptor leak in the Busybox code, and Googling
details revealed that the Debian folks had also found it. Throughout
numerous parts of Busybox, close(2) wasn't being called. The
implications here are tremendous, especially since this program is being
toted as "a fantastic application suite for embedded systems". The bug
has since been fixed, but that kind of mistake is negligent.
I would highly recommend creating something else from the ground up, or
as Sam recommended, slimming down existing applications.
> Not sure about scripting languages but what's really needed is a
> lightweight http solution that supports ssl. This can go a long way
> before you get to php et. al. My last project of this sort used
> tinyhttp (I think, whichever one Jeff Pozkanzer did) and php. But we
> didn't try to fit in flash, we used compact flash parts. I think
> tinyhttpd+php is also what m0n0wall and pfsense use but haven't looked
> in a while.
I'm sure PHP suffices for environments which have CF/SD cards, or actual
ATA disks -- but for real embedded environments (read: 4-8MB flash,
etc.) PHP won't work. The stripped binary comes out to a little over
If the webserver chosen supported something like an extended version of
server-parsed HTML, that could be benefitial here.
Also, I'll take a moment to point out that the webserver that's used on
the WRT54G platform (I believe Busybox's internal HTTP server, but I
could be wrong) is horrible performance-wise. It doesn't matter what
flavour of release (Tomato, Thibor, DD-WRT, OpenWRT, etc.) you go with
-- a single page load results in a good 40-50 individual TCP connections
being made to the webserver. You can practically deadlock the box by
continually clicking Reload in your browser. This is probably because
the webserver doesn't support Keepalives or HTTP/1.1, but again, the
implications are horrible when you consider these boxes are commonly
being used for NAT; resource starvation seems likely.
If tinyhttp supports 1.1 or Keepalives, great, problem solved.
| Jeremy Chadwick jdc at parodius.com |
| Parodius Networking http://www.parodius.com/ |
| UNIX Systems Administrator Mountain View, CA, USA |
| Making life hard for others since 1977. PGP: 4BD6C0CB |
More information about the freebsd-stable