Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Mali Driver)

Introduction

The author provides Debian GNU / Linux for Ultra96 / Ultra96-V2 (ZynqMP) [1]. The Debian GNU / Linux provided is CUI-based, but this time we have made the X Window System run on Ultra96 / Ultra96-V2 to support the GUI.

Therefore, the procedure for operating the X Window System on Ultra96 / Ultra96-V2 is explained in several parts.

This article provides steps to build the Mali Driver Debian Package and install it on ZynqMP-FPGA-Linux.

What is Mali Driver?

The Mali Driver is a Kernel Module for controlling the GPU (Mali-400) installed in ZynqMP. This kernel module is not included by default with ZynqMP-FPGA-Linux. However, the device tree is already built in by default. However, the device tree is already built in by default. If you want to render in 3D using the GPU, you need to build and add a new kernel module.

Fig.1 Mali Kernel Module

Fig.1 Mali Kernel Module


Debian Package build procedure

This chapter describes the steps to create a Debian Package for the Mali Driver.

The repository generated by the procedure explained here is available at the following URL. If you have trouble creating a repository, please use the following repository.

However, the above repository does not contain the source code for the Mali Driver. The Maili Driver source code must be downloaded from the ARM web page. The download procedure will be described later.

In addition, the Debian Package of Mali Driver pre-built for ZynqMP-FPGA-Linux (v2019.1.x) is available in the following repositories. If you have trouble building, please use this.

Create a repository

shell$ mkdir zynqmp-gpu-kmod-dpkg
shell$ cd zynqmp-gpu-kmod-dpkg
shell$ git init

Get the sauce

The source code for the Mali Driver uses the open source Mali Utgard GPU Kernel Driver provided by ARM. Please visit the ARM web page, accept the __end user license, and download DX910-SW-99002-r8p0-01rel0.tgz. The web page has the following URL:

You can also download it by the following method. However, please accept the end-user license.

shell$ wget https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-r8p0-01rel0.tgz
--2019-12-08 13:55:32--  https://developer.arm.com/-/media/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-r8p0-01rel0.tgz
Resolving developer.arm.com (developer.arm.com)... 184.26.212.16
Connecting to developer.arm.com (developer.arm.com)|184.26.212.16|:443... connected.
HTTP request sent, awaiting response... 302 Moved Temporarily
Location: https://armkeil.blob.core.windows.net/developer/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-r8p0-01rel0.tgz [following]
--2019-12-08 13:55:33--  https://armkeil.blob.core.windows.net/developer/Files/downloads/mali-drivers/kernel/mali-utgard-gpu/DX910-SW-99002-r8p0-01rel0.tgz
Resolving armkeil.blob.core.windows.net (armkeil.blob.core.windows.net)... 52.239.137.100
Connecting to armkeil.blob.core.windows.net (armkeil.blob.core.windows.net)|52.239.137.100|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 350213 (342K) [application/octet-stream]
Saving to: ‘DX910-SW-99002-r8p0-01rel0.tgz’
DX910-SW-99002-r8p0-01rel0 100%[========================================>] 342.00K   490KB/s    in 0.7s    
2019-12-08 13:55:35 (490 KB/s) - ‘DX910-SW-99002-r8p0-01rel0.tgz’ saved [350213/350213]

Expand DX910-SW-99002-r8p0-01rel0.tgz.

shell$ tar xfz DX910-SW-99002-r8p0-01rel0.tgz 

Apply a patch for Xilinx

Xilinx's PetaLinux is built by patching the open source Mali Utgard GPU Kernel Driver. The patch file can be found at the following URL:

There are 14 patch files at this URL. Apply these patch files in ascending order.

shell$ it clone https://github.com/Xilinx/meta-xilinx.git
Cloning into 'meta-xilinx'...
remote: Enumerating objects: 1209, done.
remote: Counting objects: 100% (1209/1209), done.
remote: Compressing objects: 100% (605/605), done.
remote: Total 11725 (delta 678), reused 1045 (delta 551), pack-reused 10516    
Receiving objects: 100% (11725/11725), 8.88 MiB | 1.03 MiB/s, done.
Resolving deltas: 100% (6448/6448), done.
shell$ 
shell$ for file in `\\find meta-xilinx/meta-xilinx-bsp/recipes-graphics/mali/kernel-module-mali -maxdepth 1 -type f | sort`; do patch -d DX910-SW-99002-r8p0-01rel0/driver/src/devicedrv/mali/ -p1 < $file ; done
patching file Makefile
patching file platform/arm/arm.c
patching file linux/mali_linux_trace.h
patching file platform/arm/arm.c
patching file linux/mali_kernel_linux.c
patching file platform/arm/arm.c
patching file linux/mali_memory_os_alloc.c
patching file linux/mali_osk_notification.c
patching file linux/mali_internal_sync.c
patching file linux/mali_internal_sync.h
patching file linux/mali_memory_swap_alloc.c
patching file common/mali_pm.c
patching file linux/mali_kernel_linux.c
patching file linux/mali_memory_os_alloc.c
patching file linux/mali_memory_secure.c
patching file common/mali_control_timer.c
patching file common/mali_group.c
patching file common/mali_osk.h
patching file linux/mali_osk_timers.c

Add files to create Debian Package

Create a debian directory and add the following files.

These files are not described here. See https://github.com/ikwzm/zynqmp-gpu-kmod-dpkg for more information. After adding the file, git commit.

shell$ git add debian/
shell$ git commit -m "[add] debian/"
[master 3961b1d] [add] debian/
 8 files changed, 68 insertions(+)
 create mode 100644 debian/README.Debian
 create mode 100644 debian/README.source
 create mode 100644 debian/changelog
  create mode 100644 debian/control.template
 create mode 100644 debian/copyright
 create mode 100644 debian/postinst
 create mode 100644 debian/postrm
 create mode 100644 debian/prerm
 create mode 100755 debian/rules
 

Build Debian Package

Run debian / rule binary to build the Debian Package for the Mali Driver. The built package will be created in the directory one level above.

shell$ sudo debian/rule binary
	:
Omission
	:
shell$ dpkg --info ../zynqmp-gpu-4.19.0-xlnx-v2019.1-zynqmp-fpga_0.1.2-0_arm64.deb
 new Debian package, version 2.0.
 size 1803188 bytes: control archive=584 bytes.
     412 bytes,    12 lines      control
      37 bytes,     6 lines   *  postinst             #!/bin/sh
      22 bytes,     4 lines   *  postrm               #!/bin/sh
      32 bytes,     4 lines   *  prerm                #!/bin/sh
 Package: zynqmp-gpu-4.19.0-xlnx-v2019.1-zynqmp-fpga
 Source: zynqmp-gpu
 Version: 0.1.2-0
 Architecture: arm64
 Maintainer: ikwzm <[email protected]>
 Installed-Size: 12535
 Depends: linux-image-4.19.0-xlnx-v2019.1-zynqmp-fpga
 Provides: zynqmp-gpu-kernel-module
 Section: kmod
 Priority: optional
 Homepage: <https://github.com/ikwzm/zynqmp-gpu-kmod-dpkg>
 Description: Kernel Module for ZynqMP GPU(ARM Mali-400).

Installation

Debian Package installation

This section describes the steps to install the Mali Driver Debian Package on ZynqMP-FPGA-Linux.

The pre-built Debian Package is available in the following repositories. You can install this.

shell$ sudo dpkg -i zynqmp-gpu-4.19.0-xlnx-v2019.1-zynqmp-fpga_0.1.2-0_arm64.deb
(Reading database ... 66644 files and directories currently installed.)
Preparing to unpack zynqmp-gpu-4.19.0-xlnx-v2019.1-zynqmp-fpga_0.1.2-0_arm64.deb ...
Unpacking zynqmp-gpu-4.19.0-xlnx-v2019.1-zynqmp-fpga (0.1.2-0) over (0.1.2-0) ...
Setting up zynqmp-gpu-4.19.0-xlnx-v2019.1-zynqmp-fpga (0.1.2-0) ...

Installing this Debian Package will add /lib/modules/4.19.0-xlnx-v2019.1-zynqmp-fpga/kernel/drivers/gpu/mali.ko.

Install Device Tree

There must be a GPU (Mali) node in the Device Tree for the Mali Driver to work. The following is an example of a GPU (Mali) node in the Device Tree.

	gpu: gpu@fd4b0000 {
		status = "okay";
		compatible = "arm,mali-400", "arm,mali-utgard";
		reg = <0x0 0xfd4b0000 0x0 0x10000>;
		interrupt-parent = <&gic>;
		interrupts = <0 132 4>, <0 132 4>, <0 132 4>, <0 132 4>, <0 132 4>, <0 132 4>;
		interrupt-names = "IRQGP", "IRQGPMMU", "IRQPP0", "IRQPPMMU0", "IRQPP1", "IRQPPMMU1";
		clock-names = "gpu", "gpu_pp0", "gpu_pp1";
		power-domains = <&zynqmp_firmware PD_GPU>;
	};

The Device Tree for Ultra96 / Ultra96-V2 provided by ZynqMP-FPGA-Linux already has a GPU (Mali) node added. Therefore, simply installing the Debian Package for the Mali Driver will enable the Mali Driver.

[Overview]: https://qiita.com/ikwzm/items/fdec04519268b3fb9a50 "" Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Overview) "@Qiita" [Video Driver Edition]: https://qiita.com/ikwzm/items/2a0fbfd2938a893e57d4 "" Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Video Driver Edition) "@Qiita" [Mali Driver]: https://qiita.com/ikwzm/items/8c96d75e03cdcb91e5b2 "" Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Mali Driver) "@Qiita" [LibMali edition]: https://qiita.com/ikwzm/items/85fa889def8eb07a9e94 "" Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (libMali edition) "@Qiita" [fbdev edition]: https://qiita.com/ikwzm/items/f922f7e17aa2382d5c76 "" Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (fbdev edition) "@Qiita" [glmark2 edition]: https://qiita.com/ikwzm/items/5065fb0b6c01ea706571 "" Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (glmark2 edition) "@ Qiita" [1]: https://qiita.com/ikwzm/items/0c6f110aa19e368af03d "Debian GNU / Linux for UltraZed / Ultra96 / Ultra96-V2 (v2019.1 version) Boot image provided" @Qiita "

Recommended Posts

Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Mali Driver)
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Video Driver)
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Gnome Desktop)
Run Lima Driver on Debian GNU / Linux for Ultra96 / Ultra96-V2
Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (fbdev)
Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Overview)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Installation)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Build)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Build) [Unfinished]
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Installation) [Unfinished]
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Vitis edition)
Running XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Overview)
Run bootgen on Debian GNU / Linux, Ubuntu
Debian GNU / Linux (v2019.2 version) boot image provided for UltraZed / Ultra96 / Ultra96-V2
Run Debian (Linux) & LXQt on Athlon 200GE (AMD)
Running XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Overview)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Installation)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Build)
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Build) [Unfinished]
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Installation) [Unfinished]
Run XRT (Xilinx Runtime) on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Vitis edition)
Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (fbdev)
Running X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Overview)
Run Lima Driver on Debian GNU / Linux for Ultra96 / Ultra96-V2
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (LibMali)
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Video Driver)
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Gnome Desktop)
Run X Window on Debian GNU / Linux for Ultra96 / Ultra96-V2 (Mali Driver)
Debian GNU / Linux (v2019.2 version) boot image provided for UltraZed / Ultra96 / Ultra96-V2
Run bootgen on Debian GNU / Linux, Ubuntu
Linux on Windows -1-: debian introduction
Run Tensorflow 2.x on Python 3.7
Linux on Windows -1-: debian introduction
Run FreeBSD on Linux + qemu