diff mbox series

[1/3] package: debian: strip headers package

Message ID 20241031132630.24667-2-t.boehler@kunbus.com (mailing list archive)
State New
Headers show
Series Resolve some lintian errors/warnings | expand

Commit Message

Thomas Böhler Oct. 31, 2024, 1:26 p.m. UTC
The linux-headers package contains unstripped binaries. Lintian
complains about this:

    E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/asn1_compiler]
    E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/basic/fixdep]
    E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/kallsyms]
    E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/mod/modpost]
    E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/sorttable]

It's not possible to outright strip every package built with
"debian/rules" as, for instance, the "binary-image" target shouldn't be
stripped because it contains debug information that the
"binary-image-dbg" target will make use of.

Thus conditionally use "dh_strip" on the "binary-headers" target after
using "dh_builddeb" to strip only the contents of the package lintian
complains about. Also pass the "--no-automatic-dbgsym" option to make
sure no headers-dbgsym package is created.

Signed-off-by: Thomas Böhler <t.boehler@kunbus.com>
---
 scripts/package/debian/rules | 2 ++
 1 file changed, 2 insertions(+)

Comments

Masahiro Yamada Nov. 9, 2024, 8:42 p.m. UTC | #1
On Thu, Oct 31, 2024 at 10:26 PM Thomas Böhler <t.boehler@kunbus.com> wrote:
>
> The linux-headers package contains unstripped binaries. Lintian
> complains about this:
>
>     E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/asn1_compiler]
>     E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/basic/fixdep]
>     E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/kallsyms]
>     E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/mod/modpost]
>     E: linux-headers-6.12.0-rc4-g7e04fcfc6195: unstripped-binary-or-object [usr/src/linux-headers-6.12.0-rc4-g7e04fcfc6195/scripts/sorttable]
>
> It's not possible to outright strip every package built with
> "debian/rules" as, for instance, the "binary-image" target shouldn't be
> stripped because it contains debug information that the
> "binary-image-dbg" target will make use of.
>
> Thus conditionally use "dh_strip" on the "binary-headers" target after
> using "dh_builddeb" to strip only the contents of the package lintian
> complains about. Also pass the "--no-automatic-dbgsym" option to make
> sure no headers-dbgsym package is created.
>
> Signed-off-by: Thomas Böhler <t.boehler@kunbus.com>
> ---
>  scripts/package/debian/rules | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules
> index ca07243bd5cd..0c75319acae1 100755
> --- a/scripts/package/debian/rules
> +++ b/scripts/package/debian/rules
> @@ -46,6 +46,8 @@ define binary
>         $(Q)dh_testroot $(DH_OPTIONS)
>         $(Q)dh_prep $(DH_OPTIONS)
>         $(Q)+$(MAKE) $(make-opts) run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb $(package)'
> +       $(if $(filter $(headers-package),$(package)),\
> +               $(Q)dh_strip $(DH_OPTIONS) --no-automatic-dbgsym)
>         $(Q)dh_installdocs $(DH_OPTIONS)
>         $(Q)dh_installchangelogs $(DH_OPTIONS)
>         $(Q)dh_compress $(DH_OPTIONS)
> --
> 2.39.2
>


Probably, I want to postpone this until I figure out
how to sort out issues.

If this patch is applied to the mainline, the following build error will happen
because Kbuild works incrementally.

[How to reproduce]

$ make defconfig all
$ make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- defconfig bindeb-pkg

aarch64-linux-gnu-strip fails because x86 binaries are remaining.



Rebuilding host programs with aarch64-linux-gnu-gcc...
dpkg-deb: building package
'linux-image-6.12.0-rc6-00041-g2808938103be' in
'../linux-image-6.12.0-rc6-00041-g2808938103be_6.12.0-rc6-00041-g2808938103be-4_arm64.deb'.
  INSTALL debian/linux-libc-dev/usr/include
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/kallsyms
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/sorttable
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/asn1_compiler
dpkg-deb: building package 'linux-libc-dev' in
'../linux-libc-dev_6.12.0-rc6-00041-g2808938103be-4_arm64.deb'.
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/mod/modpost.o
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/mod/file2alias.o
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/mod/sumversion.o
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/mod/symsearch.o
  HOSTCC  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/basic/fixdep
  HOSTLD  debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/mod/modpost
aarch64-linux-gnu-strip: Unable to recognise the format of the input
file `debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/selinux/genheaders/genheaders'
dh_strip: error: aarch64-linux-gnu-strip --remove-section=.comment
--remove-section=.note -o /tmp/Kv0I0EefcE/stripYJQMDW
debian/linux-headers-6.12.0-rc6-00041-g2808938103be/usr/src/linux-headers-6.12.0-rc6-00041-g2808938103be/scripts/selinux/genheaders/genheaders
returned exit code 1
dh_strip: error: Aborting due to earlier error
make[4]: *** [debian/rules:63: binary-headers] Error 2
make[4]: *** Waiting for unfinished jobs....
dpkg-deb: building package
'linux-image-6.12.0-rc6-00041-g2808938103be-dbg' in
'../linux-image-6.12.0-rc6-00041-g2808938103be-dbg_6.12.0-rc6-00041-g2808938103be-4_arm64.deb'.
dpkg-buildpackage: error: make -f debian/rules binary subprocess
returned exit status 2
make[3]: *** [scripts/Makefile.package:126: bindeb-pkg] Error 2
make[2]: *** [Makefile:1570: bindeb-pkg] Error 2
make[1]: *** [/home/masahiro/workspace/linux-kbuild/Makefile:347:
__build_one_by_one] Error 2
make: *** [Makefile:224: __sub-make] Error 2




--
Best Regards
Masahiro Yamada
diff mbox series

Patch

diff --git a/scripts/package/debian/rules b/scripts/package/debian/rules
index ca07243bd5cd..0c75319acae1 100755
--- a/scripts/package/debian/rules
+++ b/scripts/package/debian/rules
@@ -46,6 +46,8 @@  define binary
 	$(Q)dh_testroot $(DH_OPTIONS)
 	$(Q)dh_prep $(DH_OPTIONS)
 	$(Q)+$(MAKE) $(make-opts) run-command KBUILD_RUN_COMMAND='+$$(srctree)/scripts/package/builddeb $(package)'
+	$(if $(filter $(headers-package),$(package)),\
+		$(Q)dh_strip $(DH_OPTIONS) --no-automatic-dbgsym)
 	$(Q)dh_installdocs $(DH_OPTIONS)
 	$(Q)dh_installchangelogs $(DH_OPTIONS)
 	$(Q)dh_compress $(DH_OPTIONS)