All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] classes/kernel: Delay module signing until after strip
@ 2024-07-05 13:19 joerg.sommer
  2024-07-05 14:08 ` [OE-core] " Bruce Ashfield
  2024-07-10 20:03 ` Alexandre Belloni
  0 siblings, 2 replies; 5+ messages in thread
From: joerg.sommer @ 2024-07-05 13:19 UTC (permalink / raw)
  To: openembedded-core; +Cc: Jörg Sommer

From: Jörg Sommer <joerg.sommer@navimatix.de>

The current do_package does not strip the kernel modules, if they are
signed. Hence, the files in a release image stay very big and the debug
information are not split into the kernel-dbg package.

The idea of this change is to suppress the signing of the modules on
`modules_install` and run `modules_sign` after the debug information was
striped.

Signed-off-by: Jörg Sommer <joerg.sommer@navimatix.de>
---
 meta/classes-recipe/kernel.bbclass | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)


Another idea would be to move the code to split the debug info in package.bbclass to a
stand-alone tool and inject this in the kernel's modules_install.


diff --git a/meta/classes-recipe/kernel.bbclass b/meta/classes-recipe/kernel.bbclass
index 89badd90f1..96e40be085 100644
--- a/meta/classes-recipe/kernel.bbclass
+++ b/meta/classes-recipe/kernel.bbclass
@@ -461,7 +461,8 @@ kernel_do_install() {
 	#
 	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
 	if (grep -q -i -e '^CONFIG_MODULES=y$' .config); then
-		oe_runmake DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
+		# don't sign now, it's down after extraction of debug information
+		oe_runmake CONFIG_MODULE_SIG_ALL=n DEPMOD=echo MODLIB=${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${D}${nonarch_base_libdir}/firmware modules_install
 		rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/build"
 		rm -f "${D}${nonarch_base_libdir}/modules/${KERNEL_VERSION}/source"
 		# Remove empty module directories to prevent QA issues
@@ -497,6 +498,16 @@ kernel_do_install() {
 	! [ -e Module.symvers ] || install -m 0644 Module.symvers ${D}/${KERNEL_IMAGEDEST}/Module.symvers-${KERNEL_VERSION}
 }
 
+sign_kernel_modules() {
+	unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS MACHINE
+	if (grep -q -i -e '^CONFIG_MODULES=y$' ${B}/.config); then
+		# modinst_pre= prevents the cleaning of the target before signing
+		oe_runmake -C ${B} modinst_pre= DEPMOD=echo MODLIB=${PKGD}${nonarch_base_libdir}/modules/${KERNEL_VERSION} INSTALL_FW_PATH=${PKGD}${nonarch_base_libdir}/firmware modules_sign
+	fi
+}
+
+PACKAGEBUILDPKGD += "sign_kernel_modules"
+
 # Must be ran no earlier than after do_kernel_checkout or else Makefile won't be in ${S}/Makefile
 do_kernel_version_sanity_check() {
 	if [ "x${KERNEL_VERSION_SANITY_SKIP}" = "x1" ]; then
-- 
2.34.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-07-10 20:03 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-05 13:19 [PATCH] classes/kernel: Delay module signing until after strip joerg.sommer
2024-07-05 14:08 ` [OE-core] " Bruce Ashfield
2024-07-05 18:34   ` Jörg Sommer
2024-07-05 19:00     ` Bruce Ashfield
2024-07-10 20:03 ` Alexandre Belloni

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.