core/pkg-kconfig: ensure we have necessary tools to run configurators
v2 cover core/pkg-kconfig: ensure we have necessary tools to run configurators
Hello All!
Recent version of the linux kernel introduced major changes in the kconfig infrastructure.
Starting with linux-4.16, the kconfig parser code is no longer shipped with the linux source tree, and mut be generated from the lex/yacc parser sources.
Similarly, starting with linux-4.18, the kconfig infra allows calling back to the shell to run various commands, especially calling to the compiler to test its features (and hide/show options accordingly).
So, we need to ensure the appropriate tools are available before we attempt to run any of the configurators.
This three-fold series firs introduces the necessary chjanges in the kconfig infrastructure, so that packages can specify dependencies to be built and installed before the configurators are run.
Then, the linux package is fixed to take advantage of that forits dependencies on host-flex and host-bison.
Finally, the linux package is also fixed to guarantee the toolchain is available for the configurators.
Changes v1 -> v2:
- introduce the KCONFIG_DEPENDENCIES in the kconfig-package infra (Thomas)
- change linux to take advantage of that (Thomas)
Regards,
Yann E. MORIN.
The following changes since commit 81ea4a243b63d7bb1fec580910c553af4ae072c1
package/lttng-tools: bump version to 2.10.5 (2018-08-01 14:28:30 +0200)
are available in the git repository at:
git://git.buildroot.org/~ymorin/git/buildroot.git
for you to fetch changes up to c524705de894ee785cb185668ab2d84a48a7218f
linux: kconfig needs the toolchain (2018-08-01 23:20:40 +0200)
----------------------------------------------------------------
Yann E. MORIN (3):
core/pkg-kconfig: allow dependencies before configurators
linux: kconfig needs host-{flex,bison} to build the configurators
linux: kconfig needs the toolchain
docs/manual/adding-packages-kconfig.txt | 4 ++++ linux/linux.mk | 16 +++++++++++++++- package/pkg-kconfig.mk | 9 +++++++++ 3 files changed, 28 insertions(+), 1 deletion(-)
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH v2 1/3 core/pkg-kconfig: allow dependencies before configurators
Some users of kconfig need some packages to be built before their kconfig infra be used.
For example, the linux kernel, starting with 4.16, needs flex and bison to generate the parser code. Furthermore, starting with 4.18, it will also need the cross-compiler before parsing the kconfig stuff, because that calls the compiler to check its features.
Currently, this is broken, even the flex/bison ones, even though they are listed, because there is no way to define dependencie that are guaranteed before the (visual) configurators. For example:
$ make distclean
$ make menuconfig
--> enable the linux kernel, choose a defconfig, save, exit
$ make linux-menuconfig
[...]
HOSTCC scripts/basic/fixdep
HOSTCC scripts/kconfig/conf.o
YACC scripts/kconfig/zconf.tab.c
/bin/sh: bison: command not found
LEX scripts/kconfig/zconf.lex.c
scripts/Makefile.lib:196: recipe for target 'scripts/kconfig/zconf.tab.c' failed
make[3]: *** [scripts/kconfig/zconf.tab.c] Error 127
make[3]: *** Waiting for unfinished jobs....
/bin/sh: flex: command not found
scripts/Makefile.lib:188: recipe for target 'scripts/kconfig/zconf.lex.c' failed
make[3]: *** [scripts/kconfig/zconf.lex.c] Error 127
Makefile:528: recipe for target 'rpc_defconfig' failed
make[2]: *** [rpc_defconfig] Error 2
linux/linux.mk:511: recipe for target '/home/ymorin/dev/buildroot/buildroot/output/build/linux-4.17.11/.config' failed
make[1]: *** [/home/ymorin/dev/buildroot/buildroot/output/build/linux-4.17.11/.config] Error 2
Makefile:79: recipe for target '_all' failed
make: *** [_all] Error 2So, we introduce a new type of dependencies for kconfig-based packages, that are guaranteed to be built and installed before the (visual) configurators are called.
Since those dependencies are phony targets and therefore always out of date, a normal dependency would cause the .config target to be rebuilt on each invocation of make. So we use an order-only pre-requisite, like is done for the patch dependency.
--- docs/manual/adding-packages-kconfig.txt | 4 ++++ package/pkg-kconfig.mk | 9 +++++++++ 2 files changed, 13 insertions(+)
docs/manual/adding-packages-kconfig.txt +4 -0
@@ -81,3 +81,7 @@ be set to suit the needs of the package under consideration: be well suited for all packages that use the standard kconfig infrastructure as inherited from the Linux kernel; some packages use a derivative of kconfig that use a different location. + +* +FOO_KCONFIG_DEPENDENCIES+: the list of packages (most probably, host + packages) that need to be built before this package's kconfig is + interpreted. Seldom used. By default, empty.
package/pkg-kconfig.mk +9 -0
@@ -41,6 +41,10 @@ endef define inner-kconfig-package +# Register the kconfig dependencies as regular dependencies, so that +# they are also accounted for in the generated graphs. +$(2)_DEPENDENCIES += $$($(2)_KCONFIG_DEPENDENCIES) + # Call the generic package infrastructure to generate the necessary # make targets. # Note: this must be done _before_ attempting to use $$($(2)_DIR) in a
@@ -121,6 +125,11 @@ $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_F # it explicitly. It doesn't hurt to always have it though. $$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $(1)-patch +# Some packages may need additional tools to be present by the time their +# kconfig structure is parsed (e.g. the linux kernel may need to call to +# the compiler to test its features). +$$($(2)_DIR)/$$($(2)_KCONFIG_DOTCONFIG): | $$($(2)_KCONFIG_DEPENDENCIES) + # In order to get a usable, consistent configuration, some fixup may be needed. # The exact rules are specified by the package .mk file. define $(2)_FIXUP_DOT_CONFIG
Signature · 1 line
2.14.1
PATCH v2 2/3 linux: kconfig needs host-{flex, bison} to build the configurators
In reply to Yann E. MORIN--- linux/linux.mk | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
linux/linux.mk +5 -1
@@ -62,7 +62,11 @@ LINUX_PATCHES = $(call qstrip,$(BR2_LINUX_KERNEL_PATCH)) LINUX_PATCH = $(filter ftp://% http://% https://%,$(LINUX_PATCHES)) LINUX_INSTALL_IMAGES = YES -LINUX_DEPENDENCIES += host-bison host-flex host-kmod +LINUX_DEPENDENCIES += host-kmod + +# Starting with 4.16, the generated kconfig code is no longer +# shipped with the kernel sources, so we need flex and bison. +LINUX_KCONFIG_DEPENDENCIES = host-bison host-flex # host tools needed for kernel compression ifeq ($(BR2_LINUX_KERNEL_LZ4),y)
Signature · 1 line
2.14.1
PATCH v2 3/3 linux: kconfig needs the toolchain
In reply to Yann E. MORINStarting 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
---
Changes v1 -> v2:
- take advantage of the kconfig-package infra (Thomas)
--- linux/linux.mk | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
linux/linux.mk +11 -1
@@ -66,7 +66,10 @@ LINUX_DEPENDENCIES += host-kmod # Starting with 4.16, the generated kconfig code is no longer # shipped with the kernel sources, so we need flex and bison. -LINUX_KCONFIG_DEPENDENCIES = host-bison host-flex +# Starting with 4.18, the kconfig in the kernel calls the +# cross-compiler to check its capabilities. So we need the +# toolchain before we can call the configurators. +LINUX_KCONFIG_DEPENDENCIES = host-bison host-flex toolchain # host tools needed for kernel compression ifeq ($(BR2_LINUX_KERNEL_LZ4),y)
@@ -514,6 +517,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
Signature · 1 line
2.14.1