Skip to contentSkip to conversation

uclibc: fix handling of configuration file

PATCH Superseded Thomas De Schampheleire 2 participants 6 messages Jul 15, 2014 – Jul 17, 2014

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 uclibc: fix handling of configuration file

This patch series (part of it poster earlier as RFC) has as main goal to fix the uclibc kconfig handling with following requirements in mind:

- neither foo-menuconfig nor foo-update-config should have a dependency on the toolchain (which means we cannot depend on foo-configure)

- 'clean foo-menuconfig' should start from the specified (custom) config file

- 'foo-menuconfig foo-update-config' should preserve the changes made in the menuconfig step (this problem is reported for uclibc with bug #7154
(https://bugs.busybox.net/show_bug.cgi?id=7154).

- 'make foo-menuconfig; make foo-menuconfig' should preserve the changes made in the menuconfig step.

- 'make clean foo-update-config' should copy the initial file, do any fixups, and then save the config

Once this series is accepted, the plan is:
- to extract the kconfig-related bits to a kconfig-package infrastructure.
- to convert busybox, linux and barebox to this kconfig-package infra too.

---
 package/uclibc/uclibc.mk |  24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)
#1 lore raw

PATCH v2 1/1 uclibc: rename SETUP_DOT_CONFIG to FIXUP_DOT_CONFIG

In a subsequent patch, the behavior of UCLIBC_SETUP_DOT_CONFIG will change so that it only applies fixups to the (already copied) configuration file. This patch renames this function to UCLIBC_FIXUP_DOT_CONFIG to better match the future behavior.

---
v2: update commit message (ThomasP)

 package/uclibc/uclibc.mk |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
package/uclibc/uclibc.mk +2 -2
diff -r c7afd4612342 -r 9634175cf29d package/uclibc/uclibc.mk
@@ -393,7 +393,7 @@
 	UCLIBC_EXTRA_CFLAGS="$(UCLIBC_EXTRA_CFLAGS) $(TARGET_ABI)" \
 	HOSTCC="$(HOSTCC)"
 
-define UCLIBC_SETUP_DOT_CONFIG
+define UCLIBC_FIXUP_DOT_CONFIG
 	$(INSTALL) -m 0644 $(UCLIBC_CONFIG_FILE) $(@D)/.config
 	$(call KCONFIG_SET_OPT,CROSS_COMPILER_PREFIX,"$(TARGET_CROSS)",$(@D)/.config)
 	$(call KCONFIG_ENABLE_OPT,TARGET_$(UCLIBC_TARGET_ARCH),$(@D)/.config)
@@ -433,7 +433,7 @@
 endef
 
 define UCLIBC_CONFIGURE_CMDS
-	$(UCLIBC_SETUP_DOT_CONFIG)
+	$(UCLIBC_FIXUP_DOT_CONFIG)
 	$(MAKE1) -C $(UCLIBC_DIR) \
 		$(UCLIBC_MAKE_FLAGS) \
 		PREFIX=$(STAGING_DIR) \
#2 lore raw

PATCH v2 1/1 uclibc: rename SETUP_DOT_CONFIG to FIXUP_DOT_CONFIG

Quoted 7 lines · Thomas De Schampheleire

In a subsequent patch, the behavior of UCLIBC_SETUP_DOT_CONFIG will change so that it only applies fixups to the (already copied) configuration file. This patch renames this function to UCLIBC_FIXUP_DOT_CONFIG to better match the future behavior.

Regards,
Arnout

Quoted 29 lines

---
v2: update commit message (ThomasP)

 package/uclibc/uclibc.mk |  4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff -r c7afd4612342 -r 9634175cf29d package/uclibc/uclibc.mk

package/uclibc/uclibc.mk +2 -2
@@ -393,7 +393,7 @@
 	UCLIBC_EXTRA_CFLAGS="$(UCLIBC_EXTRA_CFLAGS) $(TARGET_ABI)" \
 	HOSTCC="$(HOSTCC)"
 
-define UCLIBC_SETUP_DOT_CONFIG
+define UCLIBC_FIXUP_DOT_CONFIG
 	$(INSTALL) -m 0644 $(UCLIBC_CONFIG_FILE) $(@D)/.config
 	$(call KCONFIG_SET_OPT,CROSS_COMPILER_PREFIX,"$(TARGET_CROSS)",$(@D)/.config)
 	$(call KCONFIG_ENABLE_OPT,TARGET_$(UCLIBC_TARGET_ARCH),$(@D)/.config)
@@ -433,7 +433,7 @@
 endef
 
 define UCLIBC_CONFIGURE_CMDS
-	$(UCLIBC_SETUP_DOT_CONFIG)
+	$(UCLIBC_FIXUP_DOT_CONFIG)
 	$(MAKE1) -C $(UCLIBC_DIR) \
 		$(UCLIBC_MAKE_FLAGS) \
 		PREFIX=$(STAGING_DIR) \
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
#3 lore raw

PATCH v2 1/1 uclibc: menuconfig: take into account initial settings from config file

In reply to Thomas De Schampheleire

When executing the sequence 'make clean uclibc-menuconfig', the configured config file is not taken into account and one starts from the default settings.

This patch adds an explicit target for the config file and lets the configure and menuconfig steps depend on it, fixing the problem.

---
v2:
- use UCLIBC_TARGET_CONFIGURE instead of specifying the stamp path in full (Arnout)
rfc->patch:
- add target for .config to avoid menuconfig copying the config file every time (ThomasP, Arnout)
- move dependency on patch step from menuconfig to the .config target

 package/uclibc/uclibc.mk |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
package/uclibc/uclibc.mk +8 -4
diff -r 9634175cf29d -r a22b18c9a90d package/uclibc/uclibc.mk
@@ -394,7 +394,6 @@
 	HOSTCC="$(HOSTCC)"
 
 define UCLIBC_FIXUP_DOT_CONFIG
-	$(INSTALL) -m 0644 $(UCLIBC_CONFIG_FILE) $(@D)/.config
 	$(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)
@@ -533,7 +532,14 @@
 	$(UCLIBC_INSTALL_UTILS_STAGING)
 endef
 
-uclibc-menuconfig: uclibc-patch
+$(eval $(generic-package))
+
+$(UCLIBC_DIR)/.config: $(UCLIBC_CONFIG_FILE) | uclibc-patch
+	$(INSTALL) -m 0644 $(UCLIBC_CONFIG_FILE) $(UCLIBC_DIR)/.config
+
+$(UCLIBC_TARGET_CONFIGURE): $(UCLIBC_DIR)/.config
+
+uclibc-menuconfig: $(UCLIBC_DIR)/.config
 	$(MAKE1) -C $(UCLIBC_DIR) \
 		$(UCLIBC_MAKE_FLAGS) \
 		PREFIX=$(STAGING_DIR) \
@@ -542,8 +548,6 @@
 		menuconfig
 	rm -f $(UCLIBC_DIR)/.stamp_{configured,built,target_installed,staging_installed}
 
-$(eval $(generic-package))
-
 uclibc-update-config: $(UCLIBC_DIR)/.stamp_configured
 	cp -f $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE)
 
#4 lore raw

PATCH v2 1/1 uclibc: update-config: preserve freshly configured settings

In reply to Thomas De Schampheleire

In the sequence:

make uclibc-menuconfig
make uclibc-update-config

the freshly configured settings from the menuconfig are lost during the update-config step. This is because update-config depends on the configure step, which starts by copying the config file to the build directory.

Instead, stop depending on the configure step from update-config, and introduce a new stamp file .stamp_config_fixup_done, which applies any fixups on the .config file.
An alternative solution would be to add a call to UCLIBC_FIXUP_DOT_CONFIG to the relevant targets instead of depending on a new stamp file, but this would unnecessarily repeat the fixups on subsequent invocations of update-config, for example.

No longer depending on the configure step has the added bonus that 'uclibc-update-config' no longer needs the toolchain to be available, which makes:
make clean uclibc-menuconfig uclibc-update-config
much faster and user-friendly.

Additionally, make sure that 'make clean uclibc-update-config' works properly, by depending on .stamp_config_fixup_done so that the config file is present and fixed.

Fixes bug #7154 https://bugs.busybox.net/show_bug.cgi?id=7154

---
v2:
- use $(Q)touch iso touch (Arnout)
- update commit message to clarify stamp file choice (Arnout)

rfc->patch:
- rebase
- rename .stamp_config_file_fixed into .stamp_config_fixup_done
- add dependency on .config from .stamp_config_file_fixed (Arnout)
- remove explicit call to UCLIBC_FIXUP_DOT_CONFIG from configure commands, and instead depend on .stamp_config_fixup_done.

 package/uclibc/uclibc.mk |  12 ++++++++----
 1 files changed, 8 insertions(+), 4 deletions(-)
package/uclibc/uclibc.mk +8 -4
diff -r a22b18c9a90d -r f2da132c93ad package/uclibc/uclibc.mk
@@ -432,7 +432,6 @@
 endef
 
 define UCLIBC_CONFIGURE_CMDS
-	$(UCLIBC_FIXUP_DOT_CONFIG)
 	$(MAKE1) -C $(UCLIBC_DIR) \
 		$(UCLIBC_MAKE_FLAGS) \
 		PREFIX=$(STAGING_DIR) \
@@ -537,7 +536,11 @@
 $(UCLIBC_DIR)/.config: $(UCLIBC_CONFIG_FILE) | uclibc-patch
 	$(INSTALL) -m 0644 $(UCLIBC_CONFIG_FILE) $(UCLIBC_DIR)/.config
 
-$(UCLIBC_TARGET_CONFIGURE): $(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)/.config
 	$(MAKE1) -C $(UCLIBC_DIR) \
@@ -546,9 +549,10 @@
 		DEVEL_PREFIX=/usr/ \
 		RUNTIME_PREFIX=$(STAGING_DIR)/ \
 		menuconfig
-	rm -f $(UCLIBC_DIR)/.stamp_{configured,built,target_installed,staging_installed}
+	rm -f $(UCLIBC_DIR)/.stamp_{config_fixup_done,configured,built}
+	rm -f $(UCLIBC_DIR)/.stamp_{target,staging}_installed
 
-uclibc-update-config: $(UCLIBC_DIR)/.stamp_configured
+uclibc-update-config: $(UCLIBC_DIR)/.stamp_config_fixup_done
 	cp -f $(UCLIBC_DIR)/.config $(UCLIBC_CONFIG_FILE)
 
 # Before uClibc is built, we must have the second stage cross-compiler
#5 lore raw

PATCH v2 1/1 uclibc: fix handling of configuration file

In reply to Thomas De Schampheleire

All,

Quoted 24 lines · Thomas De Schampheleire

This patch series (part of it poster earlier as RFC) has as main goal to fix the uclibc kconfig handling with following requirements in mind:

- neither foo-menuconfig nor foo-update-config should have a dependency on the toolchain (which means we cannot depend on foo-configure)

- 'clean foo-menuconfig' should start from the specified (custom) config file

- 'foo-menuconfig foo-update-config' should preserve the changes made in the menuconfig step (this problem is reported for uclibc with bug #7154
(https://bugs.busybox.net/show_bug.cgi?id=7154).

- 'make foo-menuconfig; make foo-menuconfig' should preserve the changes made in the menuconfig step.

- 'make clean foo-update-config' should copy the initial file, do any fixups, and then save the config

Once this series is accepted, the plan is:
- to extract the kconfig-related bits to a kconfig-package infrastructure.
- to convert busybox, linux and barebox to this kconfig-package infra too.

Quoted 5 lines
---
 package/uclibc/uclibc.mk |  24 ++++++++++++++++--------
 1 files changed, 16 insertions(+), 8 deletions(-)

Any further comments on v2 of this patch?

Thanks,
Thomas