public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* make deb-pkg: Does not strip debug symbols when compressing modules
@ 2023-12-14 20:10 Salvatore Bonaccorso
  2023-12-14 20:15 ` Salvatore Bonaccorso
  0 siblings, 1 reply; 4+ messages in thread
From: Salvatore Bonaccorso @ 2023-12-14 20:10 UTC (permalink / raw)
  To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel

Hi

When using (only tested with XZ compression, but the others should
behave similarly) CONFIG_MODULE_COMPRESS_XZ=y to compress the modules,
it looks that the debug symbols are not striped.

Building with the attached test configuration results in packages:

-rw-r--r-- 1 build build  8.9M Dec 14 20:47 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
-rw-r--r-- 1 build build   75M Dec 14 20:48 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
-rw-r--r-- 1 build build 1014M Dec 14 20:47 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
-rw-r--r-- 1 build build  1.3M Dec 14 20:47 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb

This is odd, the linux-image-6.7.0-rc5+ package has a size of almost
1G and the modules are not stripped.

Switching the values instread to 

CONFIG_MODULE_COMPRESS_NONE=y
# CONFIG_MODULE_COMPRESS_XZ is not set

the packages are again produced correctly:

-rw-r--r-- 1 build build 8.9M Dec 14 20:59 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
-rw-r--r-- 1 build build 819M Dec 14 21:00 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
-rw-r--r-- 1 build build  73M Dec 14 20:59 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
-rw-r--r-- 1 build build 1.3M Dec 14 20:59 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb

Regards,
Salvatore

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

* Re: make deb-pkg: Does not strip debug symbols when compressing modules
  2023-12-14 20:10 make deb-pkg: Does not strip debug symbols when compressing modules Salvatore Bonaccorso
@ 2023-12-14 20:15 ` Salvatore Bonaccorso
  2023-12-15 12:13   ` Nicolas Schier
  2023-12-16  1:24   ` Masahiro Yamada
  0 siblings, 2 replies; 4+ messages in thread
From: Salvatore Bonaccorso @ 2023-12-14 20:15 UTC (permalink / raw)
  To: Masahiro Yamada, Nathan Chancellor, Nicolas Schier
  Cc: linux-kbuild, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 1626 bytes --]

Hi,

On Thu, Dec 14, 2023 at 09:10:41PM +0100, Salvatore Bonaccorso wrote:
> Hi
> 
> When using (only tested with XZ compression, but the others should
> behave similarly) CONFIG_MODULE_COMPRESS_XZ=y to compress the modules,
> it looks that the debug symbols are not striped.
> 
> Building with the attached test configuration results in packages:
> 
> -rw-r--r-- 1 build build  8.9M Dec 14 20:47 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> -rw-r--r-- 1 build build   75M Dec 14 20:48 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> -rw-r--r-- 1 build build 1014M Dec 14 20:47 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> -rw-r--r-- 1 build build  1.3M Dec 14 20:47 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> 
> This is odd, the linux-image-6.7.0-rc5+ package has a size of almost
> 1G and the modules are not stripped.
> 
> Switching the values instread to 
> 
> CONFIG_MODULE_COMPRESS_NONE=y
> # CONFIG_MODULE_COMPRESS_XZ is not set
> 
> the packages are again produced correctly:
> 
> -rw-r--r-- 1 build build 8.9M Dec 14 20:59 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> -rw-r--r-- 1 build build 819M Dec 14 21:00 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> -rw-r--r-- 1 build build  73M Dec 14 20:59 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> -rw-r--r-- 1 build build 1.3M Dec 14 20:59 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb

and the classical one. Missed to attach the promised attachement. The
used config is now here.

Regards,
Salvatore

[-- Attachment #2: test.config.xz --]
[-- Type: application/x-xz, Size: 55432 bytes --]

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

* Re: make deb-pkg: Does not strip debug symbols when compressing modules
  2023-12-14 20:15 ` Salvatore Bonaccorso
@ 2023-12-15 12:13   ` Nicolas Schier
  2023-12-16  1:24   ` Masahiro Yamada
  1 sibling, 0 replies; 4+ messages in thread
From: Nicolas Schier @ 2023-12-15 12:13 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: Masahiro Yamada, Nathan Chancellor, linux-kbuild, linux-kernel,
	Nicolas Schier

[-- Attachment #1: Type: text/plain, Size: 1981 bytes --]

On Thu, Dec 14, 2023 at 09:15:52PM +0100, Salvatore Bonaccorso wrote:
> Hi,
> 
> On Thu, Dec 14, 2023 at 09:10:41PM +0100, Salvatore Bonaccorso wrote:
> > Hi
> > 
> > When using (only tested with XZ compression, but the others should
> > behave similarly) CONFIG_MODULE_COMPRESS_XZ=y to compress the modules,
> > it looks that the debug symbols are not striped.
> > 
> > Building with the attached test configuration results in packages:
> > 
> > -rw-r--r-- 1 build build  8.9M Dec 14 20:47 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> > -rw-r--r-- 1 build build   75M Dec 14 20:48 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> > -rw-r--r-- 1 build build 1014M Dec 14 20:47 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> > -rw-r--r-- 1 build build  1.3M Dec 14 20:47 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> > 
> > This is odd, the linux-image-6.7.0-rc5+ package has a size of almost
> > 1G and the modules are not stripped.
> > 
> > Switching the values instread to 
> > 
> > CONFIG_MODULE_COMPRESS_NONE=y
> > # CONFIG_MODULE_COMPRESS_XZ is not set
> > 
> > the packages are again produced correctly:
> > 
> > -rw-r--r-- 1 build build 8.9M Dec 14 20:59 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> > -rw-r--r-- 1 build build 819M Dec 14 21:00 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> > -rw-r--r-- 1 build build  73M Dec 14 20:59 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> > -rw-r--r-- 1 build build 1.3M Dec 14 20:59 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> 
> and the classical one. Missed to attach the promised attachement. The
> used config is now here.

:)

Hi Salvatore,

did you try to build with 'make INSTALL_MOD_STRIP=1 ...'?  When I'm
reproducing your issue here, the flag reduces the package size from ~1GB
to ~95MB.

Kind regards,
Nicolas

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: make deb-pkg: Does not strip debug symbols when compressing modules
  2023-12-14 20:15 ` Salvatore Bonaccorso
  2023-12-15 12:13   ` Nicolas Schier
@ 2023-12-16  1:24   ` Masahiro Yamada
  1 sibling, 0 replies; 4+ messages in thread
From: Masahiro Yamada @ 2023-12-16  1:24 UTC (permalink / raw)
  To: Salvatore Bonaccorso
  Cc: Nathan Chancellor, Nicolas Schier, linux-kbuild, linux-kernel,
	Ben Hutchings, Bastian Blank

On Fri, Dec 15, 2023 at 5:16 AM Salvatore Bonaccorso <carnil@debian.org> wrote:
>
> Hi,
>
> On Thu, Dec 14, 2023 at 09:10:41PM +0100, Salvatore Bonaccorso wrote:
> > Hi
> >
> > When using (only tested with XZ compression, but the others should
> > behave similarly) CONFIG_MODULE_COMPRESS_XZ=y to compress the modules,
> > it looks that the debug symbols are not striped.
> >
> > Building with the attached test configuration results in packages:
> >
> > -rw-r--r-- 1 build build  8.9M Dec 14 20:47 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> > -rw-r--r-- 1 build build   75M Dec 14 20:48 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> > -rw-r--r-- 1 build build 1014M Dec 14 20:47 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> > -rw-r--r-- 1 build build  1.3M Dec 14 20:47 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-1_amd64.deb
> >
> > This is odd, the linux-image-6.7.0-rc5+ package has a size of almost
> > 1G and the modules are not stripped.
> >
> > Switching the values instread to
> >
> > CONFIG_MODULE_COMPRESS_NONE=y
> > # CONFIG_MODULE_COMPRESS_XZ is not set
> >
> > the packages are again produced correctly:
> >
> > -rw-r--r-- 1 build build 8.9M Dec 14 20:59 linux-headers-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> > -rw-r--r-- 1 build build 819M Dec 14 21:00 linux-image-6.7.0-rc5+-dbg_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> > -rw-r--r-- 1 build build  73M Dec 14 20:59 linux-image-6.7.0-rc5+_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
> > -rw-r--r-- 1 build build 1.3M Dec 14 20:59 linux-libc-dev_6.7.0-rc5-00042-g88035e5694a8-2_amd64.deb
>
> and the classical one. Missed to attach the promised attachement. The
> used config is now here.
>
> Regards,
> Salvatore



The debug package never compiled properly with module compression.

The suffix of modules is .ko.xz instead of .ko in your case.



The following line in scripts/package/builddeb does not match anything.


   for module in $(find ${image_pdir}/lib/modules/ -name *.ko -printf
'%P\n'); do


So, nothing is copied to linux-image-dbg, nothing is stripped from linux-image.



Debian kernel does similar, and it was OK because
Debian does not enable CONFIG_MODULE_COMPRESS_*.



Recently, the following commit was applied.  [1]



commit de26137e2a9f847ce65e370d4bf61745f75a4e5d
Author:     Bastian Blank <waldi@debian.org>
AuthorDate: Wed Dec 14 09:52:23 2022 +0100
Commit:     Bastian Blank <waldi@debian.org>
CommitDate: Sun Oct 8 10:29:38 2023 +0200

    Drop not needed extra step to add debug links

    The build step already includes a sufficient GNU debug link section
    containing a build ID in the kernel modules.  This means we don't have
    to manually create one later, so remove the code that does it.





Perhaps, upstream kernel can do similar things to make the code simpler.
('make module_install INSTALL_MOD_STRIP=1' for linux-image,
'make modules_install' for linux-image-dbg)



I CCed Ben and Bastian.



[1] https://salsa.debian.org/kernel-team/linux/-/commit/de26137e2a9f847ce65e370d4bf61745f75a4e5d








-- 
Best Regards
Masahiro Yamada

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

end of thread, other threads:[~2023-12-16  1:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-14 20:10 make deb-pkg: Does not strip debug symbols when compressing modules Salvatore Bonaccorso
2023-12-14 20:15 ` Salvatore Bonaccorso
2023-12-15 12:13   ` Nicolas Schier
2023-12-16  1:24   ` Masahiro Yamada

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox