1、首先我们需要在packages\apps下面建立一个文件夹:FILE;在文件夹FILE中我们可以根据需要内置的文件的类型,建立不同的文件夹,比如我们可以建立video.photo,music然后将我们需要内置的文件分别放到对应的文件夹中;
2、在build/target/product/generic_no_telephony.mk中增加FILE选项,使得在编译系统的时候会去编译FILE文件夹;
diff --git a/build/target/product/generic_no_telephony.mk b/build/target/product/generic_no_telephony.mk
index 0c6e9ac..bd63cd9 100644
--- a/build/target/product/generic_no_telephony.mk
+++ b/build/target/product/generic_no_telephony.mk
@@ -36,6 +36,7 @@ PRODUCT_PACKAGES := \
MusicFX \
Provision \
Phone \
+ FILE\
QuickSearchBox \
Settings \
SystemUI \
3、在FILE文件夹下面编写Android.mk文件,使得系统编译的时候,将FILE文件夹下面的多媒体文件全部拷贝到:out\target\product\rk2928sdk\system\media
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_POST_PROCESS_COMMAND := $(shell mkdir -p $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/CAR_1.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/CAR_2.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/COLORS_2_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/COLORS_3_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/COLORS_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/FLOWERS.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/LAKE_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/LANDSCAPE_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/music/Lost_Without_You.mp3 $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/video/Bunny_Trailer.mp4 $(TARGET_OUT)/media/)
4、在将文件拷贝到out\target\product\rk2928sdk\system\media下面以后,我们需要在添加一个service,使机器在开启的时候将多媒体文件从MEDIA文件夹下面拷贝到我们的内存当中;
(1)首先我们需要在FILE目录下面添加一个脚本文件copyfile.sh,来实现从MEDIA文件夹拷贝文件到内存中的功能;
#!/system/bin/sh
FLASH_DIR=/mnt/sdcard
JPG1=/mnt/sdcard/CAR_1.jpg
JPG2=/mnt/sdcard/CAR_2.jpg
JPG3=/mnt/sdcard/COLORS_2_1280x800.jpg
JPG4=/mnt/sdcard/COLORS_3_1280x800.jpg
JPG5=/mnt/sdcard/COLORS_1280x800.jpg
JPG6=/mnt/sdcard/FLOWERS.jpg
JPG7=/mnt/sdcard/LAKE_1280x800.jpg
JPG8=/mnt/sdcard/LANDSCAPE_1280x800.jpg
Mp31=/mnt/sdcard/Lost_Without_You.mp3
avi1=/mnt/sdcard/Bunny_Trailer.mp4
PACKAGES_TEST=/system/media
echo "check test file in the flash"
if [ -f $JPG1 ];then
echo "jpg1 file in the flash"
else
busybox cp $PACKAGES_TEST/CAR_1.jpg $FLASH_DIR/
fi
if [ -f $JPG2 ];then
echo "jpg2 file in the flash"
else
busybox cp $PACKAGES_TEST/CAR_2.jpg $FLASH_DIR/
fi
if [ -f $JPG3 ];then
echo "jpg3 file in the flash"
else
busybox cp $PACKAGES_TEST/COLORS_2_1280x800.jpg $FLASH_DIR/
fi
if [ -f $JPG4 ];then
echo "jpg4 file in the flash"
else
busybox cp $PACKAGES_TEST/COLORS_3_1280x800.jpg $FLASH_DIR/
fi
if [ -f $JPG5 ];then
echo "jpg5 file in the flash"
else
busybox cp $PACKAGES_TEST/COLORS_1280x800.jpg $FLASH_DIR/
fi
if [ -f $JPG6 ];then
echo "jpg6 file in the flash"
else
busybox cp $PACKAGES_TEST/FLOWERS.jpg $FLASH_DIR/
fi
if [ -f $JPG7 ];then
echo "jpg7 file in the flash"
else
busybox cp $PACKAGES_TEST/LAKE_1280x800.jpg $FLASH_DIR/
fi
if [ -f $JPG8 ];then
echo "jpg8 file in the flash"
else
busybox cp $PACKAGES_TEST/LANDSCAPE_1280x800.jpg $FLASH_DIR/
fi
if [ -f $Mp31 ];then
echo "mp31 file in the flash"
else
busybox cp $PACKAGES_TEST/Lost_Without_You.mp3 $FLASH_DIR/
fi
if [ -f $avi1 ];then
echo "avi1 file in the flash"
else
busybox cp $PACKAGES_TEST/Bunny_Trailer.mp4 $FLASH_DIR/
fi
(2)、同样这个脚本文件需要先拷贝到out\target\product\rk2928sdk\system\bin下面,更改FILE文件夹下面的Android.mk文件
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := optional
LOCAL_POST_PROCESS_COMMAND := $(shell mkdir -p $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell mkdir -p $(TARGET_OUT)/bin/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/CAR_1.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/CAR_2.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/COLORS_2_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/COLORS_3_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/COLORS_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/FLOWERS.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/LAKE_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/photo/LANDSCAPE_1280x800.jpg $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/music/Lost_Without_You.mp3 $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/video/Bunny_Trailer.mp4 $(TARGET_OUT)/media/)
LOCAL_POST_PROCESS_COMMAND := $(shell cp $(LOCAL_PATH)/copyfile.sh $(TARGET_OUT)/bin/)
(3)添加一个service,使得机器开启的时候就运行copyfile.sh脚本文件,将MEDIA文件夹下面的多媒体文件全部内置到内存中
diff --git a/device/rockchip/rk2928sdk/init.rc b/device/rockchip/rk2928sdk/init.rc
index fc05db3..31dde14 100755
--- a/device/rockchip/rk2928sdk/init.rc
+++ b/device/rockchip/rk2928sdk/init.rc
@@ -578,3 +578,6 @@ service mdnsd /system/bin/mdnsd
service whtest /system/bin/whtest.sh
disabled
oneshot
+service copyfile /system/bin/copyfile.sh
+ class main
+ # oneshot
到这里预置多媒体文件的更改流程就写完了,同理如果要做预置APK,只需要在脚本文件中添加拷贝APK,将APK拷贝到out\target\product\rk2928sdk\system\app下面,这个是我在做项目的时候更改的流程,有不对之处,望指正!