rk3399 Android7.1 预置app

首先进入如下目录,打开如下文件

root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/device/rockchip/common# vim device.mk 
root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/device/rockchip/common# 

看到如下代码段

# Prebuild apps
ifneq ($(strip $(TARGET_PRODUCT)), )
    TARGET_DEVICE_DIR=$(shell test -d device && find device -maxdepth 4 -path '*/$(TARGET_PRODUCT)/BoardConfig.mk')
    TARGET_DEVICE_DIR := $(patsubst %/,%,$(dir $(TARGET_DEVICE_DIR)))
    $(info device-rockchip-common TARGET_DEVICE_DIR: $(TARGET_DEVICE_DIR))//此打印语句是我添加上的,目的在于确认TARGET_DEVICE_DIR
    $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall bundled_persist-app)
    $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall_del bundled_uninstall_back-app)
    $(shell python $(LOCAL_PATH)/auto_generator.py $(TARGET_DEVICE_DIR) preinstall_del_forever bundled_uninstall_gone-app)
    -include $(TARGET_DEVICE_DIR)/preinstall/preinstall.mk
    -include $(TARGET_DEVICE_DIR)/preinstall_del/preinstall.mk
    -include $(TARGET_DEVICE_DIR)/preinstall_del_forever/preinstall.mk
endif

auto_generator.py用于生成Android.mk 、preinstall.mk

两个文件生成后的内容就不说了,因为这些都是类似于内核驱动里边的makefile文件一样,三个文件夹(preinstall、preinstall_del、preinstall_del_forever)下生成的文件内容都是不一样的,具体的自己去观察吧

$(info device-rockchip-common TARGET_DEVICE_DIR: $(TARGET_DEVICE_DIR))//此打印语句是我添加上的,目的在于确认TARGET_DEVICE_DIR   先声明一点,每个开发板这个目录可能都不一样,所以最好自己确认,比如有的公司自己拿去改了源码,改了统一的东西为自己的

打印结果如下(说明一下,这是在编译Android系统,不同的开发板有不同编译方式,按着自己的来)

root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup# ./mk.sh -s -j=4
'/3399_backup/g3399-v7-1-2-20180529_backup/device/rockchip/rk3399/g3399/parameter.txt' -> '/3399_backup/g3399-v7-1-2-20180529_backup/out/release/parameter.txt'
'/3399_backup/g3399-v7-1-2-20180529_backup/device/rockchip/rk3399/g3399/misc.img' -> '/3399_backup/g3399-v7-1-2-20180529_backup/out/release/misc.img'
'/3399_backup/g3399-v7-1-2-20180529_backup/device/rockchip/rk3399/g3399/upgrade_tool' -> '/3399_backup/g3399-v7-1-2-20180529_backup/out/release/upgrade_tool'
including device/asus/fugu/vendorsetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-mips/vendorsetup.sh
including device/generic/mini-emulator-mips64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/google/dragon/vendorsetup.sh
including device/google/marlin/vendorsetup.sh
including device/htc/flounder/vendorsetup.sh
including device/huawei/angler/vendorsetup.sh
including device/lge/bullhead/vendorsetup.sh
including device/linaro/hikey/vendorsetup.sh
including device/moto/shamu/vendorsetup.sh
including device/rockchip/rk3399/vendorsetup.sh
including sdk/bash_completion/adb.bash


//就是这句话
device-rockchip-common TARGET_DEVICE_DIR: device/rockchip/rk3399/g3399




============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=7.1.2
TARGET_PRODUCT=g3399
TARGET_BUILD_VARIANT=userdebug
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm64
TARGET_ARCH_VARIANT=armv8-a
TARGET_CPU_VARIANT=cortex-a53
TARGET_2ND_ARCH=arm
TARGET_2ND_ARCH_VARIANT=armv7-a-neon
TARGET_2ND_CPU_VARIANT=cortex-a53.a57
HOST_ARCH=x86_64
HOST_2ND_ARCH=x86

    -include $(TARGET_DEVICE_DIR)/preinstall/preinstall.mk
    -include $(TARGET_DEVICE_DIR)/preinstall_del/preinstall.mk
    -include $(TARGET_DEVICE_DIR)/preinstall_del_forever/preinstall.mk

上面三句话就是根据文件夹下边的.mk文件去预置app

所以,理论上,我们应该将apk文件放入到源码目录这个路径下device/rockchip/rk3399/g3399的preinstall(系统的不可卸载的)    、   preinstall_del(系统的可卸载的,恢复出厂设置可恢复的)   、  preinstall_del_forever(非系统的可卸载的,恢复出厂设置不可恢复的)这三个文件夹下边,然后重新编译整个系统烧写就ok了,此时可能会报错,不知道原因是什么(报错的情况下,将preinstall等文件夹删除后重新编译也是可以的,其实你可以去out/target/product/g3399/system/vendor/这个文件下边看,如果有bundled_persist-app/这个文件夹生成,且文件夹里边有你预置的app,那么删除preinstall等文件夹重新编译烧写系统也是可行的,虽然我不知道原因在哪,有可能是第三方的公司修改东西没改完全或者还有一些其他需要我们注意的地方吧),但是执行make clean后编译,就可编译成功,如果预置成功,则在device/rockchip/rk3399/g3399的你之前放入的文件夹下边会生成Android.mk 和app名字命名的文件夹,以及preinstall.mk;另外一种查看方式是在源码目录下的

root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor# pwd
/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor
root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor# ls
bin  bundled_persist-app  etc  lib  lib64
root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor# 

上边新生成的bundled_persist-app就是预置的app,如下

root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor# cd bundled_persist-app/
root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor/bundled_persist-app# ls
baidushurufa_194  InfrareEye1.0
root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor/bundled_persist-app# cd baidushurufa_194/
root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor/bundled_persist-app/baidushurufa_194# ls
baidushurufa_194.apk  lib  oat
root@ubuntu:/3399_backup/g3399-v7-1-2-20180529_backup/out/target/product/g3399/system/vendor/bundled_persist-app/baidushurufa_194# 

网上还有一种牛掰的操作,就是在vendor目录下建立对应的文件夹,将app放进去,这种方式经过测试,对于系统的不可卸载的是行不通的,对于不需要.so的方式是可以的,你可以尝试一下将app放入preinstall下边编译(系统的不可卸载的),如上我预置的百度输入法,它在以自己命名的文件下边除了apk文件,还有lib文件夹的oat这些东西肯定都是必须的,对于系统的不可卸载的方式去预置app来说 

这样重新烧写系统就能看到预置的app了

你可能感兴趣的:(RK3399平台)