mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] arm: error out if __LINUX_ARM_ARCH__ is undefined
@ 2023-04-14 17:14 Ahmad Fatoum
  2023-04-17  6:55 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-04-14 17:14 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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@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

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




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

* Re: [PATCH master] arm: error out if __LINUX_ARM_ARCH__ is undefined
  2023-04-14 17:14 [PATCH master] arm: error out if __LINUX_ARM_ARCH__ is undefined Ahmad Fatoum
@ 2023-04-17  6:55 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-04-17  6:55 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

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@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 |



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

end of thread, other threads:[~2023-04-17  6:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-04-14 17:14 [PATCH master] arm: error out if __LINUX_ARM_ARCH__ is undefined Ahmad Fatoum
2023-04-17  6:55 ` Sascha Hauer

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