diff --git a/DEVELOPERS b/DEVELOPERS index 73664feb48..a64a9ef384 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -2020,6 +2020,9 @@ F: package/libfribidi/ N: Min Xu F: package/shadowsocks-libev/ +N: Miquèl Raynal +F: package/rockchip-mali/ + N: Mircea Gliga F: package/mbuffer/ diff --git a/package/Config.in b/package/Config.in index a555e6fd78..bf7a346f75 100644 --- a/package/Config.in +++ b/package/Config.in @@ -548,6 +548,7 @@ endmenu source "package/raspi-gpio/Config.in" source "package/read-edid/Config.in" source "package/rng-tools/Config.in" + source "package/rockchip-mali/Config.in" source "package/rpi-userland/Config.in" source "package/rs485conf/Config.in" source "package/rtc-tools/Config.in" diff --git a/package/rockchip-mali/Config.in b/package/rockchip-mali/Config.in new file mode 100644 index 0000000000..b2033652a8 --- /dev/null +++ b/package/rockchip-mali/Config.in @@ -0,0 +1,31 @@ +config BR2_PACKAGE_ROCKCHIP_MALI + bool "rockchip-mali" + depends on BR2_TOOLCHAIN_USES_GLIBC + depends on BR2_ARM_EABIHF || BR2_aarch64 + # lidbrm. This would normally need a Config.in comment, but + # these blobs are linked against glibc, so we are sure to have + # thread support, so don't bother. + depends on BR2_TOOLCHAIN_HAS_THREADS + select BR2_PACKAGE_HAS_LIBEGL + select BR2_PACKAGE_HAS_LIBGLES + select BR2_PACKAGE_HAS_LIBGBM + select BR2_PACKAGE_LIBGBM_HAS_FEATURE_DMA_BUF + select BR2_PACKAGE_LIBDRM + help + Install the binary user-space libraries for the ARM Mali GPU + suitable for Rockchip platforrms. This package requires a + kernel with the ARM Mali GPU kernel driver enabled, as found + in the 'mali-driver' package. + +if BR2_PACKAGE_ROCKCHIP_MALI + +config BR2_PACKAGE_PROVIDES_LIBEGL + default "rockchip-mali" + +config BR2_PACKAGE_PROVIDES_LIBGLES + default "rockchip-mali" + +config BR2_PACKAGE_PROVIDES_LIBGBM + default "rockchip-mali" + +endif diff --git a/package/rockchip-mali/rockchip-mali.hash b/package/rockchip-mali/rockchip-mali.hash new file mode 100644 index 0000000000..38efcb3077 --- /dev/null +++ b/package/rockchip-mali/rockchip-mali.hash @@ -0,0 +1,2 @@ +sha256 ee440d859e9d7dfdf29b9a00c7a633337913c407be567d3651c29c12eb75fd9c rockchip-mali-721653b5b3b525a4f80d15aa7e2f9df7b7e60427.tar.gz +sha256 a78acc73de9909efb879800d4daa4640c4aaa55cd751238a133954aba15e4285 END_USER_LICENCE_AGREEMENT.txt diff --git a/package/rockchip-mali/rockchip-mali.mk b/package/rockchip-mali/rockchip-mali.mk new file mode 100644 index 0000000000..6200191a73 --- /dev/null +++ b/package/rockchip-mali/rockchip-mali.mk @@ -0,0 +1,77 @@ +################################################################################ +# +# rockchip-mali +# +################################################################################ + +ROCKCHIP_MALI_VERSION = 721653b5b3b525a4f80d15aa7e2f9df7b7e60427 +ROCKCHIP_MALI_SITE = $(call github,rockchip-linux,libmali,$(ROCKCHIP_MALI_VERSION)) +ROCKCHIP_MALI_LICENSE = Proprietary +ROCKCHIP_MALI_LICENSE_FILES = END_USER_LICENCE_AGREEMENT.txt +ROCKCHIP_MALI_INSTALL_STAGING = YES +ROCKCHIP_MALI_DEPENDENCIES = host-patchelf libdrm +ROCKCHIP_MALI_PROVIDES = libegl libgles libgbm + +ROCKCHIP_MALI_LIB = libmali-bifrost-g31-rxp0$(ROCKCHIP_MALI_SUFFIX).so +ROCKCHIP_MALI_PKGCONFIG_FILES = egl gbm glesv2 mali +ROCKCHIP_MALI_ARCH_DIR = $(if $(BR2_arm),arm-linux-gnueabihf,aarch64-linux-gnu) +ROCKCHIP_MALI_HEADERS = EGL FBDEV GLES GLES2 GLES3 KHR gbm.h + +# We need to create: +# - The symlink that matches the library SONAME (libmali.so.1) +# - The .so symlinks needed at compile time by the compiler (*.so) +ROCKCHIP_MALI_LIB_SYMLINKS = \ + libmali.so.1 \ + libMali.so \ + libEGL.so \ + libgbm.so \ + libGLESv1_CM.so \ + libGLESv2.so + +ifeq ($(BR2_PACKAGE_WAYLAND),y) +ROCKCHIP_MALI_SUFFIX = -wayland-gbm +ROCKCHIP_MALI_PKGCONFIG_FILES += wayland-egl +ROCKCHIP_MALI_LIB_SYMLINKS += libwayland-egl.so +ROCKCHIP_MALI_DEPENDENCIES += wayland +else +ROCKCHIP_MALI_SUFFIX = -gbm +endif + +define ROCKCHIP_MALI_INSTALL_CMDS +# Install the library + $(INSTALL) -D -m 0755 \ + $(@D)/lib/$(ROCKCHIP_MALI_ARCH_DIR)/$(ROCKCHIP_MALI_LIB) \ + $(1)/usr/lib/$(ROCKCHIP_MALI_LIB) + +# Ensure it has a proper soname + $(HOST_DIR)/bin/patchelf --set-soname libmali.so.1 \ + $(1)/usr/lib/$(ROCKCHIP_MALI_LIB) + +# Generate and install the .pc files + mkdir -p $(1)/usr/lib/pkgconfig + $(foreach pkgconfig,$(ROCKCHIP_MALI_PKGCONFIG_FILES), \ + sed -e 's%@CMAKE_INSTALL_LIBDIR@%lib%;s%@CMAKE_INSTALL_INCLUDEDIR@%include%' \ + $(@D)/pkgconfig/$(pkgconfig).pc.cmake > \ + $(1)/usr/lib/pkgconfig/$(pkgconfig).pc + ) + +# Install all headers + $(foreach d,$(ROCKCHIP_MALI_HEADERS), \ + cp -dpfr $(@D)/include/$(d) $(1)/usr/include/ + ) + +# Create symlinks + $(foreach symlink,$(ROCKCHIP_MALI_LIB_SYMLINKS), \ + ln -sf $(ROCKCHIP_MALI_LIB) $(1)/usr/lib/$(symlink) + ) +endef + +define ROCKCHIP_MALI_INSTALL_TARGET_CMDS + $(call ROCKCHIP_MALI_INSTALL_CMDS,$(TARGET_DIR)) +endef + +define ROCKCHIP_MALI_INSTALL_STAGING_CMDS + $(call ROCKCHIP_MALI_INSTALL_CMDS,$(STAGING_DIR)) +endef + +$(eval $(generic-package))