编译 Android 11源码
参考小米6 lineageos官方编译文档:https://wiki.lineageos.org/devices/sagit/build
单独编译 framework
以LineageOS18.1(Android 11)为例:
1、在源码根目录执行:
make framework-minus-apex
2、用生成的framework.jar替换系统的framework.jar
adb root
adb remount
adb push framework.jar /system/framework/framework.jar
3、重启zygote
adb shell stop
adb shell start
如果卡开机界面不能进入系统,修改下面配置,并编译完整系统刷机,再编译framework.jar单独替换:
1、build/make/core目录下board_config.mk文件
1)WITH_DEXPREOPT := ture 改为 WITH_DEXPREOPT := false
2、build/make/core目录下dex_preopt_config.mk文件
1)WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= ture 改为 WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= false
2)注释下面代码:
ifeq (,$(filter eng, $(TARGET_BUILD_VARIANT)))
ifneq (true,$(WITH_DEXPREOPT))
ifneq (true,$(WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY))
$(call pretty-error, DEXPREOPT must be enabled for user and userdebug builds)
endif
endif
endif