Windows10
环境准备
- git2.17.1
- python3.12.1
- 清华源http://aosp.tuna.tsinghua.edu.cn/
获取manifest
git clone http:
切换分支
- 切换到所需分支,文中使用android-10.0.0_r47
git checkout android-10.0.0_r47
- 根据自己所要源码修改default.xml,文中主要留frameworks/base和native、system/core
<project path="frameworks/base" name="platform/frameworks/base" groups="pdk-cw-fs,pdk-fs" />
<project path="frameworks/native" name="platform/frameworks/native" groups="pdk" />
<project path="system/core" name="platform/system/core" groups="pdk" />
python脚本
import xml.dom.minidom
import os
from subprocess import call
rootdir = "F:/source/android10"
git = "D:/Environment/Git/bin/git.exe"
dom = xml.dom.minidom.parse("F:/source/manifest/default.xml")
root = dom.documentElement
prefix = git + " clone http://aosp.tuna.tsinghua.edu.cn/"
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
call(cmd)
python 脚本路径
Linux
参考:android源码linux环境配置