[2/3] image_types: oe_mkext234fs: add arguments to customize output file extension

Message ID 20170522093003.17711-3-nicolas.dechesne@linaro.org
State New
Headers show
Series
  • Add support for 'fastboot images'
Related show

Commit Message

Nicolas Dechesne May 22, 2017, 9:30 a.m.
Add a function argument to allow users of this fonction to specify the output
file extension. This commit as it is, is a no-op, and this new feature will be
used in the future.

Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>

---
 meta/classes/image_types.bbclass | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

-- 
2.11.0

-- 
_______________________________________________
Openembedded-core mailing list
Openembedded-core@lists.openembedded.org
http://lists.openembedded.org/mailman/listinfo/openembedded-core

Patch hide | download patch | download mbox

diff --git a/meta/classes/image_types.bbclass b/meta/classes/image_types.bbclass
index 7749b00098..efdcfed843 100644
--- a/meta/classes/image_types.bbclass
+++ b/meta/classes/image_types.bbclass
@@ -56,9 +56,11 @@  IMAGE_CMD_cramfs = "mkfs.cramfs ${IMAGE_ROOTFS} ${IMGDEPLOYDIR}/${IMAGE_NAME}${I
 
 oe_mkext234fs () {
 	fstype=$1
+	ext=$2
 	extra_imagecmd=""
 
-	if [ $# -gt 1 ]; then
+	if [ $# -gt 2 ]; then
+		shift
 		shift
 		extra_imagecmd=$@
 	fi
@@ -72,15 +74,15 @@  oe_mkext234fs () {
 		eval COUNT=\"$MIN_COUNT\"
 	fi
 	# Create a sparse image block
-	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype seek=$ROOTFS_SIZE count=$COUNT bs=1024
-	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype -d ${IMAGE_ROOTFS}
+	dd if=/dev/zero of=${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$ext seek=$ROOTFS_SIZE count=$COUNT bs=1024
+	mkfs.$fstype -F $extra_imagecmd ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$ext -d ${IMAGE_ROOTFS}
 	# Error codes 0-3 indicate successfull operation of fsck (no errors or errors corrected)
-	fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$fstype || [ $? -le 3 ]
+	fsck.$fstype -pvfD ${IMGDEPLOYDIR}/${IMAGE_NAME}${IMAGE_NAME_SUFFIX}.$ext || [ $? -le 3 ]
 }
 
-IMAGE_CMD_ext2 = "oe_mkext234fs ext2 ${EXTRA_IMAGECMD}"
-IMAGE_CMD_ext3 = "oe_mkext234fs ext3 ${EXTRA_IMAGECMD}"
-IMAGE_CMD_ext4 = "oe_mkext234fs ext4 ${EXTRA_IMAGECMD}"
+IMAGE_CMD_ext2 = "oe_mkext234fs ext2 ext2 ${EXTRA_IMAGECMD}"
+IMAGE_CMD_ext3 = "oe_mkext234fs ext3 ext3 ${EXTRA_IMAGECMD}"
+IMAGE_CMD_ext4 = "oe_mkext234fs ext4 ext4 ${EXTRA_IMAGECMD}"
 
 MIN_BTRFS_SIZE ?= "16384"
 IMAGE_CMD_btrfs () {