diff options
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 | } | ||