Skip to contentSkip to conversation

kernel-grub.bbclass: use KERNEL_PACKAGE_NAME for the image packages

PATCH In review Prasanth R 4 participants 5 messages Oct 29 – Nov 12

lore
Share & tools
lore

Prasanth R

author
#0 lore raw

PATCH 1/1 kernel-grub.bbclass: use KERNEL_PACKAGE_NAME for the image packages

kernel-grub adds its scriptlets to kernel-image-<type>, but kernel.bbclass names these packages ${KERNEL_PACKAGE_NAME}-image-<type>. With another KERNEL_PACKAGE_NAME the scriptlets go to a package that does not exist, so they never run and the GRUB menu is not updated on a kernel upgrade.

Use KERNEL_PACKAGE_NAME, as kernel.bbclass and linux-dummy.bbclass do.

AI-Generated: Uses Claude

---

Notes:
Checked with bitbake -e: with KERNEL_PACKAGE_NAME set, the GRUB scriptlets were set on kernel-image-<type>, which is not in PACKAGES. With this patch they are on <KERNEL_PACKAGE_NAME>-image-<type>; the default is unchanged.

 meta/classes-recipe/kernel-grub.bbclass | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
meta/classes-recipe/kernel-grub.bbclass +3 -2
index 2325e635e1..7c6abc5b4f 100644
@@ -98,6 +98,7 @@ python __anonymous () {
 	fi
 '''
 
+    kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"
     imagetypes = d.getVar('KERNEL_IMAGETYPES')
     imagetypes = re.sub(r'\.gz$', '', imagetypes)
 
@@ -105,7 +106,7 @@ python __anonymous () {
         typelower = type.lower()
         preinst_append = preinst.replace('KERNEL_IMAGETYPE', type)
         postinst_prepend = postinst.replace('KERNEL_IMAGETYPE', type)
-        d.setVar('pkg_preinst:kernel-image-' + typelower + ':append', preinst_append)
-        d.setVar('pkg_postinst:kernel-image-' + typelower + ':prepend', postinst_prepend)
+        d.setVar('pkg_preinst:%s-image-%s:append' % (kname, typelower), preinst_append)
+        d.setVar('pkg_postinst:%s-image-%s:prepend' % (kname, typelower), postinst_prepend)
 }
 
Signature · 1 line
2.34.1
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Prasanth R

kernel-grub adds its scriptlets to kernel-image-<type>, but kernel.bbclass names these packages ${KERNEL_PACKAGE_NAME}-image-<type>. With another KERNEL_PACKAGE_NAME the scriptlets go to a package that does not exist, so they never run and the GRUB menu is not updated on a kernel upgrade.

Use KERNEL_PACKAGE_NAME, as kernel.bbclass and linux-dummy.bbclass do.

[...]

Quoted 2 lines

+ kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"

Minor: the 'or "kernel"' isn't needed, since kernel.bbclass already defaults KERNEL_PACKAGE_NAME with ??=. It's harmless though, so I'm fine with it as-is.

Bruce

#2 lore raw

Hi Mathieu,

I see the kernel.bbclass v2 and kernel-grub patches are both marked “Changes Requested” in patchwork.
Bruce acked both. Are there any issues to look into?

Thanks,
Prasanth R

Quoted 22 lines · Bruce Ashfield
Quoted 2 lines · Prasanth R

kernel-grub adds its scriptlets to kernel-image-<type>, but

kernel.bbclass

Quoted 6 lines

names these packages ${KERNEL_PACKAGE_NAME}-image-<type>. With another KERNEL_PACKAGE_NAME the scriptlets go to a package that does not exist, so they never run and the GRUB menu is not updated on a kernel upgrade.

Use KERNEL_PACKAGE_NAME, as kernel.bbclass and linux-dummy.bbclass do.

[...]

Quoted 2 lines

+ kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"

Minor: the 'or "kernel"' isn't needed, since kernel.bbclass already defaults KERNEL_PACKAGE_NAME with ??=. It's harmless though, so I'm fine with it as-is.

Bruce

#3 lore raw
Quoted 9 lines · Prasanth Ramesh

Hi Mathieu,

I see the kernel.bbclass v2 and kernel-grub patches are both marked “Changes Requested” in patchwork.
Bruce acked both. Are there any issues to look into?

Thanks,
Prasanth R

Hi Prasanth,

This commit raised some discussion during Monday review session. You should be getting some feedback soon.

Thanks,
Mathieu

Signature · 3 lines
Mathieu Dubois-Briand, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw
In reply to Prasanth R
Quoted 24 lines · prasanth via lists.openembedded.org

kernel-grub adds its scriptlets to kernel-image-<type>, but kernel.bbclass names these packages ${KERNEL_PACKAGE_NAME}-image-<type>. With another KERNEL_PACKAGE_NAME the scriptlets go to a package that does not exist, so they never run and the GRUB menu is not updated on a kernel upgrade.

Use KERNEL_PACKAGE_NAME, as kernel.bbclass and linux-dummy.bbclass do.

AI-Generated: Uses Claude

---

Notes:
    Checked with bitbake -e: with KERNEL_PACKAGE_NAME set, the GRUB scriptlets were set on kernel-image-<type>, which is not in PACKAGES. With this patch they are on <KERNEL_PACKAGE_NAME>-image-<type>; the default is unchanged.

 meta/classes-recipe/kernel-grub.bbclass | 5 +++--

 1 file changed, 3 insertions(+), 2 deletions(-)
meta/classes-recipe/kernel-grub.bbclass +0 -0
index 2325e635e1..7c6abc5b4f 100644
@@ -98,6 +98,7 @@ python __anonymous () {
Quoted 4 lines

  fi
 '''

+    kname = d.getVar('KERNEL_PACKAGE_NAME') or "kernel"

I'm afraid I'm not happy with that fallback default. If something does change in the code paths later, I really want this to break, not have inconsistent values. I'd therefore like to see a revised version of this please.

Thanks,

Richard