前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >[073]M1编译AOSP是什么体验

[073]M1编译AOSP是什么体验

作者头像
王小二
发布2022-03-24 08:37:50
1.7K0
发布2022-03-24 08:37:50
举报

前言

朋友入手了一台新款M1的Macbook Pro,成功编译AOSP,分享一下经验

代码语言:javascript
复制
MacBook Pro 14寸,M1 Pro 10核心16核图形处理器,16GB运行内存,1TB硬盘

AOSP on mac

准备工作:

  • git
  • Python 3

获取代码,切换到清华源

代码语言:javascript
复制
cd ~
mkdir bin/; cd bin/
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod +x repo
export PATH=$PATH:~/bin/
export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
sudo chown 你的用户名 /opt/

MacOS X默认的文件系统是不区分大小写的,因此需要创建响应的卷,然后挂载:

代码语言:javascript
复制
cd /opt/
hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 300g android.img
hdiutil attach android.img.sparseimage -mountpoint android/
mkdir android; cd android

同步代码:

代码语言:javascript
复制
repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-12.0.0_r3
repo sync

编译:

代码语言:javascript
复制
. build/envsetup.sh
lunch aosp_crosshatch-userdebug

build/soong下做如下修改:

代码语言:javascript
复制
diff --git a/cc/config/x86_darwin_host.go b/cc/config/x86_darwin_host.go
index b0344af84..ee9f8e746 100644
--- a/cc/config/x86_darwin_host.go
+++ b/cc/config/x86_darwin_host.go
@@ -68,6 +68,7 @@ var (
                "10.15",
                "11.0",
                "11.1",
+               "12.0",
        }
 
        darwinAvailableLibraries = append(

总共用时3小时19分,感觉不是很快,这个成绩只能是一般般

代码语言:javascript
复制
ulimit -S -n 1024
m
... ...
[ 99% 116263/116280] //frameworks/base/packages/SystemUI:SystemUI r8 [common]
...
Missing class org.jetbrains.annotations.Nullable (referenced from: android.graphics.fonts.Font com.android.keyguard.FontInterpolator$InterpKey.l and 1010 other contexts)
[100% 116280/116280] build out/target/product/crosshatch/obj/PACKAGING/check-all-partition-sizes_intermediates/check_all_partition_sizes.log

#### build completed successfully (03:19:17 (hh:mm:ss)) ####

刷机:

代码语言:javascript
复制
adb reboot bootloader
fastboot flashall -w

遇到的问题

虽然整体编译过了,也可以刷机,但是发现在用一些调试工具的时候有一些莫名其妙的问题。

国外网友的经验分享

https://www.bilibili.com/video/BV1Fh411874w 1,视频为youtube码农真实测试M1编译性能,结果:8个小时。看起来并没有为M1设备,还在按照x86-64转译运行编译 2,长远看Google是否会优化M1上的编译速度呢?答案:否 https://source.android.com/setup/build/requirements Warning: Building on either Windows or MacOS (as of June 22, 2021) is NOT supported.

购买建议

有钱就买,没钱就不买,合理使用官网14天无理由退货的规则。

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2022.03.01 ,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 前言
  • AOSP on mac
  • 遇到的问题
  • 国外网友的经验分享
  • 购买建议
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档