summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorCaleb Connolly <[email protected]>2024-01-09 11:51:09 +0000
committerTom Rini <[email protected]>2024-02-13 15:38:49 -0500
commite761035b64235db8930eb15d2703dc3f43e99224 (patch)
tree55a006d2199d296ed551840a84eaeab7ab64158f /boot
parent348ea878508de90fdcc5a051cabe05d190e40e35 (diff)
boot: add support for button commands
With the relatively new button API in U-Boot, it's now much easier to model the common usecase of mapping arbitrary actions to different buttons during boot - for example entering fastboot mode, setting some additional kernel cmdline arguments, or booting with a custom recovery ramdisk, to name a few. Historically, this functionality has been implemented in board code, making it fixed for a given U-Boot binary and requiring the code be duplicated and modified for every board. Implement a generic abstraction to run an arbitrary command during boot when a specific button is pressed. The button -> command mapping is configured via environment variables with the following format: button_cmd_N_name=<button label> button_cmd_N=<command to run> Where N is the mapping number starting from 0. For example: button_cmd_0_name=vol_down button_cmd_0=fastboot usb 0 This will cause the device to enter fastboot mode if volume down is held during boot. After we enter the cli loop the button commands are no longer valid, this allows the buttons to additionally be used for navigating a boot menu. Tested-by: Svyatoslav Ryhel <[email protected]> # Tegra30 Signed-off-by: Caleb Connolly <[email protected]>
Diffstat (limited to 'boot')
-rw-r--r--boot/Kconfig15
1 files changed, 15 insertions, 0 deletions
diff --git a/boot/Kconfig b/boot/Kconfig
index 71ee41645f3..3d7aabd27d6 100644
--- a/boot/Kconfig
+++ b/boot/Kconfig
@@ -20,6 +20,21 @@ config TIMESTAMP
loaded that does not, the message 'Wrong FIT format: no timestamp'
is shown.
+config BUTTON_CMD
+ bool "Support for running a command if a button is held during boot"
+ depends on CMDLINE
+ depends on BUTTON
+ help
+ For many embedded devices it's useful to enter a special flashing mode
+ such as fastboot mode when a button is held during boot. This option
+ allows arbitrary commands to be assigned to specific buttons. These will
+ be run after "preboot" if the button is held. Configuration is done via
+ the environment variables "button_cmd_N_name" and "button_cmd_N" where n is
+ the button number (starting from 0). e.g:
+
+ "button_cmd_0_name=vol_down"
+ "button_cmd_0=fastboot usb 0"
+
menuconfig FIT
bool "Flattened Image Tree (FIT)"
select HASH