Is it possible to exclude paths from rootfs tar in a teziimg?

Hi @bruno.tx,

I have managed to dig deeper into things and it turns out that variable is mentioned on some other threads about different images.
However, while digging I found that the process that needed to change to support this variable is do_image_tar which is where the tar and tar.xz are created for the rootfs.

My current fix that would seem to work for my case is:

image_type_custom_tezi.bbclass

IMAGE_CMD_TAR_ORIGINAL := "${IMAGE_CMD_TAR}"
IMAGE_ROOTFS_TAR_EXCLUSIONS = "${@ ''.join(" --exclude='.%s'" % p for p in '${IMAGE_ROOTFS_EXCLUDE_PATH}'.split())}"
IMAGE_CMD_TAR:tar = "${IMAGE_CMD_TAR_ORIGINAL}${IMAGE_ROOTFS_TAR_EXCLUSIONS}"

local.conf or layer.conf:

IMAGE_ROOTFS_EXCLUDE_PATH += "${data_dir}"

This addition adds the --exclude parameter for each entry in the IMAGE_ROOTFS_EXCLUDE_PATH variable (in case there is more than one) to the tar command, but only when building the tar image (e.g. rootfs).

Not sure if this will be helpful for others, or if there is a better way to do this. But it solves my current needs.

Regards,

1 Like