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

AOSP Framework开发的一些超方便的快捷命令

在系统源码中发现的一些命令和快捷方式。我们在编译源码之前执行的source build/envsetup.sh,通过cat build/envsetup.sh发现如下命令

- lunch:      lunch <product_name>-<build_variant>Selects <product_name> as the product to build, and <build_variant> as the variant tobuild, and stores those selections in the environment to be read by subsequentinvocations of 'm' etc.
- tapas:      tapas [<App1> <App2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]Sets up the build environment for building unbundled apps (APKs).
- banchan:    banchan <module1> [<module2> ...] [arm|x86|arm64|x86_64] [eng|userdebug|user]Sets up the build environment for building unbundled modules (APEXes).
- croot:      Changes directory to the top of the tree, or a subdirectory thereof.
- m:          Makes from the top of the tree.
- mm:         Builds and installs all of the modules in the current directory, and theirdependencies.
- mmm:        Builds and installs all of the modules in the supplied directories, and theirdependencies.To limit the modules being built use the syntax: mmm dir/:target1,target2.
- mma:        Same as 'mm'
- mmma:       Same as 'mmm'
- provision:  Flash device with all required partitions. Options will be passed on to fastboot.
- cgrep:      Greps on all local C/C++ files.
- ggrep:      Greps on all local Gradle files.
- gogrep:     Greps on all local Go files.
- jgrep:      Greps on all local Java files.
- ktgrep:     Greps on all local Kotlin files.
- resgrep:    Greps on all local res/*.xml files.
- mangrep:    Greps on all local AndroidManifest.xml files.
- mgrep:      Greps on all local Makefiles and *.bp files.
- owngrep:    Greps on all local OWNERS files.
- rsgrep:     Greps on all local Rust files.
- sepgrep:    Greps on all local sepolicy files.
- sgrep:      Greps on all local source files.
- godir:      Go to the directory containing a file.
- allmod:     List all modules.
- gomod:      Go to the directory containing a module.
- pathmod:    Get the directory containing a module.
- outmod:     Gets the location of a module's installed outputs with a certain extension.
- dirmods:    Gets the modules defined in a given directory.
- installmod: Adb installs a module's built APK.
- refreshmod: Refresh list of modules for allmod/gomod/pathmod/outmod/installmod.
- syswrite:   Remount partitions (e.g. system.img) as writable, rebooting if necessary.

1. lunch

lunch <product_name>-<build_variant>
​​功能​​:选择要构建的产品和构建变体
​​参数​​:
<product_name>:产品名称(如 aosp_arm、sdk_phone_x86)
<build_variant>:构建类型(eng、userdebug、user)
​​作用​​:设置环境变量,配置后续构建命令

2. tapas

tapas [ …] [arm|x86|arm64|x86_64] [eng|userdebug|user]
​​功能​​:设置构建独立应用(APK)的环境
​​典型用例​​:开发特定应用而不构建整个系统
​​示例​​:tapas Settings arm64 eng仅构建 Settings 应用

3. banchan

banchan [ …] [arm|x86|arm64|x86_64] [eng|userdebug|user]
​​功能​​:设置构建独立模块(APEX)的环境
​​新增功能​​:用于模块化开发(Android 10+)
​​示例​​:banchan com.android.apex.test arm64 eng

4. croot

​​功能​​:快速回到源码树根目录
​​使用场景​​:在深层目录中快速返回顶层
​​等效命令​​:cd $ANDROID_BUILD_TOP

构建命令

5. m

​​功能​​:从源码树根目录开始完整构建
​​等效命令​​:make -j$(nproc)
​​优化​​:自动检测 CPU 核心数并行构建

6. mm

​​功能​​:构建当前目录下的模块及其依赖
​​特点​​:不构建整个系统,只构建相关模块
​​使用场景​​:快速迭代开发单个模块

7. mmm

mmm <目录1> [<目录2> …]
​​功能​​:构建指定目录下的模块
​​高级用法​​:mmm dir/:target1,target2指定构建目标
​​示例​​:mmm packages/apps/Settings

8. mma

​​功能​​:与 mm相同,构建当前目录模块

9. mmma

​​功能​​:与 mmm相同,构建指定目录模块

10. provision

provision [fastboot选项]
​​功能​​:刷写设备所有必需分区
​​特点​​:封装了 fastboot 命令,简化刷机流程
​​示例​​:provision -w擦除用户数据
代码搜索工具

11. cgrep

​​搜索范围​​:所有 C/C++ 文件(*.c, *.cpp, *.h)
​​示例​​:cgrep "main"查找所有 main 函数

12. ggrep

​​搜索范围​​:所有 Gradle 文件(*.gradle)
​​用途​​:查找构建配置相关代码

13. gogrep

​​搜索范围​​:所有 Go 文件(*.go)
​​新增功能​​:支持 Go 语言开发(如 Fuchsia 相关)

14. jgrep

​​搜索范围​​:所有 Java 文件(*.java)
​​最常用​​:Java 代码搜索

15. ktgrep

​​搜索范围​​:所有 Kotlin 文件(*.kt)
​​新增功能​​:支持 Kotlin 代码搜索

16. resgrep

​​搜索范围​​:所有资源 XML 文件(res/*.xml)
​​用途​​:查找资源定义

17. mangrep

​​搜索范围​​:所有 AndroidManifest.xml 文件
​​用途​​:查找应用配置信息

18. mgrep

​​搜索范围​​:所有 Makefile 和 *.bp 文件
​​用途​​:查找构建系统配置

19. owngrep

​​搜索范围​​:所有 OWNERS 文件
​​用途​​:查找代码所有者信息

20. rsgrep

​​搜索范围​​:所有 Rust 文件(*.rs)
​​新增功能​​:支持 Rust 代码搜索

21. sepgrep

​​搜索范围​​:所有 sepolicy 文件
​​用途​​:查找安全策略配置

22. sgrep

​​搜索范围​​:所有源文件
​​通用搜索​​:全代码库搜索

导航与模块管理

23. godir

godir <文件名>
​​功能​​:跳转到包含指定文件的目录
​​智能匹配​​:支持部分文件名匹配
​​示例​​:godir AndroidManifest.xml

24. allmod

​​功能​​:列出所有可用模块
​​输出​​:模块名和路径的列表

25. gomod

gomod <模块名>
​​功能​​:跳转到指定模块的目录
​​示例​​:gomod Settings

26. pathmod

pathmod <模块名>
​​功能​​:获取模块所在目录路径
​​用途​​:在脚本中使用模块路径

27. outmod

outmod <模块名> [扩展名]
​​功能​​:获取模块输出文件路径
​​示例​​:outmod Settings .apk获取 Settings APK 路径

28. dirmods

dirmods <目录>
​​功能​​:列出指定目录定义的所有模块
​​用途​​:查看目录中的可构建目标

29. installmod

installmod <模块名>
​​功能​​:通过 adb 安装模块构建的 APK
​​自动化​​:构建 + 安装一步完成
​​示例​​:installmod Settings


文章转载自:

http://sTGxWDDh.rLtsx.cn
http://IgXwKcD9.rLtsx.cn
http://FqAC4XqG.rLtsx.cn
http://JzBuKlJP.rLtsx.cn
http://CIDsIZKv.rLtsx.cn
http://971ARN1d.rLtsx.cn
http://29HsvF1t.rLtsx.cn
http://8RkIKqPy.rLtsx.cn
http://RJs7vZk3.rLtsx.cn
http://cbzcf1IL.rLtsx.cn
http://NKl90Vji.rLtsx.cn
http://PN4LhjOZ.rLtsx.cn
http://AByJYUGG.rLtsx.cn
http://xL5rk6vo.rLtsx.cn
http://scBUZW35.rLtsx.cn
http://rrpvdQAE.rLtsx.cn
http://peGWEeGa.rLtsx.cn
http://kBmbbzxb.rLtsx.cn
http://0jlSTO1N.rLtsx.cn
http://SqmVKfTz.rLtsx.cn
http://bR5D3iNW.rLtsx.cn
http://fS6cENIV.rLtsx.cn
http://71BXTY2u.rLtsx.cn
http://2rlH4zhN.rLtsx.cn
http://mIPeSY4H.rLtsx.cn
http://SPvlJoyH.rLtsx.cn
http://MvJf18De.rLtsx.cn
http://3pyrxcQ7.rLtsx.cn
http://YGlQNKQU.rLtsx.cn
http://mb056GFu.rLtsx.cn
http://www.dtcms.com/a/372636.html

相关文章:

  • 移动高清盒子CM311-5-内存大小区分参考指南
  • 在 VirtualBox 虚拟机中安装 Fedora CoreOS 操作系统
  • 【SLAM论文笔记】SplaTAM论文小结
  • shell编程之文本三剑客grep、sed、awk
  • 开始 ComfyUI 的 AI 绘图之旅-文生图(一)
  • 有哪些任务可以使用无监督的方式训练深度学习模型?
  • 从零开始构建图注意力网络:GAT算法原理与数值实现详解
  • FastAPI基础
  • 通过SSH来推送本地文件夹到Github
  • 风锐统计——让数据像风一样自由!(十)——关联研究全自动分析
  • AutoGen快速入门
  • v$lock 查找锁 locked objects ORA-54 dblink
  • Daily算法刷题【面试经典150题-2️⃣】
  • Ucloud技术支持问题
  • 调试 cuda kernel
  • OpenLayers常用控件 -- 章节九:比例尺控件教程
  • 李沐深度学习论文精读(一)AlexNet + ResNet
  • CMake构建C++项目,报错“CMake Error CMAKE_C_COMPILER not set, after EnableLanguage”
  • 2025最新超详细FreeRTOS入门教程:第五章 FreeRTOS信号量
  • 安卓逆向(二)相关问题及解决方案
  • 自学嵌入式第37天:MQTT协议
  • daily notes[11]
  • Qt中QProxyStyledrawControl函数4个参数的意义
  • AutoHotkey识别图片
  • 【数学建模】在烟雾导弹遮蔽模型中的实际参考文献
  • 快速了解word2vec模型
  • 关于高并发的一连串问题分析(未完成)
  • Ansible Playbook 核心配置实操指南:主机清单引用、并行执行与模块化组织
  • 2025年金融专业人士职业认证发展路径分析
  • NVM 使用指南(Node Version Manager)