当前位置: 首页 > news >正文

【Android安全】Windows 环境下载 AOSP 源码

准备环境
安装 git
安装 Python
硬盘剩余容量最好大于 800G

在这里插入图片描述

打开 Git Bash,用 git 克隆源代码仓库

git clone https://android.googlesource.com/platform/manifest.git
//没有梯子使用清华源
git clone https://aosp.tuna.tsinghua.edu.cn/platform/manifest.git

在这里插入图片描述

这时 目录下会出现一个 manifest 目录

切换到想要的源码版本分支

cd manifest
// 使用 git branch -a 查看所有分支,找到想要的分支
git branch -a
// 这里以android-14.0.0_r9 为例
git checkout android-14.0.0_r9 

在这里插入图片描述
在这里插入图片描述
使用 Python 执行脚本进行源代码下载
将下面的代码复制,创建文件 python_download.py,进行对应修改,并保存。

import xml.dom.minidom
import os
from subprocess import call# 1. 修改为源码要保存的路径
rootdir = "G:/AOSP_source/AOSP_14.0.0_r9"# 2. 设置 git 安装的路径
git = "D:/Academic/Git/program/bin/git.exe"# 3. 修改为第一步中 manifest 中 default.xml 保存的路径
dom = xml.dom.minidom.parse("G:/AOSP_source/manifest/default.xml")
root = dom.documentElementprefix = git + " clone https://android.googlesource.com/"
# 4. 没有梯子使用清华源下载
# prefix = git + " clone https://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 脚本,开始下载

python python_download.py

在这里插入图片描述


参见:https://github.com/jeanboydev/Android-ReadTheFuckingSourceCode/blob/master/article/android/framework/Android-Windows%E7%8E%AF%E5%A2%83%E4%B8%8B%E8%BD%BD%E6%BA%90%E7%A0%81.md

http://www.lryc.cn/news/307682.html

相关文章:

  • Vue.js+SpringBoot开发快递管理系统
  • Linux/Spectra
  • C 嵌入式系统设计模式 08:硬件代理模式
  • 【k8s配置与存储--持久化存储(PV、PVC、存储类)】
  • 【Vite】解决Vite http proxy error: Error: connect ECONNREFUSED
  • FPGA领域顶级学术会议
  • 罗技鼠标滚轮模式介绍 | 鼠标滚轮异响 - 解决方案
  • Scrapy与分布式开发(2.2):正则表达式
  • 今年“全国爱耳日”主题确定!立聪堂助听器组织社区义诊
  • 区块链智能合约开发
  • Android 启动流程及 init 进程解析
  • Java设计模式:核心概述(一)
  • 计算机网络:IP
  • CSS中使用变量的两个函数var和calc
  • 了解docker与k8s
  • 服务器防火墙的应用技术有哪些
  • 打开 Camera app 出图,前几帧图像偏暗、偏色该怎样去避免?
  • SD-WAN技术:优化国内外服务器访问的关键
  • 【MySQL】学习和总结标量子查询
  • vue3第三节(v-model 执行原理)
  • RunnerGo UI自动化测试脚本如何配置
  • Android 指南针校准进度计算实现
  • c++学习:Lambda练习和数组练习
  • 数据仓库和数据湖的区别
  • tkinterFrame框架+标签框架LabelFrame+Toplevel窗口的使用
  • C 语言中的 char 关键字详解
  • 信息安全管理与评估赛题解析-应急响应(含环境)
  • 微服务-微服务Spring Security OAuth 2实战
  • 二次供水物联网:HiWoo Cloud助力城市水务管理升级
  • P1015 [NOIP1999 普及组] 回文数