简体   繁体   中英

How to build linux command for Android on Linux machine

Since there are a few commands missing on Android, I want to build them by myself.

Take one as an example:

There is no dig command on Android.

I've got the source code from ftp://ftp.isc.org/isc/bind9/9.2.3/bind-9.2.3.tar.gz and then I want to build it. But I got stuck.

How can I build the executable on my linux machine ?

You can do it in two ways.

  1. To build any C Source code for Android Platform you can use Android NDK Toolchian , It lets you build Native code for another platform.
    It can be used as a stand-alone compiler without an Android APK.
    Documentation and Sample Code .

    To build it as an executable (without APK) and not shared object, replace include $(BUILD_SHARED_LIBRARY) with include $(BUILD_EXECUTABLE) in Android.mk .

  2. For Linux commands on Android you can use Busybox .
    It supports most of the commands.
    However dig is not supported in busybox, you can add it by following this article .

Hopefully this gives you a start.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM