平台
RK3288 + Android 7.1
需求
ROM 中集成可卸载APK, 需满足要求:
烧录完成启动后, 应用已装上
用户可手动卸载
重启后保持应用安装/卸载状态
重置后, 应用已安装上
实现
在make 完成后, 创建out/target/product/rk3288/vendor/bundled_uninstall_back-app目录 把预装APK存放到此目录下, 结构如下: |--out/target/product/rk3288/vendor/bundled_uninstall_back-app/ |--apkFile-1.apk |--apkFile-2.apk .... 其中, apkFile为APK文件名, 任意, 建议使用英文最好不带字符, 避免使用中文编码 接着再重新 make 并使用 mkimage生成image文件 最后打包update.img 固件
后续
vendor 分区有大小限制, 注意APK不能超过分区大小
那么问题来了, 如何修改 分区大小?
首先, 这里走了一个弯路:
diff --git a/device/rockchip/rk3288/BoardConfig.mk b/device/rockchip/rk3288/BoardConfig.mk index fb36305..da5ffc0 100755 --- a/device/rockchip/rk3288/BoardConfig.mk +++ b/device/rockchip/rk3288/BoardConfig.mk @@ -99,7 +99,7 @@ ifeq ($(strip $(USE_DEFAULT_PARAMETER)), true) BOARD_VENDORIMAGE_PARTITION_SIZE := $(shell python device/rockchip/common/get_partition_size.py $(TARGET_DEVICE_DIR)/parameter.txt vendor0) #$(info Calculated BOARD_VENDORIMAGE_PARTITION_SIZE=$(BOARD_VENDORIMAGE_PARTITION_SIZE) use $(TARGET_DEVICE_DIR)/parameter.txt) else - BOARD_VENDORIMAGE_PARTITION_SIZE ?= 52428800 + BOARD_VENDORIMAGE_PARTITION_SIZE ?= 104857600
原来以为修改这个分区大小即可, 后面验证不可行.
正确方法
diff --git a/device/rockchip/rk3288/parameter.txt b/device/rockchip/rk3288/parameter.txt index 37ab61e..f869e67 100755 --- a/device/rockchip/rk3288/parameter.txt +++ b/device/rockchip/rk3288/parameter.txt @@ -7,4 +7,4 @@ ATAG: 0x60000800 MACHINE: 3288 CHECK_MASK: 0x80 PWR_HLD: 0,0,A,0,1 -CMDLINE: console=ttyFIQ0 androidboot.baseband=N/A androidboot.selinux=permissive androidboot.hardware=rk30board androidboot.console=ttyFIQ0 init=/init initrd=0x62000000,0x00800000 mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(trust),0x00002000@0x00006000(misc),0x00008000@0x00008000(resource),0x0000C000@0x00010000(kernel),0x00010000@0x0001C000(boot),0x00010000@0x0002C000(recovery),0x00038000@0x0003C000(backup),0x00040000@0x00074000(cache),0x00400000@0x000B4000(system),0x00008000@0x004B4000(metadata),0x00019000@0x004BC000(vendor0),0x00019000@0x004D5000(vendor1),-@0x004EE000(userdata) +CMDLINE: console=ttyFIQ0 androidboot.baseband=N/A androidboot.selinux=permissive androidboot.hardware=rk30board androidboot.console=ttyFIQ0 init=/init initrd=0x62000000,0x00800000 mtdparts=rk29xxnand:0x00002000@0x00002000(uboot),0x00002000@0x00004000(trust),0x00002000@0x00006000(misc),0x00008000@0x00008000(resource),0x0000C000@0x00010000(kernel),0x00010000@0x0001C000(boot),0x00010000@0x0002C000(recovery),0x00038000@0x0003C000(backup),0x00040000@0x00074000(cache),0x00400000@0x000B4000(system),0x00008000@0x004B4000(metadata),0x00100000@0x004BC000(vendor0),0x00100000@0x005BC000(vendor1),-@0x006BC000(userdata)