[PATCH master] arm: error out if __LINUX_ARM_ARCH__ is undefined

Sascha Hauer sha at pengutronix.de
Sun Apr 16 23:55:16 PDT 2023


On Fri, Apr 14, 2023 at 07:14:21PM +0200, Ahmad Fatoum wrote:
> With recent multiarch (really, multiplatform) rework, oldconfig will
> reask users what platforms they want to build for. The default is N,
> so holding return (or an olddefconfig) will just disable all boards and
> with it all CPUs leading to a cryptic torrent of:
> 
>   arch/arm/include/asm/swab.h:31:28: warning: "__LINUX_ARM_ARCH__" is not defined, evaluates to 0 [-Wundef]
>      31 | #if defined(__KERNEL__) && __LINUX_ARM_ARCH__ >= 6
>         |                            ^~~~~~~~~~~~~~~~~~
> 
> Make user experience a bit better by printing an error message instead.
> 
> Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
> ---
>  arch/arm/Makefile                 | 1 +
>  arch/arm/include/asm/arch-check.h | 9 +++++++++
>  2 files changed, 10 insertions(+)
>  create mode 100644 arch/arm/include/asm/arch-check.h

Applied, thanks

Sascha

> 
> diff --git a/arch/arm/Makefile b/arch/arm/Makefile
> index 9bd7db6ba9f8..a506f1e3a3e5 100644
> --- a/arch/arm/Makefile
> +++ b/arch/arm/Makefile
> @@ -42,6 +42,7 @@ endif
>  # Note that GCC does not numerically define an architecture version
>  # macro, but instead defines a whole series of macros which makes
>  # testing for a specific architecture or later rather impossible.
> +arch-y				:= -include asm/arch-check.h
>  arch-$(CONFIG_CPU_64v8)		:= -D__LINUX_ARM_ARCH__=8 $(call cc-option,-march=armv8-a)
>  arch-$(CONFIG_CPU_32v7)		:=-D__LINUX_ARM_ARCH__=7 $(call cc-option,-march=armv7-a,-march=armv5t -Wa$(comma)-march=armv7-a)
>  arch-$(CONFIG_CPU_32v6)		:=-D__LINUX_ARM_ARCH__=6 $(call cc-option,-march=armv6,-march=armv5t -Wa$(comma)-march=armv6)
> diff --git a/arch/arm/include/asm/arch-check.h b/arch/arm/include/asm/arch-check.h
> new file mode 100644
> index 000000000000..2cf1b624a4de
> --- /dev/null
> +++ b/arch/arm/include/asm/arch-check.h
> @@ -0,0 +1,9 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef __ARM_ASM_ARCH_CHECK_H__
> +#define __ARM_ASM_ARCH_CHECK_H__
> +
> +#ifndef __LINUX_ARM_ARCH__
> +#error No boards/CPUs selected in Kconfig
> +#endif
> +
> +#endif
> -- 
> 2.39.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



More information about the barebox mailing list