From c60b6bb82e7121635ce3f7119927e8704fe03f0f Mon Sep 17 00:00:00 2001 From: Stefan Agner Date: Sat, 25 Apr 2020 22:15:39 +0000 Subject: image_types_ostree: use hardlink tree Instead of copying the files to be commited to the ostree just use a hardlink tree. This improves performance and wasts less diskspace. When using this method the root directory has already the correct permission bits set. Also get rid of the unnecessary sync. This halfs the execution time of the do_image_ostree tasks in my measurments. Signed-off-by: Stefan Agner --- classes/image_types_ostree.bbclass | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/classes/image_types_ostree.bbclass b/classes/image_types_ostree.bbclass index d29d4c4..758ce00 100644 --- a/classes/image_types_ostree.bbclass +++ b/classes/image_types_ostree.bbclass @@ -20,14 +20,24 @@ CONVERSION_CMD_tar = "touch ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.${ CONVERSIONTYPES_append = " tar" TAR_IMAGE_ROOTFS_task-image-ostree = "${OSTREE_ROOTFS}" + +python prepare_ostree_rootfs() { + import oe.path + import shutil + + ostree_rootfs = d.getVar("OSTREE_ROOTFS") + if os.path.lexists(ostree_rootfs): + bb.utils.remove(ostree_rootfs, True) + + # Copy required as we change permissions on some files. + image_rootfs = d.getVar("IMAGE_ROOTFS") + oe.path.copyhardlinktree(image_rootfs, ostree_rootfs) +} + do_image_ostree[dirs] = "${OSTREE_ROOTFS}" -do_image_ostree[cleandirs] = "${OSTREE_ROOTFS}" +do_image_ostree[prefuncs] += "prepare_ostree_rootfs" do_image_ostree[depends] = "coreutils-native:do_populate_sysroot virtual/kernel:do_deploy ${INITRAMFS_IMAGE}:do_image_complete" IMAGE_CMD_ostree () { - cp -a ${IMAGE_ROOTFS}/* ${OSTREE_ROOTFS} - chmod a+rx ${OSTREE_ROOTFS} - sync - for d in var/*; do if [ "${d}" != "var/local" ]; then rm -rf ${d} -- cgit v1.2.3-54-g00ecf