[Toybox] [PATCH 00/10] toybox for android.

Georgi Chorbadzhiyski gf at unixsol.org
Wed Mar 7 16:38:52 PST 2012


With these patches I'm able to cross compile toybox allyesconfig
for android. I'm using the Linux NDK from http://developer.android.com/sdk/ndk/index.html
http://dl.google.com/android/ndk/android-ndk-r7b-linux-x86.tar.bz2

I have not tested the resulting toybox binary! It just compiles.

What is broken:
  toysh, xargs - same problem as with OS X - missing getdelim() and getline().
  who          - utmpx is not supported in bionic.
  netcat       - -t parameter requires forkpty() which is not supported in bionic.
  id           - getgrgid_r() is unsupported, no extra group info.
  lib/getmountlist.c - Possibly broken.
  lib/lib.c    - terminal_size() is most likely broken.

The compilation settings are hardcoded in the configure file. To test compilation
for Android download the NDK from the URL above, untar it in some directory, then
change NDK_ROOT variable in configure.

There is an ugly hack that copies crtbegin_dynamic.o and crtend_android.o files
from NDK in the toybox root directory. I was unable to force the linker to use them
where they are.

Patches are available in android branch at https://github.com/gfto/toybox

Georgi Chorbadzhiyski (10):
  configure: Hardcode android cross compilation parameters.
  scripts/make: Do not add -lutil to linker flags.
  toys.h: Add __ANDROID__ checks where needed.
  lib/portability.h: In bionic there is no statvfs replace it with
    statfs.
  lib/lib.c: struct winsize is not defined in bionic.
  lib/getmountlist: setmntent(), getmntent_r() and stpcpy() are not
    defined in bionic.
  mdev: Do not use strndupa().
  Use fprintf(stderr, ...) instead of dprintf().
  Define sethostname(), swapon() and swapoff().
  getgrgid_r(), forkpty(), getline(), getdelim(), and getutxent() are
    unsupported in bionic.

 configure          |    9 +++++++++
 lib/getmountlist.c |   31 ++++++++++++++++++-------------
 lib/lib.c          |    7 +++++--
 lib/portability.h  |    7 ++++---
 scripts/make.sh    |    2 +-
 toys.h             |   11 +++++++++++
 toys/count.c       |    4 ++--
 toys/hostname.c    |    7 +++++++
 toys/id.c          |    2 ++
 toys/mdev.c        |   11 ++++++++---
 toys/netcat.c      |    2 ++
 toys/patch.c       |   22 +++++++++++-----------
 toys/sed.c         |    2 +-
 toys/swapoff.c     |    7 +++++++
 toys/swapon.c      |    7 +++++++
 toys/toysh.c       |    2 +-
 toys/who.c         |    4 ++++
 toys/xargs.c       |    2 +-
 18 files changed, 101 insertions(+), 38 deletions(-)

-- 
1.7.5.1


 1331167132.0


More information about the Toybox mailing list