diff options
author | Ayan Kumar Halder | 2021-10-28 18:08:23 +0100 |
---|---|---|
committer | Stefano Stabellini | 2021-10-28 10:59:46 -0700 |
commit | d1af839cb8db976827984e2b6aed14681685c638 (patch) | |
tree | 68354fd47e5ba362987acdbc05f774eda79bb3d7 /scripts/disk_image | |
parent | 98915b5536f3099a78bddc4be6a44bb25d412a15 (diff) |
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 <ayankuma@xilinx.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Signed-off-by: Stefano Stabellini <stefano.stabellini@xilinx.com>
Diffstat (limited to 'scripts/disk_image')
-rwxr-xr-x | scripts/disk_image | 18 |
1 files changed, 12 insertions, 6 deletions
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 - |