diff mbox series

[02/10] kconfig: Add scripts/Kconfig.include from v4.19

Message ID 20200514123009.5721-2-trini@konsulko.com
State Accepted
Commit a9610bd8e44853184a1b8a4c57f8355ee0bf7347
Headers show
Series [01/10] kconfiglib: Update to the 14.1.0 release | expand

Commit Message

Tom Rini May 14, 2020, 12:30 p.m. UTC
As part of re-syncing our Kconfig logic up to v4.19, we had missed
adding this new file that includes helper macros.  To quote the upstream
commit e1cfdc0e72fc ("kconfig: add basic helper macros to scripts/Kconfig.include"):

Kconfig got text processing tools like we see in Make.  Add Kconfig
helper macros to scripts/Kconfig.include like we collect Makefile
macros in scripts/Kbuild.include.

Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
Signed-off-by: Tom Rini <trini at konsulko.com>
---
 Kconfig                 |  2 ++
 scripts/Kconfig.include | 30 ++++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)
 create mode 100644 scripts/Kconfig.include

Comments

Masahiro Yamada May 18, 2020, 2:55 a.m. UTC | #1
Tom,



On Thu, May 14, 2020 at 9:32 PM Tom Rini <trini at konsulko.com> wrote:
>
> As part of re-syncing our Kconfig logic up to v4.19, we had missed
> adding this new file that includes helper macros.  To quote the upstream
> commit e1cfdc0e72fc ("kconfig: add basic helper macros to scripts/Kconfig.include"):
>
> Kconfig got text processing tools like we see in Make.  Add Kconfig
> helper macros to scripts/Kconfig.include like we collect Makefile
> macros in scripts/Kbuild.include.
>
> Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
> Signed-off-by: Tom Rini <trini at konsulko.com>


If you want to align with Linux kernel, please go ahead.


Some notes.


Previously, CROSS_COMPILE was not required at the Kconfig stage.

So, people was able to do this:

      make qemu_arm64_defconfig
      make CROSS_COMPILE=aarch64-linux-gnu-


Going forward, Kconfig requires CROSS_COMPILE set correctly.

      make CROSS_COMPILE=aarch64-linux-gnu-  qemu_arm64_defconfig
      make CROSS_COMPILE=aarch64-linux-gnu-

Maybe, passing CROSS_COMPILE as an environment variable is handier

      export CROSS_COMPILE=aarch64-linux-gnu-
      make qemu_arm64_defconfig
      make





When you upgrade the compiler, in theory,
you must re-run Kconfig because the .config now
contains the compiler information.

If you want to do this automatically,
you can import CC_VERSION_TEXT.

Specifically, the following two commits:
21c54b774744719c386fbdc829b0e7759edb8ece
315bab4e972d9795529b764718d475492db40c0f




> ---
>  Kconfig                 |  2 ++
>  scripts/Kconfig.include | 30 ++++++++++++++++++++++++++++++
>  2 files changed, 32 insertions(+)
>  create mode 100644 scripts/Kconfig.include
>
> diff --git a/Kconfig b/Kconfig
> index 15f1a75c61ab..72b4439264a6 100644
> --- a/Kconfig
> +++ b/Kconfig
> @@ -5,6 +5,8 @@
>  #
>  mainmenu "U-Boot $(UBOOTVERSION) Configuration"
>
> +source "scripts/Kconfig.include"
> +
>  # Allow defaults in arch-specific code to override any given here
>  source "arch/Kconfig"
>
> diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
> new file mode 100644
> index 000000000000..dad5583451af
> --- /dev/null
> +++ b/scripts/Kconfig.include
> @@ -0,0 +1,30 @@
> +# Kconfig helper macros
> +
> +# Convenient variables
> +comma       := ,
> +quote       := "
> +squote      := '
> +empty       :=
> +space       := $(empty) $(empty)
> +dollar      := $
> +right_paren := )
> +left_paren  := (
> +
> +# $(if-success,<command>,<then>,<else>)
> +# Return <then> if <command> exits with 0, <else> otherwise.
> +if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
> +
> +# $(success,<command>)
> +# Return y if <command> exits with 0, n otherwise
> +success = $(if-success,$(1),y,n)
> +
> +# $(cc-option,<flag>)
> +# Return y if the compiler supports <flag>, n otherwise
> +cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
> +
> +# $(ld-option,<flag>)
> +# Return y if the linker supports <flag>, n otherwise
> +ld-option = $(success,$(LD) -v $(1))
> +
> +# gcc version including patch level
> +gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//')
> --
> 2.17.1
>


--
Best Regards
Masahiro Yamada
Tom Rini May 18, 2020, 3:23 p.m. UTC | #2
On Mon, May 18, 2020 at 11:55:11AM +0900, Masahiro Yamada wrote:
> Tom,
> 
> 
> 
> On Thu, May 14, 2020 at 9:32 PM Tom Rini <trini at konsulko.com> wrote:
> >
> > As part of re-syncing our Kconfig logic up to v4.19, we had missed
> > adding this new file that includes helper macros.  To quote the upstream
> > commit e1cfdc0e72fc ("kconfig: add basic helper macros to scripts/Kconfig.include"):
> >
> > Kconfig got text processing tools like we see in Make.  Add Kconfig
> > helper macros to scripts/Kconfig.include like we collect Makefile
> > macros in scripts/Kbuild.include.
> >
> > Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
> > Signed-off-by: Tom Rini <trini at konsulko.com>
> 
> 
> If you want to align with Linux kernel, please go ahead.
> 
> 
> Some notes.
> 
> 
> Previously, CROSS_COMPILE was not required at the Kconfig stage.
> 
> So, people was able to do this:
> 
>       make qemu_arm64_defconfig
>       make CROSS_COMPILE=aarch64-linux-gnu-
> 
> 
> Going forward, Kconfig requires CROSS_COMPILE set correctly.
> 
>       make CROSS_COMPILE=aarch64-linux-gnu-  qemu_arm64_defconfig
>       make CROSS_COMPILE=aarch64-linux-gnu-
> 
> Maybe, passing CROSS_COMPILE as an environment variable is handier
> 
>       export CROSS_COMPILE=aarch64-linux-gnu-
>       make qemu_arm64_defconfig
>       make
> 
> 
> 
> 
> 
> When you upgrade the compiler, in theory,
> you must re-run Kconfig because the .config now
> contains the compiler information.
> 
> If you want to do this automatically,
> you can import CC_VERSION_TEXT.
> 
> Specifically, the following two commits:
> 21c54b774744719c386fbdc829b0e7759edb8ece
> 315bab4e972d9795529b764718d475492db40c0f

OK, so we really want to grab those changes as well at the time, thanks!
Tom Rini May 18, 2020, 4:55 p.m. UTC | #3
On Mon, May 18, 2020 at 11:23:20AM -0400, Tom Rini wrote:
> On Mon, May 18, 2020 at 11:55:11AM +0900, Masahiro Yamada wrote:
> > Tom,
> > 
> > 
> > 
> > On Thu, May 14, 2020 at 9:32 PM Tom Rini <trini at konsulko.com> wrote:
> > >
> > > As part of re-syncing our Kconfig logic up to v4.19, we had missed
> > > adding this new file that includes helper macros.  To quote the upstream
> > > commit e1cfdc0e72fc ("kconfig: add basic helper macros to scripts/Kconfig.include"):
> > >
> > > Kconfig got text processing tools like we see in Make.  Add Kconfig
> > > helper macros to scripts/Kconfig.include like we collect Makefile
> > > macros in scripts/Kbuild.include.
> > >
> > > Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
> > > Signed-off-by: Tom Rini <trini at konsulko.com>
> > 
> > 
> > If you want to align with Linux kernel, please go ahead.
> > 
> > 
> > Some notes.
> > 
> > 
> > Previously, CROSS_COMPILE was not required at the Kconfig stage.
> > 
> > So, people was able to do this:
> > 
> >       make qemu_arm64_defconfig
> >       make CROSS_COMPILE=aarch64-linux-gnu-
> > 
> > 
> > Going forward, Kconfig requires CROSS_COMPILE set correctly.
> > 
> >       make CROSS_COMPILE=aarch64-linux-gnu-  qemu_arm64_defconfig
> >       make CROSS_COMPILE=aarch64-linux-gnu-
> > 
> > Maybe, passing CROSS_COMPILE as an environment variable is handier
> > 
> >       export CROSS_COMPILE=aarch64-linux-gnu-
> >       make qemu_arm64_defconfig
> >       make
> > 
> > 
> > 
> > 
> > 
> > When you upgrade the compiler, in theory,
> > you must re-run Kconfig because the .config now
> > contains the compiler information.
> > 
> > If you want to do this automatically,
> > you can import CC_VERSION_TEXT.
> > 
> > Specifically, the following two commits:
> > 21c54b774744719c386fbdc829b0e7759edb8ece
> > 315bab4e972d9795529b764718d475492db40c0f
> 
> OK, so we really want to grab those changes as well at the time, thanks!

Trying this out and trying to follow the code a bit, the first commit is
helpful for us in that it's good to have the compiler noted in the file.
But even without it, with this series applied we see:
$ make O=/tmp/rpi3_32b HOSTCC=clang-10 CROSS_COMPILE=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-  CC="clang-10 -target arm-linux-gnueabi" rpi_3_32b_config
make[1]: Entering directory '/tmp/rpi3_32b'
  HOSTCC  scripts/basic/fixdep
  GEN     ./Makefile
  HOSTCC  scripts/kconfig/conf.o
  YACC    scripts/kconfig/zconf.tab.c
  LEX     scripts/kconfig/zconf.lex.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
make[1]: Leaving directory '/tmp/rpi3_32b'
$ make O=/tmp/rpi3_32b HOSTCC=clang-10 CROSS_COMPILE=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
make[1]: Entering directory '/tmp/rpi3_32b'
  GEN     ./Makefile
scripts/kconfig/conf  --syncconfig Kconfig
  UPD     include/config.h
  CFG     u-boot.cfg
...


So we're getting syncconfig run and CC-related changes are caught.

For the second commit, since ARCH comes from CONFIG_SYS_ARCH and not the
make line/environment, we don't have that problem to start with?
Thanks!
Masahiro Yamada May 19, 2020, 1:40 a.m. UTC | #4
On Tue, May 19, 2020 at 1:55 AM Tom Rini <trini at konsulko.com> wrote:
>
> On Mon, May 18, 2020 at 11:23:20AM -0400, Tom Rini wrote:
> > On Mon, May 18, 2020 at 11:55:11AM +0900, Masahiro Yamada wrote:
> > > Tom,
> > >
> > >
> > >
> > > On Thu, May 14, 2020 at 9:32 PM Tom Rini <trini at konsulko.com> wrote:
> > > >
> > > > As part of re-syncing our Kconfig logic up to v4.19, we had missed
> > > > adding this new file that includes helper macros.  To quote the upstream
> > > > commit e1cfdc0e72fc ("kconfig: add basic helper macros to scripts/Kconfig.include"):
> > > >
> > > > Kconfig got text processing tools like we see in Make.  Add Kconfig
> > > > helper macros to scripts/Kconfig.include like we collect Makefile
> > > > macros in scripts/Kbuild.include.
> > > >
> > > > Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
> > > > Signed-off-by: Tom Rini <trini at konsulko.com>
> > >
> > >
> > > If you want to align with Linux kernel, please go ahead.
> > >
> > >
> > > Some notes.
> > >
> > >
> > > Previously, CROSS_COMPILE was not required at the Kconfig stage.
> > >
> > > So, people was able to do this:
> > >
> > >       make qemu_arm64_defconfig
> > >       make CROSS_COMPILE=aarch64-linux-gnu-
> > >
> > >
> > > Going forward, Kconfig requires CROSS_COMPILE set correctly.
> > >
> > >       make CROSS_COMPILE=aarch64-linux-gnu-  qemu_arm64_defconfig
> > >       make CROSS_COMPILE=aarch64-linux-gnu-
> > >
> > > Maybe, passing CROSS_COMPILE as an environment variable is handier
> > >
> > >       export CROSS_COMPILE=aarch64-linux-gnu-
> > >       make qemu_arm64_defconfig
> > >       make
> > >
> > >
> > >
> > >
> > >
> > > When you upgrade the compiler, in theory,
> > > you must re-run Kconfig because the .config now
> > > contains the compiler information.
> > >
> > > If you want to do this automatically,
> > > you can import CC_VERSION_TEXT.
> > >
> > > Specifically, the following two commits:
> > > 21c54b774744719c386fbdc829b0e7759edb8ece
> > > 315bab4e972d9795529b764718d475492db40c0f
> >
> > OK, so we really want to grab those changes as well at the time, thanks!
>
> Trying this out and trying to follow the code a bit, the first commit is
> helpful for us in that it's good to have the compiler noted in the file.
> But even without it, with this series applied we see:
> $ make O=/tmp/rpi3_32b HOSTCC=clang-10 CROSS_COMPILE=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-  CC="clang-10 -target arm-linux-gnueabi" rpi_3_32b_config
> make[1]: Entering directory '/tmp/rpi3_32b'
>   HOSTCC  scripts/basic/fixdep
>   GEN     ./Makefile
>   HOSTCC  scripts/kconfig/conf.o
>   YACC    scripts/kconfig/zconf.tab.c
>   LEX     scripts/kconfig/zconf.lex.c
>   HOSTCC  scripts/kconfig/zconf.tab.o
>   HOSTLD  scripts/kconfig/conf
> #
> # configuration written to .config
> #
> make[1]: Leaving directory '/tmp/rpi3_32b'
> $ make O=/tmp/rpi3_32b HOSTCC=clang-10 CROSS_COMPILE=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
> make[1]: Entering directory '/tmp/rpi3_32b'
>   GEN     ./Makefile
> scripts/kconfig/conf  --syncconfig Kconfig
>   UPD     include/config.h
>   CFG     u-boot.cfg
> ...
>
>
> So we're getting syncconfig run and CC-related changes are caught.


This is because you changed the environment variable, $(CC).


I meant the situation, "the compiler version is updated
without changing the installation path".


I think this does not happen quite often, but I assumed the
following scenario.

- "apt-get upgrade" will upgrade distro compilers.
  The executables in /usr/bin/ are overwritten.

- If you have cross compilers in $(HOME)/bin etc.,
  you may want to simply overwrite to upgrade the compilers.



> For the second commit, since ARCH comes from CONFIG_SYS_ARCH and not the
> make line/environment, we don't have that problem to start with?
> Thanks!


Sorry, I missed ARCH comes from CONFIG_SYS_ARCH in U-Boot.
That is a difference from Linux.



arch/*/config.mk define CROSS_COMPILE.


arch/m68k/config.mk:ifeq ($(CROSS_COMPILE),)
arch/m68k/config.mk:CROSS_COMPILE := m68k-elf-
arch/microblaze/config.mk:ifeq ($(CROSS_COMPILE),)
arch/microblaze/config.mk:CROSS_COMPILE := mb-
arch/nds32/config.mk:ifeq ($(CROSS_COMPILE),)
arch/nds32/config.mk:CROSS_COMPILE := nds32le-linux-
arch/nios2/config.mk:ifeq ($(CROSS_COMPILE),)
arch/nios2/config.mk:CROSS_COMPILE := nios2-elf-
arch/powerpc/config.mk:ifeq ($(CROSS_COMPILE),)
arch/powerpc/config.mk:CROSS_COMPILE := ppc_8xx-
arch/powerpc/config.mk:ifeq ($(CROSS_COMPILE),powerpc-netbsd-)
arch/powerpc/config.mk:ifeq ($(CROSS_COMPILE),powerpc-openbsd-)
arch/sh/config.mk:ifeq ($(CROSS_COMPILE),)
arch/sh/config.mk:CROSS_COMPILE := sh4-linux-
arch/x86/cpu/config.mk:CROSS_COMPILE ?= i386-linux-
arch/xtensa/config.mk:CROSS_COMPILE ?= xtensa-linux-



If you apply patch, you cannot support
CROSS_COMPILE defines in arch/*/config.mk



U-Boot determines SYS_ARCH from Kconfig.
After Kconfig, the build system can include
the correct arch/*/config.mk, but it is too late
to pick up CROSS_COMPILE.
Tom Rini May 19, 2020, 2:18 p.m. UTC | #5
On Tue, May 19, 2020 at 10:40:01AM +0900, Masahiro Yamada wrote:
> On Tue, May 19, 2020 at 1:55 AM Tom Rini <trini at konsulko.com> wrote:
> >
> > On Mon, May 18, 2020 at 11:23:20AM -0400, Tom Rini wrote:
> > > On Mon, May 18, 2020 at 11:55:11AM +0900, Masahiro Yamada wrote:
> > > > Tom,
> > > >
> > > >
> > > >
> > > > On Thu, May 14, 2020 at 9:32 PM Tom Rini <trini at konsulko.com> wrote:
> > > > >
> > > > > As part of re-syncing our Kconfig logic up to v4.19, we had missed
> > > > > adding this new file that includes helper macros.  To quote the upstream
> > > > > commit e1cfdc0e72fc ("kconfig: add basic helper macros to scripts/Kconfig.include"):
> > > > >
> > > > > Kconfig got text processing tools like we see in Make.  Add Kconfig
> > > > > helper macros to scripts/Kconfig.include like we collect Makefile
> > > > > macros in scripts/Kbuild.include.
> > > > >
> > > > > Cc: Masahiro Yamada <yamada.masahiro at socionext.com>
> > > > > Signed-off-by: Tom Rini <trini at konsulko.com>
> > > >
> > > >
> > > > If you want to align with Linux kernel, please go ahead.
> > > >
> > > >
> > > > Some notes.
> > > >
> > > >
> > > > Previously, CROSS_COMPILE was not required at the Kconfig stage.
> > > >
> > > > So, people was able to do this:
> > > >
> > > >       make qemu_arm64_defconfig
> > > >       make CROSS_COMPILE=aarch64-linux-gnu-
> > > >
> > > >
> > > > Going forward, Kconfig requires CROSS_COMPILE set correctly.
> > > >
> > > >       make CROSS_COMPILE=aarch64-linux-gnu-  qemu_arm64_defconfig
> > > >       make CROSS_COMPILE=aarch64-linux-gnu-
> > > >
> > > > Maybe, passing CROSS_COMPILE as an environment variable is handier
> > > >
> > > >       export CROSS_COMPILE=aarch64-linux-gnu-
> > > >       make qemu_arm64_defconfig
> > > >       make
> > > >
> > > >
> > > >
> > > >
> > > >
> > > > When you upgrade the compiler, in theory,
> > > > you must re-run Kconfig because the .config now
> > > > contains the compiler information.
> > > >
> > > > If you want to do this automatically,
> > > > you can import CC_VERSION_TEXT.
> > > >
> > > > Specifically, the following two commits:
> > > > 21c54b774744719c386fbdc829b0e7759edb8ece
> > > > 315bab4e972d9795529b764718d475492db40c0f
> > >
> > > OK, so we really want to grab those changes as well at the time, thanks!
> >
> > Trying this out and trying to follow the code a bit, the first commit is
> > helpful for us in that it's good to have the compiler noted in the file.
> > But even without it, with this series applied we see:
> > $ make O=/tmp/rpi3_32b HOSTCC=clang-10 CROSS_COMPILE=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-  CC="clang-10 -target arm-linux-gnueabi" rpi_3_32b_config
> > make[1]: Entering directory '/tmp/rpi3_32b'
> >   HOSTCC  scripts/basic/fixdep
> >   GEN     ./Makefile
> >   HOSTCC  scripts/kconfig/conf.o
> >   YACC    scripts/kconfig/zconf.tab.c
> >   LEX     scripts/kconfig/zconf.lex.c
> >   HOSTCC  scripts/kconfig/zconf.tab.o
> >   HOSTLD  scripts/kconfig/conf
> > #
> > # configuration written to .config
> > #
> > make[1]: Leaving directory '/tmp/rpi3_32b'
> > $ make O=/tmp/rpi3_32b HOSTCC=clang-10 CROSS_COMPILE=~/.buildman-toolchains/gcc-9.2.0-nolibc/arm-linux-gnueabi/bin/arm-linux-gnueabi-
> > make[1]: Entering directory '/tmp/rpi3_32b'
> >   GEN     ./Makefile
> > scripts/kconfig/conf  --syncconfig Kconfig
> >   UPD     include/config.h
> >   CFG     u-boot.cfg
> > ...
> >
> >
> > So we're getting syncconfig run and CC-related changes are caught.
> 
> 
> This is because you changed the environment variable, $(CC).
> 
> 
> I meant the situation, "the compiler version is updated
> without changing the installation path".
> 
> 
> I think this does not happen quite often, but I assumed the
> following scenario.
> 
> - "apt-get upgrade" will upgrade distro compilers.
>   The executables in /usr/bin/ are overwritten.
> 
> - If you have cross compilers in $(HOME)/bin etc.,
>   you may want to simply overwrite to upgrade the compilers.
> 
> 
> 
> > For the second commit, since ARCH comes from CONFIG_SYS_ARCH and not the
> > make line/environment, we don't have that problem to start with?
> > Thanks!
> 
> 
> Sorry, I missed ARCH comes from CONFIG_SYS_ARCH in U-Boot.
> That is a difference from Linux.
> 
> 
> 
> arch/*/config.mk define CROSS_COMPILE.
> 
> 
> arch/m68k/config.mk:ifeq ($(CROSS_COMPILE),)
> arch/m68k/config.mk:CROSS_COMPILE := m68k-elf-
> arch/microblaze/config.mk:ifeq ($(CROSS_COMPILE),)
> arch/microblaze/config.mk:CROSS_COMPILE := mb-
> arch/nds32/config.mk:ifeq ($(CROSS_COMPILE),)
> arch/nds32/config.mk:CROSS_COMPILE := nds32le-linux-
> arch/nios2/config.mk:ifeq ($(CROSS_COMPILE),)
> arch/nios2/config.mk:CROSS_COMPILE := nios2-elf-
> arch/powerpc/config.mk:ifeq ($(CROSS_COMPILE),)
> arch/powerpc/config.mk:CROSS_COMPILE := ppc_8xx-
> arch/powerpc/config.mk:ifeq ($(CROSS_COMPILE),powerpc-netbsd-)
> arch/powerpc/config.mk:ifeq ($(CROSS_COMPILE),powerpc-openbsd-)
> arch/sh/config.mk:ifeq ($(CROSS_COMPILE),)
> arch/sh/config.mk:CROSS_COMPILE := sh4-linux-
> arch/x86/cpu/config.mk:CROSS_COMPILE ?= i386-linux-
> arch/xtensa/config.mk:CROSS_COMPILE ?= xtensa-linux-
> 
> 
> 
> If you apply patch, you cannot support
> CROSS_COMPILE defines in arch/*/config.mk
> 
> 
> 
> U-Boot determines SYS_ARCH from Kconfig.
> After Kconfig, the build system can include
> the correct arch/*/config.mk, but it is too late
> to pick up CROSS_COMPILE.

Ah, hmm, well, lets see what people say about dropping those lines.
Thanks!
diff mbox series

Patch

diff --git a/Kconfig b/Kconfig
index 15f1a75c61ab..72b4439264a6 100644
--- a/Kconfig
+++ b/Kconfig
@@ -5,6 +5,8 @@ 
 #
 mainmenu "U-Boot $(UBOOTVERSION) Configuration"
 
+source "scripts/Kconfig.include"
+
 # Allow defaults in arch-specific code to override any given here
 source "arch/Kconfig"
 
diff --git a/scripts/Kconfig.include b/scripts/Kconfig.include
new file mode 100644
index 000000000000..dad5583451af
--- /dev/null
+++ b/scripts/Kconfig.include
@@ -0,0 +1,30 @@ 
+# Kconfig helper macros
+
+# Convenient variables
+comma       := ,
+quote       := "
+squote      := '
+empty       :=
+space       := $(empty) $(empty)
+dollar      := $
+right_paren := )
+left_paren  := (
+
+# $(if-success,<command>,<then>,<else>)
+# Return <then> if <command> exits with 0, <else> otherwise.
+if-success = $(shell,{ $(1); } >/dev/null 2>&1 && echo "$(2)" || echo "$(3)")
+
+# $(success,<command>)
+# Return y if <command> exits with 0, n otherwise
+success = $(if-success,$(1),y,n)
+
+# $(cc-option,<flag>)
+# Return y if the compiler supports <flag>, n otherwise
+cc-option = $(success,$(CC) -Werror $(1) -E -x c /dev/null -o /dev/null)
+
+# $(ld-option,<flag>)
+# Return y if the linker supports <flag>, n otherwise
+ld-option = $(success,$(LD) -v $(1))
+
+# gcc version including patch level
+gcc-version := $(shell,$(srctree)/scripts/gcc-version.sh -p $(CC) | sed 's/^0*//')