From: Jörg Sommer <[email protected]>

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 <[email protected]>
---
 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

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#201607): 
https://lists.openembedded.org/g/openembedded-core/message/201607
Mute This Topic: https://lists.openembedded.org/mt/107053401/21656
Group Owner: [email protected]
Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to