From 2175e76a51e53798ee4e19903b368a7e6c98356a Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:33 -0600 Subject: bootstd: Read the Operating System name for distro/scripts Add the concept of an OS name to the bootflow. This typically includes the OS name, version and kernel version. Implement this for the distro and script bootmeths so that it works with Armbian and older version of Fedora. Signed-off-by: Simon Glass --- include/bootflow.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'include/bootflow.h') diff --git a/include/bootflow.h b/include/bootflow.h index 32dbbbbe261..776158c65df 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -52,6 +52,8 @@ enum bootflow_state_t { * @buf: Bootflow file contents (allocated) * @size: Size of bootflow file in bytes * @err: Error number received (0 if OK) + * @os_name: Name of the OS / distro being booted, or NULL if not known + * (allocated) */ struct bootflow { struct list_head bm_node; @@ -68,6 +70,7 @@ struct bootflow { char *buf; int size; int err; + char *os_name; }; /** -- cgit v1.2.3 From 24d8e1b37b90760a6c9867f37210aa4b1f2e8f63 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:34 -0600 Subject: bootstd: Allow reading a logo for the OS Some operating systems provide a logo in bmp format. Read this in if present so it can be displayed in the menu. Signed-off-by: Simon Glass --- include/bootflow.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include/bootflow.h') diff --git a/include/bootflow.h b/include/bootflow.h index 776158c65df..8a07ab30191 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -49,6 +49,8 @@ enum bootflow_state_t { * @state: Current state (enum bootflow_state_t) * @subdir: Subdirectory to fetch files from (with trailing /), or NULL if none * @fname: Filename of bootflow file (allocated) + * @logo: Logo to display for this bootflow (BMP format) + * @logo_size: Size of the logo in bytes * @buf: Bootflow file contents (allocated) * @size: Size of bootflow file in bytes * @err: Error number received (0 if OK) @@ -67,6 +69,8 @@ struct bootflow { enum bootflow_state_t state; char *subdir; char *fname; + void *logo; + uint logo_size; char *buf; int size; int err; -- cgit v1.2.3 From 02d929bfb25af22171dbd100f38ffd8fa6bf6238 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:40 -0600 Subject: bootstd: Support creating a boot menu Create an expo to handle the boot menu. For now this is quite simple, with just a header, some menu items and a pointer to show the current one. Signed-off-by: Simon Glass --- include/bootflow.h | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'include/bootflow.h') diff --git a/include/bootflow.h b/include/bootflow.h index 8a07ab30191..e7a09568f1b 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -9,6 +9,9 @@ #include +struct bootstd_priv; +struct expo; + /** * enum bootflow_state_t - states that a particular bootflow can be in * @@ -336,4 +339,24 @@ int bootflow_iter_uses_network(const struct bootflow_iter *iter); */ int bootflow_iter_uses_system(const struct bootflow_iter *iter); +/** + * bootflow_menu_new() - Create a new bootflow menu + * + * @expp: Returns the expo created + * Returns 0 on success, -ve on error + */ +int bootflow_menu_new(struct expo **expp); + +/** + * bootflow_menu_run() - Create and run a menu of available bootflows + * + * @std: Bootstd information + * @text_mode: Uses a text-based menu suitable for a serial port + * @bflowp: Returns chosen bootflow (set to NULL if nothing is chosen) + * @return 0 if an option was chosen, -EAGAIN if nothing was chosen, -ve on + * error + */ +int bootflow_menu_run(struct bootstd_priv *std, bool text_mode, + struct bootflow **bflowp); + #endif -- cgit v1.2.3 From e64c29521c0e6111b446fd67e85c6dd3d491103c Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Fri, 6 Jan 2023 08:52:42 -0600 Subject: bootstd: Support setting a theme for the menu Allow a theme to be set. For now this is very simple, just a default font size to use for all elements. Signed-off-by: Simon Glass --- include/bootflow.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'include/bootflow.h') diff --git a/include/bootflow.h b/include/bootflow.h index e7a09568f1b..c201246c6de 100644 --- a/include/bootflow.h +++ b/include/bootflow.h @@ -7,6 +7,7 @@ #ifndef __bootflow_h #define __bootflow_h +#include #include struct bootstd_priv; @@ -347,6 +348,15 @@ int bootflow_iter_uses_system(const struct bootflow_iter *iter); */ int bootflow_menu_new(struct expo **expp); +/** + * bootflow_menu_apply_theme() - Apply a theme to a bootmenu + * + * @exp: Expo to update + * @node: Node containing the theme information + * Returns 0 on success, -ve on error + */ +int bootflow_menu_apply_theme(struct expo *exp, ofnode node); + /** * bootflow_menu_run() - Create and run a menu of available bootflows * -- cgit v1.2.3