1
0
mirror of https://git.yoctoproject.org/meta-arm synced 2026-05-31 00:39:57 +00:00

arm-autonomy: xenguest-mgr: Add support for compressed partition images

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>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
Signed-off-by: Jon Mason <jon.mason@arm.com>
This commit is contained in:
Kamil Dziezyk
2020-05-11 14:29:26 +01:00
committed by Jon Mason
parent f5075e9cd9
commit 4447316896
2 changed files with 22 additions and 4 deletions
@@ -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 - `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 size of SIZE GB, format it with filesystem FS (can be ext2, ext3, ext4, vfat
or swap) and extract CONTENT as initial partition content 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. CONTENT can be empty.
The disk-files contain files to be used for initializing the disk partitions The disk-files contain files to be used for initializing the disk partitions
@@ -262,12 +262,30 @@ function xenguest_disk_init()
fi fi
case ${content} in 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 # dd into partition
echo "xenguest-mkimage extract-disk-file ${guestfile} " \ 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} \ 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 if [ $? -ne 0 ]; then
echo "${PREF} Cannot populate partition ${part}" echo "${PREF} Cannot populate partition ${part}"
xenguest_detach_disk xenguest_detach_disk