diff --git a/meta-arm-autonomy/documentation/xenguest-mkimage.md b/meta-arm-autonomy/documentation/xenguest-mkimage.md index d77fd48b..3dcc28b4 100644 --- a/meta-arm-autonomy/documentation/xenguest-mkimage.md +++ b/meta-arm-autonomy/documentation/xenguest-mkimage.md @@ -62,7 +62,7 @@ The file contains the following entries: - `DISK_PARTX=SIZE:FS:CONTENT`: create a partition number X (1 to 4) with a size of SIZE GB, format it with filesystem FS (can be ext2, ext3, ext4, vfat or swap) and extract CONTENT as initial partition content - (.tar[.gz|.xz|.bz2] file or img file to be dumped in the partition). FS and + (.tar[.gz|.xz|.bz2] file or img[.gz|.bz2] file to be dumped in the partition). FS and CONTENT can be empty. The disk-files contain files to be used for initializing the disk partitions diff --git a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager index 4777054f..99975a24 100755 --- a/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager +++ b/meta-arm-autonomy/recipes-extended/xenguest/files/xenguest-manager @@ -262,12 +262,30 @@ function xenguest_disk_init() fi case ${content} in - *.img) + *.img*) + decompress="" + case ${content} in + *.img.gz) + decompress='zcat' + ;; + *.img.bz2) + decompress='bzcat' + ;; + *.img) + decompress='cat' + ;; + *) + # invalid/unknown compression type + echo "${PREF} Invalid file format in disk ${content}" + xenguest_detach_disk + exit 1 + ;; + esac # dd into partition echo "xenguest-mkimage extract-disk-file ${guestfile} " \ - "${content} | dd of=/dev/xvda${part} " >> ${LOGFILE} 2>&1 + "${content} | ${decompress} | dd of=/dev/xvda${part} " >> ${LOGFILE} 2>&1 xenguest-mkimage extract-disk-file ${guestfile} ${content} \ - | dd of=/dev/xvda${part} >> ${LOGFILE} 2>&1 + | ${decompress} | dd of=/dev/xvda${part} >> ${LOGFILE} 2>&1 if [ $? -ne 0 ]; then echo "${PREF} Cannot populate partition ${part}" xenguest_detach_disk