summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSam bobroff <sam.bobroff@au1.ibm.com>2015-12-22 22:22:00 +0100
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>2015-12-22 22:39:14 +0100
commit8ef62b996b9f2fa04d907885b16ae7caa199c617 (patch)
treef7b8713149e282da5a0f02ca5f635dcb479ab96b
parent79c7bae6cbd6c1dd062c32709f17ac0a6611bfbf (diff)
downloadbuildroot-8ef62b996b9f2fa04d907885b16ae7caa199c617.tar.gz
buildroot-8ef62b996b9f2fa04d907885b16ae7caa199c617.zip
core/pkg-kconfig: handle generated defconfigs
As of Linux kernel commit ea4d1a8 "powerpc/configs: Replace pseries_le_defconfig with a Makefile target using merge_config" some kconfig defconfigs (one so far: "pseries_le_defconfig") can be generated using "make <defconfig>" and they do not exist on disk as a single defconfig file. This causes buildroot's build to fail for those configs with: 'arch/powerpc/configs/pseries_le_defconfig' for 'linux' does not exist To handle this case and keep the makefile steps as simple as possible, introduce a new package variable, *_KCONFIG_DEFCONFIG, that can be used to indicate that a defconfig rule is being used, rather than a file. This allows the rule that generates the .config file to use either the provided file (by copying) or a generated defconfig (by running "make <defconfig>") as its starting point. merge_config.sh can then be run the same way in either case, using .config as both input and output. Note that merge_config.sh is now modifying .config in-place but this is safe because it uses a temporary copy while making changes. This patch introduces the new variable but does not make use of it. Use of the new variable will be introduced in separate patches. Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com> [yann.morin.1998@free.fr: - include all the other kconfig-package hunks into this one patch - do not transform the 'echo "..."; exit 1' into $(error ...) calls - use a make $(if)-block instead of a shell if-block to copy the file or run make (like is done to check the kconfig snippets) - misc typoes and rephrasing in the commit log - do not force the _defconfig suffix in the infra (Thomas) ] Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr> Cc: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
-rw-r--r--package/pkg-kconfig.mk20
1 files changed, 16 insertions, 4 deletions
diff --git a/package/pkg-kconfig.mk b/package/pkg-kconfig.mk
index 44c74a712a..eaee572e9c 100644
--- a/package/pkg-kconfig.mk
+++ b/package/pkg-kconfig.mk
@@ -63,8 +63,12 @@ $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES): | $(1)-patch
# 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) $$($(2)_KCONFIG_FRAGMENT_FILES)
+ $$(if $$($(2)_KCONFIG_DEFCONFIG), \
+ $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
+ $$($(2)_KCONFIG_OPTS) $$($(2)_KCONFIG_DEFCONFIG), \
+ cp $$($(2)_KCONFIG_FILE) $$(@))
support/kconfig/merge_config.sh -m -O $$(@D) \
- $$($(2)_KCONFIG_FILE) $$($(2)_KCONFIG_FRAGMENT_FILES)
+ $$(@) $$($(2)_KCONFIG_FRAGMENT_FILES)
$$(Q)yes "" | $$($(2)_MAKE_ENV) $$(MAKE) -C $$($(2)_DIR) \
$$($(2)_KCONFIG_OPTS) oldconfig
@@ -89,10 +93,14 @@ $$($(2)_TARGET_CONFIGURE): $$($(2)_DIR)/.stamp_kconfig_fixup_done
# already called above, so we can effectively use this variable.
ifeq ($$($$($(2)_KCONFIG_VAR)),y)
-# FOO_KCONFIG_FILE is required
ifeq ($$(BR_BUILDING),y)
-ifeq ($$($(2)_KCONFIG_FILE),)
-$$(error Internal error: no value specified for $(2)_KCONFIG_FILE)
+# Either FOO_KCONFIG_FILE or FOO_KCONFIG_DEFCONFIG is required...
+ifeq ($$(or $$($(2)_KCONFIG_FILE),$$($(2)_KCONFIG_DEFCONFIG)),)
+$$(error Internal error: no value specified for $(2)_KCONFIG_FILE or $(2)_KCONFIG_DEFCONFIG)
+endif
+# ... but not both:
+ifneq ($$(and $$($(2)_KCONFIG_FILE),$$($(2)_KCONFIG_DEFCONFIG)),)
+$$(error Internal error: $(2)_KCONFIG_FILE and $(2)_KCONFIG_DEFCONFIG are mutually exclusive but both are defined)
endif
endif
@@ -160,6 +168,8 @@ $(1)-savedefconfig: $(1)-check-configuration-done
$(1)-update-config: $(1)-check-configuration-done
@$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
echo "Unable to perform $(1)-update-config when fragment files are set"; exit 1)
+ @$$(if $$($(2)_KCONFIG_DEFCONFIG), \
+ echo "Unable to perform $(1)-update-config when using a defconfig rule"; exit 1)
cp -f $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
@@ -170,6 +180,8 @@ $(1)-update-config: $(1)-check-configuration-done
$(1)-update-defconfig: $(1)-savedefconfig
@$$(if $$($(2)_KCONFIG_FRAGMENT_FILES), \
echo "Unable to perform $(1)-update-defconfig when fragment files are set"; exit 1)
+ @$$(if $$($(2)_KCONFIG_DEFCONFIG), \
+ echo "Unable to perform $(1)-update-defconfig when using a defconfig rule"; exit 1)
cp -f $$($(2)_DIR)/defconfig $$($(2)_KCONFIG_FILE)
touch --reference $$($(2)_DIR)/.config $$($(2)_KCONFIG_FILE)
OpenPOWER on IntegriCloud