summaryrefslogtreecommitdiff
path: root/boot
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2023-01-06 08:52:42 -0600
committerTom Rini <trini@konsulko.com>2023-01-16 18:26:51 -0500
commite64c29521c0e6111b446fd67e85c6dd3d491103c (patch)
treea50e37bd6cb9fde926a7fcbbb4e32d2effb53bc4 /boot
parentd985f1dbddb241c21a9150abf59dd386ba1ffe05 (diff)
downloadu-boot-e64c29521c0e6111b446fd67e85c6dd3d491103c.tar.gz
u-boot-e64c29521c0e6111b446fd67e85c6dd3d491103c.tar.bz2
u-boot-e64c29521c0e6111b446fd67e85c6dd3d491103c.zip
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 <sjg@chromium.org>
Diffstat (limited to 'boot')
-rw-r--r--boot/bootflow_menu.c43
-rw-r--r--boot/bootstd-uclass.c2
2 files changed, 45 insertions, 0 deletions
diff --git a/boot/bootflow_menu.c b/boot/bootflow_menu.c
index 1105783afe..7f06dac0af 100644
--- a/boot/bootflow_menu.c
+++ b/boot/bootflow_menu.c
@@ -129,6 +129,43 @@ int bootflow_menu_new(struct expo **expp)
return 0;
}
+int bootflow_menu_apply_theme(struct expo *exp, ofnode node)
+{
+ struct menu_priv *priv = exp->priv;
+ struct scene *scn;
+ u32 font_size;
+ int ret;
+
+ log_debug("Applying theme %s\n", ofnode_get_name(node));
+ scn = expo_lookup_scene_id(exp, MAIN);
+ if (!scn)
+ return log_msg_ret("scn", -ENOENT);
+
+ /* Avoid error-checking optional items */
+ if (!ofnode_read_u32(node, "font-size", &font_size)) {
+ int i;
+
+ log_debug("font size %d\n", font_size);
+ scene_txt_set_font(scn, OBJ_PROMPT, NULL, font_size);
+ scene_txt_set_font(scn, OBJ_POINTER, NULL, font_size);
+ for (i = 0; i < priv->num_bootflows; i++) {
+ ret = scene_txt_set_font(scn, ITEM_DESC + i, NULL,
+ font_size);
+ if (ret)
+ return log_msg_ret("des", ret);
+ scene_txt_set_font(scn, ITEM_KEY + i, NULL, font_size);
+ scene_txt_set_font(scn, ITEM_LABEL + i, NULL,
+ font_size);
+ }
+ }
+
+ ret = scene_arrange(scn);
+ if (ret)
+ return log_msg_ret("arr", ret);
+
+ return 0;
+}
+
int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
struct bootflow **bflowp)
{
@@ -149,6 +186,12 @@ int bootflow_menu_run(struct bootstd_priv *std, bool text_mode,
if (ret)
return log_msg_ret("exp", ret);
+ if (ofnode_valid(std->theme)) {
+ ret = bootflow_menu_apply_theme(exp, std->theme);
+ if (ret)
+ return log_msg_ret("thm", ret);
+ }
+
/* For now we only support a video console */
ret = uclass_first_device_err(UCLASS_VIDEO, &dev);
if (ret)
diff --git a/boot/bootstd-uclass.c b/boot/bootstd-uclass.c
index 565c22a36e..7887acdc11 100644
--- a/boot/bootstd-uclass.c
+++ b/boot/bootstd-uclass.c
@@ -33,6 +33,8 @@ static int bootstd_of_to_plat(struct udevice *dev)
&priv->prefixes);
dev_read_string_list(dev, "bootdev-order",
&priv->bootdev_order);
+
+ priv->theme = ofnode_find_subnode(dev_ofnode(dev), "theme");
}
return 0;