鸿蒙系统研究之五:替换 AOSP 预编译库,关闭 SELinux

本文详细讲述了作者如何通过替换AOSP的预编译文件来追踪并解决OpenHarmony2.0中SeLinux的问题,涉及源码编译、AOSP版本管理及Linux内核配置。

这是我的鸿蒙系统研究系列文章的第五篇,有兴趣还可以看看前面的文章:

另外,还有关于鸿蒙系统的看法:

言归正传,在我的上一篇文章 吐槽一下开源鸿蒙系统 中,我提到过,开源鸿蒙标准系统的系统文件主要来自 AOSP 的预编译文件,这对于追踪启动过程中的问题非常不友好。我在 SeLinux 的问题上就卡壳了很久。

前几天在 gitee 上咨询鸿蒙系统的软件工程师,得知 Open Harmony 2.0 的 AOSP 的预编译文件来自 Android 10.0.0_r2 版本。为此下载 Android 10.0.0_r2 源码,编译之后替换,终于找到问题所在,顺利解决了 SeLinux 的问题。

Android 源码经过这么长时间的发展,代码越来越庞大,再加上众多分支,所以整个 repo 库非常庞大。整个源代码克隆下来有两三百个 G,如果网络不稳定,git 又没有断点续传,那就更痛苦了。建议使用国内的 AOSP 镜像站点,比如清华大学的 AOSP mirror 就不错。

$ repo init -u https://mirrors.tuna.tsinghua.edu.cn/git/AOSP/platform/manifest -b android-10.0.0_r2
$ repo sync

代码 sync 完毕之后,按照 Android 文档编译系统。

$ source build/envsetup.sh
$ 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_crosshatch-userdebug
     15. aosp_marlin-userdebug
     16. aosp_sailfish-userdebug
     17. aosp_sargo-userdebug
     18. aosp_taimen-userdebug
     19. aosp_walleye-userdebug
     20. aosp_walleye_test-userdebug
     21. aosp_x86-eng
     22. aosp_x86_64-eng
     23. beagle_x15-userdebug
     24. fuchsia_arm64-eng
     25. fuchsia_x86_64-eng
     26. hikey-userdebug
     27. hikey64_only-userdebug
     28. hikey960-userdebug
     29. hikey960_tv-userdebug
     30. hikey_tv-userdebug
     31. m_e_arm-userdebug
     32. mini_emulator_arm64-userdebug
     33. mini_emulator_x86-userdebug
     34. mini_emulator_x86_64-userdebug
     35. poplar-eng
     36. poplar-user
     37. poplar-userdebug
     38. qemu_trusty_arm64-userdebug
     39. uml-userdebug

Which would you like? [aosp_arm-eng]  

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=10
TARGET_PRODUCT=aosp_arm
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a-neon
TARGET_CPU_VARIANT=generic
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-5.4.0-77-generic-x86_64-Ubuntu-18.04.5-LTS
HOST_CROSS_OS=windows
HOST_CROSS_ARCH=x86
HOST_CROSS_2ND_ARCH=x86_64
HOST_BUILD_TYPE=release
BUILD_ID=QP1A.190711.020
OUT_DIR=out
=======
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

云水木石

但行好事,莫问前程

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

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

打赏作者

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

抵扣说明:

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

余额充值