Skip to content

Commit 52f85a5

Browse files
committed
Add tb_menu command
This command allows creating *imperatively* dynamic menus. This is done through building the menus with commands, rather than through hardly dynamic numbered environment variables. This uses PDCurses for *more correct* TUI interfaces. Though the approach could be used without; changing the existing bootmenu to an imperative approach could be done too. Using PDCurses, though, allows for more complex interactions to happen in a more standard way. While curses are named appropriately, from the cursing of developers using it, it had undeniable advantages compared to manually doing the hard work of building text-based interfaces. This first draft is sufficient for the desired goals. This is probably not the final form of the menu.
1 parent 938f7f7 commit 52f85a5

5 files changed

Lines changed: 472 additions & 0 deletions

File tree

cmd/Kconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2849,3 +2849,5 @@ config CMD_MESON
28492849
help
28502850
Enable useful commands for the Meson Soc family developed by Amlogic Inc.
28512851
endmenu
2852+
2853+
source cmd/tow-boot/Kconfig

cmd/Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,3 +281,6 @@ $(obj)/license_data_size.h: $(srctree)/Licenses/gpl-2.0.txt FORCE
281281
$(call filechk,data_size)
282282

283283
CFLAGS_ethsw.o := -Wno-enum-conversion
284+
285+
# Always included, individual commands can be toggled.
286+
obj-y += tow-boot/

cmd/tow-boot/Kconfig

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
menu "Tow-Boot additional commands"
2+
3+
config TOW_BOOT_MENU
4+
bool "Enable Tow-Boot menu commands"
5+
default n
6+
select PDCURSES
7+
select CMD_CLS
8+
help
9+
Add support for curses menu interface.
10+
11+
config TOW_BOOT_MENU_CTRL_C_EXITS
12+
bool "CTRL+C exits the menu"
13+
default n
14+
depends on TOW_BOOT_MENU
15+
16+
endmenu
17+
18+
menu "Tow-Boot menu storage name configuration"
19+
20+
config TOW_BOOT_MMC0_NAME
21+
string "MMC0 user-friendly name"
22+
default "SD" if ARCH_SUNXI
23+
default "SD" if MESON_G12A || MESON_GXL
24+
default "eMMC"
25+
help
26+
Name used in the interface for MMC0
27+
28+
config TOW_BOOT_MMC1_NAME
29+
string "MMC1 user-friendly name"
30+
default "eMMC" if ARCH_SUNXI
31+
default "eMMC" if MESON_G12A || MESON_GXL
32+
default "SD"
33+
help
34+
Name used in the interface for MMC1
35+
36+
config TOW_BOOT_MMC2_NAME
37+
string "MMC2 user-friendly name"
38+
default "(sdio)" if MESON_G12A || MESON_GXL
39+
default "(Unused)"
40+
help
41+
Name used in the interface for MMC2
42+
43+
endmenu

cmd/tow-boot/Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# SPDX-License-Identifier: GPL-2.0+
2+
#
3+
# (C) Copyright 2021 Samuel Dionne-Riel
4+
#
5+
6+
# This file is always included.
7+
8+
subdir-ccflags-y := -I$(srctree)/lib/PDCursesMod/include
9+
subdir-ccflags-y += -I$(srctree)/$(src)/include
10+
11+
obj- += dummy.o
12+
13+
ifndef CONFIG_SPL_BUILD
14+
15+
obj-$(CONFIG_TOW_BOOT_MENU) += tow-boot_menu.o
16+
17+
endif

0 commit comments

Comments
 (0)