install_linux_fw_sd: expand variables when setting bootcmd to avoid redefining them

The setting of 'bootcmd' in the script was done using single quotes, which
doesn't expand variables. As a consequence the following variables must
be defined again (during the execution of the second part of the script):
 - mmcdev
 - INSTALL_LINUX_FILENAME
 - INSTALL_ROOTFS_FILENAME

This patch changes the single quotes with double quotes, so that these
variables are expanded during the setting of 'bootcmd' with the values
assigned at the begining of the installation script (notice these are
not dynamically generated so there is no risk to expand them).

At the same time we need to escape with a backslash:
 - double quotes containing strings
 - variables that we don't want to expand (like the return value $?)

Signed-off-by: Hector Palacios <hector.palacios@digi.com>
This commit is contained in:
Hector Palacios 2016-07-06 13:32:37 +02:00
parent 052775a34c
commit a32cea139b
1 changed files with 35 additions and 38 deletions

View File

@ -106,58 +106,55 @@ fi
# - Update the 'linux' partition
# - Update the 'rootfs' partition
# - Reset the system and let it boot
setenv bootcmd '
setenv bootcmd "
env default -a;
saveenv;
setenv mmcdev 0;
setenv INSTALL_LINUX_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.boot.vfat;
setenv INSTALL_ROOTFS_FILENAME dey-image-qt-##GRAPHICAL_BACKEND##-ccimx6sbc.ext4;
echo "";
echo "";
echo ">> Creating Linux partition table on the eMMC";
echo "";
echo "";
echo \"\";
echo \"\";
echo \">> Creating Linux partition table on the eMMC\";
echo \"\";
echo \"\";
run partition_mmc_linux;
if test $? -eq 1; then
echo "[ERROR] Failed to create Linux partition table!";
echo "";
echo "Aborted.";
if test \$? -eq 1; then
echo \"[ERROR] Failed to create Linux partition table!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo "";
echo "";
echo ">> Installing Linux kernel and device tree files";
echo "";
echo "";
echo \"\";
echo \"\";
echo \">> Installing Linux kernel and device tree files\";
echo \"\";
echo \"\";
update linux mmc 1 fat ${INSTALL_LINUX_FILENAME};
if test $? -eq 1; then
echo "[ERROR] Failed to update linux partition!";
echo "";
echo "Aborted.";
if test \$? -eq 1; then
echo \"[ERROR] Failed to update linux partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo "";
echo "";
echo ">> Installing Linux root file system";
echo "";
echo "";
echo \"\";
echo \"\";
echo \">> Installing Linux root file system\";
echo \"\";
echo \"\";
update rootfs mmc 1 fat ${INSTALL_ROOTFS_FILENAME};
if test $? -eq 1; then
echo "[ERROR] Failed to update rootfs partition!";
echo "";
echo "Aborted.";
if test \$? -eq 1; then
echo \"[ERROR] Failed to update rootfs partition!\";
echo \"\";
echo \"Aborted.\";
exit;
fi;
echo "";
echo "#######################";
echo "# Install complete! #";
echo "#######################";
echo "";
echo \"\";
echo \"#######################\";
echo \"# Install complete! #\";
echo \"#######################\";
echo \"\";
sleep 1;
echo ">> Restarting the system";
echo \">> Restarting the system\";
sleep 1;
reset;
'
"
saveenv
reset