summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Górny <mgorny@gentoo.org>2020-11-13 23:37:12 +0100
committerMichał Górny <mgorny@gentoo.org>2020-11-14 15:01:37 +0100
commitd5b0c16d1d3fdf63d743b22e7192e88e04556b05 (patch)
tree547f16c1835f25549f8347519fe189c405f295fc /eclass/kernel-build.eclass
parentdev-db/postgresql: Version Bumps (diff)
downloadgentoo-d5b0c16d1d3fdf63d743b22e7192e88e04556b05.tar.gz
gentoo-d5b0c16d1d3fdf63d743b22e7192e88e04556b05.tar.bz2
gentoo-d5b0c16d1d3fdf63d743b22e7192e88e04556b05.zip
kernel-build.eclass: Support merging config files
Add a convenience function to merge kernel config files from within the build tree, and support merging user configs. Signed-off-by: Michał Górny <mgorny@gentoo.org>
Diffstat (limited to 'eclass/kernel-build.eclass')
-rw-r--r--eclass/kernel-build.eclass32
1 files changed, 32 insertions, 0 deletions
diff --git a/eclass/kernel-build.eclass b/eclass/kernel-build.eclass
index 048d0c9b016c..99279ba58a99 100644
--- a/eclass/kernel-build.eclass
+++ b/eclass/kernel-build.eclass
@@ -197,6 +197,38 @@ kernel-build_pkg_postinst() {
savedconfig_pkg_postinst
}
+# @FUNCTION: kernel-build_merge_configs
+# @USAGE: [distro.config...]
+# @DESCRIPTION:
+# Merge the config files specified as arguments (if any) into
+# the '.config' file in the current directory, then merge
+# any user-supplied configs from ${BROOT}/etc/kernel/config.d/*.config.
+# The '.config' file must exist already and contain the base
+# configuration.
+kernel-build_merge_configs() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ [[ -f .config ]] || die "${FUNCNAME}: .config does not exist"
+ has .config "${@}" &&
+ die "${FUNCNAME}: do not specify .config as parameter"
+
+ local shopt_save=$(shopt -p nullglob)
+ shopt -s nullglob
+ local user_configs=( "${BROOT}"/etc/kernel/config.d/*.config )
+ shopt -u nullglob
+
+ if [[ ${#user_configs[@]} -gt 0 ]]; then
+ elog "User config files are being applied:"
+ local x
+ for x in "${user_configs[@]}"; do
+ elog "- ${x}"
+ done
+ fi
+
+ ./scripts/kconfig/merge_config.sh -m -r \
+ .config "${@}" "${user_configs[@]}" || die
+}
+
_KERNEL_BUILD_ECLASS=1
fi