[U-Boot,v3] Ability to modify distro boot filename

Message ID 20181106122353.9136-1-martyn.welch@collabora.co.uk
State Accepted
Delegated to: Tom Rini
Headers show
Series
  • [U-Boot,v3] Ability to modify distro boot filename
Related show

Commit Message

Martyn Welch Nov. 6, 2018, 12:23 p.m.
Add in the ability to modify the distro boot filename. Whilst not
immediately useful in normal usage, it allows an alternative
configuration to be provided when other u-boot functionality is used, such
as bootcount limit, to fallback to an alternative boot configuration. In
this case we can follow the same boot path as for normal boot, just
using an alternatively named configuration file.

For example, by providing the following `altbootcmd` when bootcount is in
use:

altbootcmd=setenv boot_extlinx_conf extlinux-rollback.conf; \
	run distro_bootcmd

Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>

---

Changes in v3:
- Moving path to config variable, rename `boot_syslinux_conf`

Changes in v2:
- Moving config variable from `boot_config` to `boot_extlinux_conf`

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

Comments

Heinrich Schuchardt Nov. 6, 2018, 6:39 p.m. | #1
On 11/6/18 1:23 PM, Martyn Welch wrote:
> Add in the ability to modify the distro boot filename. Whilst not
> immediately useful in normal usage, it allows an alternative
> configuration to be provided when other u-boot functionality is used, such
> as bootcount limit, to fallback to an alternative boot configuration. In
> this case we can follow the same boot path as for normal boot, just
> using an alternatively named configuration file.
>
> For example, by providing the following `altbootcmd` when bootcount is in
> use:
>
> altbootcmd=setenv boot_extlinx_conf extlinux-rollback.conf; \
> 	run distro_bootcmd
>
> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>

Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

>
> ---
>
> Changes in v3:
> - Moving path to config variable, rename `boot_syslinux_conf`
>
> Changes in v2:
> - Moving config variable from `boot_config` to `boot_extlinux_conf`
>
>  include/config_distro_bootcmd.h | 7 ++++---
>  1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
> index 373fee78a9..5838eb3477 100644
> --- a/include/config_distro_bootcmd.h
> +++ b/include/config_distro_bootcmd.h
> @@ -355,15 +355,16 @@
>  	"boot_script_dhcp=boot.scr.uimg\0" \
>  	BOOTENV_BOOT_TARGETS \
>  	\
> +	"boot_syslinux_conf=extlinux/extlinux.conf\0" \
>  	"boot_extlinux="                                                  \
>  		"sysboot ${devtype} ${devnum}:${distro_bootpart} any "    \
> -			"${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
> +			"${scriptaddr} ${prefix}${boot_syslinux_conf}\0"  \
>  	\
>  	"scan_dev_for_extlinux="                                          \
>  		"if test -e ${devtype} "                                  \
>  				"${devnum}:${distro_bootpart} "           \
> -				"${prefix}extlinux/extlinux.conf; then "  \
> -			"echo Found ${prefix}extlinux/extlinux.conf; "    \
> +				"${prefix}${boot_syslinux_conf}; then "   \
> +			"echo Found ${prefix}${boot_syslinux_conf}; "     \
>  			"run boot_extlinux; "                             \
>  			"echo SCRIPT FAILED: continuing...; "             \
>  		"fi\0"                                                    \
>
Tom Rini Nov. 17, 2018, 2:08 p.m. | #2
On Tue, Nov 06, 2018 at 12:23:53PM +0000, Martyn Welch wrote:

> Add in the ability to modify the distro boot filename. Whilst not
> immediately useful in normal usage, it allows an alternative
> configuration to be provided when other u-boot functionality is used, such
> as bootcount limit, to fallback to an alternative boot configuration. In
> this case we can follow the same boot path as for normal boot, just
> using an alternatively named configuration file.
> 
> For example, by providing the following `altbootcmd` when bootcount is in
> use:
> 
> altbootcmd=setenv boot_extlinx_conf extlinux-rollback.conf; \
> 	run distro_bootcmd
> 
> Signed-off-by: Martyn Welch <martyn.welch@collabora.co.uk>
> Reviewed-by: Heinrich Schuchardt <xypron.glpk@gmx.de>

Applied to u-boot/master, thanks!

Patch

diff --git a/include/config_distro_bootcmd.h b/include/config_distro_bootcmd.h
index 373fee78a9..5838eb3477 100644
--- a/include/config_distro_bootcmd.h
+++ b/include/config_distro_bootcmd.h
@@ -355,15 +355,16 @@ 
 	"boot_script_dhcp=boot.scr.uimg\0" \
 	BOOTENV_BOOT_TARGETS \
 	\
+	"boot_syslinux_conf=extlinux/extlinux.conf\0" \
 	"boot_extlinux="                                                  \
 		"sysboot ${devtype} ${devnum}:${distro_bootpart} any "    \
-			"${scriptaddr} ${prefix}extlinux/extlinux.conf\0" \
+			"${scriptaddr} ${prefix}${boot_syslinux_conf}\0"  \
 	\
 	"scan_dev_for_extlinux="                                          \
 		"if test -e ${devtype} "                                  \
 				"${devnum}:${distro_bootpart} "           \
-				"${prefix}extlinux/extlinux.conf; then "  \
-			"echo Found ${prefix}extlinux/extlinux.conf; "    \
+				"${prefix}${boot_syslinux_conf}; then "   \
+			"echo Found ${prefix}${boot_syslinux_conf}; "     \
 			"run boot_extlinux; "                             \
 			"echo SCRIPT FAILED: continuing...; "             \
 		"fi\0"                                                    \