Android系统 10.0 AOSP源码编译(三):AOSP源码编译

配套系列教学视频链接:

Android 10.0 AOSP源码编译:https://edu.csdn.net/course/detail/35479

Android 10.0 根文件系统和编译系统:https://edu.csdn.net/course/detail/35480 


说明

系统:AOSP Android10.0

设备:Android模拟器

前言

本章节重点介绍android 源码下载好之后的编译方法。


一, 编译步骤

编译三部曲:1, 初始化编译环境  2, 选择产品  3, 编译

ldswfun@android:/mnt/ext-disk1/a10-aosp$  source build/envsetup.sh

ldswfun@android:/mnt/ext-disk1/a10-aosp$  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_bonito-userdebug

     5. aosp_car_arm-userdebug

     6. aosp_car_arm64-userdebug

     7. aosp_car_x86-userdebug

     8. aosp_car_x86_64-userdebug

     9. aosp_cf_arm64_phone-userdebug

     10. aosp_cf_x86_64_phone-userdebug

     11. aosp_cf_x86_auto-userdebug

     12. aosp_cf_x86_phone-userdebug

     13. aosp_cf_x86_tv-userdebug

     14. aosp_coral-userdebug

     15. aosp_coral_car-userdebug

     16. aosp_crosshatch-userdebug

     17. aosp_crosshatch_car-userdebug

     18. aosp_flame-userdebug

     19. aosp_marlin-userdebug

     20. aosp_sailfish-userdebug

     21. aosp_sargo-userdebug

     22. aosp_sunfish-userdebug

     23. aosp_taimen-userdebug

     24. aosp_walleye-userdebug

     25. aosp_walleye_test-userdebug

     26. aosp_x86-eng

     27. aosp_x86_64-eng

     28. beagle_x15-userdebug

     29. car_x86_64-userdebug

     30. fuchsia_arm64-eng

     31. fuchsia_x86_64-eng

     32. hikey-userdebug

     33. hikey64_only-userdebug

     34. hikey960-userdebug

     35. hikey960_tv-userdebug

     36. hikey_tv-userdebug

     37. m_e_arm-userdebug

     38. mini_emulator_arm64-userdebug

     39. mini_emulator_x86-userdebug

     40. mini_emulator_x86_64-userdebug

     41. poplar-eng

     42. poplar-user

     43. poplar-userdebug

     44. qemu_trusty_arm64-userdebug

Which would you like? [aosp_arm-eng]  //选择27

ldswfun@android:/mnt/ext-disk1/a10-aosp$  make  -j6

二,编译出错处理

A交换分区扩大到3-4G, 请参考以下链接:

https://blog.csdn.net/weixin_42171170/article/details/105784057   

B 若扩展好之后还报错,可尝试虚机关机,然后重启再编译一次。

三,user和eng版本说明

构建类型

使用情况

user

权限受限,适用于生产环境

userdebug

与“user”类似,但具有 root 权限和调试功能;是进行调试时的首选编译类型

eng

工程师版本,具有root权限, 并且具有额外调试工具的开发配置

四, 镜像使用

Android源码编译出来的镜像,可以通过Android自带的emulator来运行。emulator就是平常所说的模拟器, 在用户没有真机的情况, 通过启动模拟器来完成对系统和程序的调试和开发。emulator内部是基于Qemu+KVM虚拟化技术, 通过Qemu模拟出CPU ,硬件总线和外设,emulator在传统的qemu技术上, 增加了各种传感器的模拟, 如重力传感器, gps,电话模块等,  从而实现模拟出一个虚拟机的手机。

emulator启动方法:

ldswfun@android:/mnt/ext-disk1/a10-aosp$  source build/envsetup.sh

ldswfun@android:/mnt/ext-disk1/a10-aosp$  lunch  aosp_x86_64-eng

ldswfun@android:/mnt/ext-disk1/a10-aosp$  emulator  -verbose  -show-kernel -cores 4

总结

Android源码编译是比较费资源的, 并且启动emulator需要的cpu和内存负载都比较大, 如果慢的话,属于正常现象。

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

旗浩QH

你的鼓励将是我创作的最大动力

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

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

打赏作者

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

抵扣说明:

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

余额充值