[yocto] Dependencies on other file system types for custom file system type

Eric Grunt gruntblue at gmail.com
Fri Apr 12 06:21:19 PDT 2019


class file:

inherit image_types

IMAGE_TYPEDEP_squashfs-xz-ubi = "squashfs-xz"

do_image_squashfs-xz-ubi[depends] += "mtd-utils-native:do_populate_sysroot"
do_image_squashfs-xz-ubi[depends] += "squashfs-tools-native:do_populate_sysroot"

IMAGE_CMD_squashfs-xz-ubi () {
	squashfsubi_mkfs "${MKUBIFS_ARGS}" "${UBINIZE_ARGS}"
}

squashfsubi_mkfs() {
	local mkubifs_args="$1"
	local ubinize_args="$2"
	CFG_NAME=ubinize-${IMAGE_NAME}-squashfs-xz-ubi.cfg

        # Added prompt error message for ubi and ubifs image creation.
        if [ -z "$mkubifs_args"] || [ -z "$ubinize_args" ]; then
            bbfatal "MKUBIFS_ARGS and UBINIZE_ARGS have to be set, see
http://www.linux-mtd.infradead.org/faq/ubifs.html for details"
        fi

	echo \[ubifs\] > ${CFG_NAME}
	echo mode=ubi >> ${CFG_NAME}
	echo image=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz
>> ${CFG_NAME}
	echo vol_id=0 >> ${CFG_NAME}
	echo vol_type=dynamic >> ${CFG_NAME}
	echo vol_name=${UBI_VOLNAME} >> ${CFG_NAME}
	echo vol_flags=autoresize >> ${CFG_NAME}
	# normally we shouldn't need to create the squashfs image ourselves,
	# because we have a dependency declared (IMAGE_TYPEDEP)
	# But, if this file is modified, the dependency is _not_ rebuild, so
we have to do this ourselves.
	if [ ! -e ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz ]
	then
		bbwarn "${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz
does not exist. Creating."
		${IMAGE_CMD_squashfs-xz}
	fi
	ubinize -o ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.squashfs-xz-ubi
${ubinize_args} ${CFG_NAME}

	# Cleanup cfg file
	mv ${CFG_NAME} ${IMGDEPLOYDIR}/
}


More information about the yocto mailing list