diff mbox

[3/4] kernel-module-imx-gpu-viv: add new package

Message ID 1454319423-13913-4-git-send-email-gary.bisson@boundarydevices.com
State Changes Requested
Headers show

Commit Message

Gary Bisson Feb. 1, 2016, 9:37 a.m. UTC
This is the Vivante kernel driver split from the kernel source code in
order to make it possible to be used in any kernel source since 3.10.53.

The driver source code provided by Freescale needs fixes so the
community forked the code to allow faster development and easier
integration of fixes from the community.

This patch is based on the Yocto equivalent:
https://github.com/Freescale/meta-fsl-arm/commit/32cf391
https://github.com/Freescale/meta-fsl-arm/commit/4249193

This package has been tested with the following commands:
 # modprobe galcore
 # cd /usr/share/examples/viv_samples/vdk/
 # ./tutorial7

Signed-off-by: Gary Bisson <gary.bisson@boundarydevices.com>
---
As explained in the cover letter, Yocto has a do_configure_append which
allows to modify the kernel configuration and remove the built-in Vivante
driver option.
https://github.com/Freescale/meta-fsl-arm/blob/master/classes/fsl-vivante-kernel-driver-handler.bbclass#L52

In order to have a similar mechanism the kernel module Vivante package
includes a LINUX_POST_CONFIGURE_HOOKS which doesn't really feel right.

Indeed, with this hook in place, the kernel and its modules are re-built
everytime a 'make' is issued. Not sure why it affects the build this way,
any input is appreciated.

Regards,
Gary
---
 package/freescale-imx/Config.in                    |  1 +
 .../kernel-module-imx-gpu-viv/Config.in            | 12 ++++++++++
 .../kernel-module-imx-gpu-viv.mk                   | 28 ++++++++++++++++++++++
 3 files changed, 41 insertions(+)
 create mode 100644 package/freescale-imx/kernel-module-imx-gpu-viv/Config.in
 create mode 100644 package/freescale-imx/kernel-module-imx-gpu-viv/kernel-module-imx-gpu-viv.mk

Comments

Thomas Petazzoni Feb. 1, 2016, 8:56 p.m. UTC | #1
Dear Gary Bisson,

On Mon,  1 Feb 2016 10:37:02 +0100, Gary Bisson wrote:

> +config BR2_PACKAGE_KERNEL_MODULE_IMX_GPU_VIV
> +	bool "kernel-module-imx-gpu-viv"
> +	depends on BR2_LINUX_KERNEL
> +	help
> +	  Kernel loadable module for Vivante GPU.
> +
> +	  This package uses an exact copy of the GPU kernel driver source code
> +	  of the same version as base and include fixes and improvements
> +	  developed by FSL Community

Upstream URL missing here. Also please include a hash file.

> diff --git a/package/freescale-imx/kernel-module-imx-gpu-viv/kernel-module-imx-gpu-viv.mk b/package/freescale-imx/kernel-module-imx-gpu-viv/kernel-module-imx-gpu-viv.mk
> new file mode 100644
> index 0000000..9c45f23
> --- /dev/null
> +++ b/package/freescale-imx/kernel-module-imx-gpu-viv/kernel-module-imx-gpu-viv.mk
> @@ -0,0 +1,28 @@
> +################################################################################
> +#
> +# kernel-module-imx-gpu-viv
> +#
> +################################################################################
> +
> +KERNEL_MODULE_IMX_GPU_VIV_VERSION = eeeb23c0fb1cee01318088d417025263479c44ac
> +KERNEL_MODULE_IMX_GPU_VIV_SITE = \
> +	$(call github,Freescale,kernel-module-imx-gpu-viv,$(KERNEL_MODULE_IMX_GPU_VIV_VERSION))
> +KERNEL_MODULE_IMX_GPU_VIV_LICENSE = GPLv2
> +KERNEL_MODULE_IMX_GPU_VIV_LICENSE_FILES = COPYING
> +
> +KERNEL_MODULE_IMX_GPU_VIV_MODULE_MAKE_OPTS = \
> +	AQROOT=$(@D)/kernel-module-imx-gpu-viv-src \
> +	KERNEL_DIR=$(LINUX_DIR)
> +
> +KERNEL_MODULE_IMX_GPU_VIV_MODULE_SUBDIRS = kernel-module-imx-gpu-viv-src
> +
> +# Modify Linux configuration in case it includes a built-in version of
> +# the Vivante driver.
> +define LINUX_CONFIGURATION_FIXUP
> +	sed -i "/CONFIG_MXC_GPU_VIV[ =]/d" $(LINUX_DIR)/.config
> +	echo "# CONFIG_MXC_GPU_VIV is not set" >> $(LINUX_DIR)/.config
> +endef
> +LINUX_POST_CONFIGURE_HOOKS += LINUX_CONFIGURATION_FIXUP

I really don't like spreading hooks for package A in the code of
package B. I think here it's better to change linux.mk with:

        $(if $(BR2_PACKAGE_KERNEL_MODULE_IMX_GPU_VIV),
                $(call KCONFIG_DISABLE_OPT,CONFIG_MXC_GPU_VIV,$(@D)/.config))

In LINUX_KCONFIG_FIXUP_CMDS.

Peter, Arnout, Yann, what do you think ?

Thomas
Peter Korsgaard Feb. 1, 2016, 9:28 p.m. UTC | #2
>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 > I really don't like spreading hooks for package A in the code of
 > package B. I think here it's better to change linux.mk with:

 >         $(if $(BR2_PACKAGE_KERNEL_MODULE_IMX_GPU_VIV),
 >                 $(call KCONFIG_DISABLE_OPT,CONFIG_MXC_GPU_VIV,$(@D)/.config))

 > In LINUX_KCONFIG_FIXUP_CMDS.

 > Peter, Arnout, Yann, what do you think ?

Yes, that matches what we do for the other package related kernel
configs.

Does this theoretically work on a mainline kernel? If so, perhaps it
should also disable the recently added DRM_VIVANTE stuff in case it
conflicts?
Yann E. MORIN Feb. 1, 2016, 9:36 p.m. UTC | #3
Gary, All,

On 2016-02-01 22:28 +0100, Peter Korsgaard spake thusly:
> >>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:
>  > I really don't like spreading hooks for package A in the code of
>  > package B. I think here it's better to change linux.mk with:
>  >         $(if $(BR2_PACKAGE_KERNEL_MODULE_IMX_GPU_VIV),
>  >                 $(call KCONFIG_DISABLE_OPT,CONFIG_MXC_GPU_VIV,$(@D)/.config))
>  > In LINUX_KCONFIG_FIXUP_CMDS.
>  > Peter, Arnout, Yann, what do you think ?
> Yes, that matches what we do for the other package related kernel
> configs.

Agreed.

Regards,
Yann E. MORIN.
Gary Bisson Feb. 1, 2016, 11:33 p.m. UTC | #4
Peter, All,

On Mon, Feb 1, 2016 at 10:28 PM, Peter Korsgaard <peter@korsgaard.com> wrote:
>>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:
>
> Hi,
>
>  > I really don't like spreading hooks for package A in the code of
>  > package B. I think here it's better to change linux.mk with:
>
>  >         $(if $(BR2_PACKAGE_KERNEL_MODULE_IMX_GPU_VIV),
>  >                 $(call KCONFIG_DISABLE_OPT,CONFIG_MXC_GPU_VIV,$(@D)/.config))
>
>  > In LINUX_KCONFIG_FIXUP_CMDS.
>
>  > Peter, Arnout, Yann, what do you think ?
>
> Yes, that matches what we do for the other package related kernel
> configs.

Ok I'll switch to that.

> Does this theoretically work on a mainline kernel? If so, perhaps it
> should also disable the recently added DRM_VIVANTE stuff in case it
> conflicts?

No unfortunately this doesn't work on a mainline kernel.

Regards,
Gary
diff mbox

Patch

diff --git a/package/freescale-imx/Config.in b/package/freescale-imx/Config.in
index a958dbd..dfb6cc4 100644
--- a/package/freescale-imx/Config.in
+++ b/package/freescale-imx/Config.in
@@ -52,6 +52,7 @@  source "package/freescale-imx/libz160/Config.in"
 endif
 if BR2_PACKAGE_FREESCALE_IMX_PLATFORM_IMX6Q
 source "package/freescale-imx/imx-gpu-viv/Config.in"
+source "package/freescale-imx/kernel-module-imx-gpu-viv/Config.in"
 endif
 
 endif
diff --git a/package/freescale-imx/kernel-module-imx-gpu-viv/Config.in b/package/freescale-imx/kernel-module-imx-gpu-viv/Config.in
new file mode 100644
index 0000000..0725a89
--- /dev/null
+++ b/package/freescale-imx/kernel-module-imx-gpu-viv/Config.in
@@ -0,0 +1,12 @@ 
+comment "kernel-module-imx-gpu-viv needs a Linux kernel to be built"
+	depends on !BR2_LINUX_KERNEL
+
+config BR2_PACKAGE_KERNEL_MODULE_IMX_GPU_VIV
+	bool "kernel-module-imx-gpu-viv"
+	depends on BR2_LINUX_KERNEL
+	help
+	  Kernel loadable module for Vivante GPU.
+
+	  This package uses an exact copy of the GPU kernel driver source code
+	  of the same version as base and include fixes and improvements
+	  developed by FSL Community
diff --git a/package/freescale-imx/kernel-module-imx-gpu-viv/kernel-module-imx-gpu-viv.mk b/package/freescale-imx/kernel-module-imx-gpu-viv/kernel-module-imx-gpu-viv.mk
new file mode 100644
index 0000000..9c45f23
--- /dev/null
+++ b/package/freescale-imx/kernel-module-imx-gpu-viv/kernel-module-imx-gpu-viv.mk
@@ -0,0 +1,28 @@ 
+################################################################################
+#
+# kernel-module-imx-gpu-viv
+#
+################################################################################
+
+KERNEL_MODULE_IMX_GPU_VIV_VERSION = eeeb23c0fb1cee01318088d417025263479c44ac
+KERNEL_MODULE_IMX_GPU_VIV_SITE = \
+	$(call github,Freescale,kernel-module-imx-gpu-viv,$(KERNEL_MODULE_IMX_GPU_VIV_VERSION))
+KERNEL_MODULE_IMX_GPU_VIV_LICENSE = GPLv2
+KERNEL_MODULE_IMX_GPU_VIV_LICENSE_FILES = COPYING
+
+KERNEL_MODULE_IMX_GPU_VIV_MODULE_MAKE_OPTS = \
+	AQROOT=$(@D)/kernel-module-imx-gpu-viv-src \
+	KERNEL_DIR=$(LINUX_DIR)
+
+KERNEL_MODULE_IMX_GPU_VIV_MODULE_SUBDIRS = kernel-module-imx-gpu-viv-src
+
+# Modify Linux configuration in case it includes a built-in version of
+# the Vivante driver.
+define LINUX_CONFIGURATION_FIXUP
+	sed -i "/CONFIG_MXC_GPU_VIV[ =]/d" $(LINUX_DIR)/.config
+	echo "# CONFIG_MXC_GPU_VIV is not set" >> $(LINUX_DIR)/.config
+endef
+LINUX_POST_CONFIGURE_HOOKS += LINUX_CONFIGURATION_FIXUP
+
+$(eval $(kernel-module))
+$(eval $(generic-package))