[PATCH] boot: add support for button commands
Svyatoslav Ryhel
clamor95 at gmail.com
Sun Jan 7 19:35:17 CET 2024
пт, 5 січ. 2024 р. о 18:03 Caleb Connolly <caleb.connolly at linaro.org> пише:
>
> 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.
>
> Signed-off-by: Caleb Connolly <caleb.connolly at linaro.org>
> ---
> boot/Kconfig | 14 +++++++
> common/Makefile | 1 +
> common/button_cmd.c | 83 +++++++++++++++++++++++++++++++++++++++
> common/main.c | 3 ++
> doc/usage/environment.rst | 4 ++
> include/button.h | 9 +++++
> 6 files changed, 114 insertions(+)
> create mode 100644 common/button_cmd.c
>
I wonder how I lived without this patch! I hope to see it in the mainline ASAP.
Tested-by: Svyatoslav Ryhel <clamor95 at gmail.com> # Tegra30
More information about the U-Boot
mailing list