infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
################################################################################
|
|
|
|
# Kconfig package infrastructure
|
|
|
|
#
|
|
|
|
# This file implements an infrastructure that eases development of
|
|
|
|
# package .mk files for packages that use kconfig for configuration files.
|
|
|
|
# It is based on the generic-package infrastructure, and inherits all of its
|
|
|
|
# features.
|
|
|
|
#
|
|
|
|
# See the Buildroot documentation for details on the usage of this
|
|
|
|
# infrastructure.
|
|
|
|
#
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# inner-kconfig-package -- generates the make targets needed to support a
|
|
|
|
# kconfig package
|
|
|
|
#
|
|
|
|
# argument 1 is the lowercase package name
|
|
|
|
# argument 2 is the uppercase package name, including a HOST_ prefix
|
|
|
|
# for host packages
|
|
|
|
# argument 3 is the uppercase package name, without the HOST_ prefix
|
|
|
|
# for host packages
|
|
|
|
# argument 4 is the type (target or host)
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
define inner-kconfig-package
|
|
|
|
|
|
|
|
# Call the generic package infrastructure to generate the necessary
|
|
|
|
# make targets.
|
|
|
|
# Note: this must be done _before_ attempting to use $$($(2)_DIR) in a
|
|
|
|
# dependency expression
|
|
|
|
$(call inner-generic-package,$(1),$(2),$(3),$(4))
|
|
|
|
|
|
|
|
# Default values
|
|
|
|
$(2)_KCONFIG_EDITORS ?= menuconfig
|
2014-09-27 21:32:47 +02:00
|
|
|
$(2)_KCONFIG_OPTS ?=
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
$(2)_KCONFIG_FIXUP_CMDS ?=
|
2015-04-28 16:34:31 +02:00
|
|
|
$(2)_KCONFIG_FRAGMENT_FILES ?=
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
|
2015-06-13 18:46:33 +02:00
|
|
|
# The config file as well as the fragments could be in-tree, so before
|
core/pkg-kconfig: ensure kconfig base and fragment files exist
Even though we do have a dependency chain back to each of the kconfig
base and fragment files:
$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
we can't rely on it to ensure they are all present, because they all have
this rule:
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
but since this rule has no prerequisite (only build-order, but that does
not count in this case) and no recipe, make will believe each missing
file to be a PHONY target, and will always run targets that depend on
it:
https://www.gnu.org/software/make/manual/make.html#Force-Targets
So, that means a missing kconfig base or fragment file would always
cause the rule to generate .config to be run at each invocation, which
in turn would cause a rebuild of the kernel, which is clearly not what
we want.
Since this is expected make behaviour, we can well end up with a missing
Kconfig base or fragment. To avoid continuously rebuilding the kernel in
that case, we must check those files exist by ourselves, and error out
if any one of them is missing.
One would expect we check for them right in their dependency rule, like
so:
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
[ -f $(@) ] || {echo Missing $(@) >&2; exit 1; }
but that does not work, as only the first target is tested for. That
check msut be turned into a loop explicitly testing all files, like so:
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
for f in $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES); do \
[ -f $(@) ] || {echo Missing $$$${f} >&2; exit 1; }; \
done
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Floris Bos <bos@je-eigen-domein.nl>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-06-13 18:46:34 +02:00
|
|
|
# depending on them the package should be extracted (and patched) first.
|
|
|
|
#
|
|
|
|
# Since those files only have a order-only dependency, make would treat
|
|
|
|
# any missing one as a "force" target:
|
|
|
|
# https://www.gnu.org/software/make/manual/make.html#Force-Targets
|
|
|
|
# and would forcibly any rule that depend on those files, causing a
|
|
|
|
# rebuild of the kernel each time make is called.
|
|
|
|
#
|
|
|
|
# So, we provide a recipe that checks all of those files exist, to
|
|
|
|
# overcome that standard make behaviour.
|
|
|
|
#
|
2015-06-13 18:46:33 +02:00
|
|
|
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
|
core/pkg-kconfig: ensure kconfig base and fragment files exist
Even though we do have a dependency chain back to each of the kconfig
base and fragment files:
$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
we can't rely on it to ensure they are all present, because they all have
this rule:
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
but since this rule has no prerequisite (only build-order, but that does
not count in this case) and no recipe, make will believe each missing
file to be a PHONY target, and will always run targets that depend on
it:
https://www.gnu.org/software/make/manual/make.html#Force-Targets
So, that means a missing kconfig base or fragment file would always
cause the rule to generate .config to be run at each invocation, which
in turn would cause a rebuild of the kernel, which is clearly not what
we want.
Since this is expected make behaviour, we can well end up with a missing
Kconfig base or fragment. To avoid continuously rebuilding the kernel in
that case, we must check those files exist by ourselves, and error out
if any one of them is missing.
One would expect we check for them right in their dependency rule, like
so:
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
[ -f $(@) ] || {echo Missing $(@) >&2; exit 1; }
but that does not work, as only the first target is tested for. That
check msut be turned into a loop explicitly testing all files, like so:
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
for f in $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES); do \
[ -f $(@) ] || {echo Missing $$$${f} >&2; exit 1; }; \
done
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Floris Bos <bos@je-eigen-domein.nl>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-06-13 18:46:34 +02:00
|
|
|
for f in $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES); do \
|
|
|
|
if [ ! -f "$$$${f}" ]; then \
|
|
|
|
printf "Kconfig fragment '%s' for '%s' does not exist\n" "$$$${f}" "$(1)"; \
|
|
|
|
exit 1; \
|
|
|
|
fi; \
|
|
|
|
done
|
2015-02-03 15:21:41 +01:00
|
|
|
|
2015-04-28 16:34:31 +02:00
|
|
|
# The specified source configuration file and any additional configuration file
|
|
|
|
# fragments are merged together to .config, after the package has been patched.
|
2015-02-03 15:21:42 +01:00
|
|
|
# Since the file could be a defconfig file it needs to be expanded to a
|
|
|
|
# full .config first. We use 'make oldconfig' because this can be safely
|
|
|
|
# done even when the package does not support defconfigs.
|
2015-04-28 16:34:31 +02:00
|
|
|
$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
|
|
|
|
support/kconfig/merge_config.sh -m -O $$(@D) \
|
|
|
|
$$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
|
2015-02-03 15:21:42 +01:00
|
|
|
@yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
|
|
|
|
$$($(2)_KCONFIG_OPTS) oldconfig
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
|
|
|
|
# In order to get a usable, consistent configuration, some fixup may be needed.
|
|
|
|
# The exact rules are specified by the package .mk file.
|
2015-06-13 18:46:35 +02:00
|
|
|
define $(2)_FIXUP_DOT_CONFIG
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
$$($(2)_KCONFIG_FIXUP_CMDS)
|
infra/pkg-kconfig: incorporate oldconfig call to avoid endless rebuilds
The configure step of the busybox package performs 'make oldconfig', which
causes the .config file to be updated. Thus, the .config file is more recent
than our stamp file .stamp_kconfig_fixup_done. On a subsequent build, our
dependency rules would kick in, and run the config fixup again, thus
kicking in the package's configure, build and install steps yet once
more, that, ad infinitum.
One solution is to modify kconfig-package to introduce an explicit touch of
the .kconfig_fixup_config_done stamp file, as post-configure hook.
Another solution, implemented by this patch, is to move the oldconfig call
from the package's .mk file to the kconfig-package infrastructure and make
sure it is done as part of the fixup commands. This way, the stamp file will
only be touched once, after the full fixup (including oldconfig) and no
endless rebuilds will occur.
Reported-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Suggested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Acked-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-05 12:36:53 +02:00
|
|
|
@yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
|
2014-09-27 21:32:47 +02:00
|
|
|
$$($(2)_KCONFIG_OPTS) oldconfig
|
2015-06-13 18:46:35 +02:00
|
|
|
$$(Q)touch $$($(2)_DIR)/.stamp_kconfig_fixup_done
|
|
|
|
endef
|
|
|
|
|
|
|
|
$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config
|
|
|
|
$$(call $(2)_FIXUP_DOT_CONFIG)
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
|
|
|
|
# Before running configure, the configuration file should be present and fixed
|
|
|
|
$$($(2)_TARGET_CONFIGURE): $$($(2)_DIR)/.stamp_kconfig_fixup_done
|
|
|
|
|
2015-02-03 15:21:45 +01:00
|
|
|
# Only enable the foo-*config targets when the package is actually enabled.
|
|
|
|
# Note: the variable $(2)_KCONFIG_VAR is not related to the kconfig
|
|
|
|
# infrastructure, but defined by pkg-generic.mk. The generic infrastructure is
|
|
|
|
# already called above, so we can effectively use this variable.
|
|
|
|
ifeq ($$($$($(2)_KCONFIG_VAR)),y)
|
|
|
|
|
2015-04-08 19:08:34 +02:00
|
|
|
# FOO_KCONFIG_FILE is required
|
2015-07-13 12:31:58 +02:00
|
|
|
ifeq ($$(BR_BUILDING),y)
|
2015-04-08 19:08:35 +02:00
|
|
|
ifeq ($$($(2)_KCONFIG_FILE),)
|
2015-04-08 19:08:34 +02:00
|
|
|
$$(error Internal error: no value specified for $(2)_KCONFIG_FILE)
|
|
|
|
endif
|
2015-07-13 12:31:58 +02:00
|
|
|
endif
|
2015-04-08 19:08:34 +02:00
|
|
|
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
# Configuration editors (menuconfig, ...)
|
2015-06-13 18:46:36 +02:00
|
|
|
#
|
core/pkg-kconfig: allow saving config to a non-existing custom config file
A very interesting use-case for a kconfig-based package is to create a
custom (def)config file based on one bundled with the package itself,
like described in PR-8156:
make menuconfig
-> enable kernel, use an in-tree defconfig, save and exit
make linux-menuconfig
-> enable/disable whatever option, save and exit
make menuconfig
-> change to use a custom defconfig file, set a path, save and exit
make linux-update-config
-> should save to the new custom defconfig file
However, that is currently not possible, because the dependency chain
when saving the configuration goes back up to the (newly-set!) custom
(def)config file, which does not exist.
So, we break the dependency chain so that saving the configuration does
not depend on that file. Instead, we use a terminal rule that checks
that the configuration has indeed been done, and fails if not.
Closes #8156.
Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-06-13 18:46:37 +02:00
|
|
|
# We need to apply the configuration fixups right after a configuration
|
|
|
|
# editor exits, so that it is possible to save the configuration right
|
|
|
|
# after exiting an editor, and so the user always sees a .config file
|
|
|
|
# that is clean wrt. our requirements.
|
2015-06-13 18:46:36 +02:00
|
|
|
#
|
|
|
|
# Because commands in $(1)_FIXUP_KCONFIG are probably using $(@D), we
|
|
|
|
# fake it for the configurators (otherwise it is set to just '.', i.e.
|
|
|
|
# the current directory where make is run, which happens to be in
|
|
|
|
# $(TOPDIR), because the target of the rule is not an actual file, so
|
|
|
|
# does not have any path component).
|
|
|
|
#
|
|
|
|
$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): @D=$$($(2)_DIR)
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_done
|
|
|
|
$$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
|
2014-09-27 21:32:47 +02:00
|
|
|
$$($(2)_KCONFIG_OPTS) $$(subst $(1)-,,$$@)
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built}
|
2015-02-03 15:21:44 +01:00
|
|
|
rm -f $$($(2)_DIR)/.stamp_{target,staging,images}_installed
|
2015-06-13 18:46:36 +02:00
|
|
|
$$(call $(2)_FIXUP_DOT_CONFIG)
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
|
core/pkg-kconfig: allow saving config to a non-existing custom config file
A very interesting use-case for a kconfig-based package is to create a
custom (def)config file based on one bundled with the package itself,
like described in PR-8156:
make menuconfig
-> enable kernel, use an in-tree defconfig, save and exit
make linux-menuconfig
-> enable/disable whatever option, save and exit
make menuconfig
-> change to use a custom defconfig file, set a path, save and exit
make linux-update-config
-> should save to the new custom defconfig file
However, that is currently not possible, because the dependency chain
when saving the configuration goes back up to the (newly-set!) custom
(def)config file, which does not exist.
So, we break the dependency chain so that saving the configuration does
not depend on that file. Instead, we use a terminal rule that checks
that the configuration has indeed been done, and fails if not.
Closes #8156.
Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-06-13 18:46:37 +02:00
|
|
|
# Saving back the configuration
|
|
|
|
#
|
|
|
|
# Ideally, that should directly depend on $$($(2)_DIR)/.stamp_kconfig_fixup_done,
|
|
|
|
# but that breaks the use-case in PR-8156 (from a clean tree):
|
|
|
|
# make menuconfig <- enable kernel, use an in-tree defconfig, save and exit
|
|
|
|
# make linux-menuconfig <- enable/disable whatever option, save and exit
|
|
|
|
# make menuconfig <- change to use a custom defconfig file, set a path, save and exit
|
|
|
|
# make linux-update-config <- should save to the new custom defconfig file
|
|
|
|
#
|
|
|
|
# Because of that use-case, saving the configuration can *not* directly
|
|
|
|
# depend on the stamp file, because it itself depends on the .config,
|
|
|
|
# which in turn depends on the (newly-set an non-existent) custom
|
|
|
|
# defconfig file.
|
|
|
|
#
|
|
|
|
# Instead, we use an PHONY rule that will catch that situation.
|
|
|
|
#
|
|
|
|
$(1)-check-configuration-done:
|
|
|
|
@if [ ! -f $$($(2)_DIR)/.stamp_kconfig_fixup_done ]; then \
|
|
|
|
echo "$(1) is not yet configured"; \
|
|
|
|
exit 1; \
|
|
|
|
fi
|
|
|
|
|
|
|
|
$(1)-savedefconfig: $(1)-check-configuration-done
|
2015-02-03 15:21:42 +01:00
|
|
|
$$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
|
|
|
|
$$($(2)_KCONFIG_OPTS) savedefconfig
|
|
|
|
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
# Target to copy back the configuration to the source configuration file
|
2015-02-03 15:21:43 +01:00
|
|
|
# Even though we could use 'cp --preserve-timestamps' here, the separate
|
|
|
|
# cp and 'touch --reference' is used for symmetry with $(1)-update-defconfig.
|
core/pkg-kconfig: allow saving config to a non-existing custom config file
A very interesting use-case for a kconfig-based package is to create a
custom (def)config file based on one bundled with the package itself,
like described in PR-8156:
make menuconfig
-> enable kernel, use an in-tree defconfig, save and exit
make linux-menuconfig
-> enable/disable whatever option, save and exit
make menuconfig
-> change to use a custom defconfig file, set a path, save and exit
make linux-update-config
-> should save to the new custom defconfig file
However, that is currently not possible, because the dependency chain
when saving the configuration goes back up to the (newly-set!) custom
(def)config file, which does not exist.
So, we break the dependency chain so that saving the configuration does
not depend on that file. Instead, we use a terminal rule that checks
that the configuration has indeed been done, and fails if not.
Closes #8156.
Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-06-13 18:46:37 +02:00
|
|
|
$(1)-update-config: $(1)-check-configuration-done
|
2015-04-28 16:34:31 +02:00
|
|
|
@$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
|
|
|
|
echo "Unable to perform $(1)-update-config when fragment files are set"; exit 1)
|
2015-02-03 15:21:43 +01:00
|
|
|
cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
|
|
|
|
touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
|
2015-02-03 15:21:42 +01:00
|
|
|
# Note: make sure the timestamp of the stored configuration is not newer than
|
|
|
|
# the .config to avoid a useless rebuild. Note that, contrary to
|
|
|
|
# $(1)-update-config, the reference for 'touch' is _not_ the file from which
|
|
|
|
# we copy.
|
|
|
|
$(1)-update-defconfig: $(1)-savedefconfig
|
2015-04-28 16:34:31 +02:00
|
|
|
@$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
|
|
|
|
echo "Unable to perform $(1)-update-defconfig when fragment files are set"; exit 1)
|
2015-02-03 15:21:42 +01:00
|
|
|
cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
|
|
|
|
touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
|
|
|
|
|
2015-02-03 15:21:45 +01:00
|
|
|
endif # package enabled
|
|
|
|
|
2015-04-12 18:37:45 +02:00
|
|
|
.PHONY: \
|
|
|
|
$(1)-update-config \
|
|
|
|
$(1)-update-defconfig \
|
|
|
|
$(1)-savedefconfig \
|
core/pkg-kconfig: allow saving config to a non-existing custom config file
A very interesting use-case for a kconfig-based package is to create a
custom (def)config file based on one bundled with the package itself,
like described in PR-8156:
make menuconfig
-> enable kernel, use an in-tree defconfig, save and exit
make linux-menuconfig
-> enable/disable whatever option, save and exit
make menuconfig
-> change to use a custom defconfig file, set a path, save and exit
make linux-update-config
-> should save to the new custom defconfig file
However, that is currently not possible, because the dependency chain
when saving the configuration goes back up to the (newly-set!) custom
(def)config file, which does not exist.
So, we break the dependency chain so that saving the configuration does
not depend on that file. Instead, we use a terminal rule that checks
that the configuration has indeed been done, and fails if not.
Closes #8156.
Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Thomas De Schampheleire <patrickdepinguin@gmail.com>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2015-06-13 18:46:37 +02:00
|
|
|
$(1)-check-configuration-done \
|
2015-04-12 18:37:45 +02:00
|
|
|
$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS))
|
|
|
|
|
infra: introduce a kconfig-package infrastructure
There are several packages that have a configuration file managed by
kconfig: uclibc, busybox, linux and barebox. All these packages need some
make targets to handle the kconfig specificities: creating a configuration
(menuconfig, ...) and saving it back (update-config, ...)
These targets should be the same for each of these packages, but
unfortunately they are not. Especially with respect to saving back the
configuration to the original config file, there are many differences.
A previous set of patches fixed these targets for the uclibc package.
This patch extracts these targets into a common kconfig-package
infrastructure, with the goals of:
- aligning the behavior of all kconfig-based packages
- removing code duplication
In order to use this infrastructure, a package should at a minimum specify
FOO_KCONFIG_FILE and eval the kconfig-package macro. The supported
configuration editors can be set with FOO_KCONFIG_EDITORS and defaults to
menuconfig only.
Additionally, a package can specify FOO_KCONFIG_OPT for extra options to
pass to the invocation of the kconfig editors, and FOO_KCONFIG_FIXUP_CMDS
for a list of shell commands used to fixup the .config file after a
configuration has been created/edited.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
[yann.morin.1998@free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
2014-08-03 17:32:40 +02:00
|
|
|
endef # inner-kconfig-package
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# kconfig-package -- the target generator macro for kconfig packages
|
|
|
|
################################################################################
|
|
|
|
|
|
|
|
kconfig-package = $(call inner-kconfig-package,$(pkgname),$(call UPPERCASE,$(pkgname)),$(call UPPERCASE,$(pkgname)),target)
|