The parser already understands the "title" keyword at the menu level
(via "menu title"). Boot Loader Specification [1] type #2 entry files
use a bare "title" line at the entry level to give the human-readable
name of the entry, the closest extlinux equivalent of which is
"menu label" inside a label body.

Make parse_label_keys() honour "title" the same way it honours
"menu label", populating label->menu. This lets BLS entries surface
their pretty name through the existing label->menu plumbing without
the BLS bootmeth (or any other caller) having to special-case it.

No effect on existing extlinux/pxelinux files: those use "menu label"
inside a label, not bare "title", so this change is purely additive.

[1] https://uapi-group.org/specifications/specs/boot_loader_specification/

Signed-off-by: Alexey Charkov <[email protected]>
---
 boot/pxe_utils.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/boot/pxe_utils.c b/boot/pxe_utils.c
index 7ecee86a9ada..1f3f6150d9b1 100644
--- a/boot/pxe_utils.c
+++ b/boot/pxe_utils.c
@@ -1284,6 +1284,19 @@ int parse_label_keys(char **c, struct pxe_menu *cfg, 
struct pxe_label *label,
                        err = parse_label_menu(c, cfg, label);
                        break;
 
+               case T_TITLE:
+                       /*
+                        * Equivalent to 'menu label' inside a label body.
+                        * Boot Loader Specification entries use a bare
+                        * 'title' line for the human-readable name; honour
+                        * it here so the existing parser handles BLS files
+                        * natively. extlinux/pxelinux files conventionally
+                        * use 'menu label' instead, so this is additive.
+                        */
+                       if (!label->menu)
+                               err = parse_sliteral(c, &label->menu);
+                       break;
+
                case T_KERNEL:
                case T_LINUX:
                        err = parse_label_kernel(c, label);

-- 
2.53.0

Reply via email to