Arm Community
Arm Community
  • Site
  • User
  • Site
  • Search
  • User
Arm Community blogs
Arm Community blogs
Mobile, Graphics, and Gaming blog How to compile a 4.9 kernel with Mali r15p0 kernel drivers for a MiQi device ( RK3288 )
  • Blogs
  • Mentions
  • Sub-Groups
  • Tags
  • Jump...
  • Cancel
More blogs in Arm Community blogs
  • AI blog

  • Announcements

  • Architectures and Processors blog

  • Automotive blog

  • Embedded and Microcontrollers blog

  • Internet of Things (IoT) blog

  • Laptops and Desktops blog

  • Mobile, Graphics, and Gaming blog

  • Operating Systems blog

  • Servers and Cloud Computing blog

  • SoC Design and Simulation blog

  • Tools, Software and IDEs blog

Tags
Actions
  • RSS
  • More
  • Cancel
Related blog posts
Related forum threads

How to compile a 4.9 kernel with Mali r15p0 kernel drivers for a MiQi device ( RK3288 )

Myy
Myy
December 16, 2016
2 minute read time.

Until I get a recent Mali User-Space drivers build from Rockchip or the Rockchip Mali User-space drivers DDK, here's how to compile an official (read Linus Torvalds git branch) 4.9 kernel, with the official Mali r15p0 Kernel drivers, in order to use it on a MiQi device ( RK3288 board ) with the Mali r12p0 User-Space drivers for Firefly boards.

You can also find this procedure and a pre-compiled kernel on my Github repository.

This procedure does not enable the UMP drivers however...

The procedure

# Get the kernel
export KERNEL_VERSION=v4.9
git clone --depth 1 --branch $KERNEL_VERSION 'git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git' &&
cd linux

# Download, prepare and copy the Mali Kernel-Space drivers. 
# Some TGZ are AWFULLY packaged with everything having 0777 rights.
export MALI_VERSION=r15p0-00rel0
wget "http://malideveloper.arm.com/downloads/drivers/TX011/$MALI_VERSION/TX011-SW-99002-$MALI_VERSION.tgz" &&
tar zxvf TX011-SW-99002-$MALI_VERSION.tgz &&
cd TX011-SW-99002-$MALI_VERSION &&
find . -type 'f' -exec chmod 0644 {} ';' &&
find . -type 'd' -exec chmod 0755 {} ';' &&
find . -name 'sconscript' -exec rm {} ';' &&
rm -r 'driver/product/kernel/patches' 'driver/product/kernel/license.txt' &&
cp -r driver/product/kernel/drivers/gpu/arm ../drivers/gpu/ &&
cp -r driver/product/kernel/drivers/base/ump ../drivers/base/ &&
cd .. &&
rm -r TX011-SW-99002-$MALI_VERSION TX011-SW-99002-$MALI_VERSION.tgz

# Apply the Rockchip DRM, Rockchip fbdev, RK3288 DTS and
# Kconfig/Makefile patches used to enable the compilation of the
# Mali driver
export GITHUB_REPO=Miouyouyou/MyyQi
export GIT_BRANCH=master
export PATCHES_FOLDER_URL=https://raw.githubusercontent.com/$GITHUB_REPO/$GIT_BRANCH/patches
export KERNEL_PATCHES_FOLDER_URL=$PATCHES_FOLDER_URL/kernel/$KERNEL_VERSION
wget $KERNEL_PATCHES_FOLDER_URL/0001-Rockchip-DRM-and-Framebuffer-patches-from-ARM-softwa.patch &&
wget $KERNEL_PATCHES_FOLDER_URL/0002-Integrate-the-Mali-GPU-address-to-the-rk3288-and-rk3.patch &&
wget $KERNEL_PATCHES_FOLDER_URL/0003-Post-Mali-Kernel-device-drivers-modifications.patch
export PATCHES="0001-Rockchip-DRM-and-Framebuffer-patches-from-ARM-softwa.patch 0002-Integrate-the-Mali-GPU-address-to-the-rk3288-and-rk3.patch 0003-Post-Mali-Kernel-device-drivers-modifications.patch"
git apply $PATCHES &&
rm $PATCHES
unset PATCHES

# Apply a patch to the Mali Midgard driver that adapt the
# get_user_pages calls to the new signature.
export MALI_PATCHES_FOLDER=$PATCHES_FOLDER_URL/Mali/$MALI_VERSION
wget $MALI_PATCHES_FOLDER/0001-Adapt-get_user_pages-calls-to-use-the-new-calling-pr.patch &&
git apply 0001-Adapt-get_user_pages-calls-to-use-the-new-calling-pr.patch &&
rm 0001-Adapt-get_user_pages-calls-to-use-the-new-calling-pr.patch

# Get the configuration file and compile the kernel
export ARCH=arm
# Uncomment the following if you're cross-compiling ! #export CROSS_COMPILE=armv7a-hardfloat-linux-gnueabi- make mrproper wget -O .config 'https://raw.githubusercontent.com/Miouyouyou/MyyQi/master/boot/config-4.9.0MyyMyy%2B' make rk3288-miqi.dtb zImage modules -j5



Testing

The compiled kernel was tested successfully with the r12p0 Mali User-Space fbdev and Wayland drivers for Firefly boards, using the Mali OpenGL SDK samples for fbdev tests and Mesa demos for Wayland tests.

The test methodology boiled down to:

# FBDEV. Require to download the Mali OpenGL ES SDK.
cp /path/to/Mali_OpenGL_ES_SDK_v2.4.4.71fdbd_Linux_x86.tar.gz /tmp
tar zxvf Mali_OpenGL_ES_SDK_v2.4.4.71fdbd_Linux_x86.tar.gz
cd Mali_OpenGL_ES_SDK_v2.4.4
TARGET="arm" TOOLCHAIN_ROOT="" cmake .
make -j5
export LD_LIBRARY_PATH=/path/where/mali-fbdev-drivers-are/fbdev
cd samples/opengl_31/compute_particles/
./compute_particles

# Wayland
cd /tmp
git clone git://cgit.freedesktop.org/mesa/demos --depth 1
cd demos
./autogen.sh --enable-wayland --enable-gles2
export LD_LIBRARY_PATH=/path/to/mali-wayland-folder
weston
# Inside the weston terminal
export LD_LIBRARY_PATH=/path/to/mali-wayland-folder
cd /tmp/demos/src/egl/opengles2
./es2gears_wayland

Patches

I've attached the patch applied on the Mali Kernel r15p0 drivers sources.

  • 0001-Adapt-get_user_pages-calls-to-use-the-new-calling-pr.txt
  • View
  • Hide
Anonymous
Parents
  • Andy Syam
    Andy Syam over 6 years ago

    Plis link download Mali_OpenGL_ES_SDK_v2.4.4.71fdbd_Linux_x86.tar.gz

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • Myy
    Myy over 5 years ago in reply to Andy Syam

    It seems that the ARM team deleted the previous SDK archives. There were some links on amlogic repositories but they are not accessible anymore so... the SDK disappeared.

    That said, the same samples are available for Android. So the whole issue is how to port the screen initialization and OpenGL ES context creation code (with EGL, GBM and all that stuff).

    If you use a modern kernel, you can use recent Mali drivers (or Panfrost if you like debugging graphics drivers) with the DRM/KMS output, which should allow you to compile and run things like https://gist.github.com/Miouyouyou/89e9fe56a2c59bce7d4a18a858f389ef  ,   https://github.com/robclark/kmscube   and glmark2 (recent one); directly from a console, without X11 nor Wayland.
    Also, recent SDL 2 libraries can also initialize a screen through the DRM/KMS output and create an OpenGL ES 2.x/3.x context using the whole screen as a surface, so you can also give SDL 2 a try. It comes with various testing utilities, to check whether it has been compiled correclty or not.

    Here's a tutorial on how to install recent Mali user-space drivers on a recent kernel, patched correctly with the Mali kernel drivers, and run glmark2 :

    https://github.com/Miouyouyou/RockMyy/wiki/Mali-Midgard-user-space-binary-drivers

    Anyway, these samples should provide you enough boilder plate code to initialize the display with DRM.
    You can then try to adapt the Mali SDK for Android samples, available at https://github.com/ARM-software/opengl-es-sdk-for-android , using this knowledge... or start doing any OpenGL ES work you'd like to do !

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Comment
  • Myy
    Myy over 5 years ago in reply to Andy Syam

    It seems that the ARM team deleted the previous SDK archives. There were some links on amlogic repositories but they are not accessible anymore so... the SDK disappeared.

    That said, the same samples are available for Android. So the whole issue is how to port the screen initialization and OpenGL ES context creation code (with EGL, GBM and all that stuff).

    If you use a modern kernel, you can use recent Mali drivers (or Panfrost if you like debugging graphics drivers) with the DRM/KMS output, which should allow you to compile and run things like https://gist.github.com/Miouyouyou/89e9fe56a2c59bce7d4a18a858f389ef  ,   https://github.com/robclark/kmscube   and glmark2 (recent one); directly from a console, without X11 nor Wayland.
    Also, recent SDL 2 libraries can also initialize a screen through the DRM/KMS output and create an OpenGL ES 2.x/3.x context using the whole screen as a surface, so you can also give SDL 2 a try. It comes with various testing utilities, to check whether it has been compiled correclty or not.

    Here's a tutorial on how to install recent Mali user-space drivers on a recent kernel, patched correctly with the Mali kernel drivers, and run glmark2 :

    https://github.com/Miouyouyou/RockMyy/wiki/Mali-Midgard-user-space-binary-drivers

    Anyway, these samples should provide you enough boilder plate code to initialize the display with DRM.
    You can then try to adapt the Mali SDK for Android samples, available at https://github.com/ARM-software/opengl-es-sdk-for-android , using this knowledge... or start doing any OpenGL ES work you'd like to do !

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
Children
No Data
Mobile, Graphics, and Gaming blog
  • Unlock the power of SVE and SME with SIMD Loops

    Vidya Praveen
    Vidya Praveen
    SIMD Loops is an open-source project designed to help developers learn SVE and SME through hands-on experimentation. It offers a clear, practical pathway to mastering Arm’s most advanced SIMD technologies…
    • September 19, 2025
  • What is Arm Performance Studio?

    Jai Schrem
    Jai Schrem
    Arm Performance Studio gives developers free tools to analyze performance, debug graphics, and optimize apps on Arm platforms.
    • August 27, 2025
  • How Neural Super Sampling works: Architecture, training, and inference

    Liam O'Neil
    Liam O'Neil
    A deep dive into a practical, ML-powered approach to temporal super sampling.
    • August 12, 2025