summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorMichael Olbrich <m.olbrich@pengutronix.de>2018-07-25 11:39:07 +0200
committerMichael Olbrich <m.olbrich@pengutronix.de>2018-09-21 14:56:51 +0200
commit8b02c5438c89174df03a00206f86403625ee97ac (patch)
tree4149355a3c5aaae8bc8b27b4246e3e4a7d61aaa6 /scripts
parent3b7733a0d45561032f5c62790d5c7c171074b2ed (diff)
downloadptxdist-8b02c5438c89174df03a00206f86403625ee97ac.tar.gz
ptxdist-8b02c5438c89174df03a00206f86403625ee97ac.tar.xz
ptxd_make_world_kconfig: add helper to create and save .config
The helper handle layers correctly and will merge the config from a base layer with a delta config if necessary. A delta config is generated or updated if a base layer config exists. Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/lib/ptxd_make_world_kconfig.sh59
1 files changed, 53 insertions, 6 deletions
diff --git a/scripts/lib/ptxd_make_world_kconfig.sh b/scripts/lib/ptxd_make_world_kconfig.sh
index 719947de7..6d1e8b45e 100644
--- a/scripts/lib/ptxd_make_world_kconfig.sh
+++ b/scripts/lib/ptxd_make_world_kconfig.sh
@@ -8,23 +8,70 @@
# see the README file.
#
+ptxd_make_kconfig_setup() {
+ if [ -n "${ref_file_dotconfig}" ]; then
+ file_dotconfig="${ref_file_dotconfig}" ptxd_normalize_config &&
+ relative_ref_file_dotconfig="${relative_file_dotconfig}"
+ fi &&
+ ptxd_normalize_config &&
+ ptxd_kconfig_setup_config "${ptx_config_mode}" "${pkg_build_dir}/.config" \
+ "${relative_file_dotconfig}" "${file_dotconfig}" "${relative_ref_file_dotconfig}"
+}
+export -f ptxd_make_kconfig_setup
+
+ptxd_make_world_kconfig_setup() {
+ ptxd_make_world_init || return
+
+ if [ -z "${ptx_config_mode}" ]; then
+ case "${pkg_stage}" in
+ *config) ptx_config_mode=update ;;
+ *) ptx_config_mode=run ;;
+ esac
+ fi
+
+ local file_dotconfig="${pkg_config}"
+ local ref_file_dotconfig="${pkg_ref_config}"
+ ptxd_make_kconfig_setup
+}
+export -f ptxd_make_world_kconfig_setup
+
+ptxd_make_kconfig_sync() {
+ if [ -n "${ref_file_dotconfig}" ]; then
+ file_dotconfig="${ref_file_dotconfig}" ptxd_normalize_config &&
+ relative_ref_file_dotconfig="${relative_file_dotconfig}"
+ fi &&
+ ptxd_normalize_config &&
+ ptxd_kconfig_sync_config update "${pkg_build_dir}/.config" \
+ "${relative_file_dotconfig}" "${relative_ref_file_dotconfig}"
+}
+export -f ptxd_make_kconfig_sync
+
+ptxd_make_world_kconfig_sync() {
+ ptxd_make_world_init || return
+
+ local file_dotconfig="${pkg_config}"
+ local ref_file_dotconfig="${pkg_ref_config}"
+ ptxd_make_kconfig_sync
+}
+export -f ptxd_make_world_kconfig_sync
+
#
# run kconfig and update the config file
# @$1: the kconfig target (e.g. menuconfig, oldconfig, ...)
#
ptxd_make_kconfig() {
- if [ -e "${pkg_config}" ]; then
- cp "${pkg_config}" .config
- fi &&
+ local file_dotconfig="${pkg_config}"
+ local ref_file_dotconfig="${pkg_ref_config}"
+ local ptx_config_mode=run
+
+ ptxd_make_kconfig_setup &&
ptxd_eval \
"${pkg_path}" \
"${pkg_env}" \
"${pkg_conf_env}" \
make "${1}" \
"${pkg_conf_opt}" &&
- if ! diff -q -I "# [^C]" .config "${pkg_config}" > /dev/null 2>&1; then
- cp .config "${pkg_config}"
- fi
+ ptxd_make_kconfig_sync
}
export -f ptxd_make_kconfig