Android源码编译原生模拟器
admin
2024-04-16 11:31:50
0

Android源码编译原生模拟器

源代码下载

安装repo

确保主目录下有一个 bin/ 目录,并且该目录包含在路径中:

mkdir ~/bin
PATH=~/bin:$PATH

下载 Repo 工具,并确保它可执行:

curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

查看分支

repo init -u https://android.googlesource.com/platform/manifest

查看android支持分支版本 链接

初始化

使用 -b 来指定相应分支。

repo init -u https://android.googlesource.com/platform/manifest -b android-12.1.0_r26

下载

repo sync

代码编译

命令

source build/envsetup.sh
lunch $buildType
make -j4

$buildType的选择

终端输入lunch可以看到支持的build选项

1. aosp_arm-eng
2. aosp_arm64-eng
3. aosp_blueline_car-userdebug
4. aosp_bonito_car-userdebug
5. aosp_bramble_car-userdebug
6. aosp_car_arm-userdebug
7. aosp_car_arm64-userdebug
8. aosp_car_x86-userdebug
9. aosp_car_x86_64-userdebug
10. aosp_cf_arm64_auto-userdebug
11. aosp_cf_arm64_phone-userdebug
12. aosp_cf_x86_64_foldable-userdebug
13. aosp_cf_x86_64_pc-userdebug
14. aosp_cf_x86_64_phone-userdebug
15. aosp_cf_x86_64_tv-userdebug
16. aosp_cf_x86_auto-userdebug
17. aosp_cf_x86_phone-userdebug
18. aosp_cf_x86_tv-userdebug
19. aosp_coral_car-userdebug
20. aosp_crosshatch_car-userdebug
21. aosp_flame_car-userdebug
22. aosp_redfin_car-userdebug
23. aosp_sargo_car-userdebug
24. aosp_sunfish_car-userdebug
25. aosp_trout_arm64-userdebug
26. aosp_trout_x86-userdebuaosp_car_x86_64-userdebugg
27. aosp_x86-eng
28. aosp_x86_64-eng
29. arm_krait-eng
30. arm_v7_v8-eng
31. armv8-eng
32. armv8_cortex_a55-eng
33. armv8_kryo385-eng
34. beagle_x15-userdebug
35. beagle_x15_auto-userdebug
36. car_x86_64-userdebug
37. db845c-userdebug
38. gsi_car_arm64-userdebug
39. gsi_car_x86_64-userdebug
40. hikey-userdebug
41. hikey64_only-userdebug
42. hikey960-userdebug
43. hikey960_tv-userdebug
44. hikey_tv-userdebug
45. pixel3_mainline-userdebug
46. poplar-eng
47. poplar-user
48. poplar-userdebug
49. qemu_trusty_arm64-userdebug
50. sdk_car_arm-userdebug
51. sdk_car_arm64-userdebug
52. sdk_car_x86-userdebug
53. sdk_car_x86_64-userdebug
54. silvermont-eng
55. uml-userdebug
56. yukawa-userdebug
57. yukawa_sei510-userdebug

其中以aosp_car_arm-userdebug来说明,aosp_car表示平台,arm表示平台架构,userdebug表示编译类型。

编译

make命令可以编译系统,还可以单独编译某个模块,比如

make systemimage 编译system分区镜像

make vendorimage 编译vendor分区镜像

make SystemUI 编译SystemUI

make Gallery 编译图册

make framework 编译framework框架

编译问题

参考 Android源码编译问题

运行模拟器

命令

emulator

错误

cannot add library /home/jun/data/AOSP12/prebuilts/android-emulator/linux-x86_64/qemu/linux-x86_64/lib64/vulkan/libvulkan.so: failed
added library /home/jun/data/AOSP12/prebuilts/android-emulator/linux-x86_64/lib64/vulkan/libvulkan.so
INTEL-MESA: warning: Performance support disabled, consider sysctl dev.i915.perf_stream_paranoid=0configAndStartRenderer: setting vsync to 60 hz
qemu-system-x86_64: Could not open '/home/jun/data/AOSP12/out/target/product/generic_car_x86_64/userdata-qemu.img': No such file or directory

找不到userdata-qemu.img 我们需要将编译选项切换到sdk...比如sdk_car_x86_64-userdebug

重新执行 emulator

ref

下载源代码

特定设备上运行编译系统信息

代号、标记和细分版本号

相关内容

热门资讯

漂流瓶APP十大推荐榜单 优质... 漂流瓶作为一种富有浪漫色彩与探索感的社交形式,近年来在移动端持续焕发活力。这类应用依托匿名性、随机性...
免费看日剧的APP推荐 202... 日剧凭借其细腻的情感刻画、紧凑的叙事节奏以及独特的文化表达,在全球范围内积累了大量忠实观众。对于想要...
免费观看电视剧无广告APP推荐... 如今,不少观众在追剧过程中常被频繁弹出的广告打断体验,影响观感。那么,是否存在真正免费、无广告干扰,...
免费设计房屋装修图APP推荐 ... 许多业主在完成购房后,往往面临装修设计环节的难题:专业设计师费用较高,线上渠道又担心方案质量参差不齐...
好用的看动漫App推荐 202... 当下二次元文化持续升温,动漫内容已深度融入不同年龄层的数字生活场景。面对海量新番与国漫更新节奏加快、...
2026超自然现象研究必备:6... 这游戏的地图有3平方公里,藏着超500个动态刷新点——道具位置、怪物生成、鬼魂游走路径全随机。每一局...
2026年《ThePhenom... ThePhenomenon凭借其原创量子力学世界观与高帧率动态战斗系统,成为2026年全球现象级手游...
卖号平台app哪个好 好用的卖... 现在游戏号交易已经是非常正常的操作,很多玩家手中都有大量游戏号闲置,今天小编就来介绍一下卖号平台ap...
三国志王道天下攻城备战攻略一览... 本期小编介绍的是三国志王道天下攻城备战攻略一览,游戏中攻城备战是非常重要的战斗一环,而玩家们从出生的...
辉光之城1907上线了吗 辉光... 辉光之城1907上线了吗?这款主打建设和治愈风格的手游,确实吸引了不少人的关注。从目前的情况来看,游...