当前位置: 首页 > 工具软件 > Berry > 使用案例 >

香蕉派BPI-M2 Berry 全志V40 Mali400 MP2 GPU使用

姜乐语
2023-12-01

作者

QQ群:852283276
微信:arm80x86
微信公众号:青儿创客基地
B站:主页 https://space.bilibili.com/208826118

视频

香蕉派BPI-M2 Berry 全志V40 Mali400 MP2 GPU使用

香蕉派

Wiki Main Page
开发板资料下载
快速上手 香蕉派 BPI-M2 Ultra / BPI-M2 Berry

从主页找到R40对应开发板,

  • Banana Pi BPI-M2 Berry [Allwinner R40/V40/A40i]
  • Banana Pi BPI-M2U [Allwinner R40/V40/A40i]

其中Banana Pi BPI-M2U的Wiki介绍了如何编译BSP,其中使用内核也是Tina Linux,

BPI-SINOVOIP/BPI-M2U-bsp

$ cd project/
$ git clone https://github.com/BPI-SINOVOIP/BPI-M2U-bsp.git
$ cd BPI-M2U-bsp/
# pack的时候会要求输入sudo密码
$ ./build.sh BPI-M2B-1080P 1
# 编译完成之后生成
$ ls -l SD/bpi-m2b/
total 107612
drwxrwxr-x 2 developer developer     4096 Jan 21 05:17 100MB
-rw-rw-r-- 1 developer developer 38217161 Jan 21 05:17 3.10.108-BPI-M2B-Kernel-net.tgz
-rw-rw-r-- 1 developer developer 44283126 Jan 21 05:18 3.10.108-BPI-M2B-Kernel.tgz
-rw-rw-r-- 1 developer developer  1888462 Jan 21 05:18 BOOTLOADER-bpi-m2b.tgz
drwxrwxr-x 3 developer developer     4096 Jan 21 05:17 BPI-BOOT
-rw-rw-r-- 1 developer developer 12852231 Jan 21 05:17 BPI-BOOT-bpi-m2b.tgz
drwxrwxr-x 4 developer developer     4096 Jan 21 05:18 BPI-ROOT
-rw-rw-r-- 1 developer developer 12930798 Jan 21 05:18 linux-headers-3.10.108-BPI-M2B-Kernel.tgz
# 下载http://wiki.banana-pi.org/Banana_Pi_BPI-M2U#Image_Release
Ubuntu
2020-04-19 update, kernel 3.10.108
Ubuntu 16.04 mate desktop Download
Ubuntu 16.04 server Download
# 选择Ubuntu 16.04 mate desktop Download
	2020-04-19-ubuntu-16.04-mate-desktop-bpi-m2u-sd-emmc.img.zip
	2020-04-19-ubuntu-16.04-mate-desktop-bpi-m2u-sd-emmc.img.zip.md5
# 下载速度为0,选择下面这个有百度网盘的
	2019-05-10-ubuntu-16.04-mate-desktop-preview-bpi-m2u-sd-emmc.img.zip
# 将img写入SD卡

安装bpi-tools,github下载二进制工具https://github.com/BPI-SINOVOIP/bpi-tools/raw/master/bpi-tools,没有源代码,执行命令把内核安装到sd卡,

$ export PATH=/opt/bpi-tools-master:$PATH
$ ./build.sh BPI-M2B-1080P 6

ubuntu linux默认用户名密码,

user:pi
password:bananapi
user:root
password:bananapi

添加mali驱动,库,然后发现系统已经自带mali库了,

pi@bpi-iot-ros-ai:~$ ldconfig -p | grep ail
        libgailutil.so.18 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libgailutil.so.18
        libffmpegthumbnailer.so.4 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libffmpegthumbnailer.so.4
pi@bpi-iot-ros-ai:~$ 
pi@bpi-iot-ros-ai:~$ 
pi@bpi-iot-ros-ai:~$ ldconfig -p | grep gl
        libxcb-glx.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libxcb-glx.so.0
        libxcb-glx.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libxcb-glx.so
        libwx_gtk2u_gl-3.0.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libwx_gtk2u_gl-3.0.so.0
        libwayland-egl.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libwayland-egl.so.1
        libwayland-egl.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libwayland-egl.so
        libupower-glib.so.3 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libupower-glib.so.3
        libsignon-glib.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libsignon-glib.so.1
        libqmi-glib.so.5 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libqmi-glib.so.5
        libqmi-glib.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libqmi-glib.so.1
        libpyglib-2.0-python2.7.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libpyglib-2.0-python2.7.so.0
        libpulse-mainloop-glib.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libpulse-mainloop-glib.so.0
        libpulse-mainloop-glib.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libpulse-mainloop-glib.so
        libpoppler-glib.so.8 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libpoppler-glib.so.8
        libpackagekit-glib2.so.16 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libpackagekit-glib2.so.16
        libnm-glib.so.4 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libnm-glib.so.4
        libnm-glib-vpn.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libnm-glib-vpn.so.1
        libmm-glib.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libmm-glib.so.0
        libmbim-glib.so.4 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libmbim-glib.so.4
        libkwinglutils.so.7 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libkwinglutils.so.7
        libjson-glib-1.0.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libjson-glib-1.0.so.0
        libglslcompiler.so.1.14.3841212 (libc6,hard-float) => /usr/lib/libglslcompiler.so.1.14.3841212
        libglslcompiler.so.1 (libc6,hard-float) => /usr/lib/libglslcompiler.so.1
        libglslcompiler.so (libc6,hard-float) => /usr/lib/libglslcompiler.so
        libglibmm_generate_extra_defs-2.4.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libglibmm_generate_extra_defs-2.4.so.1
        libglibmm-2.4.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libglibmm-2.4.so.1
        libglib-2.0.so.0 (libc6,hard-float) => /lib/arm-linux-gnueabihf/libglib-2.0.so.0
        libglib-2.0.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libglib-2.0.so
        libglapi.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libglapi.so.0
        libglapi.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libglapi.so
        libglade-2.0.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libglade-2.0.so.0
        libgeocode-glib.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libgeocode-glib.so.0
        libflite_usenglish.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libflite_usenglish.so.1
        libdbusmenu-glib.so.4 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libdbusmenu-glib.so.4
        libdbus-glib-1.so.2 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libdbus-glib-1.so.2
        libcogl.so.20 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libcogl.so.20
        libcogl-path.so.20 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libcogl-path.so.20
        libcogl-pango.so.20 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libcogl-pango.so.20
        libavahi-glib.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libavahi-glib.so.1
        libappstream-glib.so.8 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libappstream-glib.so.8
        libaccounts-glib.so.0 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libaccounts-glib.so.0
        libQt5EglDeviceIntegration.so.5 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libQt5EglDeviceIntegration.so.5
        libQt5EglDeviceIntegration.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/libQt5EglDeviceIntegration.so
        libIMGegl.so.1.14.3841212 (libc6,hard-float) => /usr/lib/libIMGegl.so.1.14.3841212
        libIMGegl.so.1 (libc6,hard-float) => /usr/lib/libIMGegl.so.1
        libIMGegl.so (libc6,hard-float) => /usr/lib/libIMGegl.so
        libGLESv2.so.2 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/mesa-egl/libGLESv2.so.2
        libGLESv2.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/mesa-egl/libGLESv2.so
        libEGL.so.1 (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/mesa-egl/libEGL.so.1
        libEGL.so (libc6,hard-float) => /usr/lib/arm-linux-gnueabihf/mesa-egl/libEGL.so

修改BPI-BOOT分区banana/bpi-m2b/linux/1080p/uEnv.txt

board=bpi-m2u -> board=bpi-m2b
$ sudo cp mali.ko /lib/modules/3.10.108-BPI-M2B-Kernel/mali
$ sudo cp -arf x11_dma_buf/* /usr/lib/
$ cat /etc/ld.so.conf.d/
.00-pvr.conf                  arm-linux-gnueabihf_EGL.conf
00-vmcs.conf                  arm-linux-gnueabihf_GL.conf
01-mali.conf                  libc.conf
arm-linux-gnueabihf.conf      vmcs.conf
$ ls -l /usr/lib/mali/lib
libEGL.so            libGLESv1_CM.so.1    libGLESv2.so.2.0
libEGL.so.1          libGLESv1_CM.so.1.1  libMali.so
libEGL.so.1.4        libGLESv2.so         
libGLESv1_CM.so      libGLESv2.so.2

# Store the list of server defined optional extensions in REQUIRED_MODULES
# XORG_DRIVER_CHECK_EXT(RANDR, randrproto)
# XORG_DRIVER_CHECK_EXT(RENDER, renderproto)
# XORG_DRIVER_CHECK_EXT(XV, videoproto)
  143  sudo apt-get install xutils-dev
  144  autoreconf -vi
  145  ./configure --prefix=/usr
  146  sudo apt install xorg-x11-util-macros
  147  sudo apt search xorg-x11
  148  sudo apt search xorg
  149  vim configure
  150  ./configure --prefix=/usr
  151  vim configure
  152  ./configure --prefix=/usr
  153  sudo apt install xorg-server
  154  sudo apt install xorg-server-dev
  155  sudo apt-get install pkg-config libpixman-1-dev libx11-dev x11proto-gl-dev libglib2.0-dev libgl1-mesa-dev x11proto-xf86dri-dev libgcrypt11-dev
  156  sudo apt-get install x11proto-xcmisc-dev x11proto-bigreqs-dev x11proto-randr-dev x11proto-render-dev x11proto-fonts-dev x11proto-video-dev libpciaccess-dev
  157  sudo apt-get install x11proto-composite-dev x11proto-record-dev x11proto-scrnsaver-dev x11proto-resource-dev x11proto-xinerama-dev libxkbfile-dev libxfont-dev
  158  ./configure --prefix=/usr
  159  sudo apt install xorg-server-dev
  160  sudo apt install xorg-x11-server-dev
  161  sudo apt install xorg-x11-server-sdk
  162  sudo apt search | grep xorg-server
  163  sudo apt cache search | grep xorg-server
  164  sudo apt search xorg-server
  165  sudo apt search xorg
  166  sudo apt install xorg-server
  167  ./configure --prefix=/usr
  168  sudo apt install xorg
  169  history 
# 折腾半天其实sunxi wiki上说清楚了,执行下面的命令就可以了,
$ sudo apt-get install git build-essential xorg-dev xutils-dev x11proto-dri2-dev libltdl-dev libtool automake 
checking ump/ump.h usability... no
checking ump/ump.h presence... no
checking for ump/ump.h... no
checking that generated files are newer than configure... done
configure: creating ./config.status
# 手动编译安装libUMP,发现之前的操作默认安装在/usr/local,
make uninstall
# 重新编译fbturbo
$ systemctl restart lightdm.service
$ chromium-brower --use-gl=egl --ingnore-gpu-blacklist --no-sandbox

测试,

体验3D互动 30个使用WebGL技术的优秀网页设计案例
一些webGL地球的网址

发现后台unattended upgrades shutdown CPU占用率100%,先干掉。

全志

Linux内核,看Wiki,这个应该是不支持R40/A40i/A40Pro(消费级/工业级/军事级)的sun8i,tinalinux/linux-3.10是Wiki上R40 Linux SDK指向的Linux内核,后面的香蕉派,都是使用Tina维护的内核,

linux-sunxi
tinalinux/linux-3.10

内核态驱动,可参考linux-sunxi把驱动放进A40i的内核代码目录,或者在代码树外部直接编译驱动,

linux-sunxi/mali-400-kernel-drivers

用户态库,

linux-sunxi/sunxi-mali

Mali-400 X11的DRI2/EXA驱动,xf86-video-mali是官方的,真正使用的应该是xf86-video-fbturbo

linux-sunxi/xf86-video-mali
ssvb/xf86-video-fbturbo

Tina Linux

Tina Linux的Wiki,Github,Tina Linux是一整套开发包,从u-boot到linux到rootfs,采用OpenWRT的编译方式,编译安装用repo等命令,这个我以前没用过,

Tina_Linux

R40/A40i/A40pro/V40

R40介绍,里面有它的软硬件资源链接,

R40

Allwinner R40 (sun8i) SoC features a Quad-Core Cortex-A7 ARM CPU, and a Mali400 MP2 GPU from ARM. It is a not-pin-compatible quad core sucessor of the A20. It’s also known as the Allwinner T3 for In-Car Entertainment usage. A40i and A40pro are variants that differ in applicable temperatures range (industrial and military).

全志使用sysconfig.fex文件来配置各种参数,之后编译过程中转换成dts文件。

CPU Architecture
• Quad-core ARM CortexTM-A7 Processor
• ARMv7 ISA standard ARM instruction set
• Thumb-2 Technology
• Jazeller RCT
• NEON Advanced SIMD
• VFPv4 floating point
• Large Physical Address Extensions(LPAE)
• 32KB L1 Instruction cache and 32KB L1 Data cache for per CPU
• 512KB L2 cache shared
GPU Architecture
• Mali400 MP2
• Supports OpenGL ES 2.0 ,OpenGL ES 1.1, Open VG 1.1 standard

Allwinner V40 (sun8i) SoC features a Quad-Core Cortex-A7 ARM CPU, and a Mali400 MP2 GPU from ARM. It is the automotive version of R40.

 类似资料: