1.安装wsl2

a.在windows 10 系统中启用wsl2(只能是wsl2,wsl1 会编译失败), 并商店中下载ubuntu镜像,商店默认安装位置为C:\Program Files\WindowsApps,考虑到编译需要100多G空间,需要把app移动到其他盘.

用管理员权限打开cmd

1 :: 切换到目录中
2 c:\Program Files\WindowsApps> cd /d "C:\Program Files\WindowsApps"
3 :: 查找文件夹名字
4 c:\Program Files\WindowsApps>dir | findstr Ubuntu20
5 2022/02/07 16:35 <DIR> CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_neutral_split.scale-100_79rhkp1fndgsc
6 2022/02/07 16:35 <DIR> CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_neutral_~_79rhkp1fndgsc
7 2022/02/07 16:35 <DIR> CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc
8
9 xcopy CanonicalGroupLimited.Ubuntu20.04onWindows_2004.2021.825.0_x64__79rhkp1fndgsc e:\wsl /E/H/C/I

b.直接双击运行ubuntu2004.exe,

2.准备环境

安装环境
https://source.android.google.cn/setup/initializing?hl=zh-cn

aosp编译流程
https://source.android.google.cn/setup/building?hl=zh-cn

3.由于大部分库都在墙外,设置代理

 1 #repo设置proxy
2 export http_proxy=http://192.168.1.60:8080
3 export https_proxy=https://192.168.1.60:8080
4 #Git设置proxy
5 git config --global http.proxy http://192.168.1.60:8080
6 git config --global https.proxy http://192.168.1.60:8080
7#Git 取消proxy
8 git config --global --unset http.proxy
9 git config --global --unset https.proxy

4.下载代码,时间比较长.

1 $ mkdir ~/mokee
2 $ git config --global user.email "your@email.address"
3 $ git config --global user.name “Your Name”
4 $ cd ~/mokee
5
6 $ repo init -u https://github.com/MoKee/android -b mkq-mr1 --depth 1
7 $ repo sync -j4

5.执行breakfast.

 1 DESKTOP-AIAM0DF:~/mokee$ breakfast
2 You're building on Linux
3
4 Lunch menu... pick a combo:
5 1. aosp_arm-eng
6 2. aosp_arm64-eng
7 3. aosp_car_arm-userdebug
8 4. aosp_car_arm64-userdebug
9 5. aosp_car_x86-userdebug
10 6. aosp_car_x86_64-userdebug
11 7. aosp_x86-eng
12 8. aosp_x86_64-eng
13 9. car_x86_64-userdebug
14 10. m_e_arm-userdebug
15 11. mini_emulator_arm64-userdebug
16 12. mini_emulator_x86-userdebug
17 13. mini_emulator_x86_64-userdebug
18 14. mokee_arm-userdebug
19 15. mokee_arm64-userdebug
20 16. mokee_dumpling-eng
21 17. mokee_dumpling-user
22 18. mokee_dumpling-userdebug
23 19. mokee_x86-userdebug
24 20. mokee_x86_64-userdebug
25 21. qemu_trusty_arm64-userdebug
26 22. uml-userdebug
27
28 Which would you like? [aosp_arm-eng] ^C

如果列表中没有 mokee_dumpling-userdebug,

则往.repo/manifests/default.xml中添加

<project path="vendor/oneplus/dumpling" name="MoKee/android_vendor_oneplus_dumpling" clone-depth="1" />

<project path="device/oneplus/dumpling" name="MoKee/android_device_oneplus_dumpling" groups="pdk" />

怎么知道name="MoKee/android_device_oneplus_dumpling", 其实是直接在 https://github.com/MoKee  中搜索dumpling,根据xml格式自己添加的,

再次执行repo sync

6.执行 lunch mokee_dumpling-userdebug

7.执行 mka bacon

等待漫长的编译过程, 我16G内存,占用了大约12G.所以内存最好16G以上.

中间碰到几个错误,google下都解决了.

碰到的一些错误.
错误 cmd: unknown variable '$(PATH_OVERRIDE_SOONG)'
解决 breakfast
repo sync
mkbacon

编译Android时报错:error while loading shared libraries: libncurses.so.5: cannot open shared object file:
解决方式

https://blog.csdn.net/druieam/article/details/106818875

参考文档

How To Port CyanogenMod/LineageOS Android To Your Own Device

Build for dumpling

编译属于你自己的 Sultanized MoKee

小米8(Dipper)编译魔趣MK100全流程记录

最新文章

  1. Jenkins安装
  2. 变量声明---let,const,解构
  3. Thread多线程(二):Runnable
  4. jquery 判断checkbox是否选中几个版本的区别
  5. 接口API测试和返回值JSON解析的插件
  6. Java基础之一组有用的类——使用正则表达式搜索子字符串(TryRegex)
  7. 【图形学】我理解的伽马校正(Gamma Correction)
  8. 01-01-01【Nhibernate (版本3.3.1.4000) 出入江湖】配置文件
  9. hibernate_validator_06
  10. android网页分享到朋友圈问题求助?
  11. day9、用户登陆出现-bash-4.1$错误的原因及解决方法
  12. python2.6.6 升级 2.7.X
  13. SQL Server MSSQLSERVER 服务无法启动解决方案
  14. ffplay源码分析2-数据结构
  15. memcached全面剖析--5. memcached的应用和兼容程序
  16. Django的model中创建表
  17. 第十三次ScrumMeeting博客
  18. IOS内购支付server验证模式
  19. (转)ASP.NET Core 性能对比评测(ASP.NET,Python,Java,NodeJS)
  20. linux 配置svn服务器+使用+注意事项

热门文章

  1. 记一次使用tika解析文件文本导致的内存溢出问题
  2. 【模板】动态树(Link Cut Tree)
  3. C#本地时间转Unix时间
  4. .Net6 Html.Action无法使用(ViewComponents)
  5. PostGIS之空间关系
  6. postgresql 常用的删除重复数据方法
  7. pat乙级1014 福尔摩斯的约会
  8. aop切面记日志
  9. 微信小程序tabBar不显示的问题
  10. R代码