diff mbox

[U-Boot,v2,3/3] sunxi: add "fel" boot target

Message ID 1442236530-24382-4-git-send-email-bernhard.nortmann@web.de
State Accepted
Delegated to: Hans de Goede
Headers show

Commit Message

Bernhard Nortmann Sept. 14, 2015, 1:15 p.m. UTC
This patch makes use of the previous changes to add a new "fel" boot
target for sunxi boards.

When booting via FEL, it's often desirable to work around the absence
of other (usable) boot devices - or to be able to override them,
deviating from the standard boot sequence. To achieve this, the "fel"
boot target gets the highest priority, but won't actually do anything
unless certain criteria are met.

The "bootcmd_fel" implementation proposed here first tests if an actual
FEL boot takes place (using the "fel_booted" env var), and secondly
checks that "fel_scriptaddr" was set (originating from the 'loader',
i.e. the sunxi-tools fel utility). If both checks pass, then it will
try to execute the boot script (boot.scr) at the given address. In case
of an error (e.g. an invalid image), the source command might return
"false", causing "distro_bootcmd" to proceed with the next boot target.

Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>

---

Changes in v2:
- renamed fel_data_addr to fel_scriptaddr
- combined both tests into one as suggested by Hans de Goede

 include/configs/sunxi-common.h | 11 +++++++++++
 1 file changed, 11 insertions(+)

Comments

Siarhei Siamashka Sept. 16, 2015, 1:04 a.m. UTC | #1
On Mon, 14 Sep 2015 15:15:30 +0200
Bernhard Nortmann <bernhard.nortmann@web.de> wrote:

> This patch makes use of the previous changes to add a new "fel" boot
> target for sunxi boards.
> 
> When booting via FEL, it's often desirable to work around the absence
> of other (usable) boot devices - or to be able to override them,
> deviating from the standard boot sequence. To achieve this, the "fel"
> boot target gets the highest priority, but won't actually do anything
> unless certain criteria are met.
> 
> The "bootcmd_fel" implementation proposed here first tests if an actual
> FEL boot takes place (using the "fel_booted" env var), and secondly
> checks that "fel_scriptaddr" was set (originating from the 'loader',
> i.e. the sunxi-tools fel utility). If both checks pass, then it will
> try to execute the boot script (boot.scr) at the given address. In case
> of an error (e.g. an invalid image), the source command might return
> "false", causing "distro_bootcmd" to proceed with the next boot target.
> 
> Signed-off-by: Bernhard Nortmann <bernhard.nortmann@web.de>
> 
> ---
> 
> Changes in v2:
> - renamed fel_data_addr to fel_scriptaddr
> - combined both tests into one as suggested by Hans de Goede
> 
>  include/configs/sunxi-common.h | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
> index 48cc4ed..889146b 100644
> --- a/include/configs/sunxi-common.h
> +++ b/include/configs/sunxi-common.h
> @@ -423,7 +423,18 @@ extern int soft_i2c_gpio_scl;
>  #define BOOT_TARGET_DEVICES_USB(func)
>  #endif
>  
> +/* FEL boot support, auto-execute boot.scr if a script address was provided */
> +#define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
> +	"bootcmd_fel=" \
> +		"if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then " \
> +			"echo '(FEL boot)'; " \
> +			"source ${fel_scriptaddr}; " \
> +		"fi\0"
> +#define BOOTENV_DEV_NAME_FEL(devtypeu, devtypel, instance) \
> +	"fel "
> +
>  #define BOOT_TARGET_DEVICES(func) \
> +	func(FEL, fel, na) \
>  	BOOT_TARGET_DEVICES_MMC(func) \
>  	BOOT_TARGET_DEVICES_SCSI(func) \
>  	BOOT_TARGET_DEVICES_USB(func) \

Acked-by: Siarhei Siamashka <siarhei.siamashka@gmail.com>
diff mbox

Patch

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 48cc4ed..889146b 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -423,7 +423,18 @@  extern int soft_i2c_gpio_scl;
 #define BOOT_TARGET_DEVICES_USB(func)
 #endif
 
+/* FEL boot support, auto-execute boot.scr if a script address was provided */
+#define BOOTENV_DEV_FEL(devtypeu, devtypel, instance) \
+	"bootcmd_fel=" \
+		"if test -n ${fel_booted} && test -n ${fel_scriptaddr}; then " \
+			"echo '(FEL boot)'; " \
+			"source ${fel_scriptaddr}; " \
+		"fi\0"
+#define BOOTENV_DEV_NAME_FEL(devtypeu, devtypel, instance) \
+	"fel "
+
 #define BOOT_TARGET_DEVICES(func) \
+	func(FEL, fel, na) \
 	BOOT_TARGET_DEVICES_MMC(func) \
 	BOOT_TARGET_DEVICES_SCSI(func) \
 	BOOT_TARGET_DEVICES_USB(func) \