mirror of
https://source.denx.de/u-boot/u-boot.git
synced 2026-05-05 12:46:14 +02:00
board: toradex: Quote variables in test cmd expression
With correct POSIX handling, unquoted empty variables can turn the
expression like
test -n ${fdtfile}
into
test -n
The POSIX handling for single argument `test` evaluates it as true,
so the fallback initialization will be skipped unexpectedly.
Quoting variable expansions in `test` expressions will always result in
correct behavior for empty and non-empty values.
This change was triggered by
commit 8b0619579b22 ("cmd: test: fix handling of single-argument form of test")
The aim is to have a less fragile codebase that is not dependent on a
quirk of the shell implementation.
Use quoted variable expansions in `test` expressions throughout.
Signed-off-by: Franz Schnyder <franz.schnyder@toradex.com>
Acked-by: Francesco Dolcini <francesco.dolcini@toradex.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
parent
bb0f3eebb3
commit
92a04aea6d
@ -23,21 +23,21 @@ dfu_alt_info_ram=
|
||||
|
||||
update_tiboot3=
|
||||
askenv confirm Did you load tiboot3.bin (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200;
|
||||
mmc dev 0 1; mmc write ${loadaddr} 0x0 ${blkcnt};
|
||||
fi
|
||||
|
||||
update_tispl=
|
||||
askenv confirm Did you load tispl.bin (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200;
|
||||
mmc dev 0 1; mmc write ${loadaddr} 0x400 ${blkcnt};
|
||||
fi
|
||||
|
||||
update_uboot=
|
||||
askenv confirm Did you load u-boot.img (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200;
|
||||
mmc dev 0 1; mmc write ${loadaddr} 0x1400 ${blkcnt};
|
||||
fi
|
||||
|
||||
@ -13,7 +13,7 @@ scriptaddr=0x50280000
|
||||
|
||||
update_uboot=
|
||||
askenv confirm Did you load flash.bin (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt
|
||||
${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0
|
||||
${blkcnt};
|
||||
|
||||
@ -13,7 +13,7 @@ scriptaddr=0x9c600000
|
||||
|
||||
update_uboot=
|
||||
askenv confirm Did you load flash.bin (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt
|
||||
${blkcnt} / 0x200; mmc dev 0 1; mmc write ${loadaddr} 0x0
|
||||
${blkcnt};
|
||||
|
||||
@ -21,21 +21,21 @@ dfu_alt_info_ram=
|
||||
|
||||
update_tiboot3=
|
||||
askenv confirm Did you load tiboot3.bin (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200;
|
||||
mmc dev 0 1; mmc write ${loadaddr} 0x0 ${blkcnt};
|
||||
fi
|
||||
|
||||
update_tispl=
|
||||
askenv confirm Did you load tispl.bin (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200;
|
||||
mmc dev 0 1; mmc write ${loadaddr} 0x400 ${blkcnt};
|
||||
fi
|
||||
|
||||
update_uboot=
|
||||
askenv confirm Did you load u-boot.img (y/N)?;
|
||||
if test $confirm = y; then
|
||||
if test "$confirm" = y; then
|
||||
setexpr blkcnt ${filesize} + 0x1ff && setexpr blkcnt ${blkcnt} / 0x200;
|
||||
mmc dev 0 1; mmc write ${loadaddr} 0x1400 ${blkcnt};
|
||||
fi
|
||||
|
||||
@ -25,7 +25,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_SYSTEM_SETUP=y
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile ${soc}-apalis${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile ${soc}-apalis${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_CBSIZE=2048
|
||||
CONFIG_SYS_PBSIZE=2068
|
||||
CONFIG_LOG=y
|
||||
|
||||
@ -31,7 +31,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout serial,vidconsole; setenv stdin serial,usbkbd"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6q-apalis${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx6q-apalis${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_CBSIZE=1024
|
||||
CONFIG_SYS_PBSIZE=1055
|
||||
CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
|
||||
|
||||
@ -34,7 +34,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_BOOTCOMMAND="bootflow scan -b"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile k3-am69-aquila-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile k3-am69-aquila-${fdt_board}.dtb"
|
||||
CONFIG_LOG=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
|
||||
@ -18,7 +18,7 @@ CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_PBSIZE=547
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
|
||||
@ -21,7 +21,7 @@ CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_ENV_SETUP=y
|
||||
CONFIG_BOOTCOMMAND="run ubiboot || run distro_bootcmd;"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx6ull-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_PBSIZE=547
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
|
||||
@ -26,7 +26,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_SYSTEM_SETUP=y
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile ${soc}-colibri-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile ${soc}-colibri-${fdt_board}.dtb"
|
||||
CONFIG_SYS_CBSIZE=2048
|
||||
CONFIG_SYS_PBSIZE=2068
|
||||
CONFIG_LOG=y
|
||||
|
||||
@ -30,7 +30,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_BOOTCOMMAND="run distro_bootcmd; usb start; setenv stdout serial,vidconsole; setenv stdin serial,usbkbd"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx6dl-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx6dl-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_CBSIZE=1024
|
||||
CONFIG_SYS_PBSIZE=1056
|
||||
CONFIG_SYS_CONSOLE_OVERWRITE_ROUTINE=y
|
||||
|
||||
@ -22,7 +22,7 @@ CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_ENV_SETUP=y
|
||||
CONFIG_BOOTCOMMAND="run ubiboot ; echo ; echo ubiboot failed ; run distro_bootcmd;"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile ${soc}-colibri${variant}-${fdt_board}.dtb "
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile ${soc}-colibri${variant}-${fdt_board}.dtb "
|
||||
CONFIG_SYS_PBSIZE=544
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
|
||||
@ -19,7 +19,7 @@ CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile ${soc}-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile ${soc}-colibri${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_PBSIZE=544
|
||||
CONFIG_SYS_CONSOLE_IS_IN_ENV=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
|
||||
@ -23,7 +23,7 @@ CONFIG_FDT_FIXUP_PARTITIONS=y
|
||||
CONFIG_USE_BOOTCOMMAND=y
|
||||
CONFIG_BOOTCOMMAND="run ubiboot || run distro_bootcmd;"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile ${soc}-colibri-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile ${soc}-colibri-${fdt_board}.dtb"
|
||||
CONFIG_SYS_PBSIZE=1056
|
||||
CONFIG_LOGLEVEL=3
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
|
||||
@ -40,7 +40,7 @@ CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_SYSTEM_SETUP=y
|
||||
CONFIG_BOOTCOMMAND="bootflow scan -b"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx8mp-toradex-smarc-dev.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx8mp-toradex-smarc-dev.dtb"
|
||||
CONFIG_SYS_CBSIZE=2048
|
||||
CONFIG_SYS_PBSIZE=2081
|
||||
CONFIG_LOG=y
|
||||
|
||||
@ -37,7 +37,7 @@ CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_SYSTEM_SETUP=y
|
||||
CONFIG_BOOTCOMMAND="bootflow scan -b"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx95-toradex-smarc-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx95-toradex-smarc-${fdt_board}.dtb"
|
||||
CONFIG_SYS_CBSIZE=2048
|
||||
CONFIG_SYS_PBSIZE=2074
|
||||
CONFIG_LOG=y
|
||||
|
||||
@ -34,7 +34,7 @@ CONFIG_FIT_VERBOSE=y
|
||||
CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile k3-am625-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile k3-am625-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_LOG=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
|
||||
@ -36,7 +36,7 @@ CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_BOARD_SETUP_EXTENDED=y
|
||||
CONFIG_BOOTCOMMAND="bootflow scan -b"
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile k3-am62p5-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile k3-am62p5-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_LOG=y
|
||||
# CONFIG_DISPLAY_BOARDINFO is not set
|
||||
CONFIG_DISPLAY_BOARDINFO_LATE=y
|
||||
|
||||
@ -33,7 +33,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_SYSTEM_SETUP=y
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx8mm-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx8mm-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_CBSIZE=2048
|
||||
CONFIG_SYS_PBSIZE=2081
|
||||
CONFIG_LOG=y
|
||||
|
||||
@ -38,7 +38,7 @@ CONFIG_DISTRO_DEFAULTS=y
|
||||
CONFIG_BOOTDELAY=1
|
||||
CONFIG_OF_SYSTEM_SETUP=y
|
||||
CONFIG_USE_PREBOOT=y
|
||||
CONFIG_PREBOOT="test -n ${fdtfile} || setenv fdtfile imx8mp-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_PREBOOT="test -n \"${fdtfile}\" || setenv fdtfile imx8mp-verdin-${variant}-${fdt_board}.dtb"
|
||||
CONFIG_SYS_CBSIZE=2048
|
||||
CONFIG_SYS_PBSIZE=2081
|
||||
CONFIG_LOG=y
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user