Ubuntu12.04 download the whole process of Android4.0.1 source code, with a number of issues to solve [turn]

Source: Internet
Author: User
Tags get ip valgrind git commands

The school has been doing application layer development, considering the future employment problems, this decision to study the source code and drive, and compile. Did not expect to download the source of this step toss me a full two days, during the encounter a lot of problems, hey, recorded in this, hope that in the future, the source of the people do not take the unnecessary detours. In fact can be here http://zhu.im/Android/ download source code, but Google recommended to download with repo, in order to learn something more repo it, after all, the next ready is too much content. Originally I was referring to Lao Luo's blog http://blog.csdn.net/luoshengyang/article/details/6559955

Download and install it, but find out what's wrong with it. The detailed process is documented here:

1, my premise is that the Android development environment has been set up, that is, the JDK has been installed, enter java-version to check whether the success. Build Android development environment can see links 1 and Link 2.

2, the first thing to install the Git tool, and repo is based on git. At the same time, to install several required software, the command is as follows:

sudo apt-get install Git-core Flex Bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential Zip Curl Valgrind

The final valgrind is for compile time, once the easy to finish. If it is to download the source code, just install curl and git-core is enough. Curl is a file transfer tool that works with URL syntax in command-line mode, and it supports many protocols, including FTP, FTPS, HTTP, HTTPS, Telent, and so on, and we need to install it to get repo script files from the network. Then curl won't be available. Repo is git-based, and Git is a distributed version control software. Since the Android source code is made up of many parts, git clone is required multiple times if you use Git. Google offers a repo, which is essentially a script written by several git commands. This is the relationship between curl git repo. For the use of repo and git, refer to this:

(1), http://blog.chinaunix.net/uid-20780196-id-3171133.html
(2), http://www.cnblogs.com/pied/archive/2012/04/12/2444159.html
(3), http://blog.sina.com.cn/s/blog_8218aa3801013ady.html
(4), http://zhidao.baidu.com/question/466204880.html

3. Download the repo script using curl

Log in under normal user, not root. At this point ~ represents the/home/xxx/directory, under the ~ Create a new bin folder, used to drop the downloaded repo script. Refer to Android's official guidance document Http://source.android.com/source/downloading.html, and then add the ~/bin directory to path. Method for sudo gedit/etc/profile, and then add path= $PATH: ~/bin after saving is turned off, then terminal input Source/etc/profile the settings to take effect. In fact here can also use absolute path to write dead,/home/xxx/bin need to note is that all this is under the ordinary user, if the root user login, ~ represents the/root folder. So this download Android source code is ordinary users, do not switch freely. Because the inside of the ~ in the normal user and the root user is not the same place. This is not a problem if you are writing with an absolute path.

Then the terminal enters:

Curl Https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo

Use this command to download the repo script to the newly built Bin folder.

Lao Luo's blog command is: wget Https://dl-ssl.google.com/dl/googlesource/git-repo/repo use is wget, should also be. I'm using the curl command above. Then chmod a+x ~/bin/repo to add executable permissions for it.

4, create a new folder, that is, the repo workspace, download the source code here.  My new directory is/home/administrator/document/androidsource. CD to this directory, make sure that the directory is accessible to the general user for read and write.

Then you initialize the repo with the Repo init command, if you enter:

Repo Init-u https://android.googlesource.com/platform/manifest

is to let repo download the latest Android source code. Generally we can specify the downloaded Android version via the-b parameter, enter:

Repo Init-u https://android.googlesource.com/platform/manifest-b ANDROID-4.0.1_R1

is to let repo download 4.0.1 source code, you can also use the-B Jelly bean to specify the version of Android, specifically, refer to: http://source.android.com/source/initializing.html

And http://source.android.com/source/build-numbers.html, especially the second link to select a version number is better.

If you enter the above repo init ... xxx, and then go to the next step although you can download the source code, but the download will appear in the middle of the following error:

[HTML]view Plaincopy

  1. Error:the requested URL returned error:406 while accessing https://android.googlesource.com/platform/manifest/info/refs

  2. Fatal:http request failed

  3. Error:the requested URL returned error:406 while accessing https://android.googlesource.com/platform/manifest/info/refs

  4. Fatal:http request failed

  5. Fetching projects:9% (20/221) Error:the requested URL returned error:406 while accessing HTTPS://ANDROID.GOOGLESOURC E.com/platform/external/bison/info/refs

  6. Fatal:http request failed

  7. Fetching projects:10% (23/221) error:failed to connect to 2404:6800:4008:c01::52:network are unreachable while Accessi Ng Https://android.googlesource.com/platform/external/apache-xml/info/refs

  8. Fatal:http request failed

  9. error:failed to connect to 2404:6800:4008:c01::52:network are unreachable while accessing https://android.googlesource.c Om/platform/external/astl/info/refs

  10. Fatal:http request failed

  11. Error:the requested URL returned error:406 while accessing https://android.googlesource.com/platform/external/ Bluetooth/glib/info/refs

  12. Fatal:http request failed

  13. Error:the requested URL returned error:406 while accessing https://android.googlesource.com/platform/external/astl/ Info/refs

  14. Fatal:http request failed

  15. Fetching projects:11% (25/221) Error:the requested URL returned error:406 while accessing HTTPS://ANDROID.GOOGLESOURC E.com/platform/external/apache-xml/info/refs

The core of the error is the error android.googlesource.com/platform/manifest/info/refs, Baidu reference here: http://www.rosoo.net/a/201302/16504. HTML This is set by Google to prevent too many anonymous access connections.

The solution is: the browser login Https://android.googlesource.com/new-password, enter their own Gmail account, click on the page "OK" or "Allow access" will get the following information (I only found the OK button):

[HTML]view Plaincopy

    1. Login for Git:

    2. Username:git-yanzi1225627.gmail.com

    3. Password:1/iwtl_vomaqwik0i4grjddl5sybs8mgdv15cb0blonmg

    4. Staying authenticated:

    5. To stay authenticated by saving the password, append the following line to the ~/.NETRC configuration file:

    6. Machine android.googlesource.com login git-yanzi1225627.gmail.com password 1/iwtl_ VOMAQWIK0I4GRJDDL5SYBS8MGDV15CB0BLONMG Machine android-review.googlesource.com Login git-yanzi1225627.gmail.com Password 1/IWTL_VOMAQWIK0I4GRJDDL5SYBS8MGDV15CB0BLONMG

    7. Make sure can read the file with Set the permissions on ~/.netrc so, only your user account. If your home directory is on a network filesystem, consider moving it to a local disk and making ~/

    8. . netrc a symbolic link to the local version.
      Create a new. netrc file, Gedit ~/.netrc, if you don't want to create a new one. There's a "." in front of Linux. Indicates that this file is a hidden file. In the inside, enter the two jargon of machine start to save. 5, began to synchronize the source before the modification , this place I touched two days reference article http://blog.csdn.net/lengxibo/article/details/8299888#reply originally need to change/etc/ Hosts, terminal input ping www.googlesource.com or ping android.googlesource.com, get IP is www.googlesource.com and android.googlesource.com IP, my computer on the two IP is 74.125.31.82.

      Save is OK.
      CHOMD a+x download.sh Let it run, then terminal input./download.sh can start downloading, replacing the repo sync in the official document with this step.
      It is perfect to rest for 3 milliseconds when not connected to the terminal and then automatically repo sync. Inside the Projects folder is the source of the download:
      Of course, my download is finished, it is estimated that the content is not too full. Attached below is a download:

    9. The downloaded address is then added to the middle of a/A, which is the final repo init command :

    10. Repo Init-u https://android.googlesource.com/a/platform/manifest-b ANDROID-4.0.1_R1
    11. After 4 steps of the change. NETRC operation, I found the download times wrong Still, Grandpa's. The error is as follows:

    12. Error:failed Connect to android.googlesource.com:443; Connection refused while accessinghttps://android.googlesource.com/a/platform/frameworks/base/info/refs

    13. Fatal:http request failed

    14. Error:cannot Fetch Platform/tools/motodev

    15. Error:cannot Fetch Platform/frameworks/base

    16. Error:cannot Fetch PLATFORM/PREBUILTS/SDK

    17. error:exited sync due to fetch errors

    18. Then sudo gedit/etc/hosts, enter in the inside:

    19. [HTML] view Plaincopy

    20. 74.125.31.82 www.googlesource.com

    21. 74.125.31.82 android.googlesource.com

    22. 203.208.46.172 cache.pack.google.com

    23. 59.24.3.173cache.pack.google.com

    24. 6, start synchronizing the source code.

    25. Supposedly in repo init .... Then use repo sync to start to download the source code, but in the process of downloading often there is no speed "dead" situation. Of course, after I modified the/etc/hosts file, I had to die again. When the speed is not connected, you can press CTRL + Z button to pause the synchronization, and then enter Repo sync. But although this is not very convenient, such as in the middle of the night who will watch the computer to supervise the download situation, the source seems to be a night before the good, sweat. For this, you can refer to http://www.rosoo.net/a/201302/16503.html in the working directory, my is ~/document/ Create a new download.sh script file under the Androidsource folder with the following contents:

    26. [HTML] view Plaincopy

    27. <span style= "Font-size:18px;color: #FF0000;" > #!/bin/bash

    28. echo "======start repo sync======"

    29. Repo Sync

    30. While [$ = = 1]; Do

    31. echo "======sync failed, Re-sync again======"

    32. Sleep 3

    33. Repo Sync

    34. Done </span>

    35. 7, where is the source of the download

    36. Under the Working Directory ~/document/androidsource folder, enter the command ls-a and you can see a. Repo folder. It shows that this is a hidden folder, and the results are as follows in this directory:

    37. [HTML] view Plaincopy

    38. <span style= "FONT-SIZE:18PX;" >[email protected]:~/document/androidsource/.repo$ ls

    39. Manifests Manifests.git manifest.xml Projects repo</span>

    40. [HTML] view Plaincopy

    41. <span style= "FONT-SIZE:18PX;" >[email protected]:~/document/androidsource/.repo/projects$ ls

    42. Abi Build.git development.git External Libcore.git prebuilt.git

    43. Bionic.git cts.git device Frameworks Ndk.git Sdk.git

    44. Bootable dalvik.git Docs Hardware packages System

    45. </span>

    46. A little strange when I was in the repo init-u time has been used to specify the download source version for 4.0.1_R1, I do not know why the download will also appear when the 4.2.x information, and sometimes there will be 2.3.x related information, know why the great God told Ha.

    47. It is said that there will be about 10G, the source is still downloading. After downloading with MV. Repo Repo force the hidden folder into a visible look on the convenient. (It seems that you don't have to force the. Repo to become visible in the working directory after the source download all the folders directly visible. But with ls-a, there are hidden folders. Repo, the contents are as follows:

    48. From top to bottom, each column looks the same as the content in the Androidsource folder below. It's just that. git does not take. The estimated band. Git is something that might be updated. This point is speculation. This is related to the repo, which is exactly what Git's workflow is. The source is good, the next step is to do the compilation.

    49. Finally downloaded, attached a:

    50. The original download completed, Androidsource the following things automatically become visible, a total space of 4.5G size. As follows:

    51. To add, the early Android source code is managed by the Linux kernel, the download link is git://android.git.kernel.org, so the command on the web is still like this: Repo Init-u/http Android.git.kernel.org/platform/manifest.git This is obsolete, kernel has removed Android. Android source is responsible for maintaining the release by Android.googlesource.com. So as long as it is in the document Repo init after the URL with "kernel" This must not be, early pass!

    52. Reference articles (to be used when compiling the next step):

    53. 1,http://www.59a.cn/1182.html

    54. 2,http://wenku.baidu.com/view/7bd2a3f10242a8956aece40d.html

    55. 3,http://www.startos.com/ubuntu/tips/2011021022209.html

    56. 4,http://www.rosoo.net/a/201302/16503.html

    57. 5, Lao Luo http://blog.csdn.net/luoshengyang/article/details/6559955
      6,http://blog.csdn.net/herbert5069/article/details/7671801
      7,http://www.cnblogs.com/and_he/archive/2012/01/04/2312027.html
      8,http://www.iteye.com/topic/1122739

Ubuntu12.04 Download Android4.0.1 source code The whole process, with a number of issues to solve [go]

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.