All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arm-autonomy: xenguest-mgr: Add support for compressed partition images
@ 2020-05-11 13:29 Diego Sueiro
  2020-05-11 13:36 ` [meta-arm] " Bertrand Marquis
  0 siblings, 1 reply; 3+ messages in thread
From: Diego Sueiro @ 2020-05-11 13:29 UTC (permalink / raw)
  To: meta-arm; +Cc: nd, Kamil Dziezyk

From: Kamil Dziezyk <kamil.dziezyk@arm.com>

xenguest-manager now can create guest partition
using compressed images like *.img.gz or *.img.bz2.

Change-Id: Ifaec0b7c301b2b316ebccdd0ca85083262f2714c
Signed-off-by: Kamil Dziezyk <kamil.dziezyk@arm.com>
---
 .../documentation/xenguest-mkimage.md              |  2 +-
 .../xenguest/files/xenguest-manager                | 24 +++++++++++++++++++---
 2 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/meta-arm-autonomy/documentation/xenguest-mkimage.md b/meta-arm-autonomy/documentation/xenguest-mkimage.md
index d77fd48..3dcc28b 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 4777054..99975a2 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
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-05-12  0:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-11 13:29 [PATCH] arm-autonomy: xenguest-mgr: Add support for compressed partition images Diego Sueiro
2020-05-11 13:36 ` [meta-arm] " Bertrand Marquis
2020-05-12  0:16   ` Jon Mason

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.