Openembedded Core Discussions
 help / color / mirror / Atom feed
From: Alexandre Belloni <alexandre.belloni@bootlin.com>
To: joerg.sommer@navimatix.de
Cc: openembedded-core@lists.openembedded.org
Subject: Re: [OE-core] [PATCH] classes/kernel: Delay module signing until after strip
Date: Wed, 10 Jul 2024 22:03:52 +0200	[thread overview]
Message-ID: <202407102003520ffdebb9@mail.local> (raw)
In-Reply-To: <bc15a9ebae0ad3841ac2be887c288b451426e69b.1720185337.git.joerg.sommer@navimatix.de>

I did give this a go on the autobuilders were it broke all the builds:

https://autobuilder.yoctoproject.org/typhoon/#/builders/73/builds/9148/steps/14/logs/stdio

On 05/07/2024 15:19:08+0200, J�rg Sommer via lists.openembedded.org wrote:
> 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
> 

> 
> -=-=-=-=-=-=-=-=-=-=-=-
> 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/3617179
> Group Owner: openembedded-core+owner@lists.openembedded.org
> Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [alexandre.belloni@bootlin.com]
> -=-=-=-=-=-=-=-=-=-=-=-
> 


-- 
Alexandre Belloni, co-owner and COO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com


      parent reply	other threads:[~2024-07-10 20:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=202407102003520ffdebb9@mail.local \
    --to=alexandre.belloni@bootlin.com \
    --cc=joerg.sommer@navimatix.de \
    --cc=openembedded-core@lists.openembedded.org \
    /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