summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMing Liu <ming.liu@toradex.com>2019-08-30 15:39:25 +0800
committerMing Liu <ming.liu@toradex.int>2019-09-07 08:14:25 +0000
commit325fce6e4a87c035003f0ac810072ab0594567e1 (patch)
tree3082032aef015e58b149e355aa86c08dd5495130
parentd6f62b5e5d031778aac0981695b00afaea3ddcaf (diff)
image_type_tezi.bbclass: add OTA provisioning support
Add two items into image json file: ota_provisioning and ota_credentials. ota_provisioning would be set 'True' if SOTA_PACKED_CREDENTIALS is being set, and ota_credentials would be set to the basename of SOTA_PACKED_CREDENTIALS. These two variables would be checked in Tezi installer to determine whether OTA provisioning is needed. This patch would not cause any functional change in Tezi installer while SOTA_PACKED_CREDENTIALS is not set. Signed-off-by: Ming Liu <ming.liu@toradex.com>
-rw-r--r--classes/image_type_tezi.bbclass12
1 files changed, 10 insertions, 2 deletions
diff --git a/classes/image_type_tezi.bbclass b/classes/image_type_tezi.bbclass
index 32eacb5..82458d2 100644
--- a/classes/image_type_tezi.bbclass
+++ b/classes/image_type_tezi.bbclass
@@ -151,6 +151,7 @@ def rootfs_tezi_emmc(d):
"filesystem_type": d.getVar('TEZI_ROOT_FSTYPE'),
"mkfs_options": "-E nodiscard",
"filename": imagename + "." + imagetype_suffix,
+ "ota_provisioning": True if d.getVar('SOTA_PACKED_CREDENTIALS') else False,
"uncompressed_size": get_uncompressed_size(d) / 1024
}
}
@@ -195,6 +196,7 @@ def rootfs_tezi_rawnand(d, distro=False):
"content": {
"filesystem_type": "ubifs",
"filename": imagename + "." + imagetype_suffix,
+ "ota_provisioning": True if distro and d.getVar('SOTA_PACKED_CREDENTIALS') else False,
"uncompressed_size": get_uncompressed_size(d) / 1024
}
}
@@ -254,11 +256,12 @@ def rootfs_tezi_rawnand(d, distro=False):
return [uboot1, uboot2, ubi]
def rootfs_tezi_json(d, flash_type, flash_data, json_file, uenv_file):
- import json
+ import json, os
from collections import OrderedDict
from datetime import datetime
deploydir = d.getVar('DEPLOY_DIR_IMAGE')
+ ota_credentials = d.getVar('SOTA_PACKED_CREDENTIALS')
# Patched in IMAGE_CMD_teziimg() below
release_date = "%release_date%"
@@ -300,6 +303,11 @@ def rootfs_tezi_json(d, flash_type, flash_data, json_file, uenv_file):
elif flash_type == "emmc":
data["blockdevs"] = flash_data
+ if ota_credentials:
+ data["ota_credentials"] = os.path.basename(ota_credentials)
+ else:
+ data["ota_credentials"] = ""
+
with open(os.path.join(deploydir, json_file), 'w') as outfile:
json.dump(data, outfile, indent=4)
bb.note("Toradex Easy Installer metadata file {0} written.".format(json_file))
@@ -432,7 +440,7 @@ IMAGE_CMD_teziimg-distro () {
-chf ${IMGDEPLOYDIR}/${IMAGE_NAME}-Tezi_${PV}${TDX_VERDATE}.tar \
${TEZI_IMAGE_JSON_FILES} toradexlinux.png marketing.tar prepare.sh wrapup.sh \
${TEZI_IMAGE_UBOOT_FILES} ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.bootfs.tar.xz \
- ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${TEZI_ROOT_SUFFIX}
+ ${IMGDEPLOYDIR}/${IMAGE_LINK_NAME}.${TEZI_ROOT_SUFFIX} ${SOTA_PACKED_CREDENTIALS}
}
IMAGE_TYPEDEP_teziimg-distro += "${TEZI_ROOT_SUFFIX}"