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

查找pixel 4a所对应的branch分支

我选择了第二行,其补丁级别也是比较新的。

build ID标记版本支持的设备安全补丁程序级别
RQ2A.210505.003android-11.0.0_r37Android11Pixel 4a (5G)、Pixel 52021-05-05
RQ2A.210505.002android-11.0.0_r36Android11Pixel 3、Pixel 3a、Pixel 3a XL、Pixel 3 XL、Pixel 4、Pixel 4a、Pixel 4 XL2021-05-05
RQ2A.210405.006android-11.0.0_r35Android11Pixel 3、Pixel 3 XL2021-04-05
RQ2A.210405.005android-11.0.0_r34Android11Pixel 3、Pixel 3a、Pixel 3a XL、Pixel 3 XL、Pixel 4、Pixel 4a、Pixel 4a (5G)、Pixel 4 XL、Pixel 52021-04-05
RQ2A.210305.007android-11.0.0_r33Android11Pixel 4a、Pixel 4a (5G)、Pixel 52021-03-05
RQ2A.210305.006android-11.0.0_r32Android11Pixel 3、Pixel 3 XL、Pixel 3a、Pixel 3a XL、Pixel 4、Pixel 4 XL、Pixel 4a、Pixel 4a (5G)、Pixel 52021-03-05
RQ1D.210205.004android-11.0.0_r31Android11Pixel 3、Pixel 3 XL、Pixel 4a (5G)、Pixel 52021-02-05
RQ1C.210205.006android-11.0.0_r30Android11Pixel 4a (5G)、Pixel 52021-02-05
RQ1A.210205.004android-11.0.0_r29Android11Pixel 3、Pixel 3a、Pixel 3a XL、Pixel 3 XL、Pixel 4、Pixel 4a、Pixel 4a (5G)、Pixel 4 XL、Pixel 52021-02-05
RQ1D.210105.003android-11.0.0_r28Android11Pixel 3、Pixel 3 XL、Pixel 4a (5G)、Pixel 52021-01-05
RQ1A.210105.003android-11.0.0_r27Android11Pixel 3、Pixel 3 XL、Pixel 4、Pixel 4a (5G)、Pixel 4 XL、Pixel 52021-01-05
RQ1A.210105.002android-11.0.0_r26Android11Pixel 3a、Pixel 3a XL、Pixel 4a2021-01-05
RP1A.201005.004.A1android-11.0.0_r25Android11Pixel 2、Pixel 2 XL2020-10-05
RQ1D.201205.012.A1android-11.0.0_r24Android11Pixel 5、Pixel 4a (5G)2020-12-05
RQ1A.201205.003.A1android-11.0.0_r23Android11Pixel 3、Pixel 3 XL2020-12-05
RQ1A.201205.011android-11.0.0_r22Android11Pixel 5、Pixel 4a (5G)2020-12-05
RQ1A.201205.008.A1android-11.0.0_r21Android11Pixel 4、Pixel 4 XL2020-12-05
RQ1A.201205.010android-11.0.0_r20Android11Pixel 5、Pixel 4a (5G)2020-12-05
RQ1A.201205.008android-11.0.0_r19Android11Pixel 4a、Pixel 4、Pixel 4 XL2020-12-05
RQ1A.201205.003android-11.0.0_r18Android11Pixel 3a、Pixel 3a XL、Pixel 3 XL、Pixel 32020-12-05
RP1A.201105.002android-11.0.0_r17Android11Pixel 3、Pixel 3a、Pixel 3a XL、Pixel 3 XL、Pixel 4、Pixel 4a、Pixel 4 XL2020-11-05
RD1B.201105.010android-11.0.0_r16Android11Pixel 4a (5G)、Pixel 52020-11-05
RD1A.201105.003.C1android-11.0.0_r15Android11Pixel 4a (5G)、Pixel 52020-11-05
RD1A.201105.003.B1android-11.0.0_r14Android11Pixel 4a (5G)、Pixel 52020-11-05
RD1A.201105.003.A1android-11.0.0_r13Android11Pixel 4a (5G)、Pixel 52020-11-05
RD1A.201105.003android-11.0.0_r12Android11Pixel 4a (5G)、Pixel 52020-11-05
RD1A.200810.022.A4android-11.0.0_r11Android11Pixel 4a (5G)、Pixel 52020-10-05
RD1A.200810.021.B3android-11.0.0_r10Android11Pixel 4a (5G)、Pixel 52020-10-05
RD1A.200810.020.A1android-11.0.0_r9Android11Pixel 52020-10-05
RD1A.200810.021.A1android-11.0.0_r8Android11Pixel 4a (5G)、Pixel 52020-10-05
RD1A.200810.020android-11.0.0_r7Android11Pixel 4a (5G)、Pixel 52020-10-05
RP1A.201005.006android-11.0.0_r5Android11Pixel 4a2020-10-05

国内使用清华镜像,下载aosp代码

使用清华的repo

下载
curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo -o repo
chmod +x repo
为了方便可以将其拷贝到你的PATH里。

更新
repo的运行过程中会尝试访问官方的git源更新自己,如果想使用tuna的镜像源进行更新,可以将如下内容复制到你的~/.bashrc里

export REPO_URL='https://mirrors.tuna.tsinghua.edu.cn/git/git-repo'
并重启终端模拟器。

把新鲜的包下载下来

wget -c https://mirrors.tuna.tsinghua.edu.cn/aosp-monthly/aosp-latest.tar # 下载初始化包
tar xf aosp-latest.tar
cd AOSP   # 解压得到的 AOSP 工程目录

初始化分支

repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-11.0.0_r37 --no-clone-bundle --depth=1

开始同步代码

repo sync --jobs=4 --current-branch --no-clone-bundle

通过上面表格中的build ID,找到driver并下载

Pixel 4a binaries for Android 11.0.0 (RQ2A.210505.002)

Hardware ComponentCompanyDownloadSHA-256 Checksum
Vendor imageGoogleLink58017c1857198d3a6dfdcba24579fb3f1c30611815017f3de22e856b5d71e6ce
GPS, Audio, Camera, Gestures, Graphics, DRM, Video, SensorsQualcommLink40ff31bce2bc2d2afa9b0b7a2f6ad0742eaca6ac28090b4b6ddbdcb9343769bc

把这两个组件都下载下来解压,其实是两个sh脚本,放到aosp下载的源码根目录

admin@n227-085-009:/data00/home/admin/work/aosp_sunfish$ ls -al *.sh
-rwxr-x--x 1 admin admin 274738793 Jun  4 08:59 extract-google_devices-sunfish.sh
-rwxr-x--x 1 admin admin    743011 Jun  4 09:00 extract-qcom-sunfish.sh

运行这两个dirver shell脚本,一直回车,因为太长可以直接ctrl+c,然后输入I ACCEPT回车就行了

admin@n227-085-009:/data00/home/admin/work/aosp_sunfish$ extract-qcom-sunfish.sh
The license for this software will now be displayed.
You must agree to this license before using this software.

Press Enter to view the license

THIS DEVELOPER SOFTWARE LICENSE AGREEMENT (THE "AGREEMENT") IS A LEGALLY
BINDING AGREEMENT BETWEEN Qualcomm Technologies, Inc. ("LICENSOR") AND
YOU OR THE LEGAL ENTITY YOU REPRESENT ("You" or its possessive, "Your"). BY
TYPING "I ACCEPT" WHERE INDICATED YOU ACKNOWLEDGE THAT YOU HAVE READ THIS
AGREEMENT, UNDERSTAND IT AND AGREE TO BE BOUND BY ITS TERMS AND CONDITIONS.
IF YOU DO NOT AGREE TO THESE TERMS YOU MUST DISCONTINUE THE INSTALLATION
PROCESS AND YOU SHALL NOT USE THE SOFTWARE OR RETAIN ANY COPIES OF THE
SOFTWARE OR DOCUMENTATION. ANY USE OR POSSESSION OF THE SOFTWARE BY YOU IS
SUBJECT TO THE TERMS AND CONDITIONS SET FORTH IN THIS AGREEMENT. IF THE
SOFTWARE IS INSTALLED ON A COMPUTER OWNED BY A CORPORATION OR OTHER LEGAL
ENTITY, THEN YOU REPRESENT AND WARRANT THAT YOU HAVE THE AUTHORITY TO BIND
SUCH ENTITY TO THE TERMS AND CONDITIONS OF THIS AGREEMENT.

   1.  Special Definitions

      a.  The term "Android" means the open source mobile platform, software
          stack, operating system, middleware, application programming
          interfaces and mobile applications under the trade-name "Android"
          distributed at Android.com.

      b.  The term "Android Applications" means a software application or
          open-source contribution developed by You, designed to operate with
          Android that does not contain or incorporate any of the Software.

      c.  The term "Authorized Android Enabled Device" means only the device
          identified on the site from which You downloaded the Software.
          The term "Software" means the Licensor's proprietary software and
          libraries in object code form, designed for use on the Authorized
          Android Enabled Device.

      d.  The term "Authorized Android Enabled Device Software" means a
          packaged build for Authorized Android Enabled Devices, consisting
          of files suitable for installation on an Authorized Android Enabled
          Device using a mechanism such as fastboot mode or recovery mode.

   2.  License Grant

      a.  Subject to the terms of this Agreement, Licensor hereby grants to
          You, free of charge, a non-exclusive, non-sublicensable,
          non-transferable, limited copyright license, during the term of
          this Agreement, to download, install and use the Software
          internally in machine-readable (i.e., object code) form and the
          Documentation for non-commercial use on an Authorized Android
          Enabled Device and non-commercial redistribution for academic
          purposes only of a reasonable number of copies of the Authorized
          Android Enabled Device Software (the "Limited Purpose"). You may
          grant your end users the right to use the Software for
          non-commercial purposes on an Authorized Android Enabled Device.
          The license to the Software granted to You hereunder is solely for
          the Limited Purpose set forth in this section, and the Software
          shall not be used for any other purpose.

   3.  Restrictions

      a.  Retention of Rights. The entire right, title and interest in the

Type "I ACCEPT" if you agree to the terms of the license: I ACCEPT

vendor/
vendor/qcom/
vendor/qcom/sunfish/
vendor/qcom/sunfish/LICENSE
vendor/qcom/sunfish/BoardConfigPartial.mk
vendor/qcom/sunfish/proprietary/
vendor/qcom/sunfish/proprietary/libimsmedia_jni.so
vendor/qcom/sunfish/proprietary/ims.apk
vendor/qcom/sunfish/proprietary/lib64/
vendor/qcom/sunfish/proprietary/lib64/libimsmedia_jni.so
vendor/qcom/sunfish/proprietary/Android.bp
vendor/qcom/sunfish/proprietary/qti-telephony-hidl-wrapper.jar
vendor/qcom/sunfish/proprietary/QtiTelephonyService.apk
vendor/qcom/sunfish/proprietary/com.qualcomm.qcrilmsgtunnel.xml
vendor/qcom/sunfish/proprietary/qti_telephony_utils.xml
vendor/qcom/sunfish/proprietary/qti-telephony-utils.jar
vendor/qcom/sunfish/proprietary/qti_telephony_hidl_wrapper.xml
vendor/qcom/sunfish/proprietary/qcrilhook.xml
vendor/qcom/sunfish/proprietary/qcrilhook.jar
vendor/qcom/sunfish/proprietary/org_codeaurora_ims.xml
vendor/qcom/sunfish/proprietary/qcrilmsgtunnel.apk
vendor/qcom/sunfish/proprietary/Android.mk
vendor/qcom/sunfish/device-partial.mk
vendor/google_devices/
vendor/google_devices/sunfish/
vendor/google_devices/sunfish/android-info.txt
vendor/google_devices/sunfish/proprietary/
vendor/google_devices/sunfish/proprietary/BoardConfigVendor.mk
vendor/google_devices/sunfish/proprietary/device-vendor.mk

Files extracted successfully.

开始编译

1. source build/envsetup.sh
2. lunch
You're building on Linux

Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_arm64-eng
     3. aosp_blueline-userdebug
     4. aosp_blueline_car-userdebug
     5. aosp_bonito-userdebug
     6. aosp_bonito_car-userdebug
     7. aosp_bramble-userdebug
     8. aosp_car_arm-userdebug
     9. aosp_car_arm64-userdebug
     10. aosp_car_x86-userdebug
     11. aosp_car_x86_64-userdebug
     12. aosp_cf_arm64_auto-userdebug
     13. aosp_cf_arm64_phone-userdebug
     14. aosp_cf_x86_64_phone-userdebug
     15. aosp_cf_x86_auto-userdebug
     16. aosp_cf_x86_phone-userdebug
     17. aosp_cf_x86_tv-userdebug
     18. aosp_coral-userdebug
     19. aosp_coral_car-userdebug
     20. aosp_crosshatch-userdebug
     21. aosp_crosshatch_car-userdebug
     22. aosp_flame-userdebug
     23. aosp_flame_car-userdebug
     24. aosp_redfin-userdebug
     25. aosp_sargo-userdebug
     26. aosp_sunfish-userdebug
     27. aosp_trout_arm64-userdebug
     28. aosp_trout_x86-userdebug
     29. aosp_x86-eng
     30. aosp_x86_64-eng
     31. arm_krait-eng
     32. arm_v7_v8-eng
     33. armv8-eng
     34. armv8_kryo385-eng
     35. beagle_x15-userdebug
     36. beagle_x15_auto-userdebug
     37. car_x86_64-userdebug
     38. db845c-userdebug
     39. fuchsia_arm64-eng
     40. fuchsia_x86_64-eng
     41. hikey-userdebug
     42. hikey64_only-userdebug
     43. hikey960-userdebug
     44. hikey960_tv-userdebug
     45. hikey_tv-userdebug
     46. pixel3_mainline-userdebug
     47. poplar-eng
     48. poplar-user
     49. poplar-userdebug
     50. qemu_trusty_arm64-userdebug
     51. silvermont-eng
     52. uml-userdebug
     53. yukawa-userdebug
     54. yukawa_sei510-userdebug

Which would you like? [aosp_arm-eng] 26
3. make -j8

lunch的时候,选择了26 sunfish(pixel 4a的代号)

编译成功之后,打包img文件

admin$aosp$ cd out/target/product/sunfish/
admin$sunfish$ ls *.img
boot-debug.img  bootloader.img  dtbo.img     radio.img          ramdisk.img           super_empty.img  system.img        userdata.img  vbmeta_system.img
boot.img        dtb.img         product.img  ramdisk-debug.img  ramdisk-recovery.img  system_ext.img   system_other.img  vbmeta.img    vendor.img
admin$sunfish$ tar -zcvf sunfish-11.tar.gz *.img

刷机

scp传到本机Mac

scp admin@xx.xx.xx.xx:/home/admin/work/aosp_sunfish/out/target/product/sunfish/sunfish-11.tar.gz .

解压gzip文件

tar -zxvf sunfish-11.tar.gz

添加ANDROID_PRODUCT_OUT环境变量

export ANDROID_PRODUCT_OUT=/Users/admin/tmp/ROM

使用fastboot开刷

admin@C02D7132MD6R ROM % fastboot flashall -w
--------------------------------------------
Bootloader Version...: s5-0.3-6835615
Baseband Version.....: g7150-00023-201008-B-6891498
Serial Number........: 0A021JEC204265
--------------------------------------------
Checking 'product'                                 OKAY [  0.068s]
Setting current slot to 'b'                        OKAY [  0.155s]
Sending 'boot_b' (65536 KB)                        OKAY [  0.430s]
Writing 'boot_b'                                   OKAY [  0.295s]
Sending 'dtbo_b' (8192 KB)                         OKAY [  0.160s]
Writing 'dtbo_b'                                   OKAY [  0.094s]
Sending 'vbmeta_b' (8 KB)                          OKAY [  0.140s]
Writing 'vbmeta_b'                                 OKAY [  0.077s]
Sending 'vbmeta_system_b' (4 KB)                   OKAY [  0.140s]
Writing 'vbmeta_system_b'                          OKAY [  0.077s]
Rebooting into fastboot                            OKAY [  0.070s]
< waiting for any device >

Sending 'super' (4 KB)                             OKAY [  0.001s]
Updating super partition                           OKAY [  0.011s]
Resizing 'product_b'                               OKAY [  0.004s]
Resizing 'system_b'                                OKAY [  0.005s]
Resizing 'system_ext_b'                            OKAY [  0.004s]
Resizing 'system_a'                                OKAY [  0.005s]
Resizing 'vendor_b'                                OKAY [  0.004s]
Resizing 'vendor_a'                                OKAY [  0.004s]
Resizing 'product_b'                               OKAY [  0.004s]
Sending 'product_b' (233992 KB)                    OKAY [  1.194s]
Writing 'product_b'                                OKAY [  1.825s]
Resizing 'system_b'                                OKAY [  0.005s]
Sending sparse 'system_b' 1/4 (262140 KB)          OKAY [  1.350s]
Writing 'system_b'                                 OKAY [  1.935s]
Sending sparse 'system_b' 2/4 (262140 KB)          OKAY [  1.341s]
Writing 'system_b'                                 OKAY [  0.898s]
Sending sparse 'system_b' 3/4 (262140 KB)          OKAY [  1.341s]
Writing 'system_b'                                 OKAY [  0.899s]
Sending sparse 'system_b' 4/4 (73812 KB)           OKAY [  0.364s]
Writing 'system_b'                                 OKAY [  0.312s]
Resizing 'system_ext_b'                            OKAY [  0.005s]
Sending 'system_ext_b' (106640 KB)                 OKAY [  0.550s]
Writing 'system_ext_b'                             OKAY [  1.434s]
Resizing 'system_a'                                OKAY [  0.005s]
Sending 'system_a' (23844 KB)                      OKAY [  0.123s]
Writing 'system_a'                                 OKAY [  0.117s]
Resizing 'vendor_b'                                OKAY [  0.005s]
Sending sparse 'vendor_b' 1/3 (262140 KB)          OKAY [  1.352s]
Writing 'vendor_b'                                 OKAY [  1.928s]
Sending sparse 'vendor_b' 2/3 (262140 KB)          OKAY [  1.349s]
Writing 'vendor_b'                                 OKAY [  0.885s]
Sending sparse 'vendor_b' 3/3 (27864 KB)           OKAY [  0.145s]
Writing 'vendor_b'                                 OKAY [  0.148s]
Erasing 'userdata'                                 OKAY [  8.343s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Erasing 'metadata'                                 OKAY [  0.012s]
Erase successful, but not automatically formatting.
File system type raw not supported.
Rebooting                                          OKAY [  0.000s]
Finished. Total time: 46.249s
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值