diff options
author | Otavio Salvador <otavio@ossystems.com.br> | 2015-08-11 17:26:40 -0300 |
---|---|---|
committer | Otavio Salvador <otavio@ossystems.com.br> | 2016-04-19 15:03:20 -0300 |
commit | 2f94562bba387c7a6ba457f66f39ac976f656f9b (patch) | |
tree | b66a5a0f10832dca624081fac315f1a48c3ba61d /classes | |
parent | 5c52405b94a34713955665a16a9b255feb57e864 (diff) | |
download | meta-freescale-2f94562bba387c7a6ba457f66f39ac976f656f9b.tar.gz |
fsl-vivante-kernel-driver-handler.bbclass: Handle Vivante kernel driver provider
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 does or does not have 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_USES_VIVANTE_KERNEL_DRIVER_MODULE
Machine uses 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@ossystems.com.br>
Diffstat (limited to 'classes')
-rw-r--r-- | classes/fsl-vivante-kernel-driver-handler.bbclass | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/classes/fsl-vivante-kernel-driver-handler.bbclass b/classes/fsl-vivante-kernel-driver-handler.bbclass new file mode 100644 index 00000000..740638ac --- /dev/null +++ b/classes/fsl-vivante-kernel-driver-handler.bbclass | |||
@@ -0,0 +1,65 @@ | |||
1 | # Freescale Kernel Vivante Kernel Driver handler | ||
2 | # | ||
3 | # Enable the kernel to provide or not the Vivante kernel driver and | ||
4 | # dynamically set the proper providers per machine. | ||
5 | # | ||
6 | # The following options are supported: | ||
7 | # | ||
8 | # MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT | ||
9 | # | ||
10 | # Machine does or does not have support for the Vivante kernel | ||
11 | # driver, options are: | ||
12 | # | ||
13 | # 0 - machine does not have Vivante GPU driver support | ||
14 | # 1 - machine has Vivante GPU driver support | ||
15 | # | ||
16 | # MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE | ||
17 | # | ||
18 | # Machine uses the Vivante kernel driver as module, options are: | ||
19 | # | ||
20 | # 0 - enable the builtin kernel driver module | ||
21 | # 1 - enable the external kernel module | ||
22 | # | ||
23 | # Copyright 2015 (C) O.S. Systems Software LTDA. | ||
24 | # Released under the MIT license (see COPYING.MIT for the terms) | ||
25 | |||
26 | # Handle Vivante kernel driver setting: | ||
27 | # 0 - machine does not have Vivante GPU driver support | ||
28 | # 1 - machine has Vivante GPU driver support | ||
29 | MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT ??= "0" | ||
30 | |||
31 | # Use Vivante kernel driver module: | ||
32 | # 0 - enable the builtin kernel driver module | ||
33 | # 1 - enable the external kernel module | ||
34 | MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE ??= "1" | ||
35 | |||
36 | python fsl_vivante_kernel_driver_handler () { | ||
37 | has_vivante_kernel_driver_support = e.data.getVar('MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT', True) or "0" | ||
38 | use_vivante_kernel_driver_module = e.data.getVar('MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE', True) or "0" | ||
39 | |||
40 | if has_vivante_kernel_driver_support != "1": | ||
41 | return | ||
42 | |||
43 | if use_vivante_kernel_driver_module != "1": | ||
44 | e.data.appendVar('RPROVIDES_kernel-base', ' kernel-module-imx-gpu-viv') | ||
45 | e.data.appendVar('RREPLACES_kernel-base', ' kernel-module-imx-gpu-viv') | ||
46 | e.data.appendVar('RCONFLICTS_kernel-base', ' kernel-module-imx-gpu-viv') | ||
47 | } | ||
48 | |||
49 | addhandler fsl_vivante_kernel_driver_handler | ||
50 | fsl_vivante_kernel_driver_handler[eventmask] = "bb.event.RecipePreFinalise" | ||
51 | |||
52 | do_configure_prepend () { | ||
53 | if [ "${MACHINE_HAS_VIVANTE_KERNEL_DRIVER_SUPPORT}" = "1" ]; then | ||
54 | fsl_viv_handler_defconfig="${WORKDIR}/defconfig" | ||
55 | if [ -e ${B}/.config ]; then | ||
56 | fsl_viv_handler_defconfig="${B}/.config" | ||
57 | fi | ||
58 | sed -i "/CONFIG_MXC_GPU_VIV[ =]/d" $fsl_viv_handler_defconfig | ||
59 | if [ "${MACHINE_USES_VIVANTE_KERNEL_DRIVER_MODULE}" = "1" ]; then | ||
60 | echo "# CONFIG_MXC_GPU_VIV is not set" >> $fsl_viv_handler_defconfig | ||
61 | else | ||
62 | echo "CONFIG_MXC_GPU_VIV=y" >> $fsl_viv_handler_defconfig | ||
63 | fi | ||
64 | fi | ||
65 | } | ||