]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core.git/commitdiff
grub-efi-cfg: Add GRUB_TITLE for custom GRUB titles
authorSimon A. Eugster <simon.eu@gmail.com>
Wed, 15 Jan 2025 08:55:21 +0000 (09:55 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 20 Jan 2025 13:38:56 +0000 (13:38 +0000)
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.

Signed-off-by: Simon A. Eugster <simon.eu@gmail.com>
Signed-off-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes-recipe/grub-efi-cfg.bbclass
meta/recipes-bsp/grub/grub-bootconf_1.00.bb

index 52e85a3bb0eac27c4188e70b0b868ab9850e26c1..9a5cb99c525bfd07b68cb43d334e3fd1ffae24bc 100644 (file)
@@ -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"
index fed3c7e9a3c57a16dafb2eba1e84d055286f62d0..a004e3a3b2f435880ea322160ba2520b424f1087 100644 (file)
@@ -23,7 +23,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}