From d1af839cb8db976827984e2b6aed14681685c638 Mon Sep 17 00:00:00 2001 From: Ayan Kumar Halder Date: Thu, 28 Oct 2021 18:08:23 +0100 Subject: Add *.cpio to the list of know rootfs types Yocto generates *.cpio images. Thus, it can be a valid type of rootfs image. Also, when an invalid rootfs image is detected, the script should exit immediately Signed-off-by: Ayan Kumar Halder Reviewed-by: Stefano Stabellini Signed-off-by: Stefano Stabellini --- scripts/disk_image | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/disk_image b/scripts/disk_image index 56a80fc..81bbee4 100755 --- a/scripts/disk_image +++ b/scripts/disk_image @@ -114,18 +114,21 @@ function add_partition() cd "$aux_dir" - if [[ $rootfs = *.cpio.gz ]] + if [[ $rootfs = *.cpio ]] + then + cat "${UBOOT_OUT_ABS}/$rootfs" | cpio -id + elif [[ $rootfs = *.cpio.gz ]] then cat "${UBOOT_OUT_ABS}/$rootfs" | gunzip | cpio -id - _part_size=$(du -sb| awk '{print $1}') elif [[ $rootfs = *.tar.gz ]] then tar -xf "${UBOOT_OUT_ABS}/$rootfs" - _part_size=$(du -sb| awk '{print $1}') else - echo "Ignoring $rootfs: unsupported file format. Use cpio.gz or tar.gz." + echo "Ignoring $rootfs: unsupported file format. Use cpio or cpio.gz or tar.gz." + exit 1 fi + _part_size=$(du -sb| awk '{print $1}') cd - rm -rf "$aux_dir" @@ -176,14 +179,17 @@ function write_rootfs() # Extract rootfs cpio archive into `.../part/vos_$j` cd ${DESTDIR}/part/disk$j - if [[ $rootfs = *.cpio.gz ]] + if [[ $rootfs = *.cpio ]] + then + cat "${UBOOT_OUT_ABS}/$rootfs" | cpio -id + elif [[ $rootfs = *.cpio.gz ]] then cat "${UBOOT_OUT_ABS}/$rootfs" | gunzip | cpio -id elif [[ $rootfs = *.tar.gz ]] then tar -xf "${UBOOT_OUT_ABS}/$rootfs" else - echo "Ignoring $rootfs: unsupported file format. Use cpio.gz or tar.gz." + echo "Ignoring $rootfs: unsupported file format. Use cpio or cpio.gz or tar.gz." fi cd - -- cgit v1.2.3