• Ubuntu下下载编译android源码


    Installing 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 http://android.git.kernel.org/repo > ~/bin/repo $ chmod a+x ~/bin/repo 

    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:
      $ 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 git://android.git.kernel.org/platform/manifest.git 

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

      $ repo init -u git://android.git.kernel.org/platform/manifest.git -b froyo 
    • 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.

    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 several minutes 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
    余下内容可以访问android官网查看,如果英文还可以的话。 

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

    具体的注意事项为:

    1。必须用管理员模式,而不是单纯的在命令前加sudo

    具体方法为“sudo -s”输入密码之后就是以root的身份进行操作,之后创建repo的执行目录用mkdir命令,接着下载repo,使用的是:curl命令,具体用法可以参看man帮助,不过超过百分之九十的中国人呢看到那些东西就恶心,又长又烦。

    赋给repo执行权限,使用chmod命令,注意,在某些特别情况下+x和+X是不一样的,具体的没有细细研究。

    获得执行权限之后,就可以执行repo的初始化

    按照提示,一步步完成就ok了,最后可以编译出一个完整的android系统在模拟器中运行。换句话说,源码可以随意更改,以适应个人开发的硬件配置。

    2。许多软件需要提前下载,java必须使用sun官方发布的。gcc需要下载,git、curl、repo也都是要下载的。pyton也是必须的。虽然官方直说是建议安装,但是没有的话,根本无法下载repo和android源码。

    3.网速一定要“充沛”。如果是在集体宿舍,如果宿舍的用户超过四个,基本上你可以放弃下载源码这件事情了。其实,如果经常使用linux,你会发现,迅雷之流的下载软件都是不需要的。充沛的意思是说,不要造成超过两三秒钟得连接中断,换句话说,就是不要有人用pps或是迅雷在和你抢网速,如果细细了解这两款软件的工作原理,你会知道什么叫变态的。我曾经三次下载源码,都是因为宿舍有同学开pps或者迅雷而失败了,惨痛的教训啊。

    linux的使用最重要的一点是,用合适的方法,做合适的事情。如果是初学者,千万不要想当然。

    4.repo sync命令是可以用来进行断电续传的。

  • 相关阅读:
    ubuntu apache2配置
    Oauth2协议解读(一)
    OAuth2协议解读(二)
    flask 环境搭建
    BeautifulSoup初识
    Oauth2解读
    5路由控制
    ​1Web应用
    3Web框架
    2Http协议
  • 原文地址:https://www.cnblogs.com/googlegis/p/2978791.html
Copyright © 2020-2023  润新知