[Toybox] Android support

Rob Landley rob at landley.net
Fri Nov 21 04:54:02 PST 2014


On 11/21/14 00:42, enh wrote:
> On Thu, Nov 20, 2014 at 9:24 PM, Rob Landley <rob at landley.net> wrote:
>> On 11/20/14 12:33, enh wrote:
>>> i notice you just added sethostname to portability.c which causes this
>>> warning on Android:
>>>
>>> external/toybox/lib/portability.c:70:3: warning: implicit declaration
>>> of function 'syscall' [-Wimplicit-function-declaration]
>>>    return syscall(__NR_sethostname, name, len);
>>>
>>> the correct #include would have been #include <sys/syscall.h>, not
>>> <asm/unistd.h>. you really shouldn't ever #include an asm/ file.
>>
>> Agreed.
>>
>> I merged the contribution mostly as-is because I don't have an android
>> build environment set up. (I need to reinstall a system to get an
>> environment to set up AOSP in, and the release deadline was 4 days
>> overdue...)
>>
>>> i'm also curious about what your target is. AOSP master has
>>> sethostname, so you don't need any of this. (but you do need some
>>> other changes.)
>>
>> My target is making these guys happy:
>>
>> https://code.google.com/p/android/issues/detail?id=76861
>>
>> That said, I see they posted their own diff to that thread since the
>> last time I looked at it, so I'll see about merging that instead.
> 
> ah. that makes things easy then --- i'm the google guy on that bug :-)
> 
> i'm happy just building toybox as part of the platform, and there --
> to repeat what i said on the bug for the new audience on this list --
> the only things we're missing right now are <pty.h>, <shadow.h>, and
> <utmpx.h>.
> 
> here's the patch i committed this morning:
> https://android-review.googlesource.com/#/c/115676/1/lib/portability.h

Checking in the .config file makes a certain amount of sense for your
build environment, but why are you checking in generated/* files?
They're rebuilt from scratch each time. (You might want to add the whole
"generated" directory to your .gitignore instead of specific files.)

Do you try to get Android.mk files upstream into projects, or do you
prefer to maintain them locally? (I could add a scripts/android
directory with your .config and Android.mk in it, but I don't know if
that would help.)

> for a real patch you'd probably want to stop building the getdelim and
> getline implementations too. i can send one to the list if that'd
> help.

Yes please. I'm not quite sure what bionic provides here. I've
encountered three states:

1) libc provides getdelim/getline and knows it.

2) libc provides getdelim/getline but the headers won't reliably give
prototypes for them.

3) libc doesn't provide getdelim/getline, we need to provide our own.

The existing patch seems to put bionic in #2 above?

>> I'll try to get the better android patch applied this weekend. (The
>> annotation of individual commands that won't work without utmpx and such
>> in the old patch is good, so I should merge the two...)
> 
> yes, the annotations are a nice solution. i wish i'd had that a week ago :-)

I've merged your portability.h change, let me know if there's more.

> i do plan on implementing <pty.h>, hopefully before the next release,
> but i didn't want to hold up getting started on using toybox until
> that's done.

Have you seen musl-libc.org? It's a very nice MIT-licensed libc (written
from scratch in the past ~4 years) that you might be able to lift code
like that from.

>> Thank you,
>>
>> Rob
> 

 1416574442.0


More information about the Toybox mailing list