diff mbox

[U-Boot,1/3] config_distro_bootcmd.h: Use a private variable for bootpart

Message ID 1440766922-24993-2-git-send-email-sjoerd.simons@collabora.co.uk
State Accepted
Delegated to: Tom Rini
Headers show

Commit Message

Sjoerd Simons Aug. 28, 2015, 1:01 p.m. UTC
Hush has an oddity where using ${var} causes var to resolved in the the global
address space (iotw the environment) first and only afterwards will the local
variable space be searched.

This causes odd side-effects when iterating over the boot partitions
using ${bootpart} if the environment also has a bootpart variable (e.g. for
the various TI boards). Fix this by using the hopefully more unique
${distro_bootpart} instead of ${bootpart}.

Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
---

 include/config_distro_bootcmd.h | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

Comments

Stephen Warren Aug. 28, 2015, 7:42 p.m. UTC | #1
On 08/28/2015 06:01 AM, Sjoerd Simons wrote:
> Hush has an oddity where using ${var} causes var to resolved in the the global
> address space (iotw the environment) first and only afterwards will the local
> variable space be searched.
> 
> This causes odd side-effects when iterating over the boot partitions
> using ${bootpart} if the environment also has a bootpart variable (e.g. for
> the various TI boards). Fix this by using the hopefully more unique
> ${distro_bootpart} instead of ${bootpart}.

The series,
Acked-by: Stephen Warren <swarren@wwwdotorg.org>
Tom Rini Oct. 22, 2015, 9:19 p.m. UTC | #2
On Fri, Aug 28, 2015 at 03:01:54PM +0200, Sjoerd Simons wrote:

> Hush has an oddity where using ${var} causes var to resolved in the the global
> address space (iotw the environment) first and only afterwards will the local
> variable space be searched.
> 
> This causes odd side-effects when iterating over the boot partitions
> using ${bootpart} if the environment also has a bootpart variable (e.g. for
> the various TI boards). Fix this by using the hopefully more unique
> ${distro_bootpart} instead of ${bootpart}.
> 
> Signed-off-by: Sjoerd Simons <sjoerd.simons@collabora.co.uk>
> Acked-by: Stephen Warren <swarren@wwwdotorg.org>

Applied to u-boot/master, thanks!
diff mbox

Patch

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 3a360ca4..d2f49a1 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -191,11 +191,12 @@ 
 	BOOTENV_BOOT_TARGETS \
 	\
 	"boot_extlinux="                                                  \
-		"sysboot ${devtype} ${devnum}:${bootpart} any "           \
+		"sysboot ${devtype} ${devnum}:${distro_bootpart} any "    \
 			"${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
 	\
 	"scan_dev_for_extlinux="                                          \
-		"if test -e ${devtype} ${devnum}:${bootpart} "            \
+		"if test -e ${devtype} "                                  \
+				"${devnum}:${distro_bootpart} "           \
 				"${prefix}extlinux/extlinux.conf; then "  \
 			"echo Found ${prefix}extlinux/extlinux.conf; "    \
 			"run boot_extlinux; "                             \
@@ -203,13 +204,14 @@ 
 		"fi\0"                                                    \
 	\
 	"boot_a_script="                                                  \
-		"load ${devtype} ${devnum}:${bootpart} "                  \
+		"load ${devtype} ${devnum}:${distro_bootpart} "           \
 			"${scriptaddr} ${prefix}${script}; "              \
 		"source ${scriptaddr}\0"                                  \
 	\
 	"scan_dev_for_scripts="                                           \
 		"for script in ${boot_scripts}; do "                      \
-			"if test -e ${devtype} ${devnum}:${bootpart} "    \
+			"if test -e ${devtype} "                          \
+					"${devnum}:${distro_bootpart} "   \
 					"${prefix}${script}; then "       \
 				"echo Found U-Boot script "               \
 					"${prefix}${script}; "            \
@@ -219,7 +221,8 @@ 
 		"done\0"                                                  \
 	\
 	"scan_dev_for_boot="                                              \
-		"echo Scanning ${devtype} ${devnum}:${bootpart}...; "     \
+		"echo Scanning ${devtype} "                               \
+				"${devnum}:${distro_bootpart}...; "       \
 		"for prefix in ${boot_prefixes}; do "                     \
 			"run scan_dev_for_extlinux; "                     \
 			"run scan_dev_for_scripts; "                      \
@@ -228,8 +231,9 @@ 
 	"scan_dev_for_boot_part="                                         \
 		"part list ${devtype} ${devnum} -bootable devplist; "     \
 		"env exists devplist || setenv devplist 1; "              \
-		"for bootpart in ${devplist}; do "                        \
-			"if fstype ${devtype} ${devnum}:${bootpart} "     \
+		"for distro_bootpart in ${devplist}; do "                 \
+			"if fstype ${devtype} "                           \
+					"${devnum}:${distro_bootpart} "   \
 					"bootfstype; then "               \
 				"run scan_dev_for_boot; "                 \
 			"fi; "                                            \