APPLIED: [KINETIC][PATCH] UBUNTU: [Packaging] Set explicit CC in the headers package
Stefan Bader
stefan.bader at canonical.com
Mon Jan 30 16:44:49 UTC 2023
On 15.12.22 10:11, Dimitri John Ledkov wrote:
> BugLink: https://bugs.launchpad.net/bugs/1999750
>
> Currently Ubuntu Linux kernel header packages use stock Makefile as
> shipped by upstream kernel. During linux kernel package build however
> HOSTCC and CC are typically overridden to use explicit complier
> version $(DEB_HOST_GNU_TYPE)-gcc-12. This can lead to dkms module
> build failures as despite all efforts to reuse matching gcc version
> out of .config, various shell scripts / build systems / makefiles do
> not pass the CC variable as a make variable to the end make call that
> is used to build dkms modules. To avoid this, hardcode the correct
> compiler in the linux headers package shipped Makefile. This is
> similar to the Makefile includes that debian ships, albeit with less
> indirections.
>
> Tested by applying this patch to the hwe-5.19 kernel, rebuilding it,
> and testing that dkms module building is using expected compilers now.
>
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov at canonical.com>
> ---
Applied to kinetic:linux/master-next. Thanks.
-Stefan
> debian/rules.d/2-binary-arch.mk | 9 ++++++++-
> 1 file changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/debian/rules.d/2-binary-arch.mk b/debian/rules.d/2-binary-arch.mk
> index 60513c43b9..ecc5afbc97 100644
> --- a/debian/rules.d/2-binary-arch.mk
> +++ b/debian/rules.d/2-binary-arch.mk
> @@ -318,8 +318,15 @@ endif
> cp $(builddir)/build-$*/.config $(hdrdir)
> chmod 644 $(hdrdir)/.config
> $(kmake) O=$(hdrdir) -j1 syncconfig prepare scripts
> - # We'll symlink this stuff
> + # Makefile may need per-arch-flavour CC settings, which are
> + # normally set via $(kmake) during build
> rm -f $(hdrdir)/Makefile
> + cp -a $(indep_hdrdir)/Makefile $(hdrdir)/Makefile
> + sed -i 's|\(^HOSTCC = \)gcc$$|\1$(gcc)|' $(hdrdir)/Makefile
> + sed -i 's|\(^CC = $$(CROSS_COMPILE)\)gcc$$|\1$(gcc)|' $(hdrdir)/Makefile
> + # Quick check for successful substitutions
> + grep '^HOSTCC .*$(gcc)$$' $(hdrdir)/Makefile
> + grep '^CC .*$(gcc)$$' $(hdrdir)/Makefile
> rm -rf $(hdrdir)/include2 $(hdrdir)/source
> # We do not need the retpoline information.
> find $(hdrdir) -name \*.o.ur-\* | xargs rm -f
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <https://lists.ubuntu.com/archives/kernel-team/attachments/20230130/113af6b5/attachment.sig>
More information about the kernel-team
mailing list