package/amd-catalyst: Add support for OpenCL
authorRomain Perier <romain.perier@free-electrons.com>
Tue, 23 Aug 2016 12:19:50 +0000 (14:19 +0200)
committerThomas Petazzoni <thomas.petazzoni@free-electrons.com>
Tue, 23 Aug 2016 17:16:18 +0000 (19:16 +0200)
The AMD Catalyst Linux driver includes OpenCL libraries for GPGPU
computing. This commits adds support to install the binary blobs and ICD
profiles.

Signed-off-by: Romain Perier <romain.perier@free-electrons.com>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
package/amd-catalyst/Config.in
package/amd-catalyst/amd-catalyst.mk

index 55099accf091a0440a48e84a5e0c7ad160c67ef3..96e7f06481d93777bff29527395833b8ad1309d2 100644 (file)
@@ -73,4 +73,10 @@ config BR2_PACKAGE_AMD_CATALYST_MODULE
        help
          Builds and install the fglrx kernel module
 
+config BR2_PACKAGE_AMD_CATALYST_OPENCL
+       bool "OpenCL support"
+       help
+         Installs the OpenCL binary blobs and the ICD profile
+         for GPGPU computing.
+
 endif # BR2_PACKAGE_AMD_CATALYST
index 07eb0faf7f4f53d84c21db1b73f55bd52e64459f..30973534b2837baeb40da74d8a9901ecbdfa1434 100644 (file)
@@ -41,6 +41,29 @@ AMD_CATALYST_POST_PATCH_HOOKS += AMD_CATALYST_PREPARE_MODULE
 $(eval $(kernel-module))
 endif
 
+ifeq ($(BR2_PACKAGE_AMD_CATALYST_OPENCL),y)
+
+AMD_CATALYST_OCL_SUFFIX = $(if $(BR2_x86_64),64,32)
+AMD_CATALYST_OPENCL_FILES = \
+       libOpenCL.so.1 \
+       libaticalcl.so \
+       libamdocl$(AMD_CATALYST_OCL_SUFFIX).so \
+       libamdocl12cl$(AMD_CATALYST_OCL_SUFFIX).so
+
+define AMD_CATALYST_INSTALL_OPENCL
+       $(foreach f,$(AMD_CATALYST_OPENCL_FILES), \
+               $(INSTALL) -D -m 0755 $(AMD_CATALYST_ARCH_DIR)/usr/lib$(AMD_CATALYST_LIB_SUFFIX)/$(f) $(TARGET_DIR)/usr/lib/$(f)
+       )
+       ln -sf libOpenCL.so.1 \
+               $(TARGET_DIR)/usr/lib/libOpenCL.so
+       $(INSTALL) -m 0755 $(AMD_CATALYST_ARCH_DIR)/usr/bin/clinfo \
+               $(TARGET_DIR)/usr/bin/clinfo
+       $(INSTALL) -D -m 0644 $(AMD_CATALYST_ARCH_DIR)/etc/OpenCL/vendors/amdocl$(AMD_CATALYST_OCL_SUFFIX).icd \
+               $(TARGET_DIR)/etc/OpenCL/vendors/amdocl$(AMD_CATALYST_OCL_SUFFIX).icd
+endef
+
+endif
+
 ifeq ($(BR2_PACKAGE_AMD_CATALYST_XORG), y)
 
 # GL headers are needed by any package that wants to use libgl, so they need to
@@ -145,6 +168,7 @@ define AMD_CATALYST_INSTALL_TARGET_CMDS
        $(call AMD_CATALYST_INSTALL_XORG)
        $(call AMD_CATALYST_INSTALL_CMDLINE_TOOLS)
        $(call AMD_CATALYST_INSTALL_CCCLE)
+       $(call AMD_CATALYST_INSTALL_OPENCL)
 endef
 
 $(eval $(generic-package))