1 NDK Development: 2 ---------------- 3 4 This document describes how one can modify the NDK and generate 5 new experimental release packages for it. 6 7 I. Getting the sources: 8 ======================= 9 10 The sources live at android.git.kernel.org, You can get them with the following: 11 12 mkdir myndk 13 cd myndk 14 git clone git://android.git.kernel.org/platform/ndk.git . 15 16 If you intend to contribute patches, you might want to use the "repo" tool instead. 17 Follow the instructions at source.android.com and download the full Android sources 18 to your tree. 19 20 21 II. Prebuilt binaries: 22 ====================== 23 24 The source tree does not contain the prebuilt binaries for the cross-compiler and 25 other stuff that are necessary to generate machine code with the NDK. 26 27 The easiest way to get them is to use the following script: 28 29 build/tools/rebuild-all-prebuilt.sh: 30 31 It will download all source packages from the Internet, unpack, patch and build 32 them for you. In the end, the binaries will be located under the following: 33 34 build/prebuilt/$HOST_TAG/ 35 36 Where $HOST_TAG corresponds to your system (e.g. windows, darwin-x86 or linux-x86) 37 38 rebuild-all-prebuilt.sh is really a wrapper script around many other scripts 39 under build/tools. Use --help to get proper usage and options for each one of 40 these tools. Things you can do with them include: 41 42 II.1: Download the toolchain sources and package them: 43 ------------------------------------------------------ 44 45 build/tools/download-toolchain-sources.sh --package 46 47 This downloads the toolchain sources from android.git.kernel.org and 48 packages them into a file like /tmp/android-ndk-toolchain-<date>.tar.bz2 49 50 This is useful is you want to modify rebuild-all-prebuilt.sh to support different 51 prebuilts or toolchains. To use the package, to rebuilt binaries: 52 53 build/tools/rebuild-all-prebuilt.sh --toolchain-src=<package> 54 55 You can also directly unpack the sources into a target source directory with: 56 57 build/tools/download-toolchain-sources.sh <src-dir> 58 59 60 II.2.: Build the cross-compiler only: 61 ------------------------------------- 62 63 build/tools/build-gcc.sh <src-dir> <ndk-dir> <toolchain-name> 64 65 src-dir = unpacked toolchain source directory 66 ndk-dir = target NDK install location (e.g. your 'myndk' top-level directory) 67 toolchain-name = toolchain name (arm-eabi-4.2.1 / arm-eabi-4.4.0 / x86-4.2.1) 68 69 II.3.: Build the gdbserver binary only: 70 --------------------------------------- 71 72 build/tools/build-gcc.sh <gdbserver-src-dir> <ndk-dir> <toolchain-name> 73 74 II.4.: Package all prebuilt binaries for easier redistribution / unpacking: 75 --------------------------------------------------------------------------- 76 77 Build everything into a target directory: 78 79 build/tools/rebuild-all-prebuilt.sh --package 80 81 This will create a package named /tmp/android-ndk-prebuilt-<date>-<system>.tar.bz2 82 83 This package is to be unpacked directly in your NDK top-level directory, i.e. 84 85 cd myndk 86 tar xjf <package> 87 88 89