Skip to content

Commit

Permalink
Merge branch '2022-01-16-bootstd-updates'
Browse files Browse the repository at this point in the history
To quote the author:
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 options. 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.
  • Loading branch information
trini committed Jan 17, 2023
2 parents 6d03688 + b5c8fea commit 5b958de
Show file tree
Hide file tree
Showing 54 changed files with 4,105 additions and 503 deletions.
2 changes: 1 addition & 1 deletion arch/arm/mach-stm32mp/cmd_stm32prog/cmd_stm32prog.c
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ static int do_stm32prog(struct cmd_tbl *cmdtp, int flag, int argc,
do_bootz(cmdtp, 0, 4, bootm_argv);
}
if (data->script)
image_source_script(data->script, NULL, NULL);
cmd_source_script(data->script, NULL, NULL);

if (reset) {
puts("Reset...\n");
Expand Down
11 changes: 11 additions & 0 deletions arch/sandbox/dts/test.dts
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@
compatible = "u-boot,distro-efi";
};

theme {
font-size = <30>;
};

/*
* This is used for the VBE OS-request tests. A FAT filesystem
* created in a partition with the VBE information appearing
Expand Down Expand Up @@ -1013,6 +1017,13 @@
non-removable;
};

/* This is used for bootstd bootmenu tests */
mmc4 {
status = "disabled";
compatible = "sandbox,mmc";
filename = "mmc4.img";
};

pch {
compatible = "sandbox,pch";
};
Expand Down
12 changes: 12 additions & 0 deletions boot/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,18 @@ config VPL_BOOTMETH_VBE_SIMPLE_FW

endif # BOOTMETH_VBE

config EXPO
bool "Support for expos - groups of scenes displaying a UI"
default y if BOOTMETH_VBE
help
An expo is a way of presenting and collecting information from the
user. It consists of a collection of 'scenes' of which only one is
presented at a time. An expo is typically used to show a boot menu
and allow settings to be changed.

The expo can be presented in graphics form using a vidconsole, or in
text form on a serial console.

config BOOTMETH_SANDBOX
def_bool y
depends on SANDBOX
Expand Down
3 changes: 3 additions & 0 deletions boot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SANDBOX) += bootmeth_sandbox.o
obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_SCRIPT) += bootmeth_script.o
ifdef CONFIG_$(SPL_TPL_)BOOTSTD_FULL
obj-$(CONFIG_$(SPL_TPL_)CMD_BOOTEFI_BOOTMGR) += bootmeth_efi_mgr.o
obj-$(CONFIG_$(SPL_TPL_)BOOTSTD) += bootflow_menu.o
endif

obj-$(CONFIG_$(SPL_TPL_)OF_LIBFDT) += image-fdt.o
Expand All @@ -47,6 +48,8 @@ ifdef CONFIG_SPL_BUILD
obj-$(CONFIG_SPL_LOAD_FIT) += common_fit.o
endif

obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += expo.o scene.o scene_menu.o

obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE) += vbe.o vbe_request.o
obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE) += vbe_simple.o
obj-$(CONFIG_$(SPL_TPL_)BOOTMETH_VBE_SIMPLE_FW) += vbe_simple_fw.o
Expand Down
1 change: 1 addition & 0 deletions boot/bootflow.c
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,7 @@ void bootflow_free(struct bootflow *bflow)
free(bflow->subdir);
free(bflow->fname);
free(bflow->buf);
free(bflow->os_name);
}

void bootflow_remove(struct bootflow *bflow)
Expand Down
47 changes: 47 additions & 0 deletions boot/bootflow_internal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/* SPDX-License-Identifier: GPL-2.0+ */
/*
* Internal header file for bootflow
*
* Copyright 2022 Google LLC
* Written by Simon Glass <[email protected]>
*/

#ifndef __BOOTFLOW_INTERNAL_H
#define __BOOTFLOW_INTERNAL_H

/* expo IDs for elements of the bootflow menu */
enum {
START,

/* strings */
STR_PROMPT,
STR_MENU_TITLE,
STR_POINTER,

/* scene */
MAIN,

/* objects */
OBJ_U_BOOT_LOGO,
OBJ_MENU,
OBJ_PROMPT,
OBJ_MENU_TITLE,
OBJ_POINTER,

/* strings for menu items */
STR_LABEL = 100,
STR_DESC = 200,
STR_KEY = 300,

/* menu items / components (bootflow number is added to these) */
ITEM = 400,
ITEM_LABEL = 500,
ITEM_DESC = 600,
ITEM_KEY = 700,
ITEM_PREVIEW = 800,

/* left margin for the main menu */
MARGIN_LEFT = 100,
};

#endif /* __BOOTFLOW_INTERNAL_H */
Loading

0 comments on commit 5b958de

Please sign in to comment.