diff mbox series

[KINETIC,SRU] UBUNTU: [Packaging] Support arch-specific compilers in updateconfigs

Message ID 20221017114822.474788-1-dimitri.ledkov@canonical.com
State New
Headers show
Series [KINETIC,SRU] UBUNTU: [Packaging] Support arch-specific compilers in updateconfigs | expand

Commit Message

Dimitri John Ledkov Oct. 17, 2022, 11:48 a.m. UTC
BugLink: https://bugs.launchpad.net/bugs/1993120

For some kernels we had to use different toolchain on per-arch
basis. Introduce support for such scenario in kernelconfig
script. This will allow to set gcc=gcc-11 in
debian.flavour/rules.d/arch.mk. Note this doesn't yet generate correct
build-dependencies.

Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
---
 debian/scripts/misc/kernelconfig | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

Comments

Tim Gardner Oct. 17, 2022, 5:36 p.m. UTC | #1
On 10/17/22 5:48 AM, Dimitri John Ledkov wrote:
> BugLink: https://bugs.launchpad.net/bugs/1993120
> 
> For some kernels we had to use different toolchain on per-arch
> basis. Introduce support for such scenario in kernelconfig
> script. This will allow to set gcc=gcc-11 in
> debian.flavour/rules.d/arch.mk. Note this doesn't yet generate correct
> build-dependencies.
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
> ---
>   debian/scripts/misc/kernelconfig | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/debian/scripts/misc/kernelconfig b/debian/scripts/misc/kernelconfig
> index 44c1b79d97..d2f94081c3 100755
> --- a/debian/scripts/misc/kernelconfig
> +++ b/debian/scripts/misc/kernelconfig
> @@ -67,12 +67,15 @@ for arch in $archs; do
>   	# Determine cross toolchain to use for Kconfig compiler tests
>   	cross_compile="$(dpkg-architecture -qDEB_HOST_GNU_TYPE -a$arch 2>/dev/null)-"
>   
> +	# Arch-specific compiler, if any
> +	archgcc=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $DEBIAN/rules.d/$arch.mk" | make -s -f - show-gcc)
> +
>   	# Environment variables for 'make *config'. We omit CROSS_COMPILE
>   	# for i386 since it is no longer supported after 19.04, however
>   	# we maintain the configs for hwe.
>   	modify_config=true
>   	env="ARCH=$kernarch DEB_ARCH=$arch"
> -	compiler_path=$(which "${cross_compile}${gcc}" || true)
> +	compiler_path=$(which "${cross_compile}${archgcc:-$gcc}" || true)
>   	if [ "$compiler_path" != '' ]; then
>   		env="$env CROSS_COMPILE=$cross_compile CC=$compiler_path"
>   	else
Acked-by: Tim Gardner <tim.gardner@canonical.com>

Seems reasonable.
Stefan Bader Oct. 21, 2022, 7:17 a.m. UTC | #2
On 17.10.22 13:48, Dimitri John Ledkov wrote:
> BugLink: https://bugs.launchpad.net/bugs/1993120
> 
> For some kernels we had to use different toolchain on per-arch
> basis. Introduce support for such scenario in kernelconfig
> script. This will allow to set gcc=gcc-11 in
> debian.flavour/rules.d/arch.mk. Note this doesn't yet generate correct
> build-dependencies.
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
> ---
>   debian/scripts/misc/kernelconfig | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/debian/scripts/misc/kernelconfig b/debian/scripts/misc/kernelconfig
> index 44c1b79d97..d2f94081c3 100755
> --- a/debian/scripts/misc/kernelconfig
> +++ b/debian/scripts/misc/kernelconfig
> @@ -67,12 +67,15 @@ for arch in $archs; do
>   	# Determine cross toolchain to use for Kconfig compiler tests
>   	cross_compile="$(dpkg-architecture -qDEB_HOST_GNU_TYPE -a$arch 2>/dev/null)-"
>   
> +	# Arch-specific compiler, if any
> +	archgcc=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $DEBIAN/rules.d/$arch.mk" | make -s -f - show-gcc)
> +
>   	# Environment variables for 'make *config'. We omit CROSS_COMPILE
>   	# for i386 since it is no longer supported after 19.04, however
>   	# we maintain the configs for hwe.
>   	modify_config=true
>   	env="ARCH=$kernarch DEB_ARCH=$arch"
> -	compiler_path=$(which "${cross_compile}${gcc}" || true)
> +	compiler_path=$(which "${cross_compile}${archgcc:-$gcc}" || true)
>   	if [ "$compiler_path" != '' ]; then
>   		env="$env CROSS_COMPILE=$cross_compile CC=$compiler_path"
>   	else
Andrea Righi Oct. 26, 2022, 5:41 a.m. UTC | #3
On Mon, Oct 17, 2022 at 12:48:22PM +0100, Dimitri John Ledkov wrote:
> BugLink: https://bugs.launchpad.net/bugs/1993120
> 
> For some kernels we had to use different toolchain on per-arch
> basis. Introduce support for such scenario in kernelconfig
> script. This will allow to set gcc=gcc-11 in
> debian.flavour/rules.d/arch.mk. Note this doesn't yet generate correct
> build-dependencies.
> 
> Signed-off-by: Dimitri John Ledkov <dimitri.ledkov@canonical.com>

Applied to kinetic/linux and kinetic/linux-unstable.

Thanks,
-Andrea

> ---
>  debian/scripts/misc/kernelconfig | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/debian/scripts/misc/kernelconfig b/debian/scripts/misc/kernelconfig
> index 44c1b79d97..d2f94081c3 100755
> --- a/debian/scripts/misc/kernelconfig
> +++ b/debian/scripts/misc/kernelconfig
> @@ -67,12 +67,15 @@ for arch in $archs; do
>  	# Determine cross toolchain to use for Kconfig compiler tests
>  	cross_compile="$(dpkg-architecture -qDEB_HOST_GNU_TYPE -a$arch 2>/dev/null)-"
>  
> +	# Arch-specific compiler, if any
> +	archgcc=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $DEBIAN/rules.d/$arch.mk" | make -s -f - show-gcc)
> +
>  	# Environment variables for 'make *config'. We omit CROSS_COMPILE
>  	# for i386 since it is no longer supported after 19.04, however
>  	# we maintain the configs for hwe.
>  	modify_config=true
>  	env="ARCH=$kernarch DEB_ARCH=$arch"
> -	compiler_path=$(which "${cross_compile}${gcc}" || true)
> +	compiler_path=$(which "${cross_compile}${archgcc:-$gcc}" || true)
>  	if [ "$compiler_path" != '' ]; then
>  		env="$env CROSS_COMPILE=$cross_compile CC=$compiler_path"
>  	else
> -- 
> 2.34.1
> 
> 
> -- 
> kernel-team mailing list
> kernel-team@lists.ubuntu.com
> https://lists.ubuntu.com/mailman/listinfo/kernel-team
diff mbox series

Patch

diff --git a/debian/scripts/misc/kernelconfig b/debian/scripts/misc/kernelconfig
index 44c1b79d97..d2f94081c3 100755
--- a/debian/scripts/misc/kernelconfig
+++ b/debian/scripts/misc/kernelconfig
@@ -67,12 +67,15 @@  for arch in $archs; do
 	# Determine cross toolchain to use for Kconfig compiler tests
 	cross_compile="$(dpkg-architecture -qDEB_HOST_GNU_TYPE -a$arch 2>/dev/null)-"
 
+	# Arch-specific compiler, if any
+	archgcc=$(echo -e "show-%:\n\t@echo \$(\$*)\ninclude $DEBIAN/rules.d/$arch.mk" | make -s -f - show-gcc)
+
 	# Environment variables for 'make *config'. We omit CROSS_COMPILE
 	# for i386 since it is no longer supported after 19.04, however
 	# we maintain the configs for hwe.
 	modify_config=true
 	env="ARCH=$kernarch DEB_ARCH=$arch"
-	compiler_path=$(which "${cross_compile}${gcc}" || true)
+	compiler_path=$(which "${cross_compile}${archgcc:-$gcc}" || true)
 	if [ "$compiler_path" != '' ]; then
 		env="$env CROSS_COMPILE=$cross_compile CC=$compiler_path"
 	else