Tinker V
-
Build environment:
Linux Host PC Used as build/debug environment, 100GB free space on HDD is necessary OS Ubuntu 18.04 LTS or 20.04 LTS, 64 bit OS must be used -
Download the source code:
$ repo init -u https://github.com/TinkerBoard/renesas-manifest.git -b linux5.10-rzfive $ repo sync
-
Install and set up Docker enviornment
$ sudo apt-get update $ sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent softwareproperties--common $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - $ sudo apt-key fingerprint 0EBFCD88 $ sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" $ sudo apt-get update $ sudo apt-get install docker-ce docker-ce-cli containerd.io $ sudo docker run hello-world
Reference: https://docs.docker.com/engine/install/ubuntu/
-
Manage Docker as a non-root user
$ sudo groupadd docker $ sudo usermod -aG docker $USER $ newgrp docker $ docker run hello-world
-
Before starting the build, run the commands below on the Linux Host PC to install packages used for building the BSP.
$ sudo apt-get update $ sudo apt-get install -y gawk wget git-core diffstat unzip texinfo gcc-multilib \ build-essential chrpath socat cpio python python3 python3-pip python3-pexpect \ xz-utils debianutils iputils-ping libsdl1.2-dev xterm p7zip-full sudo \ libyaml-dev libssl-dev
-
Go to the directory where you have downloaded the code base and execute the script. This will take a while to install the necessary packages on the host and build the Docker image.
$ ./docker_builder/docker-builder-run.sh
-
Run the commands below to start a build.
$ ./build.sh
-
After the build is successfully completed, it will show a similar output, and the command prompt will return.
-
The image generated will be located in the build/tmp/deploy/images directory.
Image files for Tinker VItem File Name Linux Kernel Image-rzfive-tinker-v.bin Device tree file Image-r9a07g043f01-tinker-v.dtb root file system core-image-bsp-rzfive-tinker-v.tar.bz2 Bootloader spl-rzfive-tinker-v.srec, fit-rzfive-tinker-v.srec Flash Writer Flash_Writer_SCIF_TINKER_V.mot
-
Booting Flash Writer
-
Please set the SW1 dipswitches to ‘on-on-on-on’.
SW1 Dip Switch Status SW1-1 ON SW1-2 ON SW1-3 ON SW1-4 ON -
Connect the power adapter to the Tinker V, and it’ll print the message of ‘ Load Program to System RAM’ on Tera Term terminal.
-
Below is an example using Tera Term. Open a “Send file” dialog by selecting “File” → “Send file” menu.
Then, select the image Flash_Writer_SCIF_TINKER_V.mot and click “Open”.
After binary download is completed, Flash Writer starts automatically and shows a message of Flash writer version on the terminal.
-
-
Writing Bootloader
-
Use “XLS2” command of Flash Writer to write boot loader binary files. This command is used for receiving binary data from the serial port and writing the data to a specified address of Flash ROM with information such as where the data should be loaded on the address of the main memory.
Send the data of “spl-rzfive-tinker-v.srec” from terminal software after the message “please send !” is shown.
The terminal will print the message of ‘Qspi Save Information’ once the binary is downloaded successfully.
SPI Data Clear(H'FF) Check : H'00000000-0000FFFF,Clear OK?(y/n)
Please press “y” when a message prompt asks to clear SPI data.
-
Next, write another loader file by using XLS2 command again.
Send the data of “fit-rzfive-tinker-v.srec” from terminal software after the message “please send !” is shown.
The terminal will print the message of ‘Qspi Save Information’ once the binary is downloaded successfully.
SPI Data Clear(H'FF) Check : H'00000000-0000FFFF,Clear OK?(y/n)
Please press “y” when a message prompt asks to clear SPI data.
-
After writing two loader files, turn off the power and set the SW1 dipswitches to ‘off-off-on-on’.
SW1 Dip Switch Status SW1-1 OFF SW1-2 OFF SW1-3 ON SW1-4 ON
-
-
Create a microSD card to boot Linux
It is necessary to have a microSD card with over 4GB size to create a bootable SD card. You can use a Linux machine as Host PC to expand the kernel and the rootfs, using equipment such as USB card reader. Please format the SD card with the following steps first:
-
When the microSD card is not connected to Linux Host PC:
$ lsblk
-
When the microSD card is connected to Linux Host PC with USB adapter
-
Check the device name that is associated with the microSD card:
$ lsblk
The message above shows the MicroSD card associated with the /dev/sdd. Please be careful not to use the other device names in the following steps.
-
Change the partition table
microSD card needs two partitions as listed below:
Type/Number Size File system Contents Primary#1 500MB (minimum 128MB) FAT32 Linux Kernel, Device Tree Primary#2 All remaining Ext4 root filesystem According to microSD block device, set the partition table using the
fdisk
command:In the example below, the microSD block device is /dev/sdd
Then, check the partition table with the commands
partprobe
andfdisk -l /dev/sdd
below: -
Format partitions with command
mkfs
.(with device format, in this case it’s mkfs.vfat and mkfs ext4) -
Write kernel and device tree
$ mkdir tmp $ sudo mount /dev/sdd1 tmp $ sudo cp Image-rzfive-tinker-v.bin tmp/ $ sudo cp Image-r9a07g043f01-tinker-v.dtb tmp/ $ sudo umount /dev/sdd1
-
Write root filesystem
$ sudo mount /dev/sdd2 tmp $ sudo tar xf core-image-bsp-rzfive-tinker-v.tar.bz2 -C tmp/ $ sudo umount /dev/sdd2 $ rm -rf tmp
-
-
Setting U-boot boot from microSD card
Insert the micro SD card to Tinker V, and then plug the power supply. Press any key on the keyboard to stop autoboot from the serial console. If U-Boot is stopped, it displays a command line console.
Please set these values and save them to the Flash ROM.
=> env default -a => saveenv => setenv bootargs 'root=/dev/mmcblk1p2 rootwait' => setenv bootcmd 'mmc dev 1;fatload mmc 1:1 0x48080000 Image-rzfive-tinker-v.bin;fatload mmc 1:1 0x48000000 Image-r9a07g043f01-tinker-v.dtb;booti 0x48080000 - 0x48000000' => saveenv
-
Create a microSD card to boot linux for eMMC boot.
Please refer to chapter 2.2. Create microSD card image for creating microSD image.
-
After creating the microSD card image, copy a kernel image, a device tree file and rootfs to the second partition of the microSD card.
e.g. microSD block device is /dev/sdd
$ mkdir tmp $ sudo mount /dev/sdd2 tmp $ sudo cp Image-rzfive-tinker-v.bin tmp/home/root/ $ sudo cp Image-r9a07g043f01-tinker-v.dtb tmp/home/root/ $ sudo cp core-image-bsp-rzfive-tinker-v.tar.bz2 tmp/home/root/ $ sudo umount /dev/sdd2 $ rm -rf tmp
-
Set Boot from microSD.
Insert microSD card to Tinker V, then power on Tinker V. Press any key to stop autoboot from the serial console. If U-Boot is stopped, the terminal will stop show a command line console.
Please set these values and save them to the Flash ROM.
=> env default -a => saveenv => setenv bootargs 'root=/dev/mmcblk1p2 rootwait' => setenv bootcmd 'mmc dev 1;fatload mmc 1:1 0x48080000 Image-rzfive-tinker-v.bin;fatload mmc 1:1 0x48000000 Image-r9a07g043f01-tinker-v.dtb;booti 0x48080000 - 0x48000000' => saveenv
-
Power off Tinker V then Power on.
-
After booting Linux, please login as root and create partitions on eMMC.
Format eMMC.
$ mkfs.ext4 /dev/mmcblk0p1 $ mkfs.ext4 /dev/mmcblk0p2
Write the kernel, the device tree.
$ mount /dev/mmcblk0p1 /mnt/ $ cp /home/root/Image-rzfive-tinker-v.bin /mnt/ $ cp /home/root/Image-r9a07g043f01-tinker-v.dtb /mnt/ $ umount /dev/mmcblk0p1
Write the root filesystem.
$ mount /dev/mmcblk0p2 /mnt/ $ tar xf /home/root/core-image-bsp-rzfive-tinker-v.tar.bz2 -C /mnt/ $ umount /dev/mmcblk0p2
-
Setting U-boot for eMMC boot.
Insert microSD card to Tinker V, then power on Tinker V. Press any key to stop autoboot from the serial console. If U-Boot is stopped, the terminal will stop show a command line console.
Please set these values and save them to the Flash ROM.
=> env default -a => saveenv => setenv bootargs 'root=/dev/mmcblk0p2 rootwait' => setenv bootcmd 'mmc dev 1;ext4load mmc 0:1 0x48080000 Image-rzfive-tinker-v.bin;ext4load mmc 0:1 0x48000000 Image-r9a07g043f01-tinker-v.dtb;booti 0x48080000 - 0x48000000' => saveenv