[vc_row][vc_column width=”1/1″][vc_tour][vc_tab title=”Development Enviroment” tab_id=”1425908746-1-100″][vc_column_text]We do cross compilation on a host PC. The following is the environment of the host PC:
1. The ubuntu 12.04 system of x86_64
2.pcDuino 3A/3B/NANO
Note: In this post , the command starts with ‘#’ indicating that it runs on the host PC, and the command starts with ‘$’ indicating that it runs on the pcDuino.[/vc_column_text][/vc_tab][vc_tab title=”Boot the system from TF card” tab_id=”1425908746-2-37″][vc_column_text]Insert TF into pcDuino. It’s recommended to use a storage media with a capacity larger than 8G. Execute the following command:
$board-config.sh
Choose make_mmc_boot, after around 10 minutes you will get system that can boot from TF card. Then reboot the system from TF card. You need to extra your system first before you can use the storage from the TF card.
Execute the $board-config.sh again.
Choose the expand_rootfs, then you can enter into a media with larger storage area.[/vc_column_text][/vc_tab][vc_tab title=”Add Mali400 Driver ” tab_id=”1425909105631-2-8″][vc_column_text]1. Download the source code from a20_kernel.
$git clone https://github.com/pcduino/a20-kernel $cd a20_kernel $make
2. Because some libraries are not open source, we cannot do separate compilation.
$git clone https://github.com/Pillar1989/Qt5.3.2forPcDuino3 $cp Qt5.3.2forPcDuino3/mali_r3p2-01rel2 linux-sunxi/drivers/gpu/
Then apply the patch for the whole source code 0003-Sunxi-adaptation-for-mali-r3p2-01rel2-kernel-module.patch.
From 5bf12905ff1faa38af4c47ff0752d3f5f12f5644 Mon Sep 17 00:00:00 2001 From: Siarhei Siamashka <siarhei.siamashka@gmail.com> Date: Fri, 13 Sep 2013 01:52:16 +0300 Subject: [PATCH] Sunxi adaptation for mali r3p2-01rel2 kernel module Tested only on A10 and A20. TODO: - bus addresses vs. physical addresses? - umplock? - power management (disable clocks when idle)? - drm upgrade (and also fix compatibility with xf86-video-modesetting)? --- diff --git a/arch/arm/configs/sun4i_defconfig b/arch/arm/configs/sun4i_defconfig index f0344b2..8b043aa 100644 --- a/arch/arm/configs/sun4i_defconfig +++ b/arch/arm/configs/sun4i_defconfig @@ -200,7 +200,10 @@ CONFIG_AUDIO_ENGINE=y CONFIG_PA_CONTROL=y CONFIG_DRM=m CONFIG_DRM_MALI=m -CONFIG_MALI=m +CONFIG_MALI400=m +CONFIG_MALI400_DEBUG=y +CONFIG_MALI400_UMP=y +CONFIG_UMP=m CONFIG_FB=y CONFIG_FB_SUNXI=y CONFIG_FB_SUNXI_LCD=y diff --git a/arch/arm/configs/sun7i_defconfig b/arch/arm/configs/sun7i_defconfig index 709715e..0dc5613 100644 --- a/arch/arm/configs/sun7i_defconfig +++ b/arch/arm/configs/sun7i_defconfig @@ -869,9 +869,10 @@ CONFIG_DRM_I2C_CH7006=m CONFIG_DRM_I2C_SIL164=m CONFIG_DRM_MALI=m CONFIG_DRM_UDL=m -CONFIG_MALI=m +CONFIG_MALI400=m CONFIG_MALI400_DEBUG=y -CONFIG_MALI400_GPU_UTILIZATION=y +CONFIG_MALI400_UMP=y +CONFIG_UMP=m CONFIG_FB=y CONFIG_FB_SUNXI=y CONFIG_FB_SUNXI_LCD=y diff --git a/arch/arm/plat-sunxi/include/plat/irqs.h b/arch/arm/plat-sunxi/include/plat/irqs.h index ad5e322..b501ad0 100644 --- a/arch/arm/plat-sunxi/include/plat/irqs.h +++ b/arch/arm/plat-sunxi/include/plat/irqs.h @@ -164,10 +164,10 @@ #define SW_INT_IRQNO_GPU_PP0 (71 + SW_INT_START) #define SW_INT_IRQNO_GPU_PPMMU0 (72 + SW_INT_START) #define SW_INT_IRQNO_GPU_PMU (73 + SW_INT_START) - -#ifdef CONFIG_ARCH_SUN7I #define SW_INT_IRQNO_GPU_PP1 (74 + SW_INT_START) #define SW_INT_IRQNO_GPU_PPMMU1 (75 + SW_INT_START) + +#ifdef CONFIG_ARCH_SUN7I #define SW_INT_IRQNO_GPU_RSV0 (76 + SW_INT_START) #define SW_INT_IRQNO_GPU_RSV1 (77 + SW_INT_START) #define SW_INT_IRQNO_GPU_RSV2 (78 + SW_INT_START) diff --git a/drivers/gpu/Makefile b/drivers/gpu/Makefile index 83bd33d..bdf6461 100644 --- a/drivers/gpu/Makefile +++ b/drivers/gpu/Makefile @@ -1 +1 @@ -obj-y += drm/ vga/ stub/ ion/ mali/ +obj-y += drm/ vga/ stub/ ion/ mali_r3p2-01rel2/ diff --git a/drivers/gpu/drm/Kconfig b/drivers/gpu/drm/Kconfig index e5cfd95..6ad293d 100644 --- a/drivers/gpu/drm/Kconfig +++ b/drivers/gpu/drm/Kconfig @@ -175,7 +175,7 @@ config DRM_VIA config DRM_MALI tristate "Mali DRM supprt" depends on DRM - depends on MALI + depends on MALI400 help Choose this option if you have a Mali 200 or Mali 400 gpu If M is selected the module will be called mali_drm. diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index df63338..4825e23 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig @@ -25,7 +25,7 @@ source "drivers/gpu/stub/Kconfig" source "drivers/gpu/ion/Kconfig" -source "drivers/gpu/mali/Kconfig" +source "drivers/gpu/mali_r3p2-01rel2/Kconfig" config VGASTATE tristate @@ -290,7 +290,7 @@ config FB_SUNXI_RESERVED_MEM config FB_SUNXI_UMP bool "Enable FB/UMP Integration" - depends on MALI && FB_SUNXI + depends on MALI400 && FB_SUNXI default y config FB_SUNXI_LCD -- 1.8.3.2
After apply the patch, then compile the kernel again.
The default frambuff in pcDuino series is 640×480. Then you can modify the 43th Row static char *screen0_output_mode=”1920x1080p50″ under drivers/video/sunxi/disp/dev_fb.c
Here I modify to 1080p.[/vc_column_text][/vc_tab][vc_tab title=”Compile the Kernel ” tab_id=”1425909106787-3-8″][vc_column_text]$make ARCH=arm sun7i_defconfig
$make -j 8 uImage ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
$make -j 8 modules ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
$make -j 8 firmware_install modules_install INSTALL_MOD_PATH=../modules ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-
After the compile finish, you will get the new uImage under the arch/arm/boot/uImage. And get the new kernel modules under ../modules/lib/modules/.
Copy the uImage to the another part of TF card. Copy the new 3.4.79 kernel module to the system under the /lib/modules/,reboot the system, then you will find the screen character display 1080P.
$lsmod
root@ubuntu:/home/ubuntu# lsmod Module Size Used by sun4i_csi0 25980 0 videobuf_dma_contig 6844 1 sun4i_csi0 videobuf_core 20061 2 sun4i_csi0,videobuf_dma_contig gc2035 16176 1 gc0308 14344 0 g_ether 57121 0 sw_usb_udc 23041 0 udc_core 7922 2 g_ether,sw_usb_udc rt5370sta 653633 0 8188eu 496904 0 8192cu 449867 0 mali_drm 2608 1 drm 207738 2 mali_drm mali 224755 1 disp_ump 861 0 ump 33016 6 mali,disp_ump
Inside have the newest mali and disp_ump.[/vc_column_text][/vc_tab][vc_tab title=”Add the library ” tab_id=”1425909107631-4-6″][vc_column_text]Add the library which support the opensgl library and other software library in the application.
1,install the reliable software.
$sudo apt-get install libssl-dev libasound2-dev libxcb-icccm4-dev libxcb-xfixes0-dev libxcb-image0-dev libxcb-keysyms1-dev libxcb-sync0-dev libxcb-render-util0-dev libxcb-randr0-dev libx11-dev libxrender-dev libicu-dev libx11-xcb-dev libxext-dev git build-essential autoconf libtool automake
2,install ump.
$git clone https://github.com/linux-sunxi/libump.git $cd libump $autoreconf -i $./configure --prefix=/usr $make $make install
$cd Qt5.3.2forPcDuino3/sunxi_mali $ make config VERSION=r3p2-01rel1 ABI=armhf EGL_TYPE=framebuffer $make $make install $make test
Note
/* for X11 */
EGL_TYPE=x11
Then you can use the key board, press thectrl+alt+F1, then enter the characters screen.
$cd sunxi-mali/test $./test <img src="http://cnlearn.linksprite.com/wp-content/uploads/2015/03/IMG_0299.jpg" alt="IMG_0299" />
[/vc_column_text][/vc_tab][vc_tab title=”Cross compile ” tab_id=”1425995451275-5-6″][vc_column_text]Cross compile the qt-everywhere-opensource-src-5.3.2.
1, Install TF card to the ubuntu system of X86
#mkdir rootfs
2,Then mount TF card file system to rootfs
#mount /dev/sdb2 rootfs
3,Download the qt-everywhere-opensource-src-5.3.2
#wget http://download.qt.io/official_releases/qt/5.3/5.3.2/single/qt-everywhere-opensource-src-5.3.2.tar.xz #tar xvf qt-everywhere-opensource-src-5.3.2.tar.xz #cd qt-everywhere-opensource-src-5.3.2
4,Copy pcDuino3 equipment to Qt
#cp ../Qt5.3.2forPcDuino3/linux-pcDuino3-g++ qtbase/mkspecs/devices/ -rf
Here need to notice open the linux-pcDuino3-g++
You need to modify to your own path .
5,Modify the Qt source code qtbase/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
#vim qtbase/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
EGLNativeWindowType QEglFSHooks::createNativeWindow(QPlatformWindow *platformWindow, const QSize &size, const QSurfaceFormat &format) { Q_UNUSED(platformWindow); Q_UNUSED(size); Q_UNUSED(format); //return 0; static struct mali_native_window native_window = { .width = (short unsigned int)size.width(), .height = (short unsigned int)size.height(), }; return &native_window; }
6, Configure Qt
#./configure -opengl es2 -no-linuxfb -system-xcb -system-zlib -no-pch -eglfs -device linux-pcDuino3-g++ -device-option CROSS_COMPILE=/home/pillar/Qt/gcc-arm/bin/arm-linux-gnueabihf- -sysroot /home/pillar/Qt/rootfs -opensource -confirm-license -optimized-qmake -release -make libs -prefix /usr/local/qt5 -qreal float -v
Following is the configuration result
Configure summary Building on: linux-g++ (x86_64, CPU features: mmx sse sse2) Building for: devices/linux-pcDuino3-g++ (arm, CPU features: neon) Platform notes: - Also available for Linux: linux-kcc linux-icc linux-cxx qmake vars .......... styles += mac fusion windows DEFINES += QT_NO_MTDEV DEFINES += QT_NO_LIBUDEV QMAKE_X11_PREFIX = /usr DEFINES += QT_NO_XKB QMAKE_XKB_CONFIG_ROOT = /usr/share/X11/xkb QMAKE_CFLAGS_XCB = QMAKE_LIBS_XCB = -L/home/pillar/Qt/rootfs/usr/lib/arm-linux-gnueabihf -lxcb-sync -lxcb-xfixes -lxcb-render -lxcb-randr -lxcb-image -lxcb-shm -lxcb-keysyms -lxcb-icccm -lxcb-shape -lxcb sql-drivers = sql-plugins = sqlite qmake switches ......... Build options: Configuration .......... accessibility alsa audio-backend c++11 clock-gettime clock-monotonic compile_examples concurrent cross_compile egl eglfs evdev eventfd freetype full-config getaddrinfo getifaddrs iconv icu inotify ipv6ifname large-config largefile medium-config minimal-config mremap nis no-harfbuzz opengl opengles2 openssl pcre png posix_fallocate qpa qpa reduce_exports release rpath shared small-config system-zlib xcb xcb-glx xcb-plugin xcb-render xcb-xlib xkbcommon-qt xlib xrender Build parts ............ libs Mode ................... release Using C++11 ............ yes Using PCH .............. no Target compiler supports: iWMMXt/Neon .......... no/auto Qt modules and options: Qt D-Bus ............... no Qt Concurrent .......... yes Qt GUI ................. yes Qt Widgets ............. yes Large File ............. yes QML debugging .......... yes Use system proxies ..... no Support enabled for: Accessibility .......... yes ALSA ................... yes CUPS ................... no Evdev .................. yes FontConfig ............. no FreeType ............... yes (bundled copy) Glib ................... no GTK theme .............. no HarfBuzz ............... no Iconv .................. yes ICU .................... yes Image formats: GIF .................. yes (plugin, using bundled copy) JPEG ................. yes (plugin, using bundled copy) PNG .................. yes (in QtGui, using bundled copy) journald ............... no mtdev .................. no Networking: getaddrinfo .......... yes getifaddrs ........... yes IPv6 ifname .......... yes OpenSSL .............. yes (loading libraries at run-time) NIS .................... yes OpenGL / OpenVG: EGL .................. yes OpenGL ............... yes (OpenGL ES 2.x) OpenVG ............... no PCRE ................... yes (bundled copy) pkg-config ............. yes PulseAudio ............. no QPA backends: DirectFB ............. no EGLFS ................ yes KMS .................. no LinuxFB .............. no XCB .................. yes (system library) EGL on X ........... no GLX ................ yes MIT-SHM ............ yes Xcb-Xlib ........... yes Xcursor ............ yes (loaded at runtime) Xfixes ............. yes (loaded at runtime) Xi ................. yes (loaded at runtime) Xi2 ................ no Xinerama ........... yes (loaded at runtime) Xrandr ............. yes (loaded at runtime) Xrender ............ yes XKB ................ no XShape ............. yes XSync .............. yes XVideo ............. yes Session management ..... yes SQL drivers: DB2 .................. no InterBase ............ no MySQL ................ no OCI .................. no ODBC ................. no PostgreSQL ........... no SQLite 2 ............. no SQLite ............... yes (plugin, using bundled copy) TDS .................. no udev ................... no xkbcommon .............. yes (bundled copy, XKB config root: /usr/share/X11/xkb) zlib ................... yes (system library) NOTE: libxkbcommon and libxkbcommon-x11 0.4.1 or higher not found on the system, will use the bundled version from 3rd party directory. Qt is now configured for building. Just run 'make'. Once everything is built, you must run 'make install'. Qt will be installed into /usr/local/qt5 Prior to reconfiguration, make sure you remove any leftovers from the previous build.
#make -j 8
#sudo make install
I use quad computer, compile around 2 hours
After the compile, the responsible library will be installed to TF card /usr/local/qt5,the according develop tool will accord to the local /usr/local/qt5
[/vc_column_text][/vc_tab][vc_tab title=”Compile ” tab_id=”1426001272895-6-4″][vc_column_text]Here I will choose the typical Qt5_CinematicExperience
#cd Qt5.3.2forPcDuino3/Qt5_CinematicExperience_1.1 # export PATH=/usr/local/qt5/bin:$PATH #qmake #make
After compile, copy the whole project to the board. Then execute after the character interface.
$./Qt5_CinematicExperience -platform eglfs
[/vc_column_text][/vc_tab][/vc_tour][/vc_column][/vc_row]
Leave a Reply
You must be logged in to post a comment.