学习AOSP安卓系统源代码,需要什么样的电脑?不同配置的电脑,其编译时间有多大差距?

1. 卷首语

俗话说得好,工欲善其事必先利其器!有一台自己的编译服务器是每个学习AOSP 安卓系统源代码人的梦想,然而需要什么样的配置呢?下面是我当前在用的3个平台的核心配置,可供大家参考。

  • 因为学习安卓系统源代码,就需要编译和调试系统源码,所以需要一台性能强劲的电脑,否则将在等待上浪费不少时间
  • 个人推荐系统至少是6核心12线程以上,内存至少32G,考虑价格因素搭配使用固态和机械硬盘

另外推荐个人专栏文章:

2.中低配置(6000元价位)

2.1 (2019年7月)AMD Ryzen 5 2600X 6核心12线程 32GB 1TB固态

  • 此套配置,之前是为了兼顾玩点小游戏,2019-07组装,CPU和显卡记得都是千元左右价位,编译时间花了3小时23分钟。
  • 可改换AMD(锐龙7 5800X 8核16线程)2569.00元,或锐龙9(12核心 24线程),获取更高性能
  • 因集显会和CPU抢内存资源,所以不建议使用集显,若不玩游戏,可选配500元以下低端显卡

2.1.1 系统配置

CPU: AMD Ryzen 5 2600X 6核心12线程
内存:金士顿 (Kingston FURY 16GB DDR4 3200)  x2条
主板:微星B450M MORTAR迫击炮
显卡:蓝宝石(Sapphire)RX580 2048SP 8G D5 白金版 OC 1306MHz/8000MHz 8GB/256bit
硬盘:1TB 固态硬盘

2.1.2 编译配置

szhou@bcsrv03:~/workspace/aosp$ source  build/envsetup.sh
szhou@bcsrv03:~/workspace/aosp$ lunch aosp_x86_64-eng
============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=11
TARGET_PRODUCT=aosp_x86_64
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=x86_64
TARGET_ARCH_VARIANT=x86_64
TARGET_2ND_ARCH=x86
TARGET_2ND_ARCH_VARIANT=x86_64
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.11.0-37-generic-x86_64-Ubuntu-20.04.3-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=RQ3A.210705.001
OUT_DIR=out
PRODUCT_SOONG_NAMESPACES=device/generic/goldfish device/generic/goldfish-opengl hardware/google/camera hardware/google/camera/devices/EmulatedCamera device/generic/goldfish device/generic/goldfish-opengl
============================================
szhou@bcsrv03:~/workspace/aosp$ make -j12

2.1.3 编译时间 (03:23:40 (hh:mm:ss))

> [ 99% 121734/121736] Target super fs image for debug: out/target/product/generic
> 2021-10-02 00:01:49 - build_super_image.py - INFO    : Building super image from
> info dict...
> 2021-10-02 00:01:49 - common.py - INFO    :   Running: "lpmake --metadata-size 6
> 5536 --super-name super --metadata-slots 2 --device super:3229614080 --group emu
> lator_dynamic_partitions:3221225472 --partition system:readonly:1695207424:emula
> tor_dynamic_partitions --image system=out/target/product/generic_x86_64/system.i
> mg --partition vendor:readonly:65351680:emulator_dynamic_partitions --image vend
> or=out/target/product/generic_x86_64/vendor.img --output out/target/product/gene
> ric_x86_64/super.img"
> 2021-10-02 00:01:51 - common.py - INFO    : lpmake I 10-02 00:01:49 820545 82054
> 5 builder.cpp:1031] [liblp]Partition system will resize from 0 bytes to 16952074
> 24 bytes
> lpmake I 10-02 00:01:49 820545 820545 builder.cpp:1031] [liblp]Partition vendor 
> will resize from 0 bytes to 65351680 bytes
> Invalid sparse file format at header magic
> Invalid sparse file format at header magic
> 2021-10-02 00:01:51 - build_super_image.py - INFO    : Done writing image out/ta
> rget/product/generic_x86_64/super.img
> [100% 121736/121736] Create system-qemu.img now
> removing out/target/product/generic_x86_64/system-qemu.img.qcow2
> out/host/linux-x86/bin/sgdisk --clear out/target/product/generic_x86_64/system-q
> emu.img
>
>  #### build completed successfully (03:23:40 (hh:mm:ss)) ####
>
> szhou@bcsrv03:~/workspace/aosp$ 

image-20211002070528846

2.1.4 编译android-13 (03:13:06 (hh:mm:ss))

[ 99% 154474/154478] Target super fs image for debug: out/target/product/emulator_x86_64/super.img
2023-12-24 05:08:00 - build_super_image.py - INFO    : Building super image from info dict...
2023-12-24 05:08:00 - common.py - INFO    :   Running: "/home/szhou/works/aosp/aosp/out/host/linux-x86/bin/lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:8598323200 --group emulator_dynamic_partitions:8589934592 --partition system:readonly:1038884864:emulator_dynamic_partitions --image system=out/target/product/emulator_x86_64/system.img --partition system_dlkm:readonly:348160:emulator_dynamic_partitions --image system_dlkm=out/target/product/emulator_x86_64/system_dlkm.img --partition system_ext:readonly:154165248:emulator_dynamic_partitions --image system_ext=out/target/product/emulator_x86_64/system_ext.img --partition product:readonly:330076160:emulator_dynamic_partitions --image product=out/target/product/emulator_x86_64/product.img --partition vendor:readonly:167936000:emulator_dynamic_partitions --image vendor=out/target/product/emulator_x86_64/vendor.img --output out/target/product/emulator_x86_64/super.img"
2023-12-24 05:08:01 - build_super_image.py - INFO    : Done writing image out/target/product/emulator_x86_64/super.img
[100% 154478/154478] Create system-qemu.img now
removing out/target/product/emulator_x86_64/system-qemu.img.qcow2
out/host/linux-x86/bin/sgdisk --clear out/target/product/emulator_x86_64/system-qemu.img

#### build completed successfully (03:13:06 (hh:mm:ss)) ####

szhou@bc-R01:~/works/aosp/aosp$

3. 中高配置(10000元价位)

  • AMD 3900X(老电脑) 此套配置编译时间越90分钟,虽然配置了固态,但因固态空间较小,一般用于代码分析;编译部分依旧使用机械硬盘
  • Intel i7 12700为12核心20线程,为2022年3月份新配置的电脑,对于个人使用,本人已比较满意。
  • 可能部分人会去捡二手的Intel志强处理器,有功夫折腾的也可以,个人没研究这一块。

3.1 AMD 3900X 32GB 1TB固态

3.1.1 配置

CPU: AMD 锐龙9 3900X 处理器 (r9)7nm 12核24线程 3.8GHz 105W AM4接口 盒装CPU
     3499.00 元
内存:金士顿 (Kingston) FURY 32GB DDR4 3200
     929.00 元
SSD:西部数据(Western Digital)1T SSD固态硬盘 M.2接口 (NVMe协议)WD Blue SN550 
     709.00

3.1.2 编译

szhou@bcsrv01:~/aosp$ source  build/envsetup.sh
szhou@bcsrv01:~/aosp$ lunch aosp_x86_64-eng
szhou@bcsrv01:~/aosp$ make -j24

3.1.3编译时间(01:21:53 (hh:mm:ss))

> [ 99% 1338/1340] Target super fs image for debug: out/target/product/generic_x86_64/super.img
> 2021-08-20 09:07:19 - build_super_image.py - INFO    : Building super image from info dict...
> 2021-08-20 09:07:19 - common.py - INFO    :   Running: "lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:3229614080 --group emulator_dynamic_partitions:3221225472 --partition system:readonly:16952
> 07424:emulator_dynamic_partitions --image system=out/target/product/generic_x86_64/system.img --partition vendor:readonly:65351680:emulator_dynamic_partitions --image vendor=out/target/product/generic_x86_64/vendor.img --output o
> ut/target/product/generic_x86_64/super.img"
> 2021-08-20 09:07:24 - common.py - INFO    : lpmake I 08-20 09:07:20 35360 35360 builder.cpp:1031] [liblp]Partition system will resize from 0 bytes to 1695207424 bytes
> lpmake I 08-20 09:07:20 35360 35360 builder.cpp:1031] [liblp]Partition vendor will resize from 0 bytes to 65351680 bytes
> Invalid sparse file format at header magic
> Invalid sparse file format at header magic
> 2021-08-20 09:07:24 - build_super_image.py - INFO    : Done writing image out/target/product/generic_x86_64/super.img
> [100% 1340/1340] Create system-qemu.img now
> removing out/target/product/generic_x86_64/system-qemu.img.qcow2
> out/host/linux-x86/bin/sgdisk --clear out/target/product/generic_x86_64/system-qemu.img
>
> #### build completed successfully (01:21:53 (hh:mm:ss)) ####
>
> szhou@bcsrv01:~/aosp$ 

3.2 i7-12700 32GB 2TB 固态

3.2.1 2022年3月 (Intel i7-12700)

  • CPU、内存、固态硬盘为个人推荐配置
  • 2TB固态硬盘已基本足够用,飞一般的感觉
    在这里插入图片描述

3.2.2 编译 65分钟

4. 高端及其他配置

此类一般是公司里使用,如自己组建团队,可考虑购买。

4.1 戴尔(DELL) PowerEdge R740 32核64线程 64G内存

4.1.1 核心配置

  • 戴尔(DELL) PowerEdge R740 32核64线程 64G内存/3*4TB
CPU: 32核心
内存: 64G
硬盘: RAID机械硬盘

image-20211002065434988

4.1.2 编译配置

szhou@bcsrv01:~/aosp$ source  build/envsetup.sh
szhou@bcsrv01:~/aosp$ lunch aosp_x86_64-eng
szhou@bcsrv01:~/aosp$ make -j32

4.1.3 编译时间 (约40分钟)

> 2021-08-19 20:07:37 - build_super_image.py - INFO    : Done writing image out/target/product/generic_x86_64/super.img
> [100% 64385/64385] Create system-qemu.img now
> removing out/target/product/generic_x86_64/system-qemu.img.qcow2
> out/host/linux-x86/bin/sgdisk --clear out/target/product/generic_x86_64/system-qemu.img
>
> #### build completed successfully (41:58 (mm:ss)) ####
>
> szhou@Android:~/aosp_works/aosp$

4.2 E5 2673v3 X5 2673 32G 二手料 (02:32:43)

4.2.1 配置

CPU: intel E5 2673v3 (12cores, 24 threads.)
     Intel(R) Xeon(R) CPU E5-2673 v3 @ 2.40GHz
DDR: 32G/DDR3
BORAD: JY x99 
--------------------- JD shopping, total: 792 RMB
SATA solid disk:1 TB

4.2.2 编译时间

  void kotlinx.coroutines.scheduling.WorkQueue.offloadAllWork$kotlinx_coroutines_core(kotlinx.coroutines.sched
uling.GlobalQueue)
  Type information in locals-table is inconsistent. Cannot constrain type: BOTTOM (empty) for value: v15 by co
nstraint INT.
Info: Some warnings are typically a sign of using an outdated Java toolchain. To fix, recompile the source wit
h an updated toolchain.
[100% 137254/137254] Target vbmeta image: out/target/product/generic_x86_64/vbmeta.img

#### build completed successfully (02:32:43 (hh:mm:ss)) ####

4.3 DELL R630 E5 2600 v4 36核72线程 128GB内存(二手2000+, 创业推荐)

  • 遇到此机纯属意外,想到价格如此便宜,大致2000左右,加上各种硬盘配置大致不超过3000
  • 虽然使用机械硬盘,但性能却是相当不错,尤其编译Android 13 AOSP本身较为耗时
  • 除了体积大,是目前楼上配置中最具性价比的设备
    在这里插入图片描述

4.3.1 配置

CPU : Intel® Xeon® CPU E5-2686 v4 @ 2.30GHz
内存 : 128GB

4.3.2 编译时间(01:12:30 (hh:mm:ss)

  • 对比intel i5 第13代,32G内存,固态硬盘,同样的源码,大约3小时
编译:sdk_phone_x86_64-userdebug


[ 99% 154474/154478] Target super fs image for debug: out/target/product/emulator_x86_64/super.img
2023-12-20 13:27:46 - build_super_image.py - INFO    : Building super image from info dict...
2023-12-20 13:27:46 - common.py - INFO    :   Running: "/home/szhou/works/aosp/out/host/linux-x86/bin/lpmake --metadata-size 65536 --super-name super --metadata-slots 2 --device super:8598323200 --group emulator_dynamic_partitions:8589934592 --partition system:readonly:1038888960:emulator_dynamic_partitions --image system=out/target/product/emulator_x86_64/system.img --partition system_dlkm:readonly:348160:emulator_dynamic_partitions --image system_dlkm=out/target/product/emulator_x86_64/system_dlkm.img --partition system_ext:readonly:154165248:emulator_dynamic_partitions --image system_ext=out/target/product/emulator_x86_64/system_ext.img --partition product:readonly:330076160:emulator_dynamic_partitions --image product=out/target/product/emulator_x86_64/product.img --partition vendor:readonly:167936000:emulator_dynamic_partitions --image vendor=out/target/product/emulator_x86_64/vendor.img --output out/target/product/emulator_x86_64/super.img"
2023-12-20 13:27:49 - build_super_image.py - INFO    : Done writing image out/target/product/emulator_x86_64/super.img
[100% 154478/154478] Create system-qemu.img now
removing out/target/product/emulator_x86_64/system-qemu.img.qcow2
out/host/linux-x86/bin/sgdisk --clear out/target/product/emulator_x86_64/system-qemu.img

#### build completed successfully (01:12:30 (hh:mm:ss)) ####

szhou@oa-R630:~/works/aosp$ 

5. 结束语

工欲善其事,必先利其器~

欢迎留言,私信~

  • 13
    点赞
  • 47
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 26
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 26
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

阿迷创客

感谢!您的支持是我写作的动力~

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值