[Toybox] BSD support
Rob Landley
rob at landley.net
Mon Jan 20 20:15:24 PST 2014
On 01/20/14 09:01, Zack Breckenridge wrote:
> > There is a lib/platform.h and lib/platform.c that you're welcome to
> add as
> > much bsd-specific glue to as you can stomach. Those are the places
> for them.
>
> I will try to see what I can do in there. Last night I attempted a first
> shot at simply compiling Toybox with GCC on a Debian GNU/kFreeBSD
> virtual machine. It was an interesting experiment as simply issuing
> 'make defconfig && make' works out of the box (after making sure gcc,
> and some linux kernel headers are installed of course).
>
> I got a list of some 90 or so errors that point to missing header files
> or probably linux-isms as a nice starting point. Next I'll probably try
> and narrow these down into a todo list.
The easy thing to do would probably be:
1) Try to build "make allnoconfig". Make sure there are no always-on
headers that aren't supported. (If there are, they need to be moved to
lib/platform.h in an appropriate #ifdef.)
2) Switch on individual commands, one at a time, and figure out what
_does_ build. If menuconfig's available, this is easy. If not, edit
.config with a text editor. Or, try scripts/individual.sh (which doesn't
support everything even on linux, I need to go do more work on that...)
3) Where applicable, run the test suite. ("scripts/test.sh command" or
"make tests".)
Hopefully the generated/* creation stuff in scripts/* works on bsd.
There are some definite bashisms in there, which I intend to support in
toysh when I get back to implementing that. (What's there is maybe 5% of
the eventual toysh total.)
> > I expect bsd will only ever support a subset of the commands, because
> we're
> > not afraid to be linux-specific. For example, things like ifconfig make
> > liberal use of /proc
>
> Personally, I think it would be great to have (nearly) every Toybox
> command work on FreeBSD somehow even if that means adding some kind of
> emulation shim, or forcing extra requirements on BSD users. For example,
> I know if you 'kldload' the Linux emulation kernel module on FreeBSD you
> get an emulated Linux proc filesystem to work with.
I'm all for it.
FreeBSD 10.0 just dropped, I should probably make another attempt at
installing it under qemu. 9.x didn't like me...
Rob
More information about the Toybox
mailing list