User Tools

Site Tools


start:building_for_the_renesas_r-car_m2

AGL for Renesas Porter

Download AGL Source Code

The AGL source code and Yocto layers are maintained on the AGL Gerrit server. For information on how to create accounts for gerrit see Getting Started with AGL.

Prepare Repo Tool

AGL Uses the Repo tool for managing repositories. First you need to setup layers of AGL. You can use the commands below to prepare Repo:

mkdir ~/bin
export PATH=~/bin:$PATH
curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo

Download Latest Stable Release

To download all layers for the for the latest stable release, Blowfish 2.0.4:

repo init -b blowfish -m default_blowfish_2.0.4.xml -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
repo sync

Download Latest on Blowfish Branch

To download all layers on the current release branch which may be in the midst of testing or changes prior to the next stable release:

repo init -b blowfish -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
repo sync

Download Master Branch

To download all code from master:

repo init -u https://gerrit.automotivelinux.org/gerrit/AGL/AGL-repo
repo sync

Set up Build Environment

Set up the development environment for the desired target hardware. AGL has created a set up script for defining the target build and desired optional features. To get a complete list of the options available run.

  $ source meta-agl/scripts/aglsetup.sh -h

Once you run aglsetup.sh with your desired paramaters, you can build any target desired.

Features supported by aglsetup

Here is the list of features for AGL 2.0 that can be specified in the aglsetup.sh command line:

  • in meta-agl
    • agl-devel: activate development options (empty root password, debugger, strace, valgrind …)
    • agl-netboot: enable network boot support through TFTP and NBD (see meta-netboot layer)
  • in meta-agl-extra
    • agl-appfw-smack: enables IoT.bzh Application Framework + SMACK + Cynara
    • agl-demo: enable layer meta-agl-demo and meta-qt5 - required to build * agl-demo-platform
    • agl-localdev: add a local layer named “meta-localdev” in meta directory and a local.dev.inc conf file if present
    • agl-sota: enable SOTA components and dependencies (meta-sota, meta-filesystems, meta-ruby, meta-rust are added)

For newer features or to get more details on a given feature, take a look at the configuration files stored for each feature and/or each machine in meta-agl/templates and meta-agl-extra/templates.

Building the AGL Demo Platform for Renesas Porter

  • Download Renesas graphics drivers with a "click through" license from Renesas website in directory ~/Downloads (or $XDG_DOWNLOAD_DIR). Please note that these drivers are timebombed, and are only functional for 3 hours. After this timer expires, the board needs to be rebooted.
  • To build AGL demo platform for Renesas Porter board use machine porter and feature agl-demo:
source meta-agl/scripts/aglsetup.sh -m porter agl-demo agl-netboot agl-appfw-smack
bitbake agl-demo-platform

Booting AGL Demo Platform on Renesas Porter

Deployment

On the host

  • Plug microSD card and get its associated device by either running dmesg | tail -15 or lsblk, for example:
dmesg | tail -15
[ 1971.462160] sd 6:0:0:0: [sdc] Mode Sense: 03 00 00 00
[ 1971.462277] sd 6:0:0:0: [sdc] No Caching mode page found
[ 1971.462278] sd 6:0:0:0: [sdc] Assuming drive cache: write through
[ 1971.463870]  sdc: sdc1 sdc2
lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 167,7G  0 disk 
├─sda1   8:1    0   512M  0 part /boot/efi
├─sda2   8:2    0 159,3G  0 part /
└─sda3   8:3    0   7,9G  0 part [SWAP]
sdb      8:16   0 931,5G  0 disk 
└─sdb1   8:17   0 931,5G  0 part /media/storage
sdc      8:32   1  14,9G  0 disk 
├─sdc1   8:33   1    40M  0 part 
└─sdc2   8:34   1   788M  0 part 

Note: In the examples above, 'sdc' corresponds to the microSD card.

  • Create EXT3 partition on the SD-card using fdisk or another application. For example, if the microSD card is /dev/sdc:
sudo fdisk /dev/sdc

Welcome to fdisk (util-linux 2.27.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): o
Created a new DOS disklabel with disk identifier 0x96e5850d.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): 

Using default response p.
Partition number (1-4, default 1): 
First sector (2048-31291391, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-31291391, default 31291391): 

Created a new partition 1 of type 'Linux' and of size 14,9 GiB.

Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
  • Initialize the ext3 partition using “mke2fs”, for example if the microSD card is associated with sdc:
sudo mke2fs -t ext3 /dev/sdc1
mke2fs 1.42.13 (17-May-2015)
Creating filesystem with 3911168 4k blocks and 979200 inodes
Filesystem UUID: 690804b9-6c7d-4bbb-b1c1-e9357efabc52
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done 
  • Mount the microSD card partition, for example example if the microSD card is associated with sdc:
mkdir /tmp/agl
sudo mount /dev/sdc1 /tmp/agl/

Note: Please replace /dev/sdc with the actual path for your microSD card.

  • Go to your build directory:
cd $BUILDDIR/tmp/deploy/images/porter
  • Make sure the filesystem is empty:
sudo rm -rf /tmp/agl/*
  • Verify that tar version is 1.28 or newer:
tar --version
tar (GNU tar) 1.28
Copyright (C) 2014 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Written by John Gilmore and Jay Fenlason.
  • Copy Automotive Grade Linux (AGL) files onto the mircoSD card by extracting the root file system archive:
sudo tar --extract --numeric-owner --preserve-permissions --preserve-order --totals \
           --xattrs-include='*' --directory=/tmp/agl --file=agl-demo-platform-porter.tar.bz2
  • Copy Kernel Image and Device Tree Blob file into the boot directory:
sudo cp uImage+dtb /tmp/agl/boot/
  • Ensure the changes have been written to the disk:
sync
  • Unmount the micrSD card:
sudo umount /tmp/agl
  • Plug the microSD card in Renesas Porter board.

To access the shell (serial)

  • With the Porter board powered off, connect the 'Debug Serial 0' port on the board (for Porter mini-USB port close to on/off switch) with the host PC using the USB cable.
  • Use screen to access the serial debug console (may needs to apt-get install screen):
sudo screen /dev/ttyUSB0 38400

Note: Alternatively, start a terminal emulator, such as 'minicom' or 'picocom', on the host, connecting to the USB serial port (/dev/ttyUSB0) with 38400, 8n1 settings.

  • Power on the Porter board to see a shell on the console

On the target board

It is assumed that the Renesas Porter board already has u-boot running as second stage boot loader.

U-Boot configurations

Follow the steps below to configure boot from microSD card and to set screen resolution:

  • Power up the board and, using your preferred terminal emulator, stop the board's autoboot and type print to check the environment:
print
  • Verify that the ethaddr environment variable is set to the same MAC address value shown on the label on top of the RJ45 Ethernet connector. If not please set it using the following command:
setenv ethaddr <MAC address>

For example:

setenv ethaddr 2e:09:0a:00:75:b5
  • Set the follow environment variables:
setenv bootargs_console 'console=ttySC6,38400 ignore_loglevel'
setenv bootargs_video 'vmalloc=384M video=HDMI-A-1:1920x1080-32@60'
setenv bootargs_root 'root=/dev/mmcblk0p1 rootdelay=3 rw rootfstype=ext3 rootwait'
setenv bootmmc '1:1'
setenv bootcmd_sd 'ext4load mmc ${bootmmc} 0x40007fc0 boot/uImage+dtb'
setenv bootcmd 'setenv bootargs ${bootargs_console} ${bootargs_video} ${bootargs_root}; run bootcmd_sd; bootm 0x40007fc0'

WARNINGS:

If no display shows up when booting, e.g. for a non-full HD screen, replace 1920×1080 value in the bootargs_video variable with lower screen resolution such as 1024×768. Unfortunately for the moment there are no universally supported setting.

Depending on your board (Porter rev B or rev C, Koelsch etc.), the SD card slots may differ. Try setting bootmmc to 0:1 or 2:1 depending on the slot and card format.

For Renesas Porter Rev 1.0 use screen resolution 1024×768 and set bootmmc to 2:1.

  • Save the environment variables:
saveenv
  • Reboot:
reset

Troubleshooting

Due to a known bug in the upstream of meta-rust the Yocto/OE recipe for rust-cross may fail while building RVI SOTA Client or another application written in the Rust programming language. Until the complete resolution of the issue the workaround is to disable all use of the CXX11 ABI by applying the following lines to conf/local.conf:

LD_CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"
TARGET_CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"
CXXFLAGS_append = " -D_GLIBCXX_USE_CXX11_ABI=0"
  
BUILD_CXXFLAGS_remove_pn-gcc-runtime = "-D_GLIBCXX_USE_CXX11_ABI=0"
TARGET_CXXFLAGS_remove_pn-gcc-runtime = "-D_GLIBCXX_USE_CXX11_ABI=0" CXXFLAGS_remove_pn-gcc-runtime = "-D_GLIBCXX_USE_CXX11_ABI=0"

Weston

If Weston fails to start double check /etc/xdg/weston/weston.ini and verify that the output name and screen resolution matches the configured U-Boot environment, for example on Renesas Porter board rev 1.0 with screen resolution 1024×768:

[core]
shell=desktop-shell.so
backend=drm-backend.so

[shell]
locking=true
# Uncomment below to hide panel
#panel-location=none

[output]
name=HDMI-A-1
mode=1024x768
#mode=1920x1080
#mode=173.00  1920 2048 2248 2576  1080 1083 1088 1120 -hsync +vsync

Debugging

It is possible to debug AGL images on Renesas Porter board using USB to Mini-B USB cable. Plug the USB connector of the cable to your computer and use your favorite tool for serial communication. For example on Ubuntu and other Linux distributions you may use screen:

sudo screen /dev/ttyUSB0 38400
start/building_for_the_renesas_r-car_m2.txt · Last modified: 2016/12/05 23:25 by wminer