since rob asked on some other thread earlier this week...

NDK r15beta2 should hopefully ship in time for I/O in a couple of weeks, so
i had a quick go at building toybox out of the box with the latest bits...

$ ./android-ndk-r15-beta2/build/tools/make_standalone_toolchain.py
--unified-headers --arch arm64 --api 24 --install-dir
/tmp/n-standalone-toolchain
$ git clone https://github.com/landley/toybox.git
$ cd toybox
$ CC=clang
CROSS_COMPILE=/tmp/n-standalone-toolchain/bin/aarch64-linux-android- make
defconfig
$ CC=clang
CROSS_COMPILE=/tmp/n-standalone-toolchain/bin/aarch64-linux-android- make

i've attached one patch to make mkpasswd not part of the "defconfig" for
Android, since (a) we don't have passwd and (b) we don't have crypt(3). so
it wouldn't be any use and you can't build it anyway.

i've attached another patch to add liblog to the list of probed libraries
so that toybox actually links okay.

with that there's only one problem left (ignoring compiler warnings, and
the fact that selinux and boringssl aren't part of the NDK so you'll be
without working versions of any of the selinux stuff or fast versions of
the hash stuff) --- there is no public API for the <cutils/sched_policy.h>,
so that still won't build out of the box.

(this was a useful exercise because it showed that <scsi/sg.h> was still
missing from the NDK, so that bug should finally be fixed for real this
time.)

-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.
From fa5361746673d57525252853af30e6636575ce67 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Fri, 28 Apr 2017 15:21:36 -0700
Subject: [PATCH] Building mkpasswd on Android makes no sense.

And won't work anyway because we don't have crypt(3).
---
 toys/other/mkpasswd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/toys/other/mkpasswd.c b/toys/other/mkpasswd.c
index 2e1c1a9..fe1bd26 100644
--- a/toys/other/mkpasswd.c
+++ b/toys/other/mkpasswd.c
@@ -10,6 +10,7 @@ USE_MKPASSWD(NEWTOY(mkpasswd, ">2S:m:P#=0<0", TOYFLAG_USR|TOYFLAG_BIN))
 config MKPASSWD
   bool "mkpasswd"
   default y
+  depends on !TOYBOX_ON_ANDROID
   help
     usage: mkpasswd [-P FD] [-m TYPE] [-S SALT] [PASSWORD] [SALT]
 
-- 
2.13.0.rc0.306.g87b477812d-goog

From cd599e4bb7e882e164c59d18af858164d9a40606 Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Fri, 28 Apr 2017 15:25:56 -0700
Subject: [PATCH] Android needs -llog to link.

---
 scripts/make.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/make.sh b/scripts/make.sh
index 5792847..e35feb6 100755
--- a/scripts/make.sh
+++ b/scripts/make.sh
@@ -109,7 +109,7 @@ then
   # for it.
 
   > generated/optlibs.dat
-  for i in util crypt m resolv selinux smack attr rt crypto
+  for i in util crypt m resolv selinux smack attr rt crypto log
   do
     echo "int main(int argc, char *argv[]) {return 0;}" | \
     ${CROSS_COMPILE}${CC} $CFLAGS -xc - -o generated/libprobe -Wl,--as-needed -l$i > /dev/null 2>/dev/null &&
-- 
2.13.0.rc0.306.g87b477812d-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to