* [Buildroot] [PATCH 0 of 5 v3] Introduction of kconfig-package
@ 2014-08-01 19:53 Thomas De Schampheleire
2014-08-01 19:53 ` [Buildroot] [PATCH 1 of 5 v3] uclibc: fixup config before calling menuconfig Thomas De Schampheleire
` (4 more replies)
0 siblings, 5 replies; 10+ messages in thread
From: Thomas De Schampheleire @ 2014-08-01 19:53 UTC (permalink / raw)
To: buildroot
This patch series introduces a kconfig-package infrastructure and already
converts the uclibc and busybox packages.
I believe this series is complete in the sense that it could be applied as
one whole, not yet including the conversion of linux and barebox.
In a subsequent series, linux and barebox can be converted to
kconfig-package too, but there will need to be some changes to
kconfig-package to support them.
One particular difference with uclibc/busybox is that linux/barebox use a
different method to copy the original config file: instead of simply copying
it to build_dir/.config, it is first copied to arch/.../buildroot_defconfig
and then 'make ... buildroot_defconfig' is called. I'm considering in adding
a FOO_KCONFIG_INSTALL_CONFIG_CMDS variable to support this, which defaults
to the simple copy used by busybox/uclibc, but can be overwritten
appropriately by linux and barebox.
Anyway, this part is not yet ready and will only be available for 2014.11.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
Thomas De Schampheleire (5)
uclibc: fixup config before calling menuconfig
infra: introduce a kconfig-package infrastructure
manual: add documentation for kconfig-package
uclibc: convert to kconfig-package infrastructure
busybox: convert to kconfig-package infrastructure
docs/manual/adding-packages-kconfig.txt | 56 +++++++++++++++++
docs/manual/adding-packages.txt | 2 +
package/Makefile.in | 1 +
package/busybox/busybox.mk | 25 ++----
package/pkg-kconfig.mk | 82 +++++++++++++++++++++++++
package/uclibc/uclibc.mk | 35 +++-------
6 files changed, 161 insertions(+), 40 deletions(-)
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 1 of 5 v3] uclibc: fixup config before calling menuconfig
2014-08-01 19:53 [Buildroot] [PATCH 0 of 5 v3] Introduction of kconfig-package Thomas De Schampheleire
@ 2014-08-01 19:53 ` Thomas De Schampheleire
2014-08-03 7:50 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 2 of 5 v3] infra: introduce a kconfig-package infrastructure Thomas De Schampheleire
` (3 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Thomas De Schampheleire @ 2014-08-01 19:53 UTC (permalink / raw)
To: buildroot
The uclibc-menuconfig command is currently run based on the user-specified
config file, while the fixup of the config file is done afterwards.
However, it makes more sense to do an initial fixup _before_ running
menuconfig, so that the options presented to the user are consistent with
the final configuration.
This patch changes the dependency of the menuconfig target from .config to
.stamp_config_fixup_done to achieve this.
Suggested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
v3: new patch
package/uclibc/uclibc.mk | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff -r 892938e37055 -r 8fc7b26a4914 package/uclibc/uclibc.mk
--- a/package/uclibc/uclibc.mk Mon Apr 28 06:58:48 2014 +0200
+++ b/package/uclibc/uclibc.mk Fri Aug 01 21:22:29 2014 +0200
@@ -542,7 +542,7 @@
$(UCLIBC_TARGET_CONFIGURE): $(UCLIBC_DIR)/.stamp_config_fixup_done
-uclibc-menuconfig: $(UCLIBC_DIR)/.config
+uclibc-menuconfig: $(UCLIBC_DIR)/.stamp_config_fixup_done
$(MAKE) -C $(UCLIBC_DIR) \
$(UCLIBC_MAKE_FLAGS) \
PREFIX=$(STAGING_DIR) \
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 2 of 5 v3] infra: introduce a kconfig-package infrastructure
2014-08-01 19:53 [Buildroot] [PATCH 0 of 5 v3] Introduction of kconfig-package Thomas De Schampheleire
2014-08-01 19:53 ` [Buildroot] [PATCH 1 of 5 v3] uclibc: fixup config before calling menuconfig Thomas De Schampheleire
@ 2014-08-01 19:53 ` Thomas De Schampheleire
2014-08-03 8:14 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 3 of 5 v3] manual: add documentation for kconfig-package Thomas De Schampheleire
` (2 subsequent siblings)
4 siblings, 1 reply; 10+ messages in thread
From: Thomas De Schampheleire @ 2014-08-01 19:53 UTC (permalink / raw)
To: buildroot
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>
---
v3:
- let menuconfig depend on the fixup rule, rather than on .config only
(Yann)
v2:
- fold comments into this patch
- inherit from generic-package instead of sitting alongside of it (ThomasP)
Notes:
- the issue with MAKE_OPT vs MAKE_OPTS has been worked around currently
by not relying on any MAKE_OPT(S) but instead requiring the package to add
the necessary variable to FOO_KCONFIG_OPT.
However, I still believe we should create a consistent set here, either
MAKE_OPT or MAKE_OPTS, and the same for CONFIGURE_OPT(S), but this is now no
longer related to the introduction of kconfig-package.
- the targets in this patch are sufficient to handle uclibc and busybox.
For linux and barebox, some changes will be needed, but for clarity this
will be added later.
package/Makefile.in | 1 +
package/pkg-kconfig.mk | 80 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 81 insertions(+), 0 deletions(-)
diff -r 8fc7b26a4914 -r e56a7788b2d0 package/Makefile.in
--- a/package/Makefile.in Fri Aug 01 21:22:29 2014 +0200
+++ b/package/Makefile.in Mon Jun 30 21:08:13 2014 +0200
@@ -390,3 +390,4 @@
include package/pkg-python.mk
include package/pkg-virtual.mk
include package/pkg-generic.mk
+include package/pkg-kconfig.mk
diff -r 8fc7b26a4914 -r e56a7788b2d0 package/pkg-kconfig.mk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/package/pkg-kconfig.mk Mon Jun 30 21:08:13 2014 +0200
@@ -0,0 +1,82 @@
+################################################################################
+# 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
+$(2)_KCONFIG_OPT ?=
+$(2)_KCONFIG_FIXUP_CMDS ?=
+
+# FOO_KCONFIG_FILE is required
+
+ifndef $(2)_KCONFIG_FILE
+$$(error Internal error: no value specified for $(2)_KCONFIG_FILE)
+endif
+
+# The .config file is obtained by copying it from the specified source
+# configuration file, after the package has been patched.
+
+$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE) | $(1)-patch
+ $$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config
+
+# In order to get a usable, consistent configuration, some fixup may be needed.
+# The exact rules are specified by the package .mk file.
+
+$$($(2)_DIR)/.stamp_kconfig_fixup_done: $$($(2)_DIR)/.config
+ $$($(2)_KCONFIG_FIXUP_CMDS)
+ $$(Q)touch $$@
+
+# Before running configure, the configuration file should be present and fixed
+
+$$($(2)_TARGET_CONFIGURE): $$($(2)_DIR)/.stamp_kconfig_fixup_done
+
+# Configuration editors (menuconfig, ...)
+
+$$(addprefix $(1)-,$$($(2)_KCONFIG_EDITORS)): $$($(2)_DIR)/.stamp_kconfig_fixup_done
+ $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
+ $$($(2)_KCONFIG_OPT) $$(subst $(1)-,,$$@)
+ rm -f $$($(2)_DIR)/.stamp_{kconfig_fixup_done,configured,built}
+ rm -f $$($(2)_DIR)/.stamp_{target,staging}_installed
+
+# Target to copy back the configuration to the source configuration file
+
+$(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
+ cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
+
+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)))
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 3 of 5 v3] manual: add documentation for kconfig-package
2014-08-01 19:53 [Buildroot] [PATCH 0 of 5 v3] Introduction of kconfig-package Thomas De Schampheleire
2014-08-01 19:53 ` [Buildroot] [PATCH 1 of 5 v3] uclibc: fixup config before calling menuconfig Thomas De Schampheleire
2014-08-01 19:53 ` [Buildroot] [PATCH 2 of 5 v3] infra: introduce a kconfig-package infrastructure Thomas De Schampheleire
@ 2014-08-01 19:53 ` Thomas De Schampheleire
2014-08-01 20:50 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 4 of 5 v3] uclibc: convert to kconfig-package infrastructure Thomas De Schampheleire
2014-08-01 19:53 ` [Buildroot] [PATCH 5 of 5 v3] busybox: " Thomas De Schampheleire
4 siblings, 1 reply; 10+ messages in thread
From: Thomas De Schampheleire @ 2014-08-01 19:53 UTC (permalink / raw)
To: buildroot
This patch adds documentation for the new kconfig-package infrastructure to
the manual.
Note that due to the simplicity of the infrastructure, the documentation
is not split in a 'tutorial' and a 'reference', like for the other
infrastructures. Instead, the usage is described in one section.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
---
v3: update based on Yann's comments
v2: update after move to a real infrastructure
docs/manual/adding-packages-kconfig.txt | 56 +++++++++++++++++++++++++++++
docs/manual/adding-packages.txt | 2 +
2 files changed, 58 insertions(+), 0 deletions(-)
diff -r e56a7788b2d0 -r fa937f090303 docs/manual/adding-packages-kconfig.txt
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/manual/adding-packages-kconfig.txt Thu Jul 24 20:54:50 2014 +0200
@@ -0,0 +1,56 @@
+// -*- mode:doc; -*-
+// vim: set syntax=asciidoc:
+
+=== Infrastructure for packages using kconfig for configuration files
+
+A popular way for a software package to handle user-specified
+configuration is +kconfig+. Among others, it is used by the Linux
+kernel, Busybox, and Buildroot itself. The presence of a .config file
+and a +menuconfig+ target are two well-known symptoms of kconfig being
+used.
+
+Buildroot features an infrastructure for packages that use kconfig for
+their configuration. This infrastructure provides the necessary logic to
+expose the package's +menuconfig+ target as +foo-menuconfig+ in
+Buildroot, and to handle the copying back and forth of the configuration
+file in a correct way.
+
+The +kconfig-package+ infrastructure is based on the +generic-package+
+infrastructure. All variables supported by +generic-package+ are
+available in +kconfig-package+ as well. See
+xref:generic-package-reference[] for more details.
+
+In order to use the +kconfig-package+ infrastructure for a Buildroot
+package, the minimally required lines in the +.mk+ file, in addition to
+the variables required by the +generic-package+ infrastructure, are:
+
+------------------------------
+FOO_KCONFIG_FILE = reference-to-source-configuration-file
+
+$(eval $(kconfig-package))
+------------------------------
+
+This snippet creates the following make targets:
+
+* +foo-menuconfig+, which calls the package's +menuconfig+ target
+
+* +foo-update-config+, which copies back the configuration to the source
+ configuration file.
+
+and ensures that the source configuration file is copied to the build
+directory at the right moment.
+
+In addition to these minimally required lines, several optional variables can
+be set to suit the needs of the package under consideration:
+
+* +FOO_KCONFIG_EDITORS+: a space-separated list of kconfig editors to
+ support, for example 'menuconfig xconfig'. By default, 'menuconfig'.
+
+* +FOO_KCONFIG_OPT+: extra options to pass when calling the kconfig
+ ediftors. This may need to include '$(FOO_MAKE_OPT)', for example. By
+ default, empty.
+
+* +FOO_KCONFIG_FIXUP_CMDS+: a list of shell commands needed to fixup the
+ configuration file after copying it or running a kconfig editor. Such
+ commands may be needed to ensure a configuration consistent with other
+ configuration of Buildroot, for example. By default, empty.
diff -r e56a7788b2d0 -r fa937f090303 docs/manual/adding-packages.txt
--- a/docs/manual/adding-packages.txt Mon Jun 30 21:08:13 2014 +0200
+++ b/docs/manual/adding-packages.txt Thu Jul 24 20:54:50 2014 +0200
@@ -25,6 +25,8 @@
include::adding-packages-virtual.txt[]
+include::adding-packages-kconfig.txt[]
+
include::adding-packages-hooks.txt[]
include::adding-packages-gettext.txt[]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 4 of 5 v3] uclibc: convert to kconfig-package infrastructure
2014-08-01 19:53 [Buildroot] [PATCH 0 of 5 v3] Introduction of kconfig-package Thomas De Schampheleire
` (2 preceding siblings ...)
2014-08-01 19:53 ` [Buildroot] [PATCH 3 of 5 v3] manual: add documentation for kconfig-package Thomas De Schampheleire
@ 2014-08-01 19:53 ` Thomas De Schampheleire
2014-08-03 8:22 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 5 of 5 v3] busybox: " Thomas De Schampheleire
4 siblings, 1 reply; 10+ messages in thread
From: Thomas De Schampheleire @ 2014-08-01 19:53 UTC (permalink / raw)
To: buildroot
This patch converts the uclibc package to the new kconfig-package
infrastructure, thus removing code duplication and ensuring a consistent
behavior of kconfig packages.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v3: rebase after new initial patch
v2: kconfig-package is now a real package infrastructure, so remove call
to generic-package
package/uclibc/uclibc.mk | 34 ++++++++++------------------------
1 files changed, 10 insertions(+), 24 deletions(-)
diff -r fa937f090303 -r 431289c9a7bc package/uclibc/uclibc.mk
--- a/package/uclibc/uclibc.mk Thu Jul 24 20:54:50 2014 +0200
+++ b/package/uclibc/uclibc.mk Tue Jul 22 20:35:36 2014 +0200
@@ -37,6 +37,14 @@
UCLIBC_CONFIG_FILE = $(call qstrip,$(BR2_UCLIBC_CONFIG))
endif
+UCLIBC_KCONFIG_FILE = $(UCLIBC_CONFIG_FILE)
+
+UCLIBC_KCONFIG_OPT = \
+ $(UCLIBC_MAKE_FLAGS) \
+ PREFIX=$(STAGING_DIR) \
+ DEVEL_PREFIX=/usr/ \
+ RUNTIME_PREFIX=$(STAGING_DIR)/ \
+
UCLIBC_TARGET_ARCH = $(call qstrip,$(BR2_UCLIBC_TARGET_ARCH))
ifeq ($(GENERATE_LOCALE),)
@@ -393,7 +401,7 @@
UCLIBC_EXTRA_CFLAGS="$(UCLIBC_EXTRA_CFLAGS) $(TARGET_ABI)" \
HOSTCC="$(HOSTCC)"
-define UCLIBC_FIXUP_DOT_CONFIG
+define UCLIBC_KCONFIG_FIXUP_CMDS
$(call KCONFIG_SET_OPT,CROSS_COMPILER_PREFIX,"$(TARGET_CROSS)",$(@D)/.config)
$(call KCONFIG_ENABLE_OPT,TARGET_$(UCLIBC_TARGET_ARCH),$(@D)/.config)
$(call KCONFIG_SET_OPT,TARGET_ARCH,"$(UCLIBC_TARGET_ARCH)",$(@D)/.config)
@@ -531,29 +539,7 @@
$(UCLIBC_INSTALL_UTILS_STAGING)
endef
-$(eval $(generic-package))
-
-$(UCLIBC_DIR)/.config: $(UCLIBC_CONFIG_FILE) | uclibc-patch
- $(INSTALL) -m 0644 $(UCLIBC_CONFIG_FILE) $(UCLIBC_DIR)/.config
-
-$(UCLIBC_DIR)/.stamp_config_fixup_done: $(UCLIBC_DIR)/.config
- $(UCLIBC_FIXUP_DOT_CONFIG)
- $(Q)touch $@
-
-$(UCLIBC_TARGET_CONFIGURE): $(UCLIBC_DIR)/.stamp_config_fixup_done
-
-uclibc-menuconfig: $(UCLIBC_DIR)/.stamp_config_fixup_done
- $(MAKE) -C $(UCLIBC_DIR) \
- $(UCLIBC_MAKE_FLAGS) \
- PREFIX=$(STAGING_DIR) \
- DEVEL_PREFIX=/usr/ \
- RUNTIME_PREFIX=$(STAGING_DIR)/ \
- menuconfig
- rm -f $(UCLIBC_DIR)/.stamp_{config_fixup_done,configured,built}
- rm -f $(UCLIBC_DIR)/.stamp_{target,staging}_installed
-
-uclibc-update-config: $(UCLIBC_DIR)/.stamp_config_fixup_done
- cp -f $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE)
+$(eval $(kconfig-package))
# Before uClibc is built, we must have the second stage cross-compiler
$(UCLIBC_TARGET_BUILD): | host-gcc-intermediate
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 5 of 5 v3] busybox: convert to kconfig-package infrastructure
2014-08-01 19:53 [Buildroot] [PATCH 0 of 5 v3] Introduction of kconfig-package Thomas De Schampheleire
` (3 preceding siblings ...)
2014-08-01 19:53 ` [Buildroot] [PATCH 4 of 5 v3] uclibc: convert to kconfig-package infrastructure Thomas De Schampheleire
@ 2014-08-01 19:53 ` Thomas De Schampheleire
4 siblings, 0 replies; 10+ messages in thread
From: Thomas De Schampheleire @ 2014-08-01 19:53 UTC (permalink / raw)
To: buildroot
This patch converts the busybox package to the new kconfig-package
infrastructure, thus removing code duplication and ensuring a consistent
behavior of kconfig packages.
Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
---
v3: no changes
v2: rebase after making kconfig-package a full infra
package/busybox/busybox.mk | 25 +++++++++----------------
1 files changed, 9 insertions(+), 16 deletions(-)
diff -r 431289c9a7bc -r bf4a3c7c74fc package/busybox/busybox.mk
--- a/package/busybox/busybox.mk Tue Jul 22 20:35:36 2014 +0200
+++ b/package/busybox/busybox.mk Tue Jul 22 20:43:10 2014 +0200
@@ -45,6 +45,10 @@
BUSYBOX_CONFIG_FILE = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG))
endif
+BUSYBOX_KCONFIG_FILE = $(BUSYBOX_CONFIG_FILE)
+BUSYBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig
+BUSYBOX_KCONFIG_OPT = $(BUSYBOX_MAKE_OPTS)
+
define BUSYBOX_PERMISSIONS
/bin/busybox f 4755 0 0 - - - - -
/usr/share/udhcpc/default.script f 755 0 0 - - - - -
@@ -136,10 +140,6 @@
endef
endif
-define BUSYBOX_COPY_CONFIG
- $(INSTALL) -D -m 0644 $(BUSYBOX_CONFIG_FILE) $(BUSYBOX_BUILD_CONFIG)
-endef
-
# Disable shadow passwords support if unsupported by the C library
ifeq ($(BR2_TOOLCHAIN_HAS_SHADOW_PASSWORDS),)
define BUSYBOX_INTERNAL_SHADOW_PASSWORDS
@@ -190,8 +190,7 @@
$(SED) 's/^noclobber="0"$$/noclobber="1"/' $(@D)/applets/install.sh
endef
-define BUSYBOX_CONFIGURE_CMDS
- $(BUSYBOX_COPY_CONFIG)
+define BUSYBOX_KCONFIG_FIXUP_CMDS
$(BUSYBOX_SET_MMU)
$(BUSYBOX_SET_LARGEFILE)
$(BUSYBOX_SET_IPV6)
@@ -203,6 +202,9 @@
$(BUSYBOX_INTERNAL_SHADOW_PASSWORDS)
$(BUSYBOX_SET_INIT)
$(BUSYBOX_SET_WATCHDOG)
+endef
+
+define BUSYBOX_CONFIGURE_CMDS
@yes "" | $(MAKE) ARCH=$(KERNEL_ARCH) CROSS_COMPILE="$(TARGET_CROSS)" \
-C $(@D) oldconfig
$(BUSYBOX_NOCLOBBER_INSTALL)
@@ -224,13 +226,4 @@
$(BUSYBOX_INSTALL_WATCHDOG_SCRIPT)
endef
-$(eval $(generic-package))
-
-busybox-menuconfig busybox-xconfig busybox-gconfig: busybox-patch
- $(BUSYBOX_MAKE_ENV) $(MAKE) $(BUSYBOX_MAKE_OPTS) -C $(BUSYBOX_DIR) \
- $(subst busybox-,,$@)
- rm -f $(BUSYBOX_DIR)/.stamp_built
- rm -f $(BUSYBOX_DIR)/.stamp_target_installed
-
-busybox-update-config: busybox-configure
- cp -f $(BUSYBOX_BUILD_CONFIG) $(BUSYBOX_CONFIG_FILE)
+$(eval $(kconfig-package))
^ permalink raw reply [flat|nested] 10+ messages in thread
* [Buildroot] [PATCH 3 of 5 v3] manual: add documentation for kconfig-package
2014-08-01 19:53 ` [Buildroot] [PATCH 3 of 5 v3] manual: add documentation for kconfig-package Thomas De Schampheleire
@ 2014-08-01 20:50 ` Yann E. MORIN
0 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2014-08-01 20:50 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2014-08-01 21:53 +0200, Thomas De Schampheleire spake thusly:
> This patch adds documentation for the new kconfig-package infrastructure to
> the manual.
>
> Note that due to the simplicity of the infrastructure, the documentation
> is not split in a 'tutorial' and a 'reference', like for the other
> infrastructures. Instead, the usage is described in one section.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Regards,
Yann E. MORIN.
> ---
> v3: update based on Yann's comments
> v2: update after move to a real infrastructure
>
> docs/manual/adding-packages-kconfig.txt | 56 +++++++++++++++++++++++++++++
> docs/manual/adding-packages.txt | 2 +
> 2 files changed, 58 insertions(+), 0 deletions(-)
>
> diff -r e56a7788b2d0 -r fa937f090303 docs/manual/adding-packages-kconfig.txt
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/docs/manual/adding-packages-kconfig.txt Thu Jul 24 20:54:50 2014 +0200
> @@ -0,0 +1,56 @@
> +// -*- mode:doc; -*-
> +// vim: set syntax=asciidoc:
> +
> +=== Infrastructure for packages using kconfig for configuration files
> +
> +A popular way for a software package to handle user-specified
> +configuration is +kconfig+. Among others, it is used by the Linux
> +kernel, Busybox, and Buildroot itself. The presence of a .config file
> +and a +menuconfig+ target are two well-known symptoms of kconfig being
> +used.
> +
> +Buildroot features an infrastructure for packages that use kconfig for
> +their configuration. This infrastructure provides the necessary logic to
> +expose the package's +menuconfig+ target as +foo-menuconfig+ in
> +Buildroot, and to handle the copying back and forth of the configuration
> +file in a correct way.
> +
> +The +kconfig-package+ infrastructure is based on the +generic-package+
> +infrastructure. All variables supported by +generic-package+ are
> +available in +kconfig-package+ as well. See
> +xref:generic-package-reference[] for more details.
> +
> +In order to use the +kconfig-package+ infrastructure for a Buildroot
> +package, the minimally required lines in the +.mk+ file, in addition to
> +the variables required by the +generic-package+ infrastructure, are:
> +
> +------------------------------
> +FOO_KCONFIG_FILE = reference-to-source-configuration-file
> +
> +$(eval $(kconfig-package))
> +------------------------------
> +
> +This snippet creates the following make targets:
> +
> +* +foo-menuconfig+, which calls the package's +menuconfig+ target
> +
> +* +foo-update-config+, which copies back the configuration to the source
> + configuration file.
> +
> +and ensures that the source configuration file is copied to the build
> +directory at the right moment.
> +
> +In addition to these minimally required lines, several optional variables can
> +be set to suit the needs of the package under consideration:
> +
> +* +FOO_KCONFIG_EDITORS+: a space-separated list of kconfig editors to
> + support, for example 'menuconfig xconfig'. By default, 'menuconfig'.
> +
> +* +FOO_KCONFIG_OPT+: extra options to pass when calling the kconfig
> + ediftors. This may need to include '$(FOO_MAKE_OPT)', for example. By
> + default, empty.
> +
> +* +FOO_KCONFIG_FIXUP_CMDS+: a list of shell commands needed to fixup the
> + configuration file after copying it or running a kconfig editor. Such
> + commands may be needed to ensure a configuration consistent with other
> + configuration of Buildroot, for example. By default, empty.
> diff -r e56a7788b2d0 -r fa937f090303 docs/manual/adding-packages.txt
> --- a/docs/manual/adding-packages.txt Mon Jun 30 21:08:13 2014 +0200
> +++ b/docs/manual/adding-packages.txt Thu Jul 24 20:54:50 2014 +0200
> @@ -25,6 +25,8 @@
>
> include::adding-packages-virtual.txt[]
>
> +include::adding-packages-kconfig.txt[]
> +
> include::adding-packages-hooks.txt[]
>
> include::adding-packages-gettext.txt[]
--
.-----------------.--------------------.------------------.--------------------.
| 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] 10+ messages in thread
* [Buildroot] [PATCH 1 of 5 v3] uclibc: fixup config before calling menuconfig
2014-08-01 19:53 ` [Buildroot] [PATCH 1 of 5 v3] uclibc: fixup config before calling menuconfig Thomas De Schampheleire
@ 2014-08-03 7:50 ` Yann E. MORIN
0 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2014-08-03 7:50 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2014-08-01 21:53 +0200, Thomas De Schampheleire spake thusly:
> The uclibc-menuconfig command is currently run based on the user-specified
> config file, while the fixup of the config file is done afterwards.
> However, it makes more sense to do an initial fixup _before_ running
> menuconfig, so that the options presented to the user are consistent with
> the final configuration.
>
> This patch changes the dependency of the menuconfig target from .config to
> .stamp_config_fixup_done to achieve this.
>
> Suggested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
I tested that the menuconfig does indeed display our specific options,
and that the intermediate stamp file is indeed removed after exiting the
menuconfig. Further calls also properly restore our options.
Regards,
Yann E. MORIN.
>
> ---
> v3: new patch
>
> package/uclibc/uclibc.mk | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff -r 892938e37055 -r 8fc7b26a4914 package/uclibc/uclibc.mk
> --- a/package/uclibc/uclibc.mk Mon Apr 28 06:58:48 2014 +0200
> +++ b/package/uclibc/uclibc.mk Fri Aug 01 21:22:29 2014 +0200
> @@ -542,7 +542,7 @@
>
> $(UCLIBC_TARGET_CONFIGURE): $(UCLIBC_DIR)/.stamp_config_fixup_done
>
> -uclibc-menuconfig: $(UCLIBC_DIR)/.config
> +uclibc-menuconfig: $(UCLIBC_DIR)/.stamp_config_fixup_done
> $(MAKE) -C $(UCLIBC_DIR) \
> $(UCLIBC_MAKE_FLAGS) \
> PREFIX=$(STAGING_DIR) \
--
.-----------------.--------------------.------------------.--------------------.
| 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] 10+ messages in thread
* [Buildroot] [PATCH 2 of 5 v3] infra: introduce a kconfig-package infrastructure
2014-08-01 19:53 ` [Buildroot] [PATCH 2 of 5 v3] infra: introduce a kconfig-package infrastructure Thomas De Schampheleire
@ 2014-08-03 8:14 ` Yann E. MORIN
0 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2014-08-03 8:14 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2014-08-01 21:53 +0200, Thomas De Schampheleire spake thusly:
> 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>
See below a comment we already shared on IRC...
> +include package/pkg-kconfig.mk
> diff -r 8fc7b26a4914 -r e56a7788b2d0 package/pkg-kconfig.mk
> --- /dev/null Thu Jan 01 00:00:00 1970 +0000
> +++ b/package/pkg-kconfig.mk Mon Jun 30 21:08:13 2014 +0200
> @@ -0,0 +1,82 @@
[--SNIP--]
> +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))
I found that comment to be slightly confusing. Here's a proposed
rewrite:
# Call the generic package infrastructure to generate the necessary
# make targets.
# Note: we need to call inner-generic-package before we add the
# configuration rules, because we need the $$($(2)_DIR) variable
# defined there, as we use it in dependency expressions
$(call inner-generic-package,$(1),$(2),$(3),$(4))
Otherwise, I'm good with it. With the above fixed, you can add my:
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
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] 10+ messages in thread
* [Buildroot] [PATCH 4 of 5 v3] uclibc: convert to kconfig-package infrastructure
2014-08-01 19:53 ` [Buildroot] [PATCH 4 of 5 v3] uclibc: convert to kconfig-package infrastructure Thomas De Schampheleire
@ 2014-08-03 8:22 ` Yann E. MORIN
0 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2014-08-03 8:22 UTC (permalink / raw)
To: buildroot
Thomas, All,
On 2014-08-01 21:53 +0200, Thomas De Schampheleire spake thusly:
> This patch converts the uclibc package to the new kconfig-package
> infrastructure, thus removing code duplication and ensuring a consistent
> behavior of kconfig packages.
>
> Signed-off-by: Thomas De Schampheleire <thomas.de.schampheleire@gmail.com>
> Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Not removing my reviewed-by, but see below...
> diff -r fa937f090303 -r 431289c9a7bc package/uclibc/uclibc.mk
> --- a/package/uclibc/uclibc.mk Thu Jul 24 20:54:50 2014 +0200
> +++ b/package/uclibc/uclibc.mk Tue Jul 22 20:35:36 2014 +0200
[--SNIP--]
> +$(eval $(kconfig-package))
>
> # Before uClibc is built, we must have the second stage cross-compiler
> $(UCLIBC_TARGET_BUILD): | host-gcc-intermediate
Maybe we should add a comment saying why this should be after the
$(eval...) line. Something like:
# Before uClibc is built, we must have the second stage cross-compiler.
# This *must* be after the eval-line, because UCLIBC_TARGET_BUILD is
# defined in there.
$(eval .....)
With the above fixed, keep my:
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
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] 10+ messages in thread
end of thread, other threads:[~2014-08-03 8:22 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-01 19:53 [Buildroot] [PATCH 0 of 5 v3] Introduction of kconfig-package Thomas De Schampheleire
2014-08-01 19:53 ` [Buildroot] [PATCH 1 of 5 v3] uclibc: fixup config before calling menuconfig Thomas De Schampheleire
2014-08-03 7:50 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 2 of 5 v3] infra: introduce a kconfig-package infrastructure Thomas De Schampheleire
2014-08-03 8:14 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 3 of 5 v3] manual: add documentation for kconfig-package Thomas De Schampheleire
2014-08-01 20:50 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 4 of 5 v3] uclibc: convert to kconfig-package infrastructure Thomas De Schampheleire
2014-08-03 8:22 ` Yann E. MORIN
2014-08-01 19:53 ` [Buildroot] [PATCH 5 of 5 v3] busybox: " Thomas De Schampheleire
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox