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,59 +19,58 @@ if test $? -eq 1; then
|
||||||
exit;
|
exit;
|
||||||
fi
|
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
|
# Determine U-Boot file to program basing on module variant
|
||||||
if test "${module_variant}" = "0x12"; then
|
if test -n "${module_variant}"; then
|
||||||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx;
|
if test "${module_variant}" = "0x12"; then
|
||||||
elif test "${module_variant}" = "0x02" || test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x11"; then
|
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx;
|
||||||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc.imx;
|
elif test "${module_variant}" = "0x02" || test "${module_variant}" = "0x04" || test "${module_variant}" = "0x05" || test "${module_variant}" = "0x11"; then
|
||||||
elif test "${module_variant}" = "0x03" || test "${module_variant}" = "0x0e" || test "${module_variant}" = "0x0f"; then
|
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc.imx;
|
||||||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc512MB.imx;
|
elif test "${module_variant}" = "0x03" || test "${module_variant}" = "0x0e" || test "${module_variant}" = "0x0f"; then
|
||||||
elif test "${module_variant}" = "0x0b"; then
|
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc512MB.imx;
|
||||||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc.imx;
|
elif test "${module_variant}" = "0x0b"; then
|
||||||
elif test "${module_variant}" = "0x0c" || test "${module_variant}" = "0x13"; then
|
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc.imx;
|
||||||
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc512MB.imx;
|
elif test "${module_variant}" = "0x0c" || test "${module_variant}" = "0x13"; then
|
||||||
else
|
setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc512MB.imx;
|
||||||
if test -z "${INSTALL_UBOOT_FILENAME}"; then
|
fi
|
||||||
echo "[ERROR] Cannot determine U-Boot file for this module!";
|
|
||||||
echo "";
|
|
||||||
echo "1. Set variable 'INSTALL_UBOOT_FILENAME' depending on your ConnectCore 6 variant:";
|
|
||||||
echo " - For a Quad/Dual CPU with 2GB DDR3, run:";
|
|
||||||
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx";
|
|
||||||
echo " - For a Quad/Dual CPU with 1GB DDR3, run:";
|
|
||||||
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc.imx";
|
|
||||||
echo " - For a Quad/Dual CPU with 512MB DDR3, run:";
|
|
||||||
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc512MB.imx";
|
|
||||||
echo " - For a DualLite/Solo CPU with 1GB DDR3, run:";
|
|
||||||
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc.imx";
|
|
||||||
echo " - For a DualLite/Solo CPU with 512MB DDR3, run:";
|
|
||||||
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc512MB.imx";
|
|
||||||
echo "";
|
|
||||||
echo "2. Run the install script again.";
|
|
||||||
echo "";
|
|
||||||
echo "Aborted";
|
|
||||||
exit;
|
|
||||||
fi;
|
|
||||||
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
|
||||||
|
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:";
|
||||||
|
echo " - For a Quad/Dual CPU with 2GB DDR3, run:";
|
||||||
|
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc2GB.imx";
|
||||||
|
echo " - For a Quad/Dual CPU with 1GB DDR3, run:";
|
||||||
|
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc.imx";
|
||||||
|
echo " - For a Quad/Dual CPU with 512MB DDR3, run:";
|
||||||
|
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6qsbc512MB.imx";
|
||||||
|
echo " - For a DualLite/Solo CPU with 1GB DDR3, run:";
|
||||||
|
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc.imx";
|
||||||
|
echo " - For a DualLite/Solo CPU with 512MB DDR3, run:";
|
||||||
|
echo " => setenv INSTALL_UBOOT_FILENAME u-boot-ccimx6dlsbc512MB.imx";
|
||||||
|
echo "";
|
||||||
|
echo "2. Run the install script again.";
|
||||||
|
echo "";
|
||||||
|
echo "Aborted";
|
||||||
|
echo "";
|
||||||
|
exit;
|
||||||
|
fi;
|
||||||
|
|
||||||
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat
|
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat
|
||||||
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4
|
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4
|
||||||
|
|
||||||
# Check for presence of firmware files on the SD card
|
# Check for presence of firmware files on the SD card
|
||||||
for install_f in $INSTALL_UBOOT_FILENAME $INSTALL_LINUX_FILENAME $INSTALL_ROOTFS_FILENAME; do
|
for install_f in ${INSTALL_UBOOT_FILENAME} ${INSTALL_LINUX_FILENAME} ${INSTALL_ROOTFS_FILENAME}; do
|
||||||
if test ! -e mmc 1:1 $install_f; then
|
if test ! -e mmc 1:1 ${install_f}; then
|
||||||
echo "ERROR: Could not find file $install_f";
|
echo "ERROR: Could not find file ${install_f}";
|
||||||
install_abort=1
|
install_abort=1
|
||||||
fi;
|
fi;
|
||||||
done
|
done
|
||||||
if test "${install_abort}" = "1"; then
|
if test -n "${install_abort}"; then
|
||||||
echo "Aborted.";
|
echo "Aborted.";
|
||||||
exit;
|
exit;
|
||||||
fi
|
fi
|
||||||
|
|
@ -92,7 +91,7 @@ echo ""
|
||||||
echo ">> Installing U-Boot boot loader (target will reset)";
|
echo ">> Installing U-Boot boot loader (target will reset)";
|
||||||
echo ""
|
echo ""
|
||||||
echo ""
|
echo ""
|
||||||
update uboot mmc 1 fat $INSTALL_UBOOT_FILENAME
|
update uboot mmc 1 fat ${INSTALL_UBOOT_FILENAME}
|
||||||
if test $? -eq 1; then
|
if test $? -eq 1; then
|
||||||
echo "[ERROR] Failed to update U-Boot boot loader!";
|
echo "[ERROR] Failed to update U-Boot boot loader!";
|
||||||
echo "";
|
echo "";
|
||||||
|
|
@ -130,7 +129,7 @@ setenv bootcmd '
|
||||||
echo ">> Installing Linux kernel and device tree files";
|
echo ">> Installing Linux kernel and device tree files";
|
||||||
echo "";
|
echo "";
|
||||||
echo "";
|
echo "";
|
||||||
update linux mmc 1 fat $INSTALL_LINUX_FILENAME;
|
update linux mmc 1 fat ${INSTALL_LINUX_FILENAME};
|
||||||
if test $? -eq 1; then
|
if test $? -eq 1; then
|
||||||
echo "[ERROR] Failed to update linux partition!";
|
echo "[ERROR] Failed to update linux partition!";
|
||||||
echo "";
|
echo "";
|
||||||
|
|
@ -142,7 +141,7 @@ setenv bootcmd '
|
||||||
echo ">> Installing Linux root file system";
|
echo ">> Installing Linux root file system";
|
||||||
echo "";
|
echo "";
|
||||||
echo "";
|
echo "";
|
||||||
update rootfs mmc 1 fat $INSTALL_ROOTFS_FILENAME;
|
update rootfs mmc 1 fat ${INSTALL_ROOTFS_FILENAME};
|
||||||
if test $? -eq 1; then
|
if test $? -eq 1; then
|
||||||
echo "[ERROR] Failed to update rootfs partition!";
|
echo "[ERROR] Failed to update rootfs partition!";
|
||||||
echo "";
|
echo "";
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue