u-boot-dey: function for updating eMMC partitions with a message

Similar to how it's done on the ccimx6ul, create a function for updating
a partition with a file, that also prints a message.
Rename the function to be the same in all scripts.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>

https://jira.digi.com/browse/DEL-7333
This commit is contained in:
Hector Palacios 2021-05-18 16:21:06 +02:00
parent 51ce92b982
commit 8f4d707fb6
6 changed files with 103 additions and 27 deletions

View File

@ -40,7 +40,7 @@ show_usage()
exit 2 exit 2
} }
# Update a NAND partition # Update a partition
# Params: # Params:
# 1. partition # 1. partition
# 2. file # 2. file
@ -48,7 +48,7 @@ show_usage()
# Description: # Description:
# - downloads image to RAM # - downloads image to RAM
# - runs 'update' command from RAM # - runs 'update' command from RAM
nand_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
echo "=====================================================================================" echo "====================================================================================="
@ -165,7 +165,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
nand_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000 part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000
# Set 'bootcmd' for the second part of the script that will # Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults # - Reset environment to defaults
@ -195,13 +195,13 @@ sleep 3
uuu fb: ucmd setenv fastboot_buffer \${loadaddr} uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
# Update Linux # Update Linux
nand_update "linux" "${INSTALL_LINUX_FILENAME}" 15000 part_update "linux" "${INSTALL_LINUX_FILENAME}" 15000
# Update Recovery # Update Recovery
nand_update "recovery" "${INSTALL_RECOVERY_FILENAME}" 15000 part_update "recovery" "${INSTALL_RECOVERY_FILENAME}" 15000
# Update Rootfs # Update Rootfs
nand_update "rootfs" "${INSTALL_ROOTFS_FILENAME}" 90000 part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}" 90000
# Erase the 'Update' partition # Erase the 'Update' partition
uuu fb: ucmd nand erase.part update uuu fb: ucmd nand erase.part update

View File

@ -40,7 +40,7 @@ show_usage()
exit 2 exit 2
} }
# Update a NAND partition # Update a partition
# Params: # Params:
# 1. partition # 1. partition
# 2. file # 2. file
@ -48,7 +48,7 @@ show_usage()
# Description: # Description:
# - downloads image to RAM # - downloads image to RAM
# - runs 'update' command from RAM # - runs 'update' command from RAM
nand_update() part_update()
{ {
echo "\033[36m" echo "\033[36m"
echo "=====================================================================================" echo "====================================================================================="
@ -165,7 +165,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
nand_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000 part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000
# Set 'bootcmd' for the second part of the script that will # Set 'bootcmd' for the second part of the script that will
# - Reset environment to defaults # - Reset environment to defaults
@ -195,13 +195,13 @@ sleep 3
uuu fb: ucmd setenv fastboot_buffer \${loadaddr} uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
# Update Linux # Update Linux
nand_update "linux" "${INSTALL_LINUX_FILENAME}" 15000 part_update "linux" "${INSTALL_LINUX_FILENAME}" 15000
# Update Recovery # Update Recovery
nand_update "recovery" "${INSTALL_RECOVERY_FILENAME}" 15000 part_update "recovery" "${INSTALL_RECOVERY_FILENAME}" 15000
# Update Rootfs # Update Rootfs
nand_update "rootfs" "${INSTALL_ROOTFS_FILENAME}" 90000 part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}" 90000
# Erase the 'Update' partition # Erase the 'Update' partition
uuu fb: ucmd nand erase.part update uuu fb: ucmd nand erase.part update

View File

@ -40,6 +40,25 @@ show_usage()
exit 2 exit 2
} }
# Update a partition
# Params:
# 1. partition
# 2. file
part_update()
{
echo "\033[36m"
echo "====================================================================================="
echo "Updating '${1}' partition with file: ${2}"
echo "====================================================================================="
echo "\033[0m"
if [ "${1}" = "bootloader" ]; then
uuu fb: flash "${1}" "${2}"
else
uuu fb: flash -raw2sparse "${1}" "${2}"
fi
}
# Command line admits the following parameters: # Command line admits the following parameters:
# -u <u-boot-filename> # -u <u-boot-filename>
# -i <image-name> # -i <image-name>
@ -100,7 +119,7 @@ done;
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
uuu fb: flash bootloader ${INSTALL_UBOOT_FILENAME} part_update "bootloader" "${INSTALL_UBOOT_FILENAME}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1
@ -143,13 +162,13 @@ uuu fb: acmd reset
sleep 3 sleep 3
# Update Linux # Update Linux
uuu fb: flash -raw2sparse linux ${INSTALL_LINUX_FILENAME} part_update "linux" "${INSTALL_LINUX_FILENAME}"
# Update Recovery # Update Recovery
uuu fb: flash -raw2sparse recovery ${INSTALL_RECOVERY_FILENAME} part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs # Update Rootfs
uuu fb: flash -raw2sparse rootfs ${INSTALL_ROOTFS_FILENAME} part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}"
# Configure u-boot to boot into recovery mode # Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes uuu fb: ucmd setenv boot_recovery yes

View File

@ -40,6 +40,25 @@ show_usage()
exit 2 exit 2
} }
# Update a partition
# Params:
# 1. partition
# 2. file
part_update()
{
echo "\033[36m"
echo "====================================================================================="
echo "Updating '${1}' partition with file: ${2}"
echo "====================================================================================="
echo "\033[0m"
if [ "${1}" = "bootloader" ]; then
uuu fb: flash "${1}" "${2}"
else
uuu fb: flash -raw2sparse "${1}" "${2}"
fi
}
# Command line admits the following parameters: # Command line admits the following parameters:
# -u <u-boot-filename> # -u <u-boot-filename>
# -i <image-name> # -i <image-name>
@ -100,7 +119,7 @@ done;
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
uuu fb: flash bootloader ${INSTALL_UBOOT_FILENAME} part_update "bootloader" "${INSTALL_UBOOT_FILENAME}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1
@ -143,13 +162,13 @@ uuu fb: acmd reset
sleep 3 sleep 3
# Update Linux # Update Linux
uuu fb: flash -raw2sparse linux ${INSTALL_LINUX_FILENAME} part_update "linux" "${INSTALL_LINUX_FILENAME}"
# Update Recovery # Update Recovery
uuu fb: flash -raw2sparse recovery ${INSTALL_RECOVERY_FILENAME} part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs # Update Rootfs
uuu fb: flash -raw2sparse rootfs ${INSTALL_ROOTFS_FILENAME} part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}"
# Configure u-boot to boot into recovery mode # Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes uuu fb: ucmd setenv boot_recovery yes

View File

@ -40,6 +40,25 @@ show_usage()
exit 2 exit 2
} }
# Update a partition
# Params:
# 1. partition
# 2. file
part_update()
{
echo "\033[36m"
echo "====================================================================================="
echo "Updating '${1}' partition with file: ${2}"
echo "====================================================================================="
echo "\033[0m"
if [ "${1}" = "bootloader" ]; then
uuu fb: flash "${1}" "${2}"
else
uuu fb: flash -raw2sparse "${1}" "${2}"
fi
}
# Command line admits the following parameters: # Command line admits the following parameters:
# -u <u-boot-filename> # -u <u-boot-filename>
# -i <image-name> # -i <image-name>
@ -167,7 +186,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
uuu fb: flash bootloader ${INSTALL_UBOOT_FILENAME} part_update "bootloader" "${INSTALL_UBOOT_FILENAME}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1
@ -210,13 +229,13 @@ uuu fb: acmd reset
sleep 3 sleep 3
# Update Linux # Update Linux
uuu fb: flash -raw2sparse linux ${INSTALL_LINUX_FILENAME} part_update "linux" "${INSTALL_LINUX_FILENAME}"
# Update Recovery # Update Recovery
uuu fb: flash -raw2sparse recovery ${INSTALL_RECOVERY_FILENAME} part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs # Update Rootfs
uuu fb: flash -raw2sparse rootfs ${INSTALL_ROOTFS_FILENAME} part_update "rootfs" "${INSTALL_ROOTFS_FILENAME}"
# Configure u-boot to boot into recovery mode # Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes uuu fb: ucmd setenv boot_recovery yes

View File

@ -40,6 +40,25 @@ show_usage()
exit 2 exit 2
} }
# Update a partition
# Params:
# 1. partition
# 2. file
part_update()
{
echo "\033[36m"
echo "====================================================================================="
echo "Updating '${1}' partition with file: ${2}"
echo "====================================================================================="
echo "\033[0m"
if [ "${1}" = "bootloader" ]; then
uuu fb: flash "${1}" "${2}"
else
uuu fb: flash -raw2sparse "${1}" "${2}"
fi
}
# Command line admits the following parameters: # Command line admits the following parameters:
# -u <u-boot-filename> # -u <u-boot-filename>
# -i <image-name> # -i <image-name>
@ -167,7 +186,7 @@ uuu fb: ucmd setenv fastboot_buffer \${loadaddr}
uuu fb: ucmd setenv forced_update 1 uuu fb: ucmd setenv forced_update 1
# Update U-Boot # Update U-Boot
uuu fb: flash bootloader ${INSTALL_UBOOT_FILENAME} part_update "bootloader" "${INSTALL_UBOOT_FILENAME}"
# Set MMC to boot from BOOT1 partition # Set MMC to boot from BOOT1 partition
uuu fb: ucmd mmc partconf 0 1 1 1 uuu fb: ucmd mmc partconf 0 1 1 1
@ -210,10 +229,10 @@ uuu fb: acmd reset
sleep 3 sleep 3
# Update Linux # Update Linux
uuu fb: flash -raw2sparse linux ${INSTALL_LINUX_FILENAME} part_update "linux" "${INSTALL_LINUX_FILENAME}"
# Update Recovery # Update Recovery
uuu fb: flash -raw2sparse recovery ${INSTALL_RECOVERY_FILENAME} part_update "recovery" "${INSTALL_RECOVERY_FILENAME}"
# Update Rootfs # Update Rootfs
uuu fb: flash -raw2sparse rootfs ${INSTALL_ROOTFS_FILENAME} uuu fb: flash -raw2sparse rootfs ${INSTALL_ROOTFS_FILENAME}