aboutsummaryrefslogtreecommitdiffstats
path: root/common/classes
diff options
context:
space:
mode:
authorDrew Moseley <drew_moseley@mentor.com>2014-06-16 14:49:18 -0400
committerDrew Moseley <drew_moseley@mentor.com>2014-06-16 14:57:16 -0400
commit6e6a6d91fe75518e11e6d819a8c94af2e4ef3864 (patch)
treed701fe729f664c9d1157bd3a83601ebec7dad3ff /common/classes
parentece7972d08e5fc3ec82e11f93a273ff4208258bb (diff)
downloadmeta-amd-6e6a6d91fe75518e11e6d819a8c94af2e4ef3864.tar.gz
meta-amd-6e6a6d91fe75518e11e6d819a8c94af2e4ef3864.tar.bz2
meta-amd-6e6a6d91fe75518e11e6d819a8c94af2e4ef3864.zip
amd: Add kernel config fragment support
Signed-off-by: Drew Moseley <drew_moseley@mentor.com>
Diffstat (limited to 'common/classes')
-rw-r--r--common/classes/cml1-config.bbclass51
1 files changed, 51 insertions, 0 deletions
diff --git a/common/classes/cml1-config.bbclass b/common/classes/cml1-config.bbclass
new file mode 100644
index 00000000..ca3de7cc
--- /dev/null
+++ b/common/classes/cml1-config.bbclass
@@ -0,0 +1,51 @@
+# Consistent handling of the defconfig -> .config, with merge of config
+# fragments using the same mechanism as busybox and linux-yocto.
+#
+# The functionality is split into a number of small functions to easier
+# facilitate recipe alteration of the process, or filtering of the fragments
+# to be merged. To filter the fragments in use, append to the pipeline (after
+# the inherit of this class):
+#
+# merge_fragment_pipeline .= "| my_filter"
+#
+# Note: due to bitbake's use of set -e, the filter must return success (0).
+
+
+DEFCONFIG ?= "${WORKDIR}/defconfig"
+merge_fragment_pipeline = "cat"
+
+do_prepare_config () {
+ if [ ! -e "${DEFCONFIG}" ]; then
+ bbfatal "Configuration file '${DEFCONFIG}' does not exist"
+ fi
+
+ install_config
+ merge_fragments ${B}/.config
+
+ # Sanity check in case do_configure wants to overwrite this
+ chmod -w ${B}/.config
+}
+
+do_prepare_config[dirs] = "${S}"
+do_prepare_config[depends] += "kern-tools-native:do_populate_sysroot"
+
+addtask prepare_config before do_configure after do_patch
+
+install_config () {
+ cp -f ${DEFCONFIG} ${B}/.config
+}
+
+merge_fragments () {
+ list_fragments | ${merge_fragment_pipeline} >"${B}/fragments"
+ merge_config.sh -m "$1" $(cat "${B}/fragments")
+}
+
+list_fragments () {
+ cat <<END
+ ${@"\n".join(src_config_fragments(d))}
+END
+}
+
+def src_config_fragments(d):
+ sources = src_patches(d, True)
+ return [s for s in sources if s.endswith('.cfg')]