Setting Up Your Development Environment for Renesas Remi Pi

The development process is based on an Ubuntu system and requires specific hardware, software tools, and resources. Below is what you need to prepare:

1. Development Host Requirements

To build the SDK and work efficiently, your host machine should have:

2. Operating System

3. Required Packages

By following these steps, you’ll be ready to set up the development environment for the Renesas Remi Pi platform (based on RZ/G processors like the G2L with dual ARM Cortex-A53 cores) and start development and debugging quickly.
Run the following command before start porting Ubuntu:

sudo apt-get update
sudo apt-get install qemu-user-static 

Porting Ubuntu 22.04 File System

1. What is Ubuntu-base?

2. Why Use Ubuntu-base?

3. Getting the Source Code

You have two options:

  1. From MYIR’s disk image: Download the zip file from the 04-sources folder.
  2. From Ubuntu official sources: Use wget to fetch the source code.

Choose the method that fits your needs before starting the build process.

Download From Ubuntu official sources

Procedure Details

  1. Download Ubuntu-base
    sudo wget https://cdimage.ubuntu.com/ubuntu-base/releases/22.04/release/ubuntu-base-22.04-base-arm64.tar.gz
  2. Create a rootfs folder and extract the archive\ (Adjust paths and folder names as needed)
    mkdir rootfs
    tar -xf ubuntu-base-22.04.1-base-arm64.tar.gz -C rootfs/
  3. Check the extracted folder structure
tree -d -L 1 rootfs

Expected structure:

ubuntu_rootfs
├── bin -> usr/bin
├── boot
├── dev
├── etc
├── home
├── lib -> usr/lib
├── media
├── mnt
├── opt
├── proc
├── root
├── run
├── sbin -> usr/sbin
├── snap
├── srv
├── sys
├── tmp
├── usr
└── var

Preparing the chroot Environment

Install the Emulator

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

If qemu-user-static is not installed:

sudo apt install qemu-user-static

Copy DNS Configuration

cp /etc/resolv.conf ./rootfs/etc/resolv.conf 

Creating a Mount Script

  1. Create the script file and make it executable
    vi ch-mount.sh

Add the following content:

#!/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 mount -o bind /dev/pts ${2}dev/pts
    sudo chroot ${2}
}

function umnt() {
    echo "UNMOUNTING"
    sudo umount ${2}proc
    sudo umount ${2}sys
    sudo umount ${2}dev/pts
    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 1st, 2nd or both parameters were missing"
    echo ""
    echo "1st parameter: -m (mount) OR -u (umount)"
    echo "2nd parameter: full path of rootfs directory (with trailing '/')"
    echo ""
    echo "Example: ch-mount -m /media/sdcard/"
    echo ""
    echo "1st parameter: ${1}"
    echo "2nd parameter: ${2}"
fi

Change permissions:

chmod 777 ch-mount.sh

Mounting the Ubuntu Filesystem

./ch-mount.sh -m ./rootfs/

Expected output:

MOUNTING
root@system1:/# ls
bin  boot  dev  etc  home  lib  media  mnt  opt  proc  root  run  sbin  snap  srv  sys  tmp  usr  var

After mounting, you can configure the Ubuntu filesystem and install packages.

Basic Package Installation

Run these commands inside the chroot environment:

chmod 777 /tmp
apt update
apt-get install language-pack-zh-hant language-pack-zh-hans
apt install language-pack-en-base
apt install dialog rsyslog
apt install systemd avahi-daemon avahi-utils udhcpc ssh
apt install sudo vim net-tools ethtool ifupdown iputils-ping htop lrzsz gpiod wpasupplicant kmod iw usbutils memtester alsa-utils ufw psmisc

Enable logging:

touch /var/log/rsyslog
chown syslog:adm /var/log/rsyslog
chmod 666 /var/log/rsyslog
systemctl unmask rsyslog
systemctl enable rsyslog 

Network and language support:

apt-get install synaptic rfkill network-manager
apt install -y --force-yes --no-install-recommends fonts-wqy-microhei
apt install -y --force-yes --no-install-recommends ttf-wqy-zenhei

Install LXDEDesktop. Audio and Browser

apt-get install xinit lxde
sudo apt install epiphany-browser xine-ui

Create Users

Set root password:

passwd root

Remove root password login:

passwd -d root

Fix sudo permissions:

chown root:root /usr/bin/sudo
chmod 4755 /usr/bin/sudo

Create user myir:

adduser myir

Update sudoers:

sudo vi /etc/sudoers 

Add:

root ALL=(ALL:ALL) ALL
myir ALL=(ALL:ALL) ALL

Other Configurations

ln -s /lib /lib64

auto eth0
iface eth0 inet dhcp

Unmount and Exit

exit
./ch-mount.sh -u ubuntu-rootfs/

Packaging Ubuntu System

Create ext4 image:

dd if=/dev/zero of=ubuntu22.04.ext4 bs=1M count=3300
mkfs.ext4 ubuntu22.04.ext4
mkdir temp
sudo mount ubuntu22.04.ext4 temp
sudo cp -avrf ubuntu-rootfs/* temp
sudo umount temp

Create SD Boot Image

Extract tools:

tar -xf RemiPiSDUpdate.tar.bz2
cd RemiPiSDUpdate/renesas-sd

Replace ubuntu22.04.ext4 in rootfs/home/root/g2l_images, update Manifest, then run:

cd rzg2bspscripts/imagecreator/
./createimage.sh myir_config.ini

So, finally you will be able to boot into your fresh Ubuntu installation using the LXDE desktop enviroment.
Hope you enjoy this guide.
Happy Modding!