Skip to contentSkip to conversation

kconfig-package: add support for config fragments

PATCH Superseded Floris Bos 4 participants 15 messages Feb 15, 2015 – Mar 23, 2015

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Floris Bos

author
#0 lore raw

PATCH 1/5 kconfig-package: add support for config fragments

Adds functionality to the kconfig infrastructure to merge additional configuration fragment files to the main configuration file of kconfig packages, using support/kconfig/merge_config.sh

Typical use-case is when you want your configuration to be kept in sync with an upstream (def)config file, but do require some minor local modifications.

Disables -update-config and -update-defconfig targets when fragment files are set.

---
 package/pkg-kconfig.mk | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
package/pkg-kconfig.mk +10 -4
index 04ac37d..18eee76 100644
@@ -35,6 +35,7 @@ $(call inner-generic-package,$(1),$(2),$(3),$(4))
 $(2)_KCONFIG_EDITORS ?= menuconfig
 $(2)_KCONFIG_OPTS ?=
 $(2)_KCONFIG_FIXUP_CMDS ?=
+$(2)_KCONFIG_FRAGMENT_FILES ?=
 
 # FOO_KCONFIG_FILE is required
 ifndef $(2)_KCONFIG_FILE
@@ -45,13 +46,14 @@ endif
 # be extracted (and patched) first
 $$($(2)_KCONFIG_FILE): | $(1)-patch
 
-# The .config file is obtained by copying it from the specified source
-# configuration file, after the package has been patched.
+# The specified source configuration file and any additional configuration file
+# fragments are merged together to .config, after the package has been patched.
 # 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.
-$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE)
-	$$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config
+$$($(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)
 	@yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
 		$$($(2)_KCONFIG_OPTS) oldconfig
 
@@ -87,6 +89,8 @@ $(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 # Even though we could use 'cp --preserve-timestamps' here, the separate
 # cp and 'touch --reference' is used for symmetry with $(1)-update-defconfig.
 $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
+	$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
+		$$(error Unable to perform $(1)-update-config when fragment files are set))
 	cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 	touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 
@@ -95,6 +99,8 @@ $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 # $(1)-update-config, the reference for 'touch' is _not_ the file from which
 # we copy.
 $(1)-update-defconfig: $(1)-savedefconfig
+	$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
+		$$(error Unable to perform $(1)-update-defconfig when fragment files are set))
 	cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
 	touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/5 linux: add option to specify config fragments

---
 linux/Config.in | 6 ++++++
 linux/linux.mk  | 1 +
 2 files changed, 7 insertions(+)
linux/Config.in +6 -0
index 95c847b..15dc3b4 100644
@@ -161,6 +161,12 @@ config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
 	help
 	  Path to the kernel configuration file
 
+config BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES
+	string "Additional configuration fragment files"
+	help
+	  A space-seperated list of kernel configuration fragment files,
+	  that will be merged to the main kernel configuration file.
+
 #
 # Binary format
 #
linux/linux.mk +1 -0
index fc90fc5..f564530 100644
@@ -175,6 +175,7 @@ KERNEL_SOURCE_CONFIG = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE))
 endif
 
 LINUX_KCONFIG_FILE = $(KERNEL_SOURCE_CONFIG)
+LINUX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES))
 LINUX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
 LINUX_KCONFIG_OPTS = $(LINUX_MAKE_FLAGS)
 
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/5 linux: add option to specify config fragments

Floris, All,

On 2015-02-15 13:33 +0100, Floris Bos spake thusly:

Quoted 11 lines
---
 linux/Config.in | 6 ++++++
 linux/linux.mk  | 1 +
 2 files changed, 7 insertions(+)
linux/Config.in +0 -0
index 95c847b..15dc3b4 100644

linux/Config.in config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE · line 167

Quoted 7 lines
linux/Config.in +4 -0
@@ -161,6 +161,12 @@ config BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE
 	help
 	  Path to the kernel configuration file
 
+config BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES
+	string "Additional configuration fragment files"
+	help
+	  A space-seperated list of kernel configuration fragment files,

separated

Otherwise, OK:

Regards,
Yann E. MORIN.

Quoted 24 lines
linux/Config.in +2 -0
+	  that will be merged to the main kernel configuration file.
+
 #
 # Binary format
 #
linux/linux.mk +1 -0
index fc90fc5..f564530 100644
@@ -175,6 +175,7 @@ KERNEL_SOURCE_CONFIG = $(call qstrip,$(BR2_LINUX_KERNEL_CUSTOM_CONFIG_FILE))
 endif
 
 LINUX_KCONFIG_FILE = $(KERNEL_SOURCE_CONFIG)
+LINUX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_LINUX_KERNEL_CONFIG_FRAGMENT_FILES))
 LINUX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
 LINUX_KCONFIG_OPTS = $(LINUX_MAKE_FLAGS)
 
Signature · 6 lines
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
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.  |
'------------------------------^-------^------------------^--------------------'
author
#3 lore raw

PATCH 3/5 busybox: add option to specify config fragments

In reply to Floris Bos
---
 package/busybox/Config.in  | 6 ++++++
 package/busybox/busybox.mk | 1 +
 2 files changed, 7 insertions(+)
package/busybox/Config.in +6 -0
index f2f2990..5bc6f9d 100644
@@ -20,6 +20,12 @@ config BR2_PACKAGE_BUSYBOX_CONFIG
 
 	  Most people will just use the default BusyBox configuration file.
 
+config BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES
+	string "Additional BusyBox configuration fragment files"
+	help
+	  A space-seperated list of configuration fragment files,
+	  that will be merged to the main BusyBox configuration file.
+
 config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	bool "Show packages that are also provided by busybox"
 	help
package/busybox/busybox.mk +1 -0
index 61f6a16..7d2fb79 100644
@@ -46,6 +46,7 @@ ifndef BUSYBOX_CONFIG_FILE
 endif
 
 BUSYBOX_KCONFIG_FILE = $(BUSYBOX_CONFIG_FILE)
+BUSYBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES))
 BUSYBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig
 BUSYBOX_KCONFIG_OPTS = $(BUSYBOX_MAKE_OPTS)
 
Signature · 1 line
1.9.1
#4 lore raw

PATCH 3/5 busybox: add option to specify config fragments

Floris, All,

On 2015-02-15 13:33 +0100, Floris Bos spake thusly:

Quoted 11 lines
---
 package/busybox/Config.in  | 6 ++++++
 package/busybox/busybox.mk | 1 +
 2 files changed, 7 insertions(+)
package/busybox/Config.in +0 -0
index f2f2990..5bc6f9d 100644

package/busybox/Config.in config BR2_PACKAGE_BUSYBOX_CONFIG · line 26

Quoted 7 lines
package/busybox/Config.in +4 -0
@@ -20,6 +20,12 @@ config BR2_PACKAGE_BUSYBOX_CONFIG
 
 	  Most people will just use the default BusyBox configuration file.
 
+config BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES
+	string "Additional BusyBox configuration fragment files"
+	help
+	  A space-seperated list of configuration fragment files,

separated

Otherwise, OK:

Regards,
Yann E. MORIN.

Quoted 24 lines
package/busybox/Config.in +2 -0
+	  that will be merged to the main BusyBox configuration file.
+
 config BR2_PACKAGE_BUSYBOX_SHOW_OTHERS
 	bool "Show packages that are also provided by busybox"
 	help
package/busybox/busybox.mk +1 -0
index 61f6a16..7d2fb79 100644
@@ -46,6 +46,7 @@ ifndef BUSYBOX_CONFIG_FILE
 endif
 
 BUSYBOX_KCONFIG_FILE = $(BUSYBOX_CONFIG_FILE)
+BUSYBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_PACKAGE_BUSYBOX_CONFIG_FRAGMENT_FILES))
 BUSYBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig
 BUSYBOX_KCONFIG_OPTS = $(BUSYBOX_MAKE_OPTS)
 
Signature · 6 lines
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
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.  |
'------------------------------^-------^------------------^--------------------'
author
#5 lore raw

PATCH 4/5 uclibc: add option to specify config fragments

In reply to Floris Bos
---
 package/uclibc/Config.in | 6 ++++++
 package/uclibc/uclibc.mk | 1 +
 2 files changed, 7 insertions(+)
package/uclibc/Config.in +6 -0
index aa99a6f..1be9195 100644
@@ -53,6 +53,12 @@ config BR2_UCLIBC_CONFIG
 	  See also docs/README in this package.
 	  If unsure, use the default.
 
+config BR2_UCLIBC_CONFIG_FRAGMENT_FILES
+	string "Additional uClibc configuration fragment files"
+	help
+	  A space-seperated list of configuration fragment files,
+	  that will be merged to the main uClibc configuration file.
+
 config BR2_TOOLCHAIN_BUILDROOT_LARGEFILE
 	bool "Enable large file (files > 2 GB) support"
 	select BR2_LARGEFILE
package/uclibc/uclibc.mk +1 -0
index 40e6c6c..9d73b39 100644
@@ -38,6 +38,7 @@ UCLIBC_CONFIG_FILE = $(call qstrip,$(BR2_UCLIBC_CONFIG))
 endif
 
 UCLIBC_KCONFIG_FILE = $(UCLIBC_CONFIG_FILE)
+UCLIBC_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_UCLIBC_CONFIG_FRAGMENT_FILES))
 
 UCLIBC_KCONFIG_OPTS = \
 	$(UCLIBC_MAKE_FLAGS) \
Signature · 1 line
1.9.1
#6 lore raw

PATCH 4/5 uclibc: add option to specify config fragments

Floris, All,

On 2015-02-15 13:33 +0100, Floris Bos spake thusly:

Quoted 11 lines
---
 package/uclibc/Config.in | 6 ++++++
 package/uclibc/uclibc.mk | 1 +
 2 files changed, 7 insertions(+)
package/uclibc/Config.in +0 -0
index aa99a6f..1be9195 100644

package/uclibc/Config.in config BR2_UCLIBC_CONFIG · line 59

Quoted 7 lines
package/uclibc/Config.in +4 -0
@@ -53,6 +53,12 @@ config BR2_UCLIBC_CONFIG
 	  See also docs/README in this package.
 	  If unsure, use the default.
 
+config BR2_UCLIBC_CONFIG_FRAGMENT_FILES
+	string "Additional uClibc configuration fragment files"
+	help
+	  A space-seperated list of configuration fragment files,

separated Well... you know the tune, now. ;-)

Otherwise, OK:

Regards,
Yann E. MORIN.

Quoted 24 lines
package/uclibc/Config.in +2 -0
+	  that will be merged to the main uClibc configuration file.
+
 config BR2_TOOLCHAIN_BUILDROOT_LARGEFILE
 	bool "Enable large file (files > 2 GB) support"
 	select BR2_LARGEFILE
package/uclibc/uclibc.mk +1 -0
index 40e6c6c..9d73b39 100644
@@ -38,6 +38,7 @@ UCLIBC_CONFIG_FILE = $(call qstrip,$(BR2_UCLIBC_CONFIG))
 endif
 
 UCLIBC_KCONFIG_FILE = $(UCLIBC_CONFIG_FILE)
+UCLIBC_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_UCLIBC_CONFIG_FRAGMENT_FILES))
 
 UCLIBC_KCONFIG_OPTS = \
 	$(UCLIBC_MAKE_FLAGS) \
Signature · 6 lines
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
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.  |
'------------------------------^-------^------------------^--------------------'
author
#7 lore raw

PATCH 5/5 barebox: add option to specify config fragments

In reply to Floris Bos
---
 boot/barebox/Config.in  | 6 ++++++
 boot/barebox/barebox.mk | 1 +
 2 files changed, 7 insertions(+)
boot/barebox/Config.in +6 -0
index 48431bd..64e3196 100644
@@ -91,6 +91,12 @@ config BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE
 	help
 	  Path to the barebox configuration file
 
+config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES
+	string "Additional configuration fragment files"
+	help
+	  A space-seperated list of configuration fragment files,
+	  that will be merged to the main Barebox configuration file.
+
 config BR2_TARGET_BAREBOX_BAREBOXENV
 	bool "bareboxenv tool in target"
 	help
boot/barebox/barebox.mk +1 -0
index b829ae7..41f487b 100644
@@ -59,6 +59,7 @@ BAREBOX_SOURCE_CONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
 endif
 
 BAREBOX_KCONFIG_FILE = $(BAREBOX_SOURCE_CONFIG)
+BAREBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
 BAREBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
 BAREBOX_KCONFIG_OPTS = $(BAREBOX_MAKE_FLAGS)
 
Signature · 1 line
1.9.1
#8 lore raw

PATCH 5/5 barebox: add option to specify config fragments

Floris, All,

On 2015-02-15 13:33 +0100, Floris Bos spake thusly:

Quoted 11 lines
---
 boot/barebox/Config.in  | 6 ++++++
 boot/barebox/barebox.mk | 1 +
 2 files changed, 7 insertions(+)
boot/barebox/Config.in +0 -0
index 48431bd..64e3196 100644

boot/barebox/Config.in config BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE · line 97

Quoted 7 lines
boot/barebox/Config.in +4 -0
@@ -91,6 +91,12 @@ config BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE
 	help
 	  Path to the barebox configuration file
 
+config BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES
+	string "Additional configuration fragment files"
+	help
+	  A space-seperated list of configuration fragment files,

separated (lotta copy-paste, eh?)

Otherwise, OK:

Regards,
Yann E. MORIN.

Quoted 24 lines
boot/barebox/Config.in +2 -0
+	  that will be merged to the main Barebox configuration file.
+
 config BR2_TARGET_BAREBOX_BAREBOXENV
 	bool "bareboxenv tool in target"
 	help
boot/barebox/barebox.mk +1 -0
index b829ae7..41f487b 100644
@@ -59,6 +59,7 @@ BAREBOX_SOURCE_CONFIG = $(call qstrip,$(BR2_TARGET_BAREBOX_CUSTOM_CONFIG_FILE))
 endif
 
 BAREBOX_KCONFIG_FILE = $(BAREBOX_SOURCE_CONFIG)
+BAREBOX_KCONFIG_FRAGMENT_FILES = $(call qstrip,$(BR2_TARGET_BAREBOX_CONFIG_FRAGMENT_FILES))
 BAREBOX_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
 BAREBOX_KCONFIG_OPTS = $(BAREBOX_MAKE_FLAGS)
 
Signature · 6 lines
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
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.  |
'------------------------------^-------^------------------^--------------------'
#9 lore raw

PATCH 1/5 kconfig-package: add support for config fragments

In reply to Floris Bos

Floris, All,

On 2015-02-15 13:33 +0100, Floris Bos spake thusly:

Quoted 48 lines

Adds functionality to the kconfig infrastructure to merge additional configuration fragment files to the main configuration file of kconfig packages, using support/kconfig/merge_config.sh

Typical use-case is when you want your configuration to be kept in sync with an upstream (def)config file, but do require some minor local modifications.

Disables -update-config and -update-defconfig targets when fragment files are set.

---
 package/pkg-kconfig.mk | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
package/pkg-kconfig.mk +6 -4
index 04ac37d..18eee76 100644
@@ -35,6 +35,7 @@ $(call inner-generic-package,$(1),$(2),$(3),$(4))
 $(2)_KCONFIG_EDITORS ?= menuconfig
 $(2)_KCONFIG_OPTS ?=
 $(2)_KCONFIG_FIXUP_CMDS ?=
+$(2)_KCONFIG_FRAGMENT_FILES ?=
 
 # FOO_KCONFIG_FILE is required
 ifndef $(2)_KCONFIG_FILE
@@ -45,13 +46,14 @@ endif
 # be extracted (and patched) first
 $$($(2)_KCONFIG_FILE): | $(1)-patch
 
-# The .config file is obtained by copying it from the specified source
-# configuration file, after the package has been patched.
+# The specified source configuration file and any additional configuration file
+# fragments are merged together to .config, after the package has been patched.
 # 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.
-$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE)
-	$$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config
+$$($(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)
 	@yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
 		$$($(2)_KCONFIG_OPTS) oldconfig
 

package/pkg-kconfig.mk $(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done · line 93

Quoted 5 lines
package/pkg-kconfig.mk +2 -0
@@ -87,6 +89,8 @@ $(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 # Even though we could use 'cp --preserve-timestamps' here, the separate
 # cp and 'touch --reference' is used for symmetry with $(1)-update-defconfig.
 $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
+	$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
+		$$(error Unable to perform $(1)-update-config when fragment files are set))

$(error ...) is Makefile syntax, while this is a shell. I'd prefer we use a shell construct here, like:

    $$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
        echo "Unable to perform $(1)-update-config when fragment files are set"; exit 1)

package/pkg-kconfig.mk $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done · line 103

Quoted 9 lines
package/pkg-kconfig.mk +2 -0
 	cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 	touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 
@@ -95,6 +99,8 @@ $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 # $(1)-update-config, the reference for 'touch' is _not_ the file from which
 # we copy.
 $(1)-update-defconfig: $(1)-savedefconfig
+	$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
+		$$(error Unable to perform $(1)-update-defconfig when fragment files are set))

Ditto.

Otherwise, looks good.

Regards,
Yann E. MORIN.

Quoted 10 lines
package/pkg-kconfig.mk +0 -0
 	cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
 	touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 
Signature · 6 lines
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
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.  |
'------------------------------^-------^------------------^--------------------'
#10 lore raw

PATCH 1/5 kconfig-package: add support for config fragments

Quoted 16 lines · Yann E. MORIN

Floris, All,

On 2015-02-15 13:33 +0100, Floris Bos spake thusly:

Quoted 13 lines

Adds functionality to the kconfig infrastructure to merge additional configuration fragment files to the main configuration file of kconfig packages, using support/kconfig/merge_config.sh

Typical use-case is when you want your configuration to be kept in sync with an upstream (def)config file, but do require some minor local modifications.

Disables -update-config and -update-defconfig targets when fragment files are set.

---

[snip]

Quoted 10 lines

package/pkg-kconfig.mk $(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done · line 93

Quoted 6 lines
package/pkg-kconfig.mk +2 -0
@@ -87,6 +89,8 @@ $(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 # Even though we could use 'cp --preserve-timestamps' here, the separate
 # cp and 'touch --reference' is used for symmetry with $(1)-update-defconfig.
 $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
+	$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
+		$$(error Unable to perform $(1)-update-config when fragment files are set))

$(error ...) is Makefile syntax, while this is a shell. I'd prefer we use a shell construct here, like:

Quoted 2 lines
    $$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
        echo "Unable to perform $(1)-update-config when fragment files are set"; exit 1)

Or perhaps it's better to simply disable the update targets when fragments are set:

# Cannot update (def)config with fragments
ifneq ($$($(2)_KCONFIG_FRAGMENT_FILES),)
$(1)-update-config: ...
...
endif

[snip]

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#11 lore raw

PATCH 1/5 kconfig-package: add support for config fragments

----- Mail original -----

Quoted 3 lines · Yann E. MORIN
Quoted 2 lines

Floris, All,

[...]

Quoted 9 lines
Quoted 5 lines

use a shell construct here, like:

    $$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
        echo "Unable to perform $(1)-update-config when fragment
        files are set"; exit 1)

Or perhaps it's better to simply disable the update targets when fragments are set:

Quoted 8 lines

# Cannot update (def)config with fragments
ifneq ($$($(2)_KCONFIG_FRAGMENT_FILES),)
$(1)-update-config: ...
...
endif

[snip]

I'm not sure... we are in a case where the user knows that the target is supposed to exist. an unknown target message would be more confusing than the OP's proposed error message. I would not be suprised if someone reported the missing target as a bug here...

Quoted 14 lines

--

Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR
Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

#12 lore raw

PATCH 1/5 kconfig-package: add support for config fragments

J?r?my, All,

On 2015-03-23 09:09 +0100, Jeremy Rosen spake thusly:

Quoted 20 lines

----- Mail original -----

Quoted 3 lines · Yann E. MORIN
Quoted 2 lines

Floris, All,

[...]

Quoted 15 lines
Quoted 5 lines

use a shell construct here, like:

    $$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
        echo "Unable to perform $(1)-update-config when fragment
        files are set"; exit 1)

Or perhaps it's better to simply disable the update targets when fragments are set:

# Cannot update (def)config with fragments
ifneq ($$($(2)_KCONFIG_FRAGMENT_FILES),)
$(1)-update-config: ...
...
endif

Quoted 6 lines
Quoted 1 line

[snip]

I'm not sure... we are in a case where the user knows that the target is supposed to exist. an unknown target message would be more confusing than the OP's proposed error message. I would not be suprised if someone reported the missing target as a bug here...

Agred, But I guess that what Arnout suggested would be something like:

    $(1)-update-config:
    ifneq ($$($(2)_KCONFIG_FRAGMENT_FILES),)
        ...
    else
        echo ERROR.
    enfi

Regards,
Yann E. MORIN.

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.  |
'------------------------------^-------^------------------^--------------------'
#13 lore raw

PATCH 1/5 kconfig-package: add support for config fragments

Quoted 30 lines · Yann E. MORIN

J?r?my, All,

On 2015-03-23 09:09 +0100, Jeremy Rosen spake thusly:

Quoted 20 lines

----- Mail original -----

Quoted 3 lines · Yann E. MORIN
Quoted 2 lines

Floris, All,

[...]

Quoted 15 lines
Quoted 5 lines

use a shell construct here, like:

    $$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
        echo "Unable to perform $(1)-update-config when fragment
        files are set"; exit 1)

Or perhaps it's better to simply disable the update targets when fragments are set:

# Cannot update (def)config with fragments
ifneq ($$($(2)_KCONFIG_FRAGMENT_FILES),)
$(1)-update-config: ...
...
endif

Quoted 6 lines
Quoted 1 line

[snip]

I'm not sure... we are in a case where the user knows that the target is supposed to exist. an unknown target message would be more confusing than the OP's proposed error message. I would not be suprised if someone reported the missing target as a bug here...

Quoted 8 lines

Agred, But I guess that what Arnout suggested would be something like:

    $(1)-update-config:
    ifneq ($$($(2)_KCONFIG_FRAGMENT_FILES),)
        ...
    else
        echo ERROR.
    enfi

Actually I did mean what I said, but I also agree with Jeremy that it could be
confusing. So +1 to Yann's suggestion.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#14 lore raw

PATCH 1/5 kconfig-package: add support for config fragments

In reply to Floris Bos

Floris, All,

On 2015-02-15 13:33 +0100, Floris Bos spake thusly:

Quoted 10 lines

Adds functionality to the kconfig infrastructure to merge additional configuration fragment files to the main configuration file of kconfig packages, using support/kconfig/merge_config.sh

Typical use-case is when you want your configuration to be kept in sync with an upstream (def)config file, but do require some minor local modifications.

Disables -update-config and -update-defconfig targets when fragment files are set.

BTW, you forgot to document that in the manual, see:
docs/manual/adding-packages-kconfig.txt

Regards,
Yann E. MORIN.

Quoted 61 lines
---
 package/pkg-kconfig.mk | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)
package/pkg-kconfig.mk +10 -4
index 04ac37d..18eee76 100644
@@ -35,6 +35,7 @@ $(call inner-generic-package,$(1),$(2),$(3),$(4))
 $(2)_KCONFIG_EDITORS ?= menuconfig
 $(2)_KCONFIG_OPTS ?=
 $(2)_KCONFIG_FIXUP_CMDS ?=
+$(2)_KCONFIG_FRAGMENT_FILES ?=
 
 # FOO_KCONFIG_FILE is required
 ifndef $(2)_KCONFIG_FILE
@@ -45,13 +46,14 @@ endif
 # be extracted (and patched) first
 $$($(2)_KCONFIG_FILE): | $(1)-patch
 
-# The .config file is obtained by copying it from the specified source
-# configuration file, after the package has been patched.
+# The specified source configuration file and any additional configuration file
+# fragments are merged together to .config, after the package has been patched.
 # 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.
-$$($(2)_DIR)/.config: $$($(2)_KCONFIG_FILE)
-	$$(INSTALL) -m 0644 $$($(2)_KCONFIG_FILE) $$($(2)_DIR)/.config
+$$($(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)
 	@yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
 		$$($(2)_KCONFIG_OPTS) oldconfig
 
@@ -87,6 +89,8 @@ $(1)-savedefconfig: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 # Even though we could use 'cp --preserve-timestamps' here, the separate
 # cp and 'touch --reference' is used for symmetry with $(1)-update-defconfig.
 $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
+	$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
+		$$(error Unable to perform $(1)-update-config when fragment files are set))
 	cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 	touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 
@@ -95,6 +99,8 @@ $(1)-update-config: $$($(2)_DIR)/.stamp_kconfig_fixup_done
 # $(1)-update-config, the reference for 'touch' is _not_ the file from which
 # we copy.
 $(1)-update-defconfig: $(1)-savedefconfig
+	$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
+		$$(error Unable to perform $(1)-update-defconfig when fragment files are set))
 	cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
 	touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
 
Signature · 6 lines
1.9.1

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot
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.  |
'------------------------------^-------^------------------^--------------------'