package/rockchip-mali: new package

There is already a package adding Mali blobs for Sunxi Mali Utgard
GPUs. Many Rockchip SoCs feature a Mali Bifrost GPU and need specific
libraries provided under binary form with a non-GPL compliant license
by Rockchip. Package these libraries.

While the repository at https://github.com/rockchip-linux/libmali
supports many GPU variants, this package for now only supports the
Bifrost GPU blob. Support for other GPU blobs can be added later.

Signed-off-by: Maxime Chevallier <maxime.chevallier@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
[Thomas:
- Rename to rockchip-mali, because it contains other blobs than
  Bifrost ones
- Add missing entry in DEVELOPERS file
- Change BR2_arm to BR2_ARM_EABIHF as only EABIhf blobs are provided
  for arm32
- Add BR2_TOOLCHAIN_HAS_THREADS inherited from libdrm.
- Expose as a libgbm provider.
- Drop the patch, which was not necessary.
- Rework the entire installation logic, to be much simpler.]
Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
This commit is contained in:
Maxime Chevallier 2020-03-06 08:14:36 +01:00 committed by Thomas Petazzoni
parent 1842a1cb2c
commit 97c74a73e5
5 changed files with 114 additions and 0 deletions

View File

@ -2020,6 +2020,9 @@ F: package/libfribidi/
N: Min Xu <xuminready@gmail.com>
F: package/shadowsocks-libev/
N: Miquèl Raynal
F: package/rockchip-mali/
N: Mircea Gliga <gliga.mircea@gmail.com>
F: package/mbuffer/

View File

@ -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"

View File

@ -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

View File

@ -0,0 +1,2 @@
sha256 ee440d859e9d7dfdf29b9a00c7a633337913c407be567d3651c29c12eb75fd9c rockchip-mali-721653b5b3b525a4f80d15aa7e2f9df7b7e60427.tar.gz
sha256 a78acc73de9909efb879800d4daa4640c4aaa55cd751238a133954aba15e4285 END_USER_LICENCE_AGREEMENT.txt

View File

@ -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))