androidS 发布已经有一段时间了,作为一名搞机人,咱也不能落后,今天就来开盘 12 代码。

下载这个 S 代码前前后后搞了快一个月,哈哈我不愧是树懒本懒。唉,其实是中间遇到了不少问题,

环境都搞废了,还得重装系统,今天就来总结一下吧。

编译环境

1、Ubuntu16.04.5 系统

2、三星500G SSD EVO系列

3、内存8G,cpu 4核,I5(8年老本了凑合着用用)

4、二手 Pixel 3 XL一台

坑位集锦

1、磁盘大小

如果你是在虚拟机来盘这套代码的话,磁盘大小至少200G以上(血泪教训),中间扩容了三次最终还是不够大

仅仅 repo 文件夹就有 70G 左右

磁盘空间一定要大,一定要大,一定要大

不是虚拟机的请忽略这步

2、Python 版本要求

这次下载 aosp 的 S 代码时,repo init 就出现了问题,提示要求 Python 版本 3.6 以上

在这也是费了好长时间才解决这个问题,具体可参考 Linux python升级

从官网下载最新版本 Python-3.9.8 解压,解压完成后先不要着急 make install

还有个小坑,会报

ModuleNotFoundError: No module named ‘_ctypes’ 这个错误

以及 ModuleNotFoundError: No module named ‘_ssl’ 这个错误

解决办法,执行如下两条指令

sudo apt-get install libssl-dev openssl
sudo apt-get install libffi-dev

成功后,再参考 python3虚拟环境中解决 ModuleNotFoundError: No module named ‘_ssl’

修改源码 vim Modules/Setup

取消 _socket socketmodule.c 和下面的 SLL 注释

然后执行 make install 安装重新配置环境变量。

3、HTTP SSL 证书问题

执行 git config --global http.sslverify false 关闭


cczheng@ubantu:~/google$ cd Android12/
cczheng@ubantu:~/google/Android12$ export REPO_URL='https://gerrit-googlesource.proxy.ustclug.org/git-repo'
cczheng@ubantu:~/google/Android12$ repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b  android-12.0.0_r3
Downloading Repo source from https://gerrit-googlesource.proxy.ustclug.org/git-repo
fatal: unable to access 'https://gerrit-googlesource.proxy.ustclug.org/git-repo/': server certificate verification failed. CAfile: /etc/ssl/certs/ca-certificates.crt CRLfile: none
repo: error: "git" failed with exit status 128cwd: /home/cczheng/google/Android12/.repo/repocmd: ['git', 'fetch', '--quiet', '--progress', 'origin', '+refs/heads/*:refs/remotes/origin/*', '+refs/tags/*:refs/tags/*']
fatal: cloning the git-repo repository failed, will remove '.repo/repo'
cczheng@ubantu:~/google/Android12$ git config --global http.sslverify false
cczheng@ubantu:~/google/Android12$ repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b  android-12.0.0_r3
Downloading Repo source from https://gerrit-googlesource.proxy.ustclug.org/git-repo... A new version of repo (2.17) is available.
... You should upgrade soon:cp /home/cczheng/google/Android12/.repo/repo/repo /home/cczheng/bin/repoDownloading manifest from git://mirrors.ustc.edu.cn/aosp/platform/manifest
remote: Enumerating objects: 92903, done.
remote: Counting objects: 100% (92903/92903), done.
remote: Compressing objects: 100% (41747/41747), done.
remote: Total 92903 (delta 31091), reused 92896 (delta 31088)Your identity is: yangtao <yangtao@innovatech.net.cn>
If you want to change this, please re-run 'repo init' with --config-namerepo has been initialized in /home/cczheng/google/Android12

做完这些步骤后,repo init 终于可以成功了。

准备工作

1、设置 git 账户

git config --global user.email "xxxxxxx@gmail.com"
git config --global user.name "xxxxx"

2、配置PATH环境变量

mkdir ~/bin
echo "PATH=~/bin:\$PATH" >> ~/.bashrc
source ~/.bashrc

3、安装 curl 库,并设置权限

sudo apt-get install curl
curl -sSL  'https://gerrit-googlesource.proxy.ustclug.org/git-repo/+/master/repo?format=TEXT' |base64 -d > ~/bin/repo
chmod a+x ~/bin/repo

下载源码

1、建立工作目录

mkdir Android12
cd Android12

2、添加科大镜像源

export REPO_URL='https://gerrit-googlesource.proxy.ustclug.org/git-repo'

3、初始化仓库,并指定要下载android版本

repo init -u git://mirrors.ustc.edu.cn/aosp/platform/manifest -b  android-12.0.0_r3

4、同步源码

repo sync -j4

编译源码

1、安装 openjdk8

sudo add-apt-repository ppa:openjdk-r/ppa
sudo apt-get update
sudo apt-get install openjdk-8-jdk

如果电脑里面存在多个java 版本,则通过如下命令选择openjdk-8即可

sudo update-alternative --config java
sudo update-alternative --config javac

2、安装依赖库

sudo apt-get install libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-dev g++-multilib
sudo apt-get install -y git flex bison gperf build-essential libncurses5-dev:i386
sudo apt-get install tofrodos python-markdown libxml2-utils xsltproc zlib1g-dev:i386
sudo apt-get install dpkg-dev libsdl1.2-dev libesd0-dev
sudo apt-get install git-core gnupg flex bison gperf build-essential
sudo apt-get install zip curl zlib1g-dev gcc-multilib g++-multilib
sudo apt-get install libc6-dev-i386
sudo apt-get install lib32ncurses5-dev x11proto-core-dev libx11-dev
sudo apt-get install libgl1-mesa-dev libxml2-utils xsltproc unzip m4
sudo apt-get install lib32z-dev ccache
sudo apt-get install libssl-dev

3、下载对应闭源驱动文件合入源码

可以到下面的地址下载 pixel 对应驱动文件或者完整 rom 包

Google play 中文站

4、开始编译

通过 lscpu 命令查看当前cpu的详细信息

执行命令

source build/envsetup.sh
lunch 25  (aosp_crosshatch-userdebug 版本)
make -j8

lunch 根据上面cpu的类型,make -j cpu核数*2

编译完成23小时,哈哈哈哈哈哈

刷机,参考官方包自己写个刷机脚本,将你编译后out目录下得到的如下文件

copy出来,全部添加到压缩文件 aosp12.zip

然后依次执行

adb reboot fastboot

fastboot -w update .\aosp12.zip

fastboot reboot

PS H:\rom12\aosp12> adb reboot fastboot
PS H:\rom12\aosp12> fastboot -w update .\aosp12.zip
--------------------------------------------
Bootloader Version...: b1c1-0.4-7617406
Baseband Version.....: g845-00194-210812-B-7635520
Serial Number........: 89BY05MBQ
--------------------------------------------
extracting android-info.txt (0 MB) to RAM...
Checking 'product'                                 OKAY [  0.001s]
Setting current slot to 'b'                        OKAY [  0.035s]
extracting boot.img (64 MB) to disk... took 0.317s
archive does not contain 'boot.sig'
Sending 'boot_b' (65536 KB)                        OKAY [  2.063s]
Writing 'boot_b'                                   OKAY [  0.393s]
extracting dtbo.img (8 MB) to disk... took 0.048s
archive does not contain 'dtbo.sig'
Sending 'dtbo_b' (8192 KB)                         OKAY [  0.257s]
Writing 'dtbo_b'                                   OKAY [  0.066s]
archive does not contain 'dt.img'
archive does not contain 'recovery.img'
extracting vbmeta.img (0 MB) to disk... took 0.004s
archive does not contain 'vbmeta.sig'
Sending 'vbmeta_b' (8 KB)                          OKAY [  0.001s]
Writing 'vbmeta_b'                                 OKAY [  0.003s]
archive does not contain 'vbmeta_system.img'
archive does not contain 'vendor_boot.img'
extracting super_empty.img (0 MB) to disk... took 0.004s
Sending 'system_b' (4 KB)                          OKAY [  0.001s]
Updating super partition                           OKAY [  0.006s]
Resizing 'product_b'                               OKAY [  0.006s]
Resizing 'system_b'                                OKAY [  0.006s]
Resizing 'system_ext_b'                            OKAY [  0.006s]
Resizing 'vendor_b'                                OKAY [  0.006s]
archive does not contain 'boot_other.img'
archive does not contain 'odm.img'
extracting product.img (261 MB) to disk... took 2.240s
archive does not contain 'product.sig'
Resizing 'product_b'                               OKAY [  0.006s]
Sending sparse 'product_b' 1/2 (262140 KB)         OKAY [  8.237s]
Writing 'product_b'                                OKAY [  1.592s]
Sending sparse 'product_b' 2/2 (6092 KB)           OKAY [  0.210s]
Writing 'product_b'                                OKAY [  0.086s]
extracting system.img (795 MB) to disk... took 6.101s
archive does not contain 'system.sig'
Resizing 'system_b'                                OKAY [  0.006s]
Sending sparse 'system_b' 1/4 (262140 KB)          OKAY [  8.247s]
Writing 'system_b'                                 OKAY [  1.634s]
Sending sparse 'system_b' 2/4 (262140 KB)          OKAY [  8.788s]
Writing 'system_b'                                 OKAY [  1.685s]
Sending sparse 'system_b' 3/4 (262140 KB)          OKAY [  8.642s]
Writing 'system_b'                                 OKAY [  1.632s]
Sending sparse 'system_b' 4/4 (27832 KB)           OKAY [  0.935s]
Writing 'system_b'                                 OKAY [  0.199s]
extracting system_ext.img (123 MB) to disk... took 0.779s
archive does not contain 'system_ext.sig'
Resizing 'system_ext_b'                            OKAY [  0.004s]
Sending 'system_ext_b' (126872 KB)                 OKAY [  3.976s]
Writing 'system_ext_b'                             OKAY [  0.826s]
extracting system_other.img (66 MB) to disk... took 0.402s
archive does not contain 'system.sig'
Sending 'system_a' (68120 KB)                      OKAY [  2.129s]
Writing 'system_a'                                 OKAY [  0.410s]
extracting vendor.img (461 MB) to disk... took 3.112s
archive does not contain 'vendor.sig'
Resizing 'vendor_b'                                OKAY [  0.006s]
Sending sparse 'vendor_b' 1/2 (262140 KB)          OKAY [  8.233s]
Writing 'vendor_b'                                 OKAY [  1.651s]
Sending sparse 'vendor_b' 2/2 (210424 KB)          OKAY [  7.042s]
Writing 'vendor_b'                                 OKAY [  1.296s]
archive does not contain 'vendor_dlkm.img'
archive does not contain 'vendor_other.img'
Erasing 'userdata'                                 OKAY [  5.861s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Erasing 'metadata'                                 OKAY [  0.111s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Rebooting                                          OKAY [  0.000s]
Finished. Total time: 89.950s
PS H:\rom12\aosp12>

刷机结束,重启开始搞机啦。

Android 系统开发系列(1):Android 12 源代码下载、编译和刷机

Android系统编译之AOSP刷机

在谷歌云上高速编译安卓AOSP ROM、驱动、内核并完成刷机

android12.0(S) Pixel 3XL (QCOM 845) 编译刷机相关推荐

  1. android12.0(S) Launcher3 导入 AndroidStudio 调试编译

    验证环境 aosp 12.0 源码,分支 android-12.0.0_r3 可以参考之前写的 android12.0(S) Pixel 3XL (QCOM 845) 编译刷机 AndroidStud ...

  2. 安卓ASOP编译刷机

    最近研究定制AOSP源码,自己编译刷机,写一个简单的环境搭建过程,记录下 我的ubuntu 18.04虚拟机配置如下 内存:8G 处理器:4核(编译主要看这个指标) 硬盘:270G 装完虚拟机后,开始 ...

  3. 记录AOSP源码编译刷机(pixel 4a)

    查找pixel 4a所对应的branch分支 我选择了第二行,其补丁级别也是比较新的. build ID 标记 版本 支持的设备 安全补丁程序级别 RQ2A.210505.003 android-11 ...

  4. [2018.10.25]高通QFIL刷机:高通sdm845_la2.0用QFIL软件meta_build和flat_build刷机

    [1 代码准备] (i)amss_standard_oem:高通源码 (ii)test_device:amss_standard_oem对应的二进制文件(高通已经编译) (iii)caf:高通源码对应 ...

  5. android6.0-nexus5 mac上docker 编译刷机

    下载源码 hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 300g ~/android.dmg hdiuti ...

  6. Framework入门のPiex 6P源码(下载/编译/刷机)

    文章目录 前言 第一步:源代码在哪里如何下载 第二步:如何编译,用到哪些命令,编译目标文件是什么 模拟器 真机 第三步:如何修改指定代码并重新安装到手机 第四步:如何阅读源代码 第五步:如何在Linu ...

  7. Pixel 2 XL保姆级刷机教程(Magisk+LSPosed)

    文章目录 前言 谷歌原生系统刷机(线刷) 1. 安装手机usb驱动 2. 刷入第三方Recovery(这里以TWRP为例) 3. 线刷谷歌原生系统 4. 安装Magisk框架(同时也是root解决方案 ...

  8. android开发笔记之高通MSM8909编译刷机脚本

    高通平台的编译和MTK的编译还是有一些不同,多了一些项,并且打包生成的刷机文件也是分散在各个地方,导致这个好像非常玄,弄的我也是老问人,非常不好意思. 这二天,自己看了一下的脚本,搞的非常复杂,自己把 ...

  9. android 远吗编译 刷机 小米,小米10/小米10 Pro系统源代码现已开源,能刷机才是为发烧而生...

    小米10/小米10 Pro系统源代码现已开源,能刷机才是为发烧而生 2020-02-28 19:17:10 38点赞 32收藏 132评论 直达链接 集微网2月28日消息(文/数码控),我们上Gith ...

最新文章

  1. 做不了爱人,我们做什么?
  2. 响应接收窗口大小( ra-ResponseWindowSize)
  3. php移动代码,移动专区周级收录如何提交 复制这段php代码即可
  4. tabulate matlab,matlab中用于统计矩阵数据频率,出现次数的函数
  5. 百度MIP移动页面加速——不只是CDN
  6. C++ 变量和常量
  7. 怎么对MySQL数据库操作大数据?这里有思路
  8. 代理ip网站开发_网站反爬虫策略,用代理IP都能解决吗?
  9. Android Baseline小tip
  10. ITIL问题管理流程设计
  11. excel如何制作图表
  12. Facebook承诺为普通市民提供1500套住房
  13. Web前端相关面试题
  14. spss基础-5.8
  15. 你还在为无法完美卸载SQL Server 2008 R2而烦恼吗?
  16. python程序设计丁亚涛版_Python程序设计
  17. 暴雪魔兽世界用安全令牌送双头犬宠物
  18. Qt 绝对要收藏的网站QTCN Qt绘图工具
  19. Endnote 软件中的名词解释
  20. 快页堡垒机:企业IT运维的“安全守护神”

热门文章

  1. 【简单项目实战】用C++实现学生成绩管理系统 | [普通实现]
  2. react中使用Knob - Dial
  3. 使用VB或VC操作Excel 2003
  4. 有趣又实用的微信小程序,个个让人赞不绝口
  5. [ISUX译]iOS 9人机界面指南(三):iOS 技术
  6. 静态库 DIY ar crv
  7. NC 51114. 磁力块
  8. 【机器学习之线性回归】多元线性回归模型的搭建+Lasso回归的特征提取
  9. 字节跳动接力反内卷:宣布取消大小周,直接降薪 15%?员工炸了!
  10. 制作杂志级图表的第四步:几项非图表技术