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

From Renesas.info
Line 111: Line 111:


====Add users====
====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====
==== 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
|}
====Exit FileSystem====
====Exit FileSystem====
exit
./ch-mount.sh -u
==== packaged FileSystem ====
cd root
tar -cjf rootfs.tar.bz2 ./*


== Deploy FileSystem to SD Card==
== 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==
==Install Wayland, Wayland-Protocols and Weston==
=== Environment Setup ===
{| class="mw-collapsible mw-collapsed wikitable" width="50%"
|network setup
|-
|
* ifconfig eth0 10.232.162.111 netmask 255.255.255.0 up
* route add default gw 10.232.162.250
* echo "nameserver 8.8.8.8" >> /etc/resolv.conf
* echo "nameserver 8.8.4.4" >> /etc/resolv.conf
|}
{| 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
|}


==Port GPU Libraries==
==Port GPU Libraries==

Revision as of 01:07, 23 May 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/ubuntubase/releases/20.04/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

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

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

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 install \
language-pack-en-base \
sudo \
ssh \
net-tools \
network-manager \
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

Exit FileSystem

exit
./ch-mount.sh -u

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

network setup
  • ifconfig eth0 10.232.162.111 netmask 255.255.255.0 up
  • route add default gw 10.232.162.250
  • echo "nameserver 8.8.8.8" >> /etc/resolv.conf
  • echo "nameserver 8.8.4.4" >> /etc/resolv.conf
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

Port GPU Libraries

Port codec Librasries

Port Qt