summaryrefslogtreecommitdiff
path: root/classes/toradex-kernel-config.bbclass
diff options
context:
space:
mode:
authorMing Liu <ming.liu@toradex.com>2020-03-13 10:41:36 +0100
committerMing Liu <ming.liu@toradex.com>2020-03-13 10:51:47 +0100
commitaaf2b59a0bd69c1cfea6d2fc0df30ab49e16e031 (patch)
treea073a0ed8ae5baffd41ec611edf0a9186acc05ff /classes/toradex-kernel-config.bbclass
parent319f84b395d5b129c7dca90554746589d2bb9f52 (diff)
toradex-kernel-config: add bbclass
It contains a helper function kernel_configure_variable that could be called in do_configure_append task to assign a value to a config variable in ${B}/.config. Change toradex-kernel-localversion.bbclass to use this function. Signed-off-by: Ming Liu <ming.liu@toradex.com>
Diffstat (limited to 'classes/toradex-kernel-config.bbclass')
-rw-r--r--classes/toradex-kernel-config.bbclass17
1 files changed, 17 insertions, 0 deletions
diff --git a/classes/toradex-kernel-config.bbclass b/classes/toradex-kernel-config.bbclass
new file mode 100644
index 0000000..8c3ad71
--- /dev/null
+++ b/classes/toradex-kernel-config.bbclass
@@ -0,0 +1,17 @@
+# Assign a config variable in ${B}/.config.
+# Should be called in do_configure_append only.
+#
+# $1 - config variable to be set
+# $2 - value [n/y/value]
+#
+kernel_configure_variable() {
+ # Remove the original config, to avoid reassigning it.
+ sed -i -e "/CONFIG_$1[ =]/d" ${B}/.config
+
+ # Assign the config value
+ if [ "$2" = "n" ]; then
+ echo "# CONFIG_$1 is not set" >> ${B}/.config
+ else
+ echo "CONFIG_$1=$2" >> ${B}/.config
+ fi
+}