[PATCH 00/24] bootstd: Add a boot menu
Simon Glass
sjg at chromium.org
Mon Oct 17 22:29:36 CEST 2022
So far standard boot lacks a boot menu, although it is possible to create
a rudimentary one using the existing 'bootmenu' command.
Even then, this text-based menu offer only basic functionality and does
not take full advantage of the displays which are common on many devices.
This series provides a 'bootflow menu' command which allows the user to
select from the available bootflows. An attempt is made to show the name
of the available operating systems, by reading more information into the
bootflow. A logo can be read also, where supported, so that this can be
presented to the user when an option is highlighted.
Full use is made of TrueType fonts, if enabled. For cases where only a
serial console is available, it falls back to a simple text-based menu.
All of this is implementing using a new 'expo' construct, a collection of
scenes (like menu screens) which can be navigated by the user to view
information and select option. This is fairly general and should be able
to cope with a wider array of use cases, with less hacking of the menu
code, such as is currently needed for CMD_BOOTEFI_BOOTMGR.
Of course it would be possible to enhance the existing menu rather than
creating a new setup. Instead it seems better to make the existing menu
use expo, if code space permits. It avoids the event-loop problem and
should be more extensible, given its loosely coupled components and use of
IDs instead of pointers. Further motivation is provided in the
documentation.
For now the CLI keypress-decoding code is split out to be used by the new
menu. The key codes defined by menu.h are reused also.
This is of course just a starting point. Some ideas for future work are
included in the documentation.
Simon Glass (24):
sandbox: Enable mmc command and legacy images
cli: Move readline character-processing to a state machine
bootmenu: Add a few comments
menu: Rename KEY_... to BKEY_...
menu: Update bootmenu_autoboot_loop() to return the code
menu: Update bootmenu_loop() to return the code
menu: Use a switch statement
menu: Make use of CLI character processing
image: Add a function to find a script in an image
video: Enable VIDEO_ANSI by default only with EFI
video: truetype: Rename the metrics function
video: Fix unchnaged typo
video: Add font functions to the vidconsole API
bootstd: Read the Operating System name for distro/scripts
bootstd: Allow reading a logo for the OS
menu: Factor out menu-keypress decoding
expo: Add basic implementation
expo: Add support for scenes
expo: Add support for scene menus
expo: Add basic tests
bootstd: Support creating a boot menu
bootstd: Add a test for the bootstd menu
bootstd: Support setting a theme for the menu
expo: Add documentation
arch/sandbox/dts/test.dts | 11 +
boot/Kconfig | 12 +
boot/Makefile | 3 +
boot/bootflow.c | 1 +
boot/bootflow_internal.h | 37 ++
boot/bootflow_menu.c | 281 ++++++++++++++
boot/bootmeth-uclass.c | 69 +++-
boot/bootmeth_distro.c | 36 ++
boot/bootmeth_script.c | 38 ++
boot/bootstd-uclass.c | 2 +
boot/expo.c | 133 +++++++
boot/scene.c | 385 +++++++++++++++++++
boot/scene_internal.h | 123 ++++++
boot/scene_menu.c | 372 ++++++++++++++++++
cmd/bootflow.c | 44 ++-
cmd/bootmenu.c | 19 +-
cmd/eficonfig.c | 38 +-
cmd/font.c | 6 +-
cmd/source.c | 173 +++++----
common/Makefile | 6 +-
common/cli_getch.c | 208 ++++++++++
common/cli_readline.c | 150 ++------
common/menu.c | 157 ++++----
configs/sandbox_defconfig | 2 +
configs/sandbox_flattree_defconfig | 2 +
configs/snow_defconfig | 4 +
configs/tools-only_defconfig | 2 +
doc/develop/expo.rst | 184 +++++++++
doc/develop/index.rst | 1 +
drivers/video/Kconfig | 7 +-
drivers/video/console_truetype.c | 35 +-
drivers/video/vidconsole-uclass.c | 33 ++
include/bootflow.h | 40 ++
include/bootmeth.h | 16 +
include/bootstd.h | 4 +
include/cli.h | 74 ++++
include/expo.h | 474 +++++++++++++++++++++++
include/image.h | 13 +
include/menu.h | 77 +++-
include/video.h | 2 +-
include/video_console.h | 63 ++-
test/boot/Makefile | 2 +
test/boot/bootflow.c | 130 +++++++
test/boot/expo.c | 510 +++++++++++++++++++++++++
test/py/tests/bootstd/armbian.bmp.xz | Bin 0 -> 1384 bytes
test/py/tests/bootstd/mmc4.img.xz | Bin 0 -> 7072 bytes
test/py/tests/test_android/test_avb.py | 2 +
test/py/tests/test_ut.py | 216 ++++++++++-
48 files changed, 3813 insertions(+), 384 deletions(-)
create mode 100644 boot/bootflow_internal.h
create mode 100644 boot/bootflow_menu.c
create mode 100644 boot/expo.c
create mode 100644 boot/scene.c
create mode 100644 boot/scene_internal.h
create mode 100644 boot/scene_menu.c
create mode 100644 common/cli_getch.c
create mode 100644 doc/develop/expo.rst
create mode 100644 include/expo.h
create mode 100644 test/boot/expo.c
create mode 100644 test/py/tests/bootstd/armbian.bmp.xz
create mode 100644 test/py/tests/bootstd/mmc4.img.xz
--
2.38.0.413.g74048e4d9e-goog
More information about the U-Boot
mailing list