* [PATCH] grub-efi-cfg: add GRUB_TITLE for custom GRUB titles
@ 2025-01-14 16:11 Simon A. Eugster
0 siblings, 0 replies; 2+ messages in thread
From: Simon A. Eugster @ 2025-01-14 16:11 UTC (permalink / raw)
To: poky; +Cc: Simon A. Eugster
Until now, the default title of a boot entry is its label. The label is
a variable which determines the script to run during an early boot stage
and is not necessarily human readable.
This patch allows to provide a human-readable title for each boot entry.
---
documentation/ref-manual/classes.rst | 17 ++++++++++++++++-
meta/classes-recipe/grub-efi-cfg.bbclass | 8 +++++++-
meta/recipes-bsp/grub/grub-bootconf_1.00.bb | 2 +-
3 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/documentation/ref-manual/classes.rst b/documentation/ref-manual/classes.rst
index 761be7b545..460f94b232 100644
--- a/documentation/ref-manual/classes.rst
+++ b/documentation/ref-manual/classes.rst
@@ -987,10 +987,14 @@ introspection. This functionality is only enabled if the
The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specific functions for
building bootable images.
-This class supports several variables:
+This class supports several variables.
+The label specific override names are ``grub_LABEL``.
+To specificy an override for the label ``mylabel``, the override name is ``grub_mylabel``,
+for example ``APPEND:grub_mylabel = my-appends``.
- :term:`INITRD`: Indicates list of filesystem images to
concatenate and use as an initial RAM disk (initrd) (optional).
+ Can be specified for each ``LABEL``.
- :term:`ROOTFS`: Indicates a filesystem image to include
as the root filesystem (optional).
@@ -1004,6 +1008,9 @@ This class supports several variables:
- :term:`APPEND`: An override list of append strings for
each ``LABEL``.
+- :term:`GRUB_TITLE`: A custom title for each ```LABEL``.
+ Defaults to ``LABEL`` if it is not defined.
+
- :term:`GRUB_OPTS`: Additional options to add to the
configuration (optional). Options are delimited using semi-colon
characters (``;``).
@@ -1011,6 +1018,14 @@ This class supports several variables:
- :term:`GRUB_TIMEOUT`: Timeout before executing
the default ``LABEL`` (optional).
+For the label ``factory``, a custom GRUB menu entry titled "Factory Install" with the additional parameter ``factory=yes``
+can be achieved as follows::
+
+ LABELS:append = "factory"
+ APPEND:grub_factory = "factory=yes"
+ GRUB_TITLE:grub_factory = "Factory Install"
+
+
.. _ref-classes-gsettings:
``gsettings``
diff --git a/meta/classes-recipe/grub-efi-cfg.bbclass b/meta/classes-recipe/grub-efi-cfg.bbclass
index 52e85a3bb0..9a5cb99c52 100644
--- a/meta/classes-recipe/grub-efi-cfg.bbclass
+++ b/meta/classes-recipe/grub-efi-cfg.bbclass
@@ -23,6 +23,7 @@ GRUB_TIMEOUT ?= "10"
GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
GRUB_ROOT ?= "${ROOT}"
+GRUB_TITLE ?= ""
APPEND ?= ""
# Uses MACHINE specific KERNEL_IMAGETYPE
@@ -91,10 +92,15 @@ python build_efi_cfg() {
if not overrides:
bb.fatal('OVERRIDES not defined')
+ localdata.need_overrides()
localdata.setVar('OVERRIDES', 'grub_' + label + ':' + overrides)
for btype in btypes:
- cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0]))
+ title = localdata.getVar('GRUB_TITLE')
+ if not title or len(title) == 0:
+ title = label
+
+ cfgfile.write('\nmenuentry \'%s%s\'{\n' % (title, btype[0]))
lb = label
if label == "install":
lb = "install-efi"
diff --git a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
index 783e30bf38..7ed0877726 100644
--- a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
+++ b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
@@ -22,7 +22,7 @@ python do_configure() {
bb.build.exec_func('build_efi_cfg', d)
}
-do_configure[vardeps] += "APPEND ROOT"
+do_configure[vardeps] += "APPEND ROOT GRUB_TITLE"
do_install() {
install -d ${D}${EFI_FILES_PATH}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [PATCH] grub-efi-cfg: Add GRUB_TITLE for custom GRUB titles
@ 2025-01-15 8:06 Simon A. Eugster
0 siblings, 0 replies; 2+ messages in thread
From: Simon A. Eugster @ 2025-01-15 8:06 UTC (permalink / raw)
To: poky; +Cc: Simon A. Eugster
Until now, the default title of a boot entry is its label. The label is
a variable which determines the script to run during an early boot stage
and is not necessarily human readable.
This patch allows to provide a human-readable title for each boot entry.
---
meta/classes-recipe/grub-efi-cfg.bbclass | 8 +++++++-
meta/recipes-bsp/grub/grub-bootconf_1.00.bb | 2 +-
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/meta/classes-recipe/grub-efi-cfg.bbclass b/meta/classes-recipe/grub-efi-cfg.bbclass
index 52e85a3bb0..9a5cb99c52 100644
--- a/meta/classes-recipe/grub-efi-cfg.bbclass
+++ b/meta/classes-recipe/grub-efi-cfg.bbclass
@@ -23,6 +23,7 @@ GRUB_TIMEOUT ?= "10"
GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no --stop=1"
GRUB_ROOT ?= "${ROOT}"
+GRUB_TITLE ?= ""
APPEND ?= ""
# Uses MACHINE specific KERNEL_IMAGETYPE
@@ -91,10 +92,15 @@ python build_efi_cfg() {
if not overrides:
bb.fatal('OVERRIDES not defined')
+ localdata.need_overrides()
localdata.setVar('OVERRIDES', 'grub_' + label + ':' + overrides)
for btype in btypes:
- cfgfile.write('\nmenuentry \'%s%s\'{\n' % (label, btype[0]))
+ title = localdata.getVar('GRUB_TITLE')
+ if not title or len(title) == 0:
+ title = label
+
+ cfgfile.write('\nmenuentry \'%s%s\'{\n' % (title, btype[0]))
lb = label
if label == "install":
lb = "install-efi"
diff --git a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
index 783e30bf38..7ed0877726 100644
--- a/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
+++ b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
@@ -22,7 +22,7 @@ python do_configure() {
bb.build.exec_func('build_efi_cfg', d)
}
-do_configure[vardeps] += "APPEND ROOT"
+do_configure[vardeps] += "APPEND ROOT GRUB_TITLE"
do_install() {
install -d ${D}${EFI_FILES_PATH}
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-01-15 8:06 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-15 8:06 [PATCH] grub-efi-cfg: Add GRUB_TITLE for custom GRUB titles Simon A. Eugster
-- strict thread matches above, loose matches on Subject: below --
2025-01-14 16:11 [PATCH] grub-efi-cfg: add " Simon A. Eugster
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox