u-boot-dey: add image decompression logic to UUU installation scripts

We document how to use this script from the Yocto image directory. Now that the
*.ext4 files are compressed by default, the script needs to automatically
decompress said files before starting the update process.

https://onedigi.atlassian.net/browse/DEL-7582

Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
This commit is contained in:
Gabriel Valcazar 2021-06-29 12:44:57 +02:00
parent a707e98775
commit bf67c2eef4
2 changed files with 34 additions and 0 deletions

View File

@ -101,6 +101,18 @@ INSTALL_LINUX_FILENAME="${BASEFILENAME}-##MACHINE##.boot.vfat"
INSTALL_RECOVERY_FILENAME="${BASEFILENAME}-##MACHINE##.recovery.vfat"
INSTALL_ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
COMPRESSED_ROOTFS_IMAGE="${INSTALL_ROOTFS_FILENAME}.gz"
# If the rootfs image is compressed, make sure to decompress it before the update
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ ! -f ${INSTALL_ROOTFS_FILENAME} ]; then
echo "\033[36m"
echo "====================================================================================="
echo "Decompressing rootfs image '${COMPRESSED_ROOTFS_IMAGE}'"
echo "====================================================================================="
echo "\033[0m"
gzip -d -k -f "${COMPRESSED_ROOTFS_IMAGE}"
fi
# Verify existance of files before starting the update
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}"
for f in ${FILES}; do
@ -198,6 +210,11 @@ part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}"
# If the rootfs image was originally compressed, remove the uncompressed image
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ -f ${INSTALL_ROOTFS_FILENAME} ]; then
rm -f "${INSTALL_ROOTFS_FILENAME}"
fi
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update

View File

@ -163,6 +163,18 @@ INSTALL_LINUX_FILENAME="${BASEFILENAME}-##MACHINE##.boot.vfat"
INSTALL_RECOVERY_FILENAME="${BASEFILENAME}-##MACHINE##.recovery.vfat"
INSTALL_ROOTFS_FILENAME="${BASEFILENAME}-##MACHINE##.ext4"
COMPRESSED_ROOTFS_IMAGE="${INSTALL_ROOTFS_FILENAME}.gz"
# If the rootfs image is compressed, make sure to decompress it before the update
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ ! -f ${INSTALL_ROOTFS_FILENAME} ]; then
echo "\033[36m"
echo "====================================================================================="
echo "Decompressing rootfs image '${COMPRESSED_ROOTFS_IMAGE}'"
echo "====================================================================================="
echo "\033[0m"
gzip -d -k -f "${COMPRESSED_ROOTFS_IMAGE}"
fi
# Verify existance of files before starting the update
FILES="${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_RECOVERY_FILENAME} ${INSTALL_ROOTFS_FILENAME}"
for f in ${FILES}; do
@ -260,6 +272,11 @@ part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs
part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}"
# If the rootfs image was originally compressed, remove the uncompressed image
if [ -f ${COMPRESSED_ROOTFS_IMAGE} ] && [ -f ${INSTALL_ROOTFS_FILENAME} ]; then
rm -f "${INSTALL_ROOTFS_FILENAME}"
fi
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update