From: Anis Bougrine <anis.bougrine10@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: antonin.godard@bootlin.com, bruce.ashfield@gmail.com,
jose.quaresma@oss.qualcomm.com,
richard.purdie@linuxfoundation.org,
Anis Bougrine <anis.bougrine10@gmail.com>,
Ross Burton <ross.burton@arm.com>
Subject: [OE-core][PATCH v4 1/4] kernel.bbclass: re-sign kernel modules after package stripping process
Date: Sat, 22 Aug 2026 02:25:58 +0200 [thread overview]
Message-ID: <20260822002601.90667-2-anis.bougrine10@gmail.com> (raw)
In-Reply-To: <20260822002601.90667-1-anis.bougrine10@gmail.com>
Fixes [YOCTO #12927]
Currently, signed kernel modules are not stripped in order to preserve
their valid signatures. See commit 4c47e5f.
Therefore, this commit makes kernel modules stripped and correctly
signed. Two options are possible:
- Strip the kernel modules after installation and before signing.
- Re-sign the kernel modules after stripping and before package splitting.
The first option was rejected because debug symbols would be dropped early
in the build workflow, which may impact the SPDX process.
The second option is adopted because it does not impact the build flow.
Reported-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Anis Bougrine <anis.bougrine10@gmail.com>
---
changes in v4:
- Re-sign kernel modules after package stripping process
- Remove package-stripping skip in package.py
- Add MOD_INSTALL_PREFIX variable
changes in v3:
- Fixing rebase issue.
changes in v2:
- Use the conditional INSTALL_MOD_STRIP environment variable to avoid
duplicating the oe_runmake call.
- Use `scripts/config` script instead of grepping .config file.
---
.../kernel-module-split.bbclass | 21 +++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/meta/classes-recipe/kernel-module-split.bbclass b/meta/classes-recipe/kernel-module-split.bbclass
index ab2f0d1c37..253a723b95 100644
--- a/meta/classes-recipe/kernel-module-split.bbclass
+++ b/meta/classes-recipe/kernel-module-split.bbclass
@@ -35,6 +35,11 @@ modprobedir ??= "${@bb.utils.contains('DISTRO_FEATURES', 'systemd', '${nonarch_b
KERNEL_SPLIT_MODULES ?= "1"
PACKAGESPLITFUNCS =+ "split_kernel_module_packages"
+# Order matters:
+# 1. Strip the modules
+# 2. Re-sign the modules (if enabled)
+# 3. Split the packages
+PACKAGESPLITFUNCS =+ "post_strip_kernel_modules_signing"
KERNEL_MODULES_META_PACKAGE ?= "${@ d.getVar("KERNEL_PACKAGE_NAME") or "kernel" }-modules"
@@ -42,6 +47,22 @@ KERNEL_MODULE_PACKAGE_PREFIX ?= ""
KERNEL_MODULE_PACKAGE_SUFFIX ?= "-${KERNEL_VERSION}"
KERNEL_MODULE_PROVIDE_VIRTUAL ?= "1"
+# Sign kernel modules if auto-signing is enabled in the kernel config
+post_strip_kernel_modules_signing(){
+ # Read .config values
+ is_modules="$(${S}/scripts/config --file ${B}/.config --state MODULES)"
+ is_module_sig="$(${S}/scripts/config --file ${B}/.config --state MODULE_SIG)"
+ is_module_sig_all="$(${S}/scripts/config --file ${B}/.config --state MODULE_SIG_ALL)"
+
+ if [ "$is_modules" = "y" ] && [ "$is_module_sig" = "y" ] && [ "$is_module_sig_all" = "y" ]; then
+ # Sign modules under ${PKGD}
+ oe_runmake \
+ -C ${B} \
+ MODLIB=${PKGD}${nonarch_base_libdir}/modules/${KERNEL_VERSION} \
+ modules_sign
+ fi
+}
+
python split_kernel_module_packages () {
import re
--
2.50.1 (Apple Git-155)
next prev parent reply other threads:[~2026-08-22 0:29 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-22 0:25 [OE-core][PATCH v4 0/4] Make signed kernel modules stripped Anis Bougrine
2026-08-22 0:25 ` Anis Bougrine [this message]
2026-08-22 0:25 ` [OE-core][PATCH v4 2/4] package.py: remove stripping and splitting skip for signed kernel modules Anis Bougrine
2026-08-22 0:26 ` [OE-core][PATCH v4 3/4] kernel: centralize kernel module installation path in one variable Anis Bougrine
2026-08-24 18:57 ` Richard Purdie
2026-08-22 0:26 ` [OE-core][PATCH v4 4/4] documentation.conf: add documentation for MOD_INSTALL_PREFIX variable Anis Bougrine
2026-08-22 16:12 ` [OE-core][PATCH v4 0/4] Make signed kernel modules stripped Mathieu Dubois-Briand
2026-08-24 0:03 ` Bougrine Anis
2026-08-25 18:33 ` Peter Kjellerstedt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260822002601.90667-2-anis.bougrine10@gmail.com \
--to=anis.bougrine10@gmail.com \
--cc=antonin.godard@bootlin.com \
--cc=bruce.ashfield@gmail.com \
--cc=jose.quaresma@oss.qualcomm.com \
--cc=openembedded-core@lists.openembedded.org \
--cc=richard.purdie@linuxfoundation.org \
--cc=ross.burton@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox