installers: cc6ul: format 'update' and 'data' partitions

On the multi-MTD layout (default) the 'data' UBI volume is never created
and thus not mounted by the system. This is because with this layout, the
creation of the UBI volume is done by the 'update' command, but nobody
updates this partition cause DEY doesn't generate an image for it.

We want the 'data' UBI volume to be created so that the CC6UL can connect
to the regular Remote Manager URI and store the certificate in it.
As long as a UBI volume is created, Linux will mount it, so this commit
erases the partition and creates the UBI volume.

The same goes for the 'update' partition. The installer was relying on the
recovery mechanism to wipe this partition, but this is not longer required
with UBI. As long as the installer erases the partition and creates the
volume, Linux will be able to mount it, so the boot in recovery mode has
been removed from the script.

Note: the formatting is only done for multi-MTD layout; the ubivolscript
creates all volumes for single-MTD layout.

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2025-07-08 13:15:10 +02:00
parent 850f75f238
commit c17af3fd47
2 changed files with 58 additions and 19 deletions

View File

@ -112,7 +112,9 @@ else
echo " linux ${INSTALL_LINUX_FILENAME}"
echo " recovery ${INSTALL_RECOVERY_FILENAME}"
echo " rootfs ${INSTALL_ROOTFS_FILENAME}"
echo " update --format--"
fi
echo " data --format--"
echo ""
echo " Press CTRL+C now if you wish to abort or wait 10 seconds"
echo " to continue."
@ -158,9 +160,8 @@ fi
# - Set bootlimit to 3
# - If Normal Boot:
# - Update the system partitions: linux, recovery, rootfs
# - Erase the 'update' partition
# - Configure recovery to wipe 'update' partition
# - Run 'recovery' and let the system boot after
# - Format the 'update' partition
# - Format the 'data' partition
setenv bootcmd "
env default -a;
setenv singlemtdsys ${singlemtdsys};
@ -272,19 +273,33 @@ setenv bootcmd "
exit;
fi;
echo \"\";
if test \"\$\{singlemtdsys\}\" != yes; then
fi;
if test \"\$\{singlemtdsys\}\" != yes; then
if test \"\$\{dualboot\}\" != yes; then
echo \"\";
echo \"\";
echo \">> Formatting 'update' partition\";
echo \"\";
echo \"\";
nand erase.part update;
if ubi part update; then
ubi createvol update;
fi;
fi;
echo \"\";
echo \"\";
echo \">> Formatting 'data' partition\";
echo \"\";
echo \"\";
nand erase.part data;
if ubi part data; then
ubi createvol data;
fi;
setenv boot_recovery yes;
setenv recovery_command wipe_update;
fi;
saveenv;
echo \"\";
echo \"\";
echo \">> Firmware installation complete.\";
if test \"\$\{dualboot\}\" != yes; then
echo \"Rebooting into recovery mode for final deployment.\";
fi;
echo \"\";
echo \"\";
sleep 1;

View File

@ -100,6 +100,24 @@ part_update()
fi
}
# Format a partition
# Params:
# 1. partition
# Description:
# - erases a partition
# - creates UBI volume with the same name as the partition
format_part()
{
echo "\033[36m"
echo "====================================================================================="
echo "Formatting '${1}' partition"
echo "====================================================================================="
echo "\033[0m"
uuu "fb[-t 20000]:" ucmd nand erase.part "${1}"
uuu "fb[-t 20000]:" ucmd if ubi part "${1}"\; then ubi createvol "${1}"\;fi
}
clear
echo "############################################################"
echo "# Linux firmware install through USB OTG #"
@ -278,6 +296,9 @@ fi
LINUX_NAME="linux"
RECOVERY_NAME="recovery"
ROOTFS_NAME="rootfs"
UPDATE_NAME="update"
DATA_NAME="data"
# Print warning about storage media being deleted
if [ "${NOWAIT}" != true ]; then
WAIT=10
@ -305,6 +326,12 @@ if [ "${NOWAIT}" != true ]; then
printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n"
printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n"
fi
if [ "${SINGLEMTDSYS}" != true ]; then
if [ "${DUALBOOT}" != true ]; then
printf " ${UPDATE_NAME}\t--format--\n"
fi
printf " ${DATA_NAME}\t\t--format--\n"
fi
printf "\n"
printf " Press CTRL+C now if you wish to abort.\n"
printf "\n"
@ -334,7 +361,8 @@ part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000 "${DEK_FILE}"
# - Update the 'linux' partition
# - Update the 'recovery' partition
# - Update the 'rootfs' partition
# - Erase the 'update' partition
# - Format the 'update' partition
# - Format the 'data' partition
uuu fb: ucmd setenv bootcmd "
env default -a;
setenv dualboot \${dualboot};
@ -388,15 +416,11 @@ else
part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}" 120000
fi
if [ "${SINGLEMTDSYS}" != true ] && [ "${DUALBOOT}" != true ]; then
# Erase the 'Update' partition
uuu "fb[-t 20000]:" ucmd nand erase.part update
fi
if [ "${DUALBOOT}" != true ]; then
# Configure u-boot to boot into recovery mode
uuu fb: ucmd setenv boot_recovery yes
uuu fb: ucmd setenv recovery_command wipe_update
if [ "${SINGLEMTDSYS}" != true ]; then
if [ "${DUALBOOT}" != true ]; then
format_part "${UPDATE_NAME}"
fi
format_part "${DATA_NAME}"
fi
# Set the rootfstype if squashfs