Android源码编译原生模拟器

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=0

configAndStartRenderer: 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

下载源代码

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

代号、标记和细分版本号

猜你喜欢

转载自blog.csdn.net/Jun_P/article/details/128161751
今日推荐