grub-efi-cfg: add GRUB_TITLE for custom GRUB titles
PATCH 1/1 grub-efi-cfg: add GRUB_TITLE for custom GRUB titles
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(-)
documentation/ref-manual/classes.rst +16 -1
@@ -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``
meta/classes-recipe/grub-efi-cfg.bbclass +7 -1
@@ -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"
meta/recipes-bsp/grub/grub-bootconf_1.00.bb +1 -1
@@ -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}
Signature · 1 line
2.43.0
Thanks - these pieces should be split and sent to different mailing lists. meta/* to openembedded-core@, documentation/* to docs@
Alex
Quoted 111 lines · Simon A. Eugster via lists.yoctoproject.org
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(-)documentation/ref-manual/classes.rst +16
-1@@ -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``meta/classes-recipe/grub-efi-cfg.bbclass +7
-1@@ -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"meta/recipes-bsp/grub/grub-bootconf_1.00.bb +1
-2@@ -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
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#13506): https://lists.yoctoproject.org/g/poky/message/13506
Mute This Topic: https://lists.yoctoproject.org/mt/110610053/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-
Hi Alex, thanks for the hint. In a few years I will probably understand what to send to which of all those mailing lists. I'm more familiar with modern workflows as on GitLab and similar.
I sent the separate patches to oe-core and docs.
Simon
Quoted 131 lines · Alexander Kanavin
Thanks - these pieces should be split and sent to different mailing lists. meta/* to openembedded-core@, documentation/* to docs@
Alex
Quoted 5 lines · Simon A. Eugster via lists.yoctoproject.org
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.
Review
Quoted 8 lines
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(-)(quoted diff) +0
-0
b/documentation/ref-manual/classes.rstdocumentation/ref-manual/classes.rst introspection. This functionality is only enabled
Quoted 4 lines
index
761be7b545..460f94b232100644documentation/ref-manual/classes.rst +0
-0@@ -987,10 +987,14 @@ introspection. This functionality is only enabledif the
documentation/ref-manual/classes.rst introspection. This functionality is only enabled · line 987
Quoted 1 line
documentation/ref-manual/classes.rst +0
-0The :ref:`ref-classes-grub-efi` class provides ``grub-efi``-specificfunctions for
documentation/ref-manual/classes.rst introspection. This functionality is only enabled if the
Quoted 6 lines
documentation/ref-manual/classes.rst +3
-1building 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 nameis ``grub_mylabel``,
Quoted 19 lines
documentation/ref-manual/classes.rst +5
-0+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 (``;``).documentation/ref-manual/classes.rst This class supports several variables: · line 1021
Quoted 4 lines
documentation/ref-manual/classes.rst +1
-0@@ -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 "FactoryInstall" with the additional parameter ``factory=yes``
Review
Quoted 11 lines
documentation/ref-manual/classes.rst +7
-0+can be achieved as follows:: + + LABELS:append = "factory" + APPEND:grub_factory = "factory=yes" + GRUB_TITLE:grub_factory = "Factory Install" + + .. _ref-classes-gsettings: ``gsettings``(quoted diff) +0
-0b/meta/classes-recipe/grub-efi-cfg.bbclass
meta/classes-recipe/grub-efi-cfg.bbclass GRUB_TIMEOUT ?= "10" · line 23
Quoted 5 lines
index
52e85a3bb0..9a5cb99c52100644meta/classes-recipe/grub-efi-cfg.bbclass +0
-0@@ -23,6 +23,7 @@ GRUB_TIMEOUT ?= "10" GRUB_OPTS ?= "serial --unit=0 --speed=115200 --word=8 --parity=no--stop=1"
Review
Quoted 24 lines
meta/classes-recipe/grub-efi-cfg.bbclass +7
-1GRUB_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"(quoted diff) +0
-0b/meta/recipes-bsp/grub/grub-bootconf_1.00.bb
Quoted 16 lines
index
783e30bf38..7ed0877726100644meta/recipes-bsp/grub/grub-bootconf_1.00.bb +1
-2@@ -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
Quoted 3 lines
-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group. View/Reply Online (#13506):https://lists.yoctoproject.org/g/poky/message/13506
Quoted 3 lines
Mute This Topic: https://lists.yoctoproject.org/mt/110610053/1686489
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [Quoted 2 lines
-=-=-=-=-=-=-=-=-=-=-=-
Quoted 1 line · Simon Eugster
Hi Alex, thanks for the hint. In a few years I will probably understand what to send to which of all those mailing lists. I'm more familiar with modern workflows as on GitLab and similar.
You can understand it much sooner by reading poky/README.md (it's a symlink to):
https://git.yoctoproject.org/poky/tree/meta-poky/README.poky.md
Alex