[Toybox] toybox and NDK sitrep

Rob Landley rob at landley.net
Sun Apr 30 00:58:32 PDT 2017


On 04/28/2017 05:31 PM, enh wrote:
> 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...

Yay!

In other test harness news, I've put a lot of work into
https://github.com/landley/mkroot in the past week or so (simple
musl-libc test environment booting under qemu), and if you run the
mcm-buildall.sh script against
https://github.com/richfelker/musl-cross-make and then do something like

CROSS_COMPILE=~/musl-cross-make/output/aarch64-linux-musleabi-cross/bin/aarch64-linux-musleabi-
./mkroot.sh dropbear kernel

If it works you can then cd output/aarch64" and ./qemu-aarch64.sh and it
should boot you into a little emulated system.

I haven't got the whole https://landley.net/aboriginal/control-images
infrastructure reproduced yet, but I'm working on it.

I'd love to point CROSS_COMPILE at the NDK toolchains and try to get
those to work too. (Although the main reason I can use musl-cross-make
is I made puppy eyes at Rich to provide _native_ compilers, so my little
emulated environment can natively build stuff in the emulator. I need to
write and check in a module/distcc for mkroot so I can do the distcc
trick from http://landley.net/aboriginal/about.html and I see qemu
thinks it's grown multi-threaded SMP support, which might actually make
use of SMP on the host. I should poke at it, the single-cpu emulator
could only keep about 3 distcc slaves running on the host and even I've
got an 8-way SMP system...)

> $ ./android-ndk-r15-beta2/build/tools/make_standalone_toolchain.py
> --unified-headers --arch arm64 --api 24 --install-dir
> /tmp/n-standalone-toolchain

Is there somewhere I can download ndk snapshots from?
https://developer.android.com/ndk/downloads/index.html just has beta 1...

> $ 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.

Applied both, although I had to fix up the second so it installed on top
of your -libz patch.

> 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

Out of curiosity, why not?

> the hash stuff) --- there is no public API for the
> <cutils/sched_policy.h>, so that still won't build out of the box.

I should add a compile time probe for that... try now?

> (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.)

Yay!

Rob



More information about the Toybox mailing list