install_linux_fw_sd: workaround bad behavior of 'test' command
Old versions of u-boot 'v2013.0x' have a bug in the shell's test command
that makes structures like:
if test "${not-existing}" = "0x01"; then ...
if test -z "${not-existing}"; then ...
to fail when the checked variable does not exist.
So implement workarounds in the updater script to overcome this problem.
This is needed because the script may be used in modules with an old
pre-installed u-boot.
https://jira.digi.com/browse/DEL-2231
Signed-off-by: Javier Viguera <javier.viguera@digi.com>
This commit is contained in:
parent
792d214927
commit
1db41c8473
|
|
@ -19,15 +19,8 @@ if test $? -eq 1; then
|
|||
exit;
|
||||
fi
|
||||
|
||||
# Ask for user confirmation (to be enabled in the future when shipped U-Boot
|
||||
# supports the 'askenv' command)
|
||||
#askenv install_yn "Do you want to continue? (y/n):" 1
|
||||
#if test "${install_yn}" != "y" && test "${install_yn}" != "Y"; then
|
||||
# echo "Aborted.";
|
||||
# exit;
|
||||
#fi
|
||||
|
||||
# Determine U-Boot file to program basing on module variant
|
||||
if test -n "${module_variant}"; then
|
||||
if test "${module_variant}" = "0x12"; then
|
||||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx;
|
||||
elif test "${module_variant}" = "0x02" || test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x11"; then
|
||||
|
|
@ -38,8 +31,14 @@ elif test "${module_variant}" = "0x0b"; then
|
|||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc.imx;
|
||||
elif test "${module_variant}" = "0x0c" || test "${module_variant}" = "0x13"; then
|
||||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc512MB.imx;
|
||||
fi
|
||||
fi
|
||||
# Use 'test -n ...' because 'test -z ...' does not work well on old versions of
|
||||
# u-boot when the checked value is empty.
|
||||
if test -n "${INSTALL_UBOOT_FILENAME}"; then
|
||||
true;
|
||||
else
|
||||
if test -z "${INSTALL_UBOOT_FILENAME}"; then
|
||||
echo "";
|
||||
echo "[ERROR] Cannot determine U-Boot file for this module!";
|
||||
echo "";
|
||||
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 variant:";
|
||||
|
|
@ -57,21 +56,21 @@ else
|
|||
echo "2. Run the install script again.";
|
||||
echo "";
|
||||
echo "Aborted";
|
||||
echo "";
|
||||
exit;
|
||||
fi;
|
||||
fi
|
||||
|
||||
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat
|
||||
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4
|
||||
|
||||
# Check for presence of firmware files on the SD card
|
||||
for install_f in $INSTALL_UBOOT_FILENAME $INSTALL_LINUX_FILENAME $INSTALL_ROOTFS_FILENAME; do
|
||||
if test ! -e mmc 1:1 $install_f; then
|
||||
echo "ERROR: Could not find file $install_f";
|
||||
for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do
|
||||
if test ! -e mmc 1:1 ${install_f}; then
|
||||
echo "ERROR: Could not find file ${install_f}";
|
||||
install_abort=1
|
||||
fi;
|
||||
done
|
||||
if test "${install_abort}" = "1"; then
|
||||
if test -n "${install_abort}"; then
|
||||
echo "Aborted.";
|
||||
exit;
|
||||
fi
|
||||
|
|
@ -92,7 +91,7 @@ echo ""
|
|||
echo ">> Installing U-Boot boot loader (target will reset)";
|
||||
echo ""
|
||||
echo ""
|
||||
update uboot mmc 1 fat $INSTALL_UBOOT_FILENAME
|
||||
update uboot mmc 1 fat ${INSTALL_UBOOT_FILENAME}
|
||||
if test $? -eq 1; then
|
||||
echo "[ERROR] Failed to update U-Boot boot loader!";
|
||||
echo "";
|
||||
|
|
@ -130,7 +129,7 @@ setenv bootcmd '
|
|||
echo ">> Installing Linux kernel and device tree files";
|
||||
echo "";
|
||||
echo "";
|
||||
update linux mmc 1 fat $INSTALL_LINUX_FILENAME;
|
||||
update linux mmc 1 fat ${INSTALL_LINUX_FILENAME};
|
||||
if test $? -eq 1; then
|
||||
echo "[ERROR] Failed to update linux partition!";
|
||||
echo "";
|
||||
|
|
@ -142,7 +141,7 @@ setenv bootcmd '
|
|||
echo ">> Installing Linux root file system";
|
||||
echo "";
|
||||
echo "";
|
||||
update rootfs mmc 1 fat $INSTALL_ROOTFS_FILENAME;
|
||||
update rootfs mmc 1 fat ${INSTALL_ROOTFS_FILENAME};
|
||||
if test $? -eq 1; then
|
||||
echo "[ERROR] Failed to update rootfs partition!";
|
||||
echo "";
|
||||
|
|
|
|||
Loading…
Reference in New Issue