ndk source Downloading the Source Tree 【部分译】

http://source.android.com/source/downloading.html

 

在ubuntu Linux下,如果没有安装git,curl,那么执行下面2个命令

sudo apt-get install git

sudo apt-get install curl

然后按照下面执行(需要注册一个google账户,最好gmail)

 

Downloading the Source Tree

Installing Repo

安装Repo

Repo是一个整合的git工具

$ mkdir ~/bin 创建目录,用于存放repo $ PATH=~/bin:$PATH ,添加到运行环境


 
  •  

  •  

  • Download the Repo script and ensure it is executable:

    $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo 下载并存为repo文件
  •  $ chmod a+x ~/bin/repo 修改为可执行文件
     
  •  

     

     

    Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Version Control.

    To install, initialize, and configure Repo, follow these steps:

    • Make sure you have a bin/ directory in your home directory, and that it is included in your path:

      $ mkdir ~/bin $ PATH=~/bin:$PATH
       
    •  

    •  

    • Download the Repo script and ensure it is executable:

      $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo $ chmod a+x ~/bin/repo
       
    • The SHA-1 checksum for repo is e1fd3bef059d152edf4d0522590725d317bc637f

    Initializing a Repo client

    After installing Repo, set up your client to access the android source repository:

    • Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:

      $ mkdir WORKING_DIRECTORY $ cd WORKING_DIRECTORY
       
    • Run repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.

      $ repo init -u https://android.googlesource.com/platform/manifest 同步主trunk版本
       

      To check out a branch other than "master", specify it with -b:

      $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1 指定需要同步的版本为android-4.0.1_r1
       
    • When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive messages. The name that you provide here will show up in attributions for your code submissions.

    这里面具体版本可以在该网页上看到,如2.3.3_r1等。

    A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest will be kept.

    Getting the files

    To pull down files to your working directory from the repositories as specified in the default manifest, run

    $ repo sync

     

     
    

    The Android source files will be located in your working directory under their project names. The initial sync operation will take an hour or more to complete. For more about repo sync and other Repo commands, see Version Control.

    Verifying Git Tags

    Load the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.

    $ gpg --import

     

     
    

    Copy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.

    -----BEGIN PGP PUBLIC KEY BLOCK----- Version: GnuPG v1.4.2.2 (GNU/Linux) mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSV lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7 8tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMD u4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0Z wNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq /HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5 jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4 MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9 b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJv aWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5k cm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIX gAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI 2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAl QN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806Up hisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbk C2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMX LWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+ OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/M pK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7s KZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phb N8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjA vUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwo G1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQ hN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0l EXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM= =Wi5D -----END PGP PUBLIC KEY BLOCK-----

     

     
    

    After importing the keys, you can verify any tag with

    $ git tag -v TAG_NAME

     

     
    

    Next: Build the code

    You now have a complete local copy of the Android codebase. Continue on to building....

     

     

    ---------------------------------------------------------

    我在ubuntu linux 服务器上去编译,结果一大堆错误

    机器:2.6.35-22-server #33-Ubuntu SMP Sun Sep 19 20:48:58 UTC 2010 x86_64 GNU/Linux

    Java 1.6

    按照上述步骤后,执行

    make

    错误如下:

    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=2.3.3
    TARGET_PRODUCT=generic
    TARGET_BUILD_VARIANT=eng
    TARGET_SIMULATOR=
    TARGET_BUILD_TYPE=release
    TARGET_BUILD_APPS=
    TARGET_ARCH=arm
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=GRI40
    ============================================
    /bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: No such file or directory
    /bin/bash: prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin/arm-eabi-gcc: No such file or directory
    /bin/bash: bison: command not found
    find: `frameworks/base/frameworks/base/docs/html': No such file or directory
    find: `out/target/common/docs/gen': No such file or directory
    find: `frameworks/base/frameworks/base/docs/html': No such file or directory
    find: `out/target/common/docs/gen': No such file or directory
    find: `frameworks/base/frameworks/base/docs/html': No such file or directory
    find: `out/target/common/docs/gen': No such file or directory
    find: `frameworks/base/frameworks/base/docs/html': No such file or directory
    find: `out/target/common/docs/gen': No such file or directory
    find: `frameworks/base/frameworks/base/docs/html': No such file or directory
    find: `out/target/common/docs/gen': No such file or directory
    host C: acp <= build/tools/acp/acp.c
    In file included from /usr/include/features.h:387,
                     from /usr/include/stdlib.h:25,
                     from build/tools/acp/acp.c:11:
    /usr/include/gnu/stubs.h:7: fatal error: gnu/stubs-32.h: No such file or directory
    compilation terminated.
    make: *** [out/host/linux-x86/obj/EXECUTABLES/acp_intermediates/acp.o] Error 1

    ------------------------------------------------------------------

    后来,下载ndk7,在Cygwin 中编译hello-jni,顺利通过。

     

     

     

    你可能感兴趣的:(android,下载,source,编译)