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

View File

@ -100,6 +100,24 @@ part_update()
fi 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 clear
echo "############################################################" echo "############################################################"
echo "# Linux firmware install through USB OTG #" echo "# Linux firmware install through USB OTG #"
@ -278,6 +296,9 @@ fi
LINUX_NAME="linux" LINUX_NAME="linux"
RECOVERY_NAME="recovery" RECOVERY_NAME="recovery"
ROOTFS_NAME="rootfs" ROOTFS_NAME="rootfs"
UPDATE_NAME="update"
DATA_NAME="data"
# Print warning about storage media being deleted # Print warning about storage media being deleted
if [ "${NOWAIT}" != true ]; then if [ "${NOWAIT}" != true ]; then
WAIT=10 WAIT=10
@ -305,6 +326,12 @@ if [ "${NOWAIT}" != true ]; then
printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n" printf " ${RECOVERY_NAME}\t${INSTALL_RECOVERY_FILENAME}\n"
printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n" printf " ${ROOTFS_NAME}\t${INSTALL_ROOTFS_FILENAME}\n"
fi 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 "\n"
printf " Press CTRL+C now if you wish to abort.\n" printf " Press CTRL+C now if you wish to abort.\n"
printf "\n" printf "\n"
@ -334,7 +361,8 @@ part_update "uboot" "${INSTALL_UBOOT_FILENAME}" 5000 "${DEK_FILE}"
# - Update the 'linux' partition # - Update the 'linux' partition
# - Update the 'recovery' partition # - Update the 'recovery' partition
# - Update the 'rootfs' partition # - Update the 'rootfs' partition
# - Erase the 'update' partition # - Format the 'update' partition
# - Format the 'data' partition
uuu fb: ucmd setenv bootcmd " uuu fb: ucmd setenv bootcmd "
env default -a; env default -a;
setenv dualboot \${dualboot}; setenv dualboot \${dualboot};
@ -388,15 +416,11 @@ else
part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}" 120000 part_update "${ROOTFS_NAME}" "${INSTALL_ROOTFS_FILENAME}" 120000
fi fi
if [ "${SINGLEMTDSYS}" != true ] && [ "${DUALBOOT}" != true ]; then if [ "${SINGLEMTDSYS}" != true ]; then
# Erase the 'Update' partition if [ "${DUALBOOT}" != true ]; then
uuu "fb[-t 20000]:" ucmd nand erase.part update format_part "${UPDATE_NAME}"
fi fi
format_part "${DATA_NAME}"
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
fi fi
# Set the rootfstype if squashfs # Set the rootfstype if squashfs