Commit 59d03cb37700e2e204451e83b38c326df0435ff8

Authored by Sjoerd Simons
Committed by Tom Rini
1 parent 2da87ab353

config_distro_bootcmd.h: Use a private variable for bootpart

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>

Showing 1 changed file with 11 additions and 7 deletions Side-by-side Diff

include/config_distro_bootcmd.h
... ... @@ -191,11 +191,12 @@
191 191 BOOTENV_BOOT_TARGETS \
192 192 \
193 193 "boot_extlinux=" \
194   - "sysboot ${devtype} ${devnum}:${bootpart} any " \
  194 + "sysboot ${devtype} ${devnum}:${distro_bootpart} any " \
195 195 "${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
196 196 \
197 197 "scan_dev_for_extlinux=" \
198   - "if test -e ${devtype} ${devnum}:${bootpart} " \
  198 + "if test -e ${devtype} " \
  199 + "${devnum}:${distro_bootpart} " \
199 200 "${prefix}extlinux/extlinux.conf; then " \
200 201 "echo Found ${prefix}extlinux/extlinux.conf; " \
201 202 "run boot_extlinux; " \
202 203  
... ... @@ -203,13 +204,14 @@
203 204 "fi\0" \
204 205 \
205 206 "boot_a_script=" \
206   - "load ${devtype} ${devnum}:${bootpart} " \
  207 + "load ${devtype} ${devnum}:${distro_bootpart} " \
207 208 "${scriptaddr} ${prefix}${script}; " \
208 209 "source ${scriptaddr}\0" \
209 210 \
210 211 "scan_dev_for_scripts=" \
211 212 "for script in ${boot_scripts}; do " \
212   - "if test -e ${devtype} ${devnum}:${bootpart} " \
  213 + "if test -e ${devtype} " \
  214 + "${devnum}:${distro_bootpart} " \
213 215 "${prefix}${script}; then " \
214 216 "echo Found U-Boot script " \
215 217 "${prefix}${script}; " \
... ... @@ -219,7 +221,8 @@
219 221 "done\0" \
220 222 \
221 223 "scan_dev_for_boot=" \
222   - "echo Scanning ${devtype} ${devnum}:${bootpart}...; " \
  224 + "echo Scanning ${devtype} " \
  225 + "${devnum}:${distro_bootpart}...; " \
223 226 "for prefix in ${boot_prefixes}; do " \
224 227 "run scan_dev_for_extlinux; " \
225 228 "run scan_dev_for_scripts; " \
... ... @@ -228,8 +231,9 @@
228 231 "scan_dev_for_boot_part=" \
229 232 "part list ${devtype} ${devnum} -bootable devplist; " \
230 233 "env exists devplist || setenv devplist 1; " \
231   - "for bootpart in ${devplist}; do " \
232   - "if fstype ${devtype} ${devnum}:${bootpart} " \
  234 + "for distro_bootpart in ${devplist}; do " \
  235 + "if fstype ${devtype} " \
  236 + "${devnum}:${distro_bootpart} " \
233 237 "bootfstype; then " \
234 238 "run scan_dev_for_boot; " \
235 239 "fi; " \