[Toybox] BSD support

ibid.ag at gmail.com ibid.ag at gmail.com
Mon Jan 20 00:36:04 PST 2014


On Sun, Jan 19, 2014 at 09:25:57PM -0700, Zack Breckenridge wrote:
> Hello all,
> 
> I understand that this project is Linux focused, but I can't help but
> wonder if there would be any positive reception to 'porting' Toybox to
> FreeBSD (and possibly OS X)?
> 
> I would like to contribute to the project regardless (these are my
> three main platforms), and I suppose this could be a much larger
> undertaking than I'm prepared for. Simply curious. Has this been
> discussed already and apologies if so.
> 

As I recall, Rob has mentioned the idea of porting it, but ran into
difficulties getting a QEMU image for testing.
So the FreeBSD port should be welcome...if it's done cleanly.

Anyhow, things to watch out for:
#ifdef __PLATFORM:
Somewhere, Rob's got a link to "#ifdef considered harmful". 
We try to avoid #ifdef because it obscures the bigger picture, and 
when it's needed, we try to isolate it (better to have one header full
of ifdefs than a dozen files...)

Non-portable includes:
These should _never_ go in toys.h.
I suspect this might mean adding "toy-platform.h" or something similar.

Non-portable functions:
I think there's some sort of probing that the toybox build system does...
See lib/portability.c for how we handle some missing functionality.

"Portable" is more-or-less "That portion of POSIX 2008 that is widely
implemented", afaict.

Also, be sure to check whether it makes sense to use a command on the
kernel you are porting to. pivot_root may well be irrelevant for you.

Thanks,
Isaac Dunham



More information about the Toybox mailing list