From 1004579ca431cdb239295dc6771af45b41b2791a Mon Sep 17 00:00:00 2001 From: Matei Valeanu Date: Wed, 12 Jun 2019 17:59:53 +0200 Subject: ostree and otaimg enhancements override_image_types_ostree.inc - do_image_ostree task: -add dirs, cleandirs flags, to avoid mktemp, rm, cd, and to also remove at clean -add subimages, imgsuffix flags, to use automatic link creation -create image in IMGDEPLOYDIR, instead of DEPLOY_DIR_IMAGE to use the automatic deploy and clean mechanism (also helps in cleaning old images) override_image_types_ota.inc - do_image_otaimg task: -add dirs, cleandirs flags, to avoid mktemp, rm, cd, and to also remove at clean -avoid untar-ing the ostree image, and use OSTREE_ROOTFS -create image in IMGDEPLOYDIR, instead of DEPLOY_DIR_IMAGE to use the automatic deploy and clean mechanism Move OSTREE_REPO to "${WORKDIR}/ostree-repo", instead of DEPLOY_DIR_IMAGE, this repo is needed for otaimg creation sota_xeon-d.bbclass sota_atom-c3000.bbclass: -set ROOTFS_sota to IMGDEPLOYDIR insted of DEPLOY_DIR_IMAGE, as this is where the otaimg is now created; also use IMAGE_LINK_NAME istead of IMAGE_NAME, to have the correct reference to the image, even if the image was built in a previous run (IMAGE_NAME differs in this case) Change-Id: I44e87311d1819b80d34f924630d09e429d411d41 Signed-off-by: Matei Valeanu --- classes/override_image_types_ostree.inc | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'classes/override_image_types_ostree.inc') diff --git a/classes/override_image_types_ostree.inc b/classes/override_image_types_ostree.inc index ac584e5..241afcd 100644 --- a/classes/override_image_types_ostree.inc +++ b/classes/override_image_types_ostree.inc @@ -1,3 +1,18 @@ +# overrides meta-updater/classes/image_types_ostree.bbclass +# - add do_image_ostree flags: +# - dirs, cleandirs: to avoid mktemp, rm, cd, and to also remove at clean +# - subimages, imgsuffix: to use automatic link creation +# - override of IMAGE_CMD_ostree +# - use the added flags +# - IMGDEPLOYDIR, instead of DEPLOY_DIR_IMAGE + +OSTREE_ROOTFS="${WORKDIR}/ostree-root" +do_image_ostree[dirs] = "${OSTREE_ROOTFS}" +do_image_ostree[cleandirs] = "${OSTREE_ROOTFS}" +do_image_ostree[subimages] = "rootfs.ostree.tar.bz2" +do_image_ostree[imgsuffix] = "." +export OSTREE_ROOTFS + IMAGE_CMD_ostree () { if [ -z "$OSTREE_REPO" ]; then bbfatal "OSTREE_REPO should be set in your local.conf" @@ -7,13 +22,10 @@ IMAGE_CMD_ostree () { bbfatal "OSTREE_BRANCHNAME should be set in your local.conf" fi - OSTREE_ROOTFS=`mktemp -du ${WORKDIR}/ostree-root-XXXXX` - cp -a ${IMAGE_ROOTFS} ${OSTREE_ROOTFS} + cp -a ${IMAGE_ROOTFS}/* ${OSTREE_ROOTFS} chmod a+rx ${OSTREE_ROOTFS} sync - cd ${OSTREE_ROOTFS} - for d in var/*; do if [ "${d}" != "var/local" ]; then rm -rf ${d} @@ -125,16 +137,11 @@ IMAGE_CMD_ostree () { # Copy image manifest cat ${IMAGE_MANIFEST} | cut -d " " -f1,3 > usr/package.manifest - cd ${WORKDIR} - # Create a tarball that can be then commited to OSTree repo - OSTREE_TAR=${DEPLOY_DIR_IMAGE}/${IMAGE_NAME}.rootfs.ostree.tar.bz2 + OSTREE_TAR=${IMGDEPLOYDIR}/${IMAGE_NAME}.rootfs.ostree.tar.bz2 tar -C ${OSTREE_ROOTFS} --xattrs --xattrs-include='*' -cjf ${OSTREE_TAR} . sync - rm -f ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 - ln -s ${IMAGE_NAME}.rootfs.ostree.tar.bz2 ${DEPLOY_DIR_IMAGE}/${IMAGE_LINK_NAME}.rootfs.ostree.tar.bz2 - if ! ostree --repo=${OSTREE_REPO} refs 2>&1 > /dev/null; then ostree --repo=${OSTREE_REPO} init --mode=archive-z2 fi @@ -145,6 +152,4 @@ IMAGE_CMD_ostree () { --skip-if-unchanged \ --branch=${OSTREE_BRANCHNAME} \ --subject="Commit-id: ${IMAGE_NAME}" - - rm -rf ${OSTREE_ROOTFS} } -- cgit v1.2.3-54-g00ecf