Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] linux: kconfig needs the toolchain
@ 2018-07-31 20:16 Yann E. MORIN
  2018-07-31 22:21 ` Arnout Vandecappelle
  0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2018-07-31 20:16 UTC (permalink / raw)
  To: buildroot

Starting with linux-4.18, the kconfig from the kernel can call
to the compiler to test its capabilities; see:

    https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/Kconfig.include

Like is done in the kconfig-package infra for the dependency on
$(1)-patch, we use an order-only prerequisites on the toolchain,
to guarantee the compiler is available before we can display the
kconfig of the kernel.

Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
Cc: Arnout Vandecappelle <arnout@mind.be>
---
 linux/linux.mk | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/linux/linux.mk b/linux/linux.mk
index 7527b11673..63c649ce83 100644
--- a/linux/linux.mk
+++ b/linux/linux.mk
@@ -510,6 +510,13 @@ endif # BR_BUILDING
 
 $(eval $(kconfig-package))
 
+# Starting with linux-4.18, the kconfig in the kernel calls
+# the cross-compiler to check its capabilities. So we need
+# the toolchain before we can call our configurators.
+# Also, since we need LINUX_DIR, we must be after the call
+# to kconfig-package, above.
+$(LINUX_DIR)/.config: | toolchain
+
 # Support for rebuilding the kernel after the cpio archive has
 # been generated.
 .PHONY: linux-rebuild-with-initramfs
-- 
2.14.1

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

* [Buildroot] [PATCH] linux: kconfig needs the toolchain
  2018-07-31 20:16 [Buildroot] [PATCH] linux: kconfig needs the toolchain Yann E. MORIN
@ 2018-07-31 22:21 ` Arnout Vandecappelle
  2018-08-01  6:35   ` Thomas Petazzoni
  2018-08-01 15:39   ` Yann E. MORIN
  0 siblings, 2 replies; 6+ messages in thread
From: Arnout Vandecappelle @ 2018-07-31 22:21 UTC (permalink / raw)
  To: buildroot



On 31-07-18 22:16, Yann E. MORIN wrote:
> Starting with linux-4.18, the kconfig from the kernel can call
> to the compiler to test its capabilities; see:
> 
>     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/Kconfig.include
> 
> Like is done in the kconfig-package infra for the dependency on
> $(1)-patch, we use an order-only prerequisites on the toolchain,
> to guarantee the compiler is available before we can display the
> kconfig of the kernel.
 You actually want to say here why an order-only dependency and not a normal
dependency: "Since 'toolchain' is a phony target and therefore always out of
date, a normal dependency would cause the .config target to be rebuilt on each
invocation of make."

> 
> Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> Cc: Arnout Vandecappelle <arnout@mind.be>
> ---
>  linux/linux.mk | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/linux/linux.mk b/linux/linux.mk
> index 7527b11673..63c649ce83 100644
> --- a/linux/linux.mk
> +++ b/linux/linux.mk
> @@ -510,6 +510,13 @@ endif # BR_BUILDING
>  
>  $(eval $(kconfig-package))
>  
> +# Starting with linux-4.18, the kconfig in the kernel calls
> +# the cross-compiler to check its capabilities. So we need
> +# the toolchain before we can call our configurators.
> +# Also, since we need LINUX_DIR, we must be after the call
> +# to kconfig-package, above.
> +$(LINUX_DIR)/.config: | toolchain

 I think we want to avoid using LINUX_DIR, and instead use LINUX_SRCDIR or
LINUX_BUILDDIR, no? For the eventual source/build directory split?

 Regards,
 Arnout

> +
>  # Support for rebuilding the kernel after the cpio archive has
>  # been generated.
>  .PHONY: linux-rebuild-with-initramfs
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

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

* [Buildroot] [PATCH] linux: kconfig needs the toolchain
  2018-07-31 22:21 ` Arnout Vandecappelle
@ 2018-08-01  6:35   ` Thomas Petazzoni
  2018-08-01 15:48     ` Yann E. MORIN
  2018-08-01 15:39   ` Yann E. MORIN
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Petazzoni @ 2018-08-01  6:35 UTC (permalink / raw)
  To: buildroot

Hello,

On Wed, 1 Aug 2018 00:21:18 +0200, Arnout Vandecappelle wrote:

> > Like is done in the kconfig-package infra for the dependency on
> > $(1)-patch, we use an order-only prerequisites on the toolchain,
> > to guarantee the compiler is available before we can display the
> > kconfig of the kernel.  
>  You actually want to say here why an order-only dependency and not a normal
> dependency: "Since 'toolchain' is a phony target and therefore always out of
> date, a normal dependency would cause the .config target to be rebuilt on each
> invocation of make."

When looking at the patch, my initial reaction was: why is the
dependency on the .config file, rather than on the
-menuconfig/-xconfig/-nconfig/... targets. Those are phony targets, so
a normal dependency would work.

This could even be pushed one level up to the pkg-kconfig
infrastructure, as we're pretty likely to see other packages go down
this route in the future maybe ? Of course, it should be optional.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

* [Buildroot] [PATCH] linux: kconfig needs the toolchain
  2018-07-31 22:21 ` Arnout Vandecappelle
  2018-08-01  6:35   ` Thomas Petazzoni
@ 2018-08-01 15:39   ` Yann E. MORIN
  1 sibling, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2018-08-01 15:39 UTC (permalink / raw)
  To: buildroot

Arnout, All,

On 2018-08-01 00:21 +0200, Arnout Vandecappelle spake thusly:
> On 31-07-18 22:16, Yann E. MORIN wrote:
> > Starting with linux-4.18, the kconfig from the kernel can call
> > to the compiler to test its capabilities; see:
> > 
> >     https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/scripts/Kconfig.include
> > 
> > Like is done in the kconfig-package infra for the dependency on
> > $(1)-patch, we use an order-only prerequisites on the toolchain,
> > to guarantee the compiler is available before we can display the
> > kconfig of the kernel.
>  You actually want to say here why an order-only dependency and not a normal
> dependency: "Since 'toolchain' is a phony target and therefore always out of
> date, a normal dependency would cause the .config target to be rebuilt on each
> invocation of make."

ACK

> > Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> > Cc: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
> > Cc: Arnout Vandecappelle <arnout@mind.be>
> > ---
> >  linux/linux.mk | 7 +++++++
> >  1 file changed, 7 insertions(+)
> > 
> > diff --git a/linux/linux.mk b/linux/linux.mk
> > index 7527b11673..63c649ce83 100644
> > --- a/linux/linux.mk
> > +++ b/linux/linux.mk
> > @@ -510,6 +510,13 @@ endif # BR_BUILDING
> >  
> >  $(eval $(kconfig-package))
> >  
> > +# Starting with linux-4.18, the kconfig in the kernel calls
> > +# the cross-compiler to check its capabilities. So we need
> > +# the toolchain before we can call our configurators.
> > +# Also, since we need LINUX_DIR, we must be after the call
> > +# to kconfig-package, above.
> > +$(LINUX_DIR)/.config: | toolchain
> 
>  I think we want to avoid using LINUX_DIR, and instead use LINUX_SRCDIR or
> LINUX_BUILDDIR, no? For the eventual source/build directory split?

Well, LINUX_DIR is already used below, for the rules doing the rebuild
with the initramfs.

And I don't want to mix-n-match the variables just yet...

But if the consensus from others point toward using LINUX_BUILDDIR, then
I'll change.

Regards,
Yann E. MORIN.

>  Regards,
>  Arnout
> 
> > +
> >  # Support for rebuilding the kernel after the cpio archive has
> >  # been generated.
> >  .PHONY: linux-rebuild-with-initramfs
> > 
> 
> -- 
> Arnout Vandecappelle                          arnout at mind be
> Senior Embedded Software Architect            +32-16-286500
> Essensium/Mind                                http://www.mind.be
> G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
> LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
> GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH] linux: kconfig needs the toolchain
  2018-08-01  6:35   ` Thomas Petazzoni
@ 2018-08-01 15:48     ` Yann E. MORIN
  2018-08-01 21:12       ` Yann E. MORIN
  0 siblings, 1 reply; 6+ messages in thread
From: Yann E. MORIN @ 2018-08-01 15:48 UTC (permalink / raw)
  To: buildroot

Thomas, All,

On 2018-08-01 08:35 +0200, Thomas Petazzoni spake thusly:
> On Wed, 1 Aug 2018 00:21:18 +0200, Arnout Vandecappelle wrote:
> > > Like is done in the kconfig-package infra for the dependency on
> > > $(1)-patch, we use an order-only prerequisites on the toolchain,
> > > to guarantee the compiler is available before we can display the
> > > kconfig of the kernel.  
> >  You actually want to say here why an order-only dependency and not a normal
> > dependency: "Since 'toolchain' is a phony target and therefore always out of
> > date, a normal dependency would cause the .config target to be rebuilt on each
> > invocation of make."
> 
> When looking at the patch, my initial reaction was: why is the
> dependency on the .config file, rather than on the
> -menuconfig/-xconfig/-nconfig/... targets. Those are phony targets, so
> a normal dependency would work.

We need the toolchain to generate the .config file, even in a nromal
build, i.e. not just for the menuconfig et al.

I.e. running 'make clean; make' should also build the toolchain before
the linux configuration, which is part of the kconfig infra.

Agreed that it would not happen in practice, but for theoretical
correctness, it is also needed in this case.

> This could even be pushed one level up to the pkg-kconfig
> infrastructure, as we're pretty likely to see other packages go down
> this route in the future maybe ? Of course, it should be optional.

Well, I also thought about that, but decided against, because we don't
want to generalise a behaviour based on a single case.

As for the configurability, I would have gone with:

    FOO_KCONFIG_NEEDS_CC = YES

because that is actually what it wants currently.

But in the future, it might also want to call 'dtc' to check whether it
supports overlays, or call 'openssl' to check if a cypher is available.
So we'd have to expand this to:

    FOO_KCONFIG_DEPENDENCIES = toolchain host-dtc host-openssl

Or whatev'...

So I'd prefer waiting, and hard-coding that one peculiarity within the
only user so far, the linux kernel.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [PATCH] linux: kconfig needs the toolchain
  2018-08-01 15:48     ` Yann E. MORIN
@ 2018-08-01 21:12       ` Yann E. MORIN
  0 siblings, 0 replies; 6+ messages in thread
From: Yann E. MORIN @ 2018-08-01 21:12 UTC (permalink / raw)
  To: buildroot

Thomas, Arnout, All,

On 2018-08-01 17:48 +0200, Yann E. MORIN spake thusly:
> On 2018-08-01 08:35 +0200, Thomas Petazzoni spake thusly:
> > On Wed, 1 Aug 2018 00:21:18 +0200, Arnout Vandecappelle wrote:
> > > > Like is done in the kconfig-package infra for the dependency on
> > > > $(1)-patch, we use an order-only prerequisites on the toolchain,
> > > > to guarantee the compiler is available before we can display the
> > > > kconfig of the kernel.  
[--SNIP--]
> > This could even be pushed one level up to the pkg-kconfig
> > infrastructure, as we're pretty likely to see other packages go down
> > this route in the future maybe ? Of course, it should be optional.
> 
> Well, I also thought about that, but decided against, because we don't
> want to generalise a behaviour based on a single case.
[--SNIP--]
> So I'd prefer waiting, and hard-coding that one peculiarity within the
> only user so far, the linux kernel.

And now, I changed my mind, seeing that the curent state of oaffairs
with host-flex and host-bison is already broken...

I'll post an updated series that implements this at the kconfig level
soon-ish.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

end of thread, other threads:[~2018-08-01 21:12 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-31 20:16 [Buildroot] [PATCH] linux: kconfig needs the toolchain Yann E. MORIN
2018-07-31 22:21 ` Arnout Vandecappelle
2018-08-01  6:35   ` Thomas Petazzoni
2018-08-01 15:48     ` Yann E. MORIN
2018-08-01 21:12       ` Yann E. MORIN
2018-08-01 15:39   ` Yann E. MORIN

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