blob: d1e64e87f1423fc99ee4404bde874c0d521d05ce [file] [log] [blame]
rjw1f884582022-01-06 17:20:42 +08001DEPENDS += "android-tools-fsutils-native abtools-native"
2HOSTTOOLS += "zip unzip"
3PATH_prepend = "/usr/local/jdk1.8.0_161/bin:${STAGING_DIR_NATIVE}${datadir}/abtools/scripts:"
4
5AFTER_CMD = "${@bb.utils.contains("BOARD_AVB_ENABLE","true", "do_avb_sign_img","do_image_complete",d)}"
6
7do_make_otafull_package() {
8 if [ "${AB_OTA_UPDATER}" = "yes" ]; then
9 export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:${STAGING_DIR_NATIVE}/usr/lib
10 rm -rf ${DEPLOY_DIR_IMAGE}/target-files
11 mkdir ${DEPLOY_DIR_IMAGE}/target-files
12 mkdir ${DEPLOY_DIR_IMAGE}/target-files/IMAGES
13 mkdir ${DEPLOY_DIR_IMAGE}/target-files/SYSTEM
14 mkdir ${DEPLOY_DIR_IMAGE}/target-files/META
15 cp ${STAGING_DIR_NATIVE}/../rootfs/etc/update_engine/build.prop ${DEPLOY_DIR_IMAGE}/target-files/SYSTEM/
16 cp ${STAGING_DIR_NATIVE}/../rootfs/etc/update_engine/update_engine.conf ${DEPLOY_DIR_IMAGE}/target-files/META/update_engine_config.txt
17
18 if test -e ${DEPLOY_DIR_IMAGE}/target-files/META/misc_info.txt; then
19 rm ${DEPLOY_DIR_IMAGE}/target-files/META/misc_info.txt
20 fi
21 echo "recovery_api_version=3" >> ${DEPLOY_DIR_IMAGE}/target-files/META/misc_info.txt
22 echo "fstab_version=2" >> ${DEPLOY_DIR_IMAGE}/target-files/META/misc_info.txt
23 echo "ab_update=true" >> ${DEPLOY_DIR_IMAGE}/target-files/META/misc_info.txt
24
25 if [ ! -z "${AB_OTA_PARTITIONS}" ]; then
26 if test -e ${DEPLOY_DIR_IMAGE}/target-files/META/ab_partitions.txt; then
27 rm ${DEPLOY_DIR_IMAGE}/target-files/META/ab_partitions.txt
28 fi
29 tmp="${AB_OTA_PARTITIONS}"
30 for entry in $tmp ; do
31 echo $entry >> ${DEPLOY_DIR_IMAGE}/target-files/META/ab_partitions.txt
32 if [ ! -f ${DEPLOY_DIR_IMAGE}/$entry.img ]; then
33 if [ ! -n "${BUILD_ID}" ]; then
34 exit 0
35 fi
36 fi
37 cp ${DEPLOY_DIR_IMAGE}/$entry.img ${DEPLOY_DIR_IMAGE}/target-files/IMAGES/
38 done
39 fi
40 if test -e ${DEPLOY_DIR_IMAGE}/system.ext4 ; then
41 e2fsdroid ${DEPLOY_DIR_IMAGE}/system.ext4 -e -B ${DEPLOY_DIR_IMAGE}/target-files/IMAGES/system.map
42 fi
43
44 if test "x${BOARD_AVB_ENABLE}" = "xtrue" ; then
45 echo "avb_enable=true" >> ${DEPLOY_DIR_IMAGE}/target-files/META/misc_info.txt
46 echo "avb_system_hashtree_enable=true" >> ${DEPLOY_DIR_IMAGE}/target-files/META/misc_info.txt
47 add_care_map_to_target_files.py ${DEPLOY_DIR_IMAGE}/target-files
48 fi
49
50 cd ${DEPLOY_DIR_IMAGE}/target-files && zip -r -q ../target-files.zip IMAGES META SYSTEM && cd -
51 ota_from_target_files.py -p ${STAGING_DIR_NATIVE} --signapk_shared_library_path=usr/lib --signapk_path=usr/bin/signapk.jar -k ${STAGING_DATADIR_NATIVE}/abtools/security/testkey ${DEPLOY_DIR_IMAGE}/target-files.zip ${DEPLOY_DIR_IMAGE}/ota_full.zip
52 else
53 exit 0
54 fi
55}
56
57create_misc_folder() {
58 if [ "${AB_OTA_UPDATER}" = "yes" ]; then
59 install -d ${IMAGE_ROOTFS}/misc
60 fi
61}
62
63ROOTFS_PREPROCESS_COMMAND += " create_misc_folder;"
64
65
66addtask do_make_otafull_package after ${AFTER_CMD} before do_build