[Toybox] BSD support

Rob Landley rob at landley.net
Wed Jan 22 13:33:08 PST 2014


On 01/21/14 12:27, Matthew Turk wrote:
>>> I've recently ported toybox to run on Native Client, which is Google's
>>> in-browser runtime environment:
>>> https://code.google.com/p/naclports/source/browse/trunk/src/ports/toybox
>>
>>
>> Ooh, very interesting.
>>
>> Is
>> https://code.google.com/p/naclports/source/browse/trunk/src/ports/toybox/nacl.patch
>> the only patch you're applying?
>
> Yup.

Possibly I can chip a few bits out of that myself and put 'em in 
platform.h. Some of it looks quite straightforward. (Taken as a whole, 
reading it requires some eye bleach though. Redefining main() like 
that... better to move the non-main bits out of main.c and have the 
ability to pull in a different main.c for embedded builds...)

> A number of the toys have been disabled, which you can see in
> the toybox.config file.

Indeed.

> I've put a build of this here:
>
> http://yt-project.org/upload/toybox/toybox.html
> ( http://yt-project.org/upload/toybox/toybox.html?arg1=sh for the shell )

"Browser does not support PAnCL or PAnCL is disabled."

I take it I need a chrome box to run this?

Where do I read up on "what is nacl"?

>>> .  I'm afraid I didn't know about these porting suggestions, so I've
>>> made some changes in the patch that are likely against the spirit of
>>> the porting instructions you've given above.  Anyway, I'm going to try
>>> to go through and clean it up, keeping these things in mind.  The
>>> biggest hurdle was getting a working getcwd, as NaCl has some quirks
>>> in that regard, and the various dirfd-taking *at commands.
>>
>>
>> I believe all of that's in posix-2008 now.
>
> Ah, great, thanks.

I'd very much like to get a "what's the diff for posix-2013", given that 
https://lwn.net/Articles/581858/ and such are using the name. It'd be 
nice to be able to say posix 2013 compliant, but the snapshot I've been 
working on is posix-2008 (already did the move from the posix-2003 that 
was out when I started this in 2007), and I don't want to completely 
re-triage everything...

Alas, they talk about an annex but I can't _find_ it broken out. When I 
try to diff the html pages I get lots of markup differences because the 
generator changed...

>>> The long and the short, though, is that Toybox is pretty great and was
>>> quite nice to get running in that environment.
>>
>>
>> Yay. I'm glad you find it useful.
>>
>> I note that toysh is more or less a stub. I have elaborate plans for it, but
>> haven't had time to actually implement most of them yet.
>
> Understood.  Even as is, it ably serves the purpose I was looking for,
> which is to provide a serviceable shell for navigating the mount
> points and file systems used by the pexes in native client.

Well, the next big lump is environment variables, which implies quote 
parsing. Getting quote parsing right is five times as much work as 
anything actually to do with environment variables. :)

> I'm going
> to try to clean up the patch applied for NaCl, as I see from the
> discussion here I've done some things sub-optimally.  As the NaCl SDK
> grows to encompass more system calls and the like, I think more
> compile-time options and toys can be turned on.

md5sum/sha1sum looks low-hanging?

There's a fairly large lump of stuff added to lib/portability.c that 
looks like it really belongs in nacl's libc or something?

It might even be enough to justify me replacing lib/portability.c with a 
lib/portability directory containing individual C files, but how to 
select 'em is a big enough bother I'd probably hold off for now...

Always more todo items...

> I found myself somewhat overwhelmed when I tried to compile busybox,
> for precisely the reasons you suggest.
>
> Thanks again for toybox -- and I empathize with the difficulties of
> context switching.  Despite that, toysh works pretty well for
> navigating the restricted environment I'm using it in!

Well, here's hoping I can make it better...

(But this weekend, I need to get an aboriginal linux release out caught 
up with the 3.13 kernel...)

Thanks,

Rob

 1390426388.0


More information about the Toybox mailing list