RZ-G/RZ-G2 BSP Porting Ubuntu: Difference between revisions

From Renesas.info
No edit summary
 
(25 intermediate revisions by 2 users not shown)
Line 14: Line 14:


=== Install QEMU ===
=== Install QEMU ===
Run below command on Host Ubuntu PC
'''<code>sudo apt-get install qemu-user-static</code>'''


=== Download Required Files ===
=== Download Required Files ===
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Select the package to download based on the desired file system &emsp;
|-
|
* Download ubuntu-base-20.04.4-base-arm64
<pre>
wget https://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.4-base-arm64.tar.gz
</pre>
or
<pre>
wget https://cdimage.ubuntu.com/ubuntu-base/releases/focal/release/ubuntu-base-20.04.4-base-arm64.tar.gz
</pre>
* Download ubuntu-base-18.04.5-base-arm64
<pre>
wget http://cdimage.ubuntu.com/ubuntubase/releases/18.04.5/release/ubuntu-base-18.04.5-basearm64.tar.gz
</pre>
|}


=== Prepare Files ===
=== Prepare Files ===
In the following example, please replace "'''''<u>version</u>'''''" as below name as you need
ubuntu-base-20.04.4-base-arm64: 20.04.4
ubuntu-base-18.04.5-base-arm64: 18.04.5
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Initial preparation
|-
|mkdir root
sudo tar -xpf ubuntu-base-<'''''<u>version</u>'''''>-base-arm64.tar.gz -C root
sudo cp /usr/bin/qemu-aarch64-static ./root/usr/bin/
sudo cp -b /etc/resolv.conf root/etc/resolv.conf
|}
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Create a new script file
|-
|vim ch-mount.sh
#!/bin/bash
function mnt() {
echo "MOUNTING"
sudo mount -t proc /proc ${2}proc
sudo mount -t sysfs /sys ${2}sys
sudo mount -o bind /dev ${2}dev
sudo chroot ${2}
}
function umnt() {
echo "UNMOUNTING"
sudo umount ${2}proc
sudo umount ${2}sys
sudo umount ${2}dev
}
if [ "$1" == "-m" ] && [ -n "$2" ] ;
then
mnt $1 $2
elif [ "$1" == "-u" ] && [ -n "$2" ];
then
umnt $1 $2
else
echo ""
echo "Either 1'st, 2'nd or both parameters were missing"
echo ""
echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
echo "2'nd parameter is the full path of rootfs directory(with trailing
'/')"
echo ""
echo "For example: ch-mount -m /media/sdcard/"
echo ""
echo 1st parameter : ${1}
echo 2nd parameter : ${2}
fi
|}
===Configure Filesystem ===
==== Enter Filesystem====
chmod +x ch-mount.sh
./ch-mount.sh -m root/
chmod -R 777 /tmp
====Install required software====
apt-get update
apt-get install \
language-pack-en-base \
sudo \
ssh \
net-tools \
network-manager \
ethtool \
ifupdown \
isc-dhcp-client \
openssh-server \
iputils-ping \
rsyslog \
bash-completion \
htop \
resolvconf \
dialog \
vim   
====Add users====
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Plesae replace the <'''''<u>name</u>'''''> with your user name
|-
|useradd -s '/bin/bash' -m -G adm,sudo <'''''<u>name</u>'''''>
passwd <'''''<u>name</u>'''''>
passwd root
chown -R root:root /bin/su
chmod u+s /bin/su
|}
==== Configure UART====
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|vim /etc/init.d/ttyS0.conf
|-
|start on stopped rc or RUNLEVEL=[12345]
stop on RUNLEVEL [!12345]
respawn exec /sbin/getty -L 115200 ttyLP0 vt102
|}
==== Network setup ====
echo "auto eth0" > /etc/network/interfaces.d/eth0
echo "iface eth0 inet dhcp" >> /etc/network/interfaces.d/eth0
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf
====Exit FileSystem====
exit
./ch-mount.sh -u root/
==== packaged FileSystem ====
cd root
tar -cjf rootfs.tar.bz2 ./*
== Deploy FileSystem to SD Card==
Prepare a SD card with ext4 partition: [[Learning/Linux#Partitioning and Formatting an SD Card]]
extract ubuntu .bz2 package to SD card
sudo tar -xvf rootfs.tar.gz -C /media/xxx/rootfs
==Install Wayland, Wayland-Protocols and Weston==
=== Environment Setup ===
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|install required packages
|-
|
* sudo apt-get install pkg-config
* sudo apt install ninja-build cmake git python3-pip kmod
* sudo apt install libffi-dev libxml2 libxml2-dev graphviz doxygen xsltproc xmlto xdot libxkbcommon-dev libpixman-1-dev libinput-dev
* sudo apt-get install libcairo-dev glib-2.0 libpango1.0-dev libjpeg-dev libwebp-dev libegl-mesa0 libsystemd-dev libgles2-mesa libgles2-mesa-dev libpam0g-dev libgbm-dev libx11-xcb-dev freerdp2-dev liblcms2-dev libx11-xcb-dev libcolord-dev libxcb-xkb1 libpipewire-0.2-dev libdbus-1-dev libxcb-xkb-dev libdrm-dev
* sudo pip3 install --user meson -i <nowiki>https://pypi.mirrors.ustc.edu.cn/simple/</nowiki>
|}
=== Compile and install Wayland ===
Copy the Wayland 1.18.0 source code from VLP Yocto build folder to SD card.
i.e. build/tmp/work/aarch64-poky-linux/wayland/1.18.0-r0/wayland-1.18.0/
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Enter the wayland-1.18.0 folder on SD card
Run below command on Reference Board
|-
|
* export WLD=/usr
* export LD_LIBRARY_PATH=$WLD/lib/aarch64-linux-gnu
* export PKG_CONFIG_PATH=$WLD/lib/aarch64-linuxgnu/pkgconfig/:$WLD/share/pkgconfig/
* export PATH=$WLD/bin:$PATH
* sudo /root/.local/bin/meson build/ --prefix=$WLD --libdir=$WLD/lib/aarch64-linux-gnu --sysconfdir=/etc
* sudo ninja -C build/
* sudo ninja -C build/ install
|}
=== Compile and install Wayland-protocol ===
Copy the wayland-protocol1.20.0 source code from VLP Yocto build folder to SD card.
i.e. build/tmp/work/aarch64-poky-linux/wayland-protocols/1.20-r0/wayland-protocols-1.20/
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Enter the wayland-protocols-1.20 folder on SD card
Run below command on Reference Board
|-
|
* ./configure -- prefix=$WLD libdir=$WLD/lib/aarch64-linux-gnu
* sudo make install
|}
=== Compile and install Weston ===
Copy the weston8.0.0 source code from VLP Yocto build folder to SD card.
i.e. build/tmp/work/aarch64-poky-linux/weston/8.0.0-r0/weston-8.0.0/
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Enter the weston-8.0.0 folder on SD card
Run below command on Reference Board
|-
|
* sudo /root/.local/bin/meson build/ --prefix=$WLD --libdir=$WLD/lib/aarch64-linux-gnu --sysconfdir=/etc -Dbackend-drm-screencast-vaapi=false -Dxwayland=false -Dcolor-management-colord=false -Dremoting=false
|}
If the configuration is correct, it will display below messages
User defined options
    libdir : /usr/lib/aarch64-linux-gnu
    prefix : /usr
    sysconfdir : /etc
    backend-drm-screencast-vaapi : false
    color-management-colord : false
    remoting : false
    xwayland : false
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|compile and install
|-
|
* sudo ninja -C build/
* sudo ninja -C build/ install
|}
==Port GPU Libraries==
Please refer to the StartupGuide.txt document in meta-rz-features/recipes-graphics/mali/files/mali_pkg_eval_vx.x.tar.gz
=== Migrate GPU drivers ===
Copy the driver mali_kbase..ko from VLP Yocto build folder to SD card.
i.e. build/tmp/work/smarc_rzg2l-poky-linux/kernel-modulemali/r35-p0/image/lib/modules/5.10.83-cip1-yocto-standard/extra
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|install gpu .ko on reference board
|-
|
* sudo insmod mali_kbase.ko
|}
=== Migrate GPU Libraries ===
Copy the library files to SD card.
i.e.  meta-rz-features/recipesgraphics/mali/files/mali_pkg_eval_vx.x.tar.gz
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|install library to reference board
|-
|
* tar -xf mali_um_r35p0.tar.gz
* sudo cp -r mali_um/usr/lib/* /usr/lib/aarch64-linux-gnu/
* sudo cp -r /usr/lib/aarch64-linux-gnu/CL_GLES/mali_wayland/
/usr/lib/aarch64-linux-gnu/
* ln -fs /usr/lib/aarch64-linux-gnu/mali_wayland/libmali.so /usr/lib/aarch64-linux-gnu/libmali.so
|}
=== Testing ===
==== Install testing tool ====
sudo apt install glmark2-es2-wayland
==== Start Weston desktop ====
Only root user can launch weston service, please switch to root user in advance
insmod mali_kbase.ko
export XDG_RUNTIME_DIR=/usr/lib/
export RUNLEVEL=3
weston --tty 1 &
Run glmark2 test
glmark2-es2-wayland --fullscreen
{| class="wikitable"
|+
![[File:glmark1.png|thumb|glmark2 version|336x336px]]
![[File:glmark2.png|thumb|glmark2 result|390x390px]]
|-
! colspan="2" |[[File:glmark2 image.png|thumb|829x829px]]
|}
==Port codec Librasries==
In this section, we will copy codec related files from original VLP Yocto build.
i.e. core-image-qt-smarc-rzg2l.tar.bz2 or core-image-weston-smarc-rzg2l.tar.bz2
Pleaes copy this .bz2 file to Ubuntu SD card and run below instruction on reference board
unzip core-image-qt-smarc-rzg2l.tar.bz2 or core-image-weston-smarc-rzg2l.tar.bz2 to folder "yocto"
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|copy codec drivers
|-
|
* cd ./yocto
* mkdir /root/modules
* cp lib/modules/5.10.83-cip1-yocto-standard/extra/* /root/modules/
|}
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|copy gstreamer related lib
|-
|
* cp -rd usr/bin/gst-* /usr/bin/
* cp -rd usr/lib64/libgst* /usr/lib/aarch64-linux-gnu/
* cp -rd usr/lib64/gstreamer-1.0/ /usr/lib/aarch64-linux-gnu/
* cp -rd usr/lib64/girepository-1.0/ /usr/lib/aarch64-linux-gnu/
* cp -rd usr/lib64/libmmngr* /usr/lib/aarch64-linux-gnu/
* cp -rd usr/lib64/libvspm.so.1* /usr/lib/aarch64-linux-gnu/
* cp -rd usr/libexec/gstreamer-1.0/ /usr/lib/aarch64-linux-gnu/
* cp -rd usr/share/gstreamer-1.0/ /usr/share/
* cp -rd usr/share/gst-plugins-base/ /usr/share/
* cp -rd usr/share/locale/en_GB/LC_MESSAGES/gst* /usr/share/locale/en_GB/LC_MESSAGES/
* cp -rd usr/lib64/gstreamer-1.0/libgstomx.so /usr/lib/aarch64-linux-gnu/gstreamer-1.0/
* cp -rd usr/lib64/gstreamer-1.0/libgstvspmfilter.so /usr/lib/aarch64-linux-gnu/gstreamer-1.0/
* cp -rd usr/lib64/libomxr_* /usr/lib/aarch64-linux-gnu/
* cp -rd usr/lib64/libuvcs_* /usr/lib/aarch64-linux-gnu/
* mkdir /lib64
* cp -rd /usr/lib/aarch64-linux-gnu/ld-* /lib64/
* cp etc/xdg/gstomx.conf /etc/xdg/
* cp etc/gstpbfilter.conf /etc/
* cp -r etc/omxr/ /etc/
|}
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|modify omx plugin configuration
|-
|vi /etc/xdg/gstomx.conf
replace "lib64" as "lib/aarch64-linux-gnu"
[omxh264dec]
type-name=GstOMXH264Dec
core-name=/usr/lib/aarch64-linux-gnu/libomxr_core.so
component-name=OMX.RENESAS.VIDEO.DECODER.H264
·····
[omxh264enc]
type-name=GstOMXH264Enc
core-name=/usr/lib/aarch64-linux-gnu/libomxr_core.so
component-name=OMX.RENESAS.VIDEO.ENCODER.H264
····
|}
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|install gstreamer dependency
|-
|apt install gstreamer1.0-libav gstreamer1.0-plugins-bad
|}
=== Test gstreamer ===
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|login as root and insmod drivers
|-
|insmod /root/modules/mali_kbase.ko
insmod /root/modules/mmngr.ko
insmod /root/modules/mmngrbuf.ko
insmod /root/modules/uvcs_drv.ko
insmod /root/modules/vspm.ko
insmod /root/modules/vspm_if.ko
|}
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Specify gstreamer location
|-
|export GST_PLUGIN_SCANNER=/usr/lib/aarch64-linux-gnu/gstreamer-1.0/gst-plugin-scanner
export GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0
|}
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Launch weston
|-
|weston –tty 1 &
|}
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Play Video
|-
|
* Play video only:
gst-launch-1.0 filesrc location=/root/video/sintel_trailer-720p.mp4 ! qtdemux ! queue ! h264parse ! omxh264dec ! waylandsink
* Play video & audio
gst-launch-1.0 filesrc location=/root/video/sintel_trailer-720p.mp4 ! qtdemux name=d d. ! queue ! h264parse ! omxh264dec ! waylandsink d. ! queue ! faad ! alsasink device=plughw:0,0
|}
==Port Qt==
You can port Qt by following 3 methods
* Port from VLP
* Compile & Install Qt from source
* Install Qt by apt-get
=== Port from VLP ===
In this section, we will copy Qt5.6.3 related files from original VLP Yocto build.
i.e. core-image-qt-smarc-rzg2l.tar.bz2
Pleaes copy this .bz2 file to Ubuntu SD card and run below instruction on reference board
unzip core-image-qt-smarc-rzg2l.tar.bz2 to folder "yocto"
(For other version of Qt, you can modify Yocto meta-qt5\recipes-qt\qt5, please inqury Qt company for higher version QT integration)
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|Port Qt lib
|-
|cd yocto
cp -rd usr/share/qt5 /usr/share/
cp -rd usr/lib64/qt5 /usr/lib/aarch64-linux-gnu/
cp -rd usr/lib64/libQt* /usr/lib/aarch64-linux-gnu/
cp -rd usr/lib64/pkgconfig/Qt* /usr/lib/aarch64-linuxgnu/pkgconfig/
export QT_QPA_PLATFORM=wayland
export QT_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/qt5/plugins/
|}
Start Weston [[RZ-G/RZ-G2 BSP Porting Ubuntu#Start Weston desktop]]
Then run the Qt example in /usr/share/qt5/examples
=== Compile from source ===
You can download qt5 source to reference board and compile on board.
Or cross compile qt5 on PC


=== Configure Filesystem ===
Or compile qt5 in PC QEMU


==== Enter Filesystem ====
Here we compile qt5 on board
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|compile qt5
|-
|download qt5 source code by git (ignore)
mkdir qt5-build
cd qt5-build
make
make install
(rsync to SD)
|}
We suggest to compile the qt5 with [https://github.com/seebe/rzg_stuff/tree/master/build_scripts/qt scrips]


==== Install required software ====
Notes: About the flags parameter in configure of Qt5. -qpa should be set as wayland or wayland-egl. We didn't support xcomposite-egl option


==== Add users ====
=== Install Qt by apt-get ===
apt-get install qt5-default qtwayland5


==== Configure UART ====
Notes: The above installation commands can only run part of Qt functions. If you need more functions, you need to continue installing Qt related packages.


==== Exit FileSystem ====
=== Qt APPs development and testing ===
This section introduce how to develop Qt application on PC.


== Deploy FileSystem to SD Card ==
==== SDK build and installation ====
bitbake core-image-qt -c populate_sdk
The generated installation file is located at:


== Install Wayland, Wayland-Protocols and Weston ==
build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-qtaarch64-smarc-rzg2l-toolchain-3.1.14.sh


== Port GPU Libraries ==
Install this SDK to PC, default folder is /opt/poky/3.1.14


== Port codec Librasries ==
setup SDK runtime environment
source /opt/poky/3.1.14/environment-setup-aarch64-poky-linux


== Port Qt ==
==== QT creator configuration ====
{| class="wikitable"
|+
!Add Device
![[File:qt-creator-add-device.png|thumb]]
|-
|'''Add new Kit'''
|[[File:qt-creator-add-new-kit.png|thumb]]
|-
|'''Add Qt version'''
|[[File:qt-creator-add-version.png|thumb]]
|-
|'''Add compiler'''
|[[File:Qt-creator-add-compiler.png|thumb]]
|-
|'''Add debuggers'''
|[[File:qt-creator-add-debuggers.png|thumb]]
|-
|'''Select kit to build Qt project'''
|[[File:qt-creator-select-kit.png|thumb]]
|-
|'''example to run qt calculator project'''
|[[File:qt-creator-sample-project.png|thumb]]
|}

Latest revision as of 06:36, 5 June 2023

← Back to RZ-G/RZ-G2_BSP_Porting

SoC: All

Specification

Target Ubuntu OS Version: 20.04, 18.04

Target reference board: RZ/G2L,/G2LC,/G2UL SMARC

Host PC Environment: Ubuntu20.04

Ubuntu Filesystem Building

Install QEMU

Run below command on Host Ubuntu PC

sudo apt-get install qemu-user-static

Download Required Files

Select the package to download based on the desired file system  
  • Download ubuntu-base-20.04.4-base-arm64
wget https://cdimage.ubuntu.com/ubuntu-base/releases/20.04/release/ubuntu-base-20.04.4-base-arm64.tar.gz

or

wget https://cdimage.ubuntu.com/ubuntu-base/releases/focal/release/ubuntu-base-20.04.4-base-arm64.tar.gz
  • Download ubuntu-base-18.04.5-base-arm64
wget http://cdimage.ubuntu.com/ubuntubase/releases/18.04.5/release/ubuntu-base-18.04.5-basearm64.tar.gz

Prepare Files

In the following example, please replace "version" as below name as you need

ubuntu-base-20.04.4-base-arm64: 20.04.4
ubuntu-base-18.04.5-base-arm64: 18.04.5 
Initial preparation
mkdir root

sudo tar -xpf ubuntu-base-<version>-base-arm64.tar.gz -C root

sudo cp /usr/bin/qemu-aarch64-static ./root/usr/bin/

sudo cp -b /etc/resolv.conf root/etc/resolv.conf

Create a new script file
vim ch-mount.sh
#!/bin/bash
function mnt() {
echo "MOUNTING"
sudo mount -t proc /proc ${2}proc
sudo mount -t sysfs /sys ${2}sys
sudo mount -o bind /dev ${2}dev
sudo chroot ${2}
}
function umnt() {
echo "UNMOUNTING"
sudo umount ${2}proc
sudo umount ${2}sys
sudo umount ${2}dev
}
if [ "$1" == "-m" ] && [ -n "$2" ] ;
then
mnt $1 $2
elif [ "$1" == "-u" ] && [ -n "$2" ];
then
umnt $1 $2
else
echo ""
echo "Either 1'st, 2'nd or both parameters were missing"
echo ""
echo "1'st parameter can be one of these: -m(mount) OR -u(umount)"
echo "2'nd parameter is the full path of rootfs directory(with trailing
'/')"
echo ""
echo "For example: ch-mount -m /media/sdcard/"
echo ""
echo 1st parameter : ${1}
echo 2nd parameter : ${2}
fi


Configure Filesystem

Enter Filesystem

chmod +x ch-mount.sh
./ch-mount.sh -m root/
chmod -R 777 /tmp

Install required software

apt-get update
apt-get install \
language-pack-en-base \
sudo \
ssh \
net-tools \
network-manager \
ethtool \
ifupdown \
isc-dhcp-client \
openssh-server \
iputils-ping \
rsyslog \
bash-completion \
htop \
resolvconf \
dialog \
vim    

Add users

Plesae replace the <name> with your user name
useradd -s '/bin/bash' -m -G adm,sudo <name>

passwd <name>

passwd root

chown -R root:root /bin/su

chmod u+s /bin/su

Configure UART

vim /etc/init.d/ttyS0.conf
start on stopped rc or RUNLEVEL=[12345]

stop on RUNLEVEL [!12345]

respawn exec /sbin/getty -L 115200 ttyLP0 vt102

Network setup

echo "auto eth0" > /etc/network/interfaces.d/eth0
echo "iface eth0 inet dhcp" >> /etc/network/interfaces.d/eth0
echo "nameserver 8.8.8.8" >> /etc/resolv.conf
echo "nameserver 8.8.4.4" >> /etc/resolv.conf

Exit FileSystem

exit
./ch-mount.sh -u root/

packaged FileSystem

cd root
tar -cjf rootfs.tar.bz2 ./*

Deploy FileSystem to SD Card

Prepare a SD card with ext4 partition: Learning/Linux#Partitioning and Formatting an SD Card

extract ubuntu .bz2 package to SD card

sudo tar -xvf rootfs.tar.gz -C /media/xxx/rootfs

Install Wayland, Wayland-Protocols and Weston

Environment Setup

install required packages
  • sudo apt-get install pkg-config
  • sudo apt install ninja-build cmake git python3-pip kmod
  • sudo apt install libffi-dev libxml2 libxml2-dev graphviz doxygen xsltproc xmlto xdot libxkbcommon-dev libpixman-1-dev libinput-dev
  • sudo apt-get install libcairo-dev glib-2.0 libpango1.0-dev libjpeg-dev libwebp-dev libegl-mesa0 libsystemd-dev libgles2-mesa libgles2-mesa-dev libpam0g-dev libgbm-dev libx11-xcb-dev freerdp2-dev liblcms2-dev libx11-xcb-dev libcolord-dev libxcb-xkb1 libpipewire-0.2-dev libdbus-1-dev libxcb-xkb-dev libdrm-dev
  • sudo pip3 install --user meson -i https://pypi.mirrors.ustc.edu.cn/simple/

Compile and install Wayland

Copy the Wayland 1.18.0 source code from VLP Yocto build folder to SD card.

i.e. build/tmp/work/aarch64-poky-linux/wayland/1.18.0-r0/wayland-1.18.0/
Enter the wayland-1.18.0 folder on SD card

Run below command on Reference Board

  • export WLD=/usr
  • export LD_LIBRARY_PATH=$WLD/lib/aarch64-linux-gnu
  • export PKG_CONFIG_PATH=$WLD/lib/aarch64-linuxgnu/pkgconfig/:$WLD/share/pkgconfig/
  • export PATH=$WLD/bin:$PATH
  • sudo /root/.local/bin/meson build/ --prefix=$WLD --libdir=$WLD/lib/aarch64-linux-gnu --sysconfdir=/etc
  • sudo ninja -C build/
  • sudo ninja -C build/ install

Compile and install Wayland-protocol

Copy the wayland-protocol1.20.0 source code from VLP Yocto build folder to SD card.

i.e. build/tmp/work/aarch64-poky-linux/wayland-protocols/1.20-r0/wayland-protocols-1.20/
Enter the wayland-protocols-1.20 folder on SD card

Run below command on Reference Board

  • ./configure -- prefix=$WLD libdir=$WLD/lib/aarch64-linux-gnu
  • sudo make install

Compile and install Weston

Copy the weston8.0.0 source code from VLP Yocto build folder to SD card.

i.e. build/tmp/work/aarch64-poky-linux/weston/8.0.0-r0/weston-8.0.0/
Enter the weston-8.0.0 folder on SD card

Run below command on Reference Board

  • sudo /root/.local/bin/meson build/ --prefix=$WLD --libdir=$WLD/lib/aarch64-linux-gnu --sysconfdir=/etc -Dbackend-drm-screencast-vaapi=false -Dxwayland=false -Dcolor-management-colord=false -Dremoting=false

If the configuration is correct, it will display below messages

User defined options
    libdir : /usr/lib/aarch64-linux-gnu
    prefix : /usr
    sysconfdir : /etc
    backend-drm-screencast-vaapi : false
    color-management-colord : false
    remoting : false
    xwayland : false
compile and install
  • sudo ninja -C build/
  • sudo ninja -C build/ install

Port GPU Libraries

Please refer to the StartupGuide.txt document in meta-rz-features/recipes-graphics/mali/files/mali_pkg_eval_vx.x.tar.gz

Migrate GPU drivers

Copy the driver mali_kbase..ko from VLP Yocto build folder to SD card.

i.e. build/tmp/work/smarc_rzg2l-poky-linux/kernel-modulemali/r35-p0/image/lib/modules/5.10.83-cip1-yocto-standard/extra
install gpu .ko on reference board
  • sudo insmod mali_kbase.ko

Migrate GPU Libraries

Copy the library files to SD card.

i.e.  meta-rz-features/recipesgraphics/mali/files/mali_pkg_eval_vx.x.tar.gz
install library to reference board
  • tar -xf mali_um_r35p0.tar.gz
  • sudo cp -r mali_um/usr/lib/* /usr/lib/aarch64-linux-gnu/
  • sudo cp -r /usr/lib/aarch64-linux-gnu/CL_GLES/mali_wayland/

/usr/lib/aarch64-linux-gnu/

  • ln -fs /usr/lib/aarch64-linux-gnu/mali_wayland/libmali.so /usr/lib/aarch64-linux-gnu/libmali.so

Testing

Install testing tool

sudo apt install glmark2-es2-wayland

Start Weston desktop

Only root user can launch weston service, please switch to root user in advance

insmod mali_kbase.ko
export XDG_RUNTIME_DIR=/usr/lib/
export RUNLEVEL=3
weston --tty 1 &

Run glmark2 test

glmark2-es2-wayland --fullscreen
glmark2 version
glmark2 result
glmark2 image.png

Port codec Librasries

In this section, we will copy codec related files from original VLP Yocto build.

i.e. core-image-qt-smarc-rzg2l.tar.bz2 or core-image-weston-smarc-rzg2l.tar.bz2

Pleaes copy this .bz2 file to Ubuntu SD card and run below instruction on reference board

unzip core-image-qt-smarc-rzg2l.tar.bz2 or core-image-weston-smarc-rzg2l.tar.bz2 to folder "yocto"

copy codec drivers
  • cd ./yocto
  • mkdir /root/modules
  • cp lib/modules/5.10.83-cip1-yocto-standard/extra/* /root/modules/
copy gstreamer related lib
  • cp -rd usr/bin/gst-* /usr/bin/
  • cp -rd usr/lib64/libgst* /usr/lib/aarch64-linux-gnu/
  • cp -rd usr/lib64/gstreamer-1.0/ /usr/lib/aarch64-linux-gnu/
  • cp -rd usr/lib64/girepository-1.0/ /usr/lib/aarch64-linux-gnu/
  • cp -rd usr/lib64/libmmngr* /usr/lib/aarch64-linux-gnu/
  • cp -rd usr/lib64/libvspm.so.1* /usr/lib/aarch64-linux-gnu/
  • cp -rd usr/libexec/gstreamer-1.0/ /usr/lib/aarch64-linux-gnu/
  • cp -rd usr/share/gstreamer-1.0/ /usr/share/
  • cp -rd usr/share/gst-plugins-base/ /usr/share/
  • cp -rd usr/share/locale/en_GB/LC_MESSAGES/gst* /usr/share/locale/en_GB/LC_MESSAGES/
  • cp -rd usr/lib64/gstreamer-1.0/libgstomx.so /usr/lib/aarch64-linux-gnu/gstreamer-1.0/
  • cp -rd usr/lib64/gstreamer-1.0/libgstvspmfilter.so /usr/lib/aarch64-linux-gnu/gstreamer-1.0/
  • cp -rd usr/lib64/libomxr_* /usr/lib/aarch64-linux-gnu/
  • cp -rd usr/lib64/libuvcs_* /usr/lib/aarch64-linux-gnu/
  • mkdir /lib64
  • cp -rd /usr/lib/aarch64-linux-gnu/ld-* /lib64/
  • cp etc/xdg/gstomx.conf /etc/xdg/
  • cp etc/gstpbfilter.conf /etc/
  • cp -r etc/omxr/ /etc/
modify omx plugin configuration
vi /etc/xdg/gstomx.conf

replace "lib64" as "lib/aarch64-linux-gnu"

[omxh264dec]
type-name=GstOMXH264Dec
core-name=/usr/lib/aarch64-linux-gnu/libomxr_core.so
component-name=OMX.RENESAS.VIDEO.DECODER.H264
·····
[omxh264enc]
type-name=GstOMXH264Enc
core-name=/usr/lib/aarch64-linux-gnu/libomxr_core.so
component-name=OMX.RENESAS.VIDEO.ENCODER.H264
···· 
install gstreamer dependency
apt install gstreamer1.0-libav gstreamer1.0-plugins-bad

Test gstreamer

login as root and insmod drivers
insmod /root/modules/mali_kbase.ko

insmod /root/modules/mmngr.ko

insmod /root/modules/mmngrbuf.ko

insmod /root/modules/uvcs_drv.ko

insmod /root/modules/vspm.ko

insmod /root/modules/vspm_if.ko

Specify gstreamer location
export GST_PLUGIN_SCANNER=/usr/lib/aarch64-linux-gnu/gstreamer-1.0/gst-plugin-scanner

export GST_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/gstreamer-1.0

Launch weston
weston –tty 1 &
Play Video
  • Play video only:

gst-launch-1.0 filesrc location=/root/video/sintel_trailer-720p.mp4 ! qtdemux ! queue ! h264parse ! omxh264dec ! waylandsink

  • Play video & audio

gst-launch-1.0 filesrc location=/root/video/sintel_trailer-720p.mp4 ! qtdemux name=d d. ! queue ! h264parse ! omxh264dec ! waylandsink d. ! queue ! faad ! alsasink device=plughw:0,0

Port Qt

You can port Qt by following 3 methods

  • Port from VLP
  • Compile & Install Qt from source
  • Install Qt by apt-get

Port from VLP

In this section, we will copy Qt5.6.3 related files from original VLP Yocto build.

i.e. core-image-qt-smarc-rzg2l.tar.bz2

Pleaes copy this .bz2 file to Ubuntu SD card and run below instruction on reference board

unzip core-image-qt-smarc-rzg2l.tar.bz2 to folder "yocto"

(For other version of Qt, you can modify Yocto meta-qt5\recipes-qt\qt5, please inqury Qt company for higher version QT integration)

Port Qt lib
cd yocto

cp -rd usr/share/qt5 /usr/share/

cp -rd usr/lib64/qt5 /usr/lib/aarch64-linux-gnu/

cp -rd usr/lib64/libQt* /usr/lib/aarch64-linux-gnu/

cp -rd usr/lib64/pkgconfig/Qt* /usr/lib/aarch64-linuxgnu/pkgconfig/

export QT_QPA_PLATFORM=wayland

export QT_PLUGIN_PATH=/usr/lib/aarch64-linux-gnu/qt5/plugins/

Start Weston RZ-G/RZ-G2 BSP Porting Ubuntu#Start Weston desktop

Then run the Qt example in /usr/share/qt5/examples

Compile from source

You can download qt5 source to reference board and compile on board.

Or cross compile qt5 on PC

Or compile qt5 in PC QEMU

Here we compile qt5 on board

compile qt5
download qt5 source code by git (ignore)

mkdir qt5-build cd qt5-build make make install (rsync to SD)

We suggest to compile the qt5 with scrips

Notes: About the flags parameter in configure of Qt5. -qpa should be set as wayland or wayland-egl. We didn't support xcomposite-egl option

Install Qt by apt-get

apt-get install qt5-default qtwayland5

Notes: The above installation commands can only run part of Qt functions. If you need more functions, you need to continue installing Qt related packages.

Qt APPs development and testing

This section introduce how to develop Qt application on PC.

SDK build and installation

bitbake core-image-qt -c populate_sdk

The generated installation file is located at:

build/tmp/deploy/sdk/poky-glibc-x86_64-core-image-qtaarch64-smarc-rzg2l-toolchain-3.1.14.sh

Install this SDK to PC, default folder is /opt/poky/3.1.14

setup SDK runtime environment

source /opt/poky/3.1.14/environment-setup-aarch64-poky-linux 

QT creator configuration

Add Device
qt-creator-add-device.png
Add new Kit
qt-creator-add-new-kit.png
Add Qt version
qt-creator-add-version.png
Add compiler
Qt-creator-add-compiler.png
Add debuggers
qt-creator-add-debuggers.png
Select kit to build Qt project
qt-creator-select-kit.png
example to run qt calculator project
qt-creator-sample-project.png