Introduction of kconfig-package (branch yem/patrickdp/kconfig-pkg)
v4 cover Introduction of kconfig-package (branch yem/patrickdp/kconfig-pkg)
Hello All!
From: Thomas De Schampheleire <[email protected]>
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.
Changes v3 -> v4:
- add missing 4th argument when calling inner-kconfig-package (Yann)
Regards,
Yann E. MORIN.
The following changes since commit 01370132c10cb2d194042e08fefbc9cec8392c66:
gst-fsl-plugins, libfslvpuwrap: add missing select (2014-08-03 14:47:03 +0200)
are available in the git repository at:
git://gitorious.org/buildroot/buildroot.git yem/patrickdp/kconfig-pkg
for you to fetch changes up to 437a2f63b7dd1357bf859133053f4b877bc2a0e9:
busybox: convert to kconfig-package infrastructure (2014-08-03 17:17:12 +0200)
----------------------------------------------------------------
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 | 34 ++++---------- 6 files changed, 160 insertions(+), 40 deletions(-) create mode 100644 docs/manual/adding-packages-kconfig.txt create mode 100644 package/pkg-kconfig.mk
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 v4 1/5 uclibc: fixup config before calling menuconfig
From: Thomas De Schampheleire <[email protected]>
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.
--- package/uclibc/uclibc.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
package/uclibc/uclibc.mk +1 -1
@@ -542,7 +542,7 @@ $(UCLIBC_DIR)/.stamp_config_fixup_done: $(UCLIBC_DIR)/.config $(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) \
Signature · 1 line
1.9.1
PATCH v4 2/5 infra: introduce a kconfig-package infrastructure
In reply to Yann E. MORINFrom: Thomas De Schampheleire <[email protected]>
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.
[yann.morin.1998 at free.fr: add missing 4th argument when calling to
inner-kconfig-package (namely, 'target']
---
Since I was involved with that patch, I did not add me reviewed-by tag.
--- package/Makefile.in | 1 + package/pkg-kconfig.mk | 82 ++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) create mode 100644 package/pkg-kconfig.mk
package/Makefile.in +1 -0
@@ -394,3 +394,4 @@ include package/pkg-perl.mk include package/pkg-python.mk include package/pkg-virtual.mk include package/pkg-generic.mk +include package/pkg-kconfig.mk
package/pkg-kconfig.mk new file +82 -0
82 lines not on this page · raw message
Signature · 1 line
1.9.1
PATCH v4 3/5 manual: add documentation for kconfig-package
In reply to Yann E. MORINFrom: Thomas De Schampheleire <[email protected]>
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.
---
Since I was involved with that patch, I did not carry my initial reviewed-by tag.
--- docs/manual/adding-packages-kconfig.txt | 56 +++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 ++ 2 files changed, 58 insertions(+) create mode 100644 docs/manual/adding-packages-kconfig.txt
docs/manual/adding-packages-kconfig.txt new file +56 -0
@@ -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 the configuration back 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.
docs/manual/adding-packages.txt +2 -0
@@ -25,6 +25,8 @@ include::adding-packages-perl.txt[] include::adding-packages-virtual.txt[] +include::adding-packages-kconfig.txt[] + include::adding-packages-hooks.txt[] include::adding-packages-gettext.txt[]
Signature · 1 line
1.9.1
PATCH v4 4/5 uclibc: convert to kconfig-package infrastructure
In reply to Yann E. MORINFrom: Thomas De Schampheleire <[email protected]>
This patch converts the uclibc package to the new kconfig-package infrastructure, thus removing code duplication and ensuring a consistent behavior of kconfig packages.
--- package/uclibc/uclibc.mk | 34 ++++++++++------------------------ 1 file changed, 10 insertions(+), 24 deletions(-)
package/uclibc/uclibc.mk +10 -24
@@ -37,6 +37,14 @@ ifndef UCLIBC_CONFIG_FILE 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_MAKE_FLAGS = \ 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 @@ define UCLIBC_INSTALL_STAGING_CMDS $(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
Signature · 1 line
1.9.1
PATCH v4 5/5 busybox: convert to kconfig-package infrastructure
In reply to Yann E. MORINFrom: Thomas De Schampheleire <[email protected]>
This patch converts the busybox package to the new kconfig-package infrastructure, thus removing code duplication and ensuring a consistent behavior of kconfig packages.
--- package/busybox/busybox.mk | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-)
package/busybox/busybox.mk +9 -16
@@ -45,6 +45,10 @@ ifndef BUSYBOX_CONFIG_FILE 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 @@ define BUSYBOX_NETKITTELNET 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 @@ define BUSYBOX_NOCLOBBER_INSTALL $(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 @@ define BUSYBOX_CONFIGURE_CMDS $(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 @@ define BUSYBOX_INSTALL_TARGET_CMDS $(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))
Signature · 1 line
1.9.1
PATCH v4 5/5 busybox: convert to kconfig-package infrastructure
Yann, Thomas,
package/busybox/busybox.mk ifndef BUSYBOX_CONFIG_FILE · line 50
Quoted 3 lines · Yann E. MORIN
package/busybox/busybox.mk +3
-0+BUSYBOX_KCONFIG_FILE = $(BUSYBOX_CONFIG_FILE) +BUSYBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig +BUSYBOX_KCONFIG_OPT = $(BUSYBOX_MAKE_OPTS)
At some point, maybe we'll want to refactor this a bit. It seems silly to define BUSYBOX_CONFIG_FILE and BUSYBOX_MAKE_OPTS to then have to "rename" them just for the sake of the kconfig-package infra usage. Why not giving them the right name for the beginning?
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
v4 cover Introduction of kconfig-package (branch yem/patrickdp/kconfig-pkg)
In reply to Yann E. MORINYann, Thomas,
Quoted 6 lines · Yann E. MORIN
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
Thanks, I've applied the branch. Thanks both for working on this. It is clearly reassuring when the branch has been in the hands of two different developers, as it is a good indication that there has been some independent testing from two separate persons.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com