The steps for download android source code
The steps for download android source code. Except for the git tool, all the other steps is for both Windows and Linux.
In the Windows network safe mode, the language-input-tool has some trouble, so only english can be used.
All the content is referece the link: http://blog.csdn.net/hlf48641715/article/details/7188450
1. start git-shell:
2. enter the android folder
3. git clone https://android.googlesource.com/platform/manifest.git
This will create the manifest directory, and clone the ./manifest/.git directory.
hp@HP-PC /e/android $ git clone https://android.googlesource.com/platform/manifest.git Cloning into ‘manifest‘... remote: Counting objects: 106, done remote: Finding sources: 100% (106/106) remote: Total 1030 (delta 144), reused 1030 (delta 144) Receiving objects: 100% (1030/1030), 895.45 KiB | 498.00 KiB/s, done. Resolving deltas: 100% (144/144), done. hp@HP-PC /e/android $
4. switch to the manifest directory that just cloned.
And list all the tags by ‘git tag‘.
hp@HP-PC /e/android $ ls a.txt android_src_download_steps.txt download_src_new.py recovery-si android-si download_src.py manifest src hp@HP-PC /e/android $ cd manifest hp@HP-PC /e/android/manifest (master) $ git tag android-1.6_r1.1_ ....... android-4.3_r3.1 android-4.4.1_r1 android-4.4.2_r1 android-4.4.2_r2 android-4.4_r1 android-4.4_r1.1 android-4.4_r1.2 android-cts-2.2_r8 android-cts-2.3_r10 android-cts-2.3_r11 android-cts-2.3_r12 android-cts-4.0.3_r1 android-cts-4.0.3_r2 android-cts-4.0_r1 android-cts-4.1_r1 android-cts-4.1_r2 android-cts-4.2_r2 android-cts-4.4_r1 android-cts-verifier-4.0.3_r1 android-cts-verifier-4.0_r1 android-sdk-4.0.3-tools_r1 android-sdk-4.0.3_r1 android-sdk-4.4.2_r1 android-sdk-adt_r16.0.1 android-sdk-adt_r20 android-sdk-support_r11 hp@HP-PC /e/android/manifest (master) $
5. check out the android version
hp@HP-PC /e/android/manifest (master) $ git checkout android-4.4.2_r2 Note: checking out ‘android-4.4.2_r2‘. You are in ‘detached HEAD‘ state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout. If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example: git checkout -b new_branch_name HEAD is now at 1a5a541... Update manifest for android-4.4.2_r2 hp@HP-PC /e/android/manifest ((android-4.4.2_r2)) $
6. Understand the manifest/default.xml, and write a python script file
to generate a git-clone file.
Then execute the .py file, or all the git-clone will start automatically.
ATTENTION PLS: a. There must be 40G in the disk. b. All the clone will spend many many hours.
hp@HP-PC /e/android $ ls a.txt android_4.4.2_r2 download_src.py recovery-si android-si android_src_download_steps.txt manifest src hp@HP-PC /e/android $ python download_src.py C:/Program Files/Git/bin/git.exe clone http://android.googlesource.com/platform/ build.git Cloning into ‘build‘... remote: Sending approximately 23.91 MiB ... remote: Counting objects: 957, done remote: Finding sources: 100% (170/170) Receiving objects: 87% (45093/51754), 9.44 MiB | 210.00 KiB/s
7. here is the python file as the link that I have referenced.
import xml.dom.minidom import os from subprocess import call #downloaded source path # if the dir does not exist, it will be created autoomatically as below. rootdir = "E:/android/android_4.4.2_r2" #git program path git="C:/Program Files/Git/bin/git.exe" dom = xml.dom.minidom.parse("E:/android/manifest/default.xml") root = dom.documentElement prefix = git + " clone http://android.googlesource.com/" suffix = ".git" if not os.path.exists(rootdir): os.mkdir(rootdir) for node in root.getElementsByTagName("project"): os.chdir(rootdir) d = node.getAttribute("path") last = d.rfind("/") if last != -1: d = rootdir + "/" + d[:last] if not os.path.exists(d): os.makedirs(d) os.chdir(d) cmd = prefix + node.getAttribute("name") + suffix print cmd call(cmd)
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。