[meta-freescale] [PATCH v2 3/5] fsl-vivante-kernel-driver-handler.bbclass: Handle Vivante kernel driver provider

Otavio Salvador otavio at ossystems.com.br
Thu Aug 20 04:28:35 PDT 2015


Enable the kernel to provide or not the Vivante kernel driver and
dynamically set the proper providers per machine.

The following options are supported:

  MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT

      Machine has or not support for the Vivante kernel driver, options
      are:

       0 - machine does not have Vivante GPU driver support
       1 - machine has Vivante GPU driver support

  MACHINE_USE_VIVANTE_KERNEL_DRIVER_MODULE

      Machine use the Vivante kernel driver as module, options are:

       0 - enable the builtin kernel driver module
       1 - enable the external kernel module

Signed-off-by: Otavio Salvador <otavio at ossystems.com.br>
---

Changes in v2:
- improve commit log and class documentation for
  MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT (Daiane)

 classes/fsl-vivante-kernel-driver-handler.bbclass | 67 +++++++++++++++++++++++
 1 file changed, 67 insertions(+)
 create mode 100644 classes/fsl-vivante-kernel-driver-handler.bbclass

diff --git a/classes/fsl-vivante-kernel-driver-handler.bbclass b/classes/fsl-vivante-kernel-driver-handler.bbclass
new file mode 100644
index 0000000..e466b81
--- /dev/null
+++ b/classes/fsl-vivante-kernel-driver-handler.bbclass
@@ -0,0 +1,67 @@
+# Freescale Kernel Vivante Kernel Driver handler
+#
+# Enable the kernel to provide or not the Vivante kernel driver and
+#  dynamically set the proper providers per machine.
+#
+# The following options are supported:
+#
+#  MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT
+#
+#     Machine has or not support for the Vivante kernel driver, options
+#     are:
+#
+#       0 - machine does not have Vivante GPU driver support
+#       1 - machine has Vivante GPU driver support
+#
+#  MACHINE_USE_VIVANTE_KERNEL_DRIVER_MODULE
+#
+#      Machine use the Vivante kernel driver as module, options are:
+#
+#       0 - enable the builtin kernel driver module
+#       1 - enable the external kernel module
+#
+# Copyright 2015 (C) O.S. Systems Software LTDA.
+# Released under the MIT license (see COPYING.MIT for the terms)
+
+# Handle Vivante kernel driver setting
+MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT       ?= "0"
+MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT_mx6q  ?= "1"
+MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT_mx6dl ?= "1"
+MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT_mx6sx ?= "1"
+MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT_mx6sl ?= "1"
+
+# Use vivante kernel driver module:
+#   0 - enable the builtin kernel driver module
+#   1 - enable the external kernel module
+MACHINE_USE_VIVANTE_KERNEL_DRIVER_MODULE       ??= "1"
+
+python fsl_vivante_kernel_driver_handler () {
+    has_vivante_kernel_driver_support = e.data.getVar('MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT', True) or "0"
+    use_vivante_kernel_driver_module = e.data.getVar('MACHINE_USE_VIVANTE_KERNEL_DRIVER_MODULE', True) or "0"
+
+    if has_vivante_kernel_driver_support != "1":
+        return
+
+    if use_vivante_kernel_driver_module != "1":
+        e.data.appendVar('RPROVIDES_kernel-base', ' kernel-module-imx-gpu-viv')
+        e.data.appendVar('RREPLACES_kernel-base', ' kernel-module-imx-gpu-viv')
+        e.data.appendVar('RCONFLICTS_kernel-base', ' kernel-module-imx-gpu-viv')
+}
+
+addhandler fsl_vivante_kernel_driver_handler
+fsl_vivante_kernel_driver_handler[eventmask] = "bb.event.RecipePreFinalise"
+
+do_configure_prepend () {
+    if [ "${MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT}" = "1" ]; then
+        fsl_viv_handler_defconfig="${WORKDIR}/defconfig"
+        if [ -e ${B}/.config ]; then
+            fsl_viv_handler_defconfig="${B}/.config"
+        fi
+        sed -i "/CONFIG_MXC_GPU_VIV[ =]/d" $fsl_viv_handler_defconfig
+        if [ "${MACHINE_USE_VIVANTE_KERNEL_DRIVER_MODULE}" = "1" ]; then
+            echo "# CONFIG_MXC_GPU_VIV is not set" >> $fsl_viv_handler_defconfig
+        else
+            echo "CONFIG_MXC_GPU_VIV=y" >> $fsl_viv_handler_defconfig
+        fi
+    fi
+}
-- 
2.5.0



More information about the meta-freescale mailing list