赞
踩
系统环境;
目标系统: Android 8.1
目标硬件: RK3399Pro , rockchip toybrick。
参考文献:
Makefile中filter-out的函义:
https://www.jianshu.com/p/4837a05b9082
Makefile中foreach的函义:
https://blog.csdn.net/u012554768/article/details/46043193
裁剪文档:
https://blog.csdn.net/qq_23327993/article/details/90768627
步聚:
1. 添加编译环境变量 PRODUCT_DEL_PACKAGES,添加位置:build/make/core/product.mk中的_product_var_list:
- _product_var_list := \
- PRODUCT_NAME \
- PRODUCT_MODEL \
- PRODUCT_LOCALES \
- PRODUCT_AAPT_CONFIG \
- PRODUCT_AAPT_PREF_CONFIG \
- PRODUCT_AAPT_PREBUILT_DPI \
- PRODUCT_PACKAGES \
- PRODUCT_PACKAGES_DEBUG \
- PRODUCT_PACKAGES_ENG \
- PRODUCT_PACKAGES_TESTS \
- PRODUCT_DEL_PACKAGES \
- PRODUCT_DEVICE \
- PRODUCT_MANUFACTURER \
- PRODUCT_BRAND \
- PRODUCT_PROPERTY_OVERRIDES \
- PRODUCT_DEFAULT_PROPERTY_OVERRIDES \
- PRODUCT_CHARACTERISTICS \
- PRODUCT_COPY_FILES \
- PRODUCT_OTA_PUBLIC_KEYS \
- PRODUCT_EXTRA_RECOVERY_KEYS \
- PRODUCT_PACKAGE_OVERLAYS \
- DEVICE_PACKAGE_OVERLAYS \
2. 在相应的mk文件中给PRODUCT_DEL_PACKAGES赋值,如在device\rockchip\rk3399pro\rk3399pro.mk对PRODUCT_DEL_PACKAGES进行赋值;其值为要删除的APK。
- PRODUCT_DEL_PACKAGES += \
- SoundRecorder \
- Camera2 \
- Lightning \
- Email \
- Gallery2 \
- Music \
- NfcNci \
- MusicFX \
- Contacts \
- Calendar \
- ExactCalculator \
- Browser2 \
- DeskClock \
- EasterEgg
3. 在编译脚本中,增加对PRODUCT_PACKAGES的中字符串处理,删除掉PRODUCT_DEL_PACKAGES相应的字符串。
build/core/main.mk
- # The base list of modules to build for this product is specified
- # by the appropriate product definition file, which was included
- # by product_config.mk.
- product_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)
- # Filter out the overridden packages before doing expansion
- product_MODULES := $(filter-out $(foreach p, $(product_MODULES), \
- $(PACKAGES.$(p).OVERRIDES)), $(product_MODULES))
- # Filter out executables as well
- product_MODULES := $(filter-out $(foreach m, $(product_MODULES), \
- $(EXECUTABLES.$(m).OVERRIDES)), $(product_MODULES))
- #Add by denglijun 20201202 for 裁剪App
- # Filter out executables as well
- #$(warning First product_MODULES:$(product_MODULES))
- product_sub_MODULES := $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEL_PACKAGES)
- #product_MODULES := $(filter-out $(foreach z, $(product_sub_MODULES), \
- # $($(z))), $(product_MODULES))
- product_MODULES := $(filter-out $(product_sub_MODULES), $(product_MODULES))
- #$(warning product_sub_MODULES:$(product_sub_MODULES))
- #$(error product_MODULES:$(product_MODULES))
即可实现对删除。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。