R-Car/Boards/Yocto-Wheat

From eLinux.org
< R-Car
Revision as of 16:35, 8 November 2016 by Cogente (talk | contribs) (Created page with "{{TOC right}} This page contains information on building and running Yocto on Renesas R-Car V2H Wheat. == Yocto versions == [http://git.yoctoproject....")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This page contains information on building and running Yocto on Renesas R-Car V2H Wheat.

Yocto versions

Poky-2.0.1 is supported.

Preliminary steps

  1. Download evaluation version of proprietary graphics and multimedia drivers from Renesas.

    To download Multimedia and Graphics library, please use the following link:
    TBD
    To download related Linux drivers, please use the following link:
    TBD

    Graphic drivers are required for X11 and Wayland.

  2. Install required packages
    Ubuntu and Debian
    sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib \
         build-essential chrpath socat libsdl1.2-dev xterm
    
    Fedora
    sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
         diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
         ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue socat \
         SDL-devel xterm
    

    Refer to Yocto Project Quick Start for more information.

Building the BSP for Renesas R-Car Wheat

  1. Create a directory and switch to it
    Warning! Yocto builds require a lot of disk space (up to 100 GB). Make sure you have got enough before starting the build.
    export WORK=<path-to-your-build-directory>
    mkdir $WORK
    cd $WORK
    
  2. Clone basic Yocto layers:
    cd $WORK
    git clone git://git.yoctoproject.org/poky
    git clone git://git.openembedded.org/meta-openembedded
    git clone git://git.linaro.org/openembedded/meta-linaro.git
    
  3. Switch to proper branches/commits
    cd $WORK/poky
    git checkout -b tmp 40376446904ae3529be41737fed9a0b650ed167d
    cd $WORK/meta-openembedded
    git checkout -b tmp 8ab04afbffb4bc5184cfe0655049de6f44269990
    cd $WORK/meta-linaro
    git checkout -b tmp 9b1fd178309544dff1f7453e796a9437125bc0d9
    

    Another versions are not tested for compatibility.

  4. Clone Renesas BSP layer and switch to the proper branch:
    cd $WORK
    git clone git://github.com/CogentEmbedded/meta-rcar.git
    cd meta-rcar
    git checkout -b tmp origin/v2.12.0
    
  5. Clone Renesas QuickStart layer and switch to the proper branch:
    cd $WORK
    git clone git://github.com/CogentEmbedded/meta-renesas-quick-start.git
    cd meta-rcar
    git checkout -b tmp origin/bsp_v212
    
  6. Setup build environment
    cd $WORK
    source poky/oe-init-build-env
    
  7. Prepare default configuration files.
    cd $WORK/meta-renesas/meta-rcar-gen2/templates/<board>
    cp bblayers.conf $WORK/build/conf/bblayers.conf
    

    For weston/wayland:

    cp local-wayland.conf $WORK/build/conf/local.conf
    
  8. Start the build
    For weston/wayland:
    bitbake core-image-weston
    
  9. Building image can take upto a few hours depending on your host system performance.
    After the build has been completed successfuly, you should see the output similar to:
    Tasks Summary: Attempted 4321 tasks of which 4319 didn't need to be rerun and all succeeded.
    

    and the command prompt should return.

  10. Bitbake has generated all the necessary files in ./tmp/deploy/images directory.
    You can verify its content:
    [builduser]$ tree -p tmp/deploy/images/wheat/
    ├── [-rw-r--r--]  core-image-weston-wheat-20161108231942.rootfs.cpio.gz
    ├── [-rw-r--r--]  core-image-weston-wheat-20161108231942.rootfs.ext4
    ├── [-rw-r--r--]  core-image-weston-wheat-20161108231942.rootfs.manifest
    ├── [-rw-r--r--]  core-image-weston-wheat-20161108231942.rootfs.tar.bz2
    ├── [lrwxrwxrwx]  core-image-weston-wheat.cpio.gz -> core-image-weston-wheat-20161108231942.rootfs.cpio.gz
    ├── [lrwxrwxrwx]  core-image-weston-wheat.ext4 -> core-image-weston-wheat-20161108231942.rootfs.ext4
    ├── [lrwxrwxrwx]  core-image-weston-wheat.manifest -> core-image-weston-wheat-20161108231942.rootfs.manifest
    ├── [lrwxrwxrwx]  core-image-weston-wheat.tar.bz2 -> core-image-weston-wheat-20161108231942.rootfs.tar.bz2
    ├── [-rw-rw-r--]  modules--4.6+git0+f100fac1e2-r0-wheat-20161108175236.tgz
    ├── [lrwxrwxrwx]  modules-wheat.tgz -> modules--4.6+git0+f100fac1e2-r0-wheat-20161108175236.tgz
    ├── [-rw-r--r--]  README_-_DO_NOT_DELETE_FILES_IN_THIS_DIRECTORY.txt
    ├── [lrwxrwxrwx]  u-boot.bin -> u-boot-wheat-v2015.07+gitAUTOINC+33711bdd4a-r0.bin
    ├── [lrwxrwxrwx]  u-boot.srec -> u-boot-wheat-v2015.07+gitAUTOINC+33711bdd4a-r0.srec
    ├── [lrwxrwxrwx]  u-boot-wheat.bin -> u-boot-wheat-v2015.07+gitAUTOINC+33711bdd4a-r0.bin
    ├── [lrwxrwxrwx]  u-boot-wheat.srec -> u-boot-wheat-v2015.07+gitAUTOINC+33711bdd4a-r0.srec
    ├── [-rwxr-xr-x]  u-boot-wheat-v2015.07+gitAUTOINC+33711bdd4a-r0.bin
    ├── [-rw-r--r--]  u-boot-wheat-v2015.07+gitAUTOINC+33711bdd4a-r0.srec
    ├── [lrwxrwxrwx]  uImage -> uImage--4.6+git0+f100fac1e2-r0-wheat-20161108175236.bin
    ├── [-rw-r--r--]  uImage--4.6+git0+f100fac1e2-r0-r8a7792-wheat-20161108175236.dtb
    ├── [-rw-r--r--]  uImage--4.6+git0+f100fac1e2-r0-wheat-20161108175236.bin
    ├── [lrwxrwxrwx]  uImage+dtb.r8a7792-wheat -> uImage+dtb.r8a7792-wheat--4.6+git0+f100fac1e2-r0-wheat-20161108175236
    ├── [-rw-r--r--]  uImage+dtb.r8a7792-wheat--4.6+git0+f100fac1e2-r0-wheat-20161108175236
    ├── [lrwxrwxrwx]  uImage-r8a7792-wheat.dtb -> uImage--4.6+git0+f100fac1e2-r0-r8a7792-wheat-20161108175236.dtb
    ├── [lrwxrwxrwx]  uImage-wheat.bin -> uImage--4.6+git0+f100fac1e2-r0-wheat-20161108175236.bin
    ├── [lrwxrwxrwx]  zImage -> zImage--4.6+git0+f100fac1e2-r0-wheat-20161108175236
    ├── [-rw-r--r--]  zImage--4.6+git0+f100fac1e2-r0-wheat-20161108175236
    ├── [lrwxrwxrwx]  zImage+dtb.r8a7792-wheat -> zImage+dtb.r8a7792-wheat--4.6+git0+f100fac1e2-r0-wheat-20161108175236
    └── [-rw-r--r--]  zImage+dtb.r8a7792-wheat--4.6+git0+f100fac1e2-r0-wheat-20161108175236
    
    '''uImage+dtb.r8a7792-wheat''' is compressed Kernel image, '''core-image-weston-wheat.tar.bz2''' is the rootfs, '''modules-wheat.tgz''' are kernel modules.
    
  11. You can now boot R-Car V2H Wheat board over TFTP and NFS

Running Yocto image

Linux kernel can be booted from microSD card or from TFTP. Root FS can be mounted from micro SD card or via NFS.

Loading kernel via TFTP and rootfs via NFS

Follow these steps to setup working TFTP and NFS server:

  1. Setup a TFTP server.

    Ubuntu

    Install tftpd-hpa package along with tftp tools:

    sudo apt-get install tftp tftpd-hpa
    

    Fedora

    1. Install necessary packages:
      sudo yum install tftp-server tftp
      

      tftp-server is a part of xinetd. See Fedora manual for more information.

    2. Enable TFTP server:
      sudo vi /etc/xinetd.d/tftp 
      
      Set
      disable = no
      Save file and exit.
    3. Start xinetd:
      sudo systemctl start xinetd.service
      sudo systemctl enable xinetd.service
      
  2. Copy uImage+dtb.r8a7792-wheat from $WORK/build/tmp/deploy/images/wheat/ to TFTP server root.

    Ubuntu

    cp $WORK/build/tmp/deploy/images/wheat/uImage+dtb.r8a7792-wheat /srv/tftp/
    

    Fedora

    cp $WORK/build/tmp/deploy/images/wheat/uImage+dtb.r8a7792-wheat /var/lib/tftpboot/
    
  3. Verify that TFTP server is working.
    tftp localhost -c get uImage+dtb.r8a7792-wheat && ls uImage+dtb.r8a7792-wheat
    
  4. Setup NFS server.

    Debian/Ubuntu

    1. Install necessary packages:
      sudo apt-get install nfs-kernel-server nfs-common
      
    2. Start NFS server:
      sudo /etc/init.d/nfs-kernel-server start
      

    Fedora

    1. Install necessary packages:
      sudo yum install nfs-utils
      
    2. Enable and start nfs server:
      sudo systemctl enable rpcbind.service 
      sudo systemctl enable nfs-server.service 
      sudo systemctl enable nfs-lock.service 
      sudo systemctl enable nfs-idmap.service
      sudo systemctl start rpcbind.service 
      sudo systemctl start nfs-server.service 
      sudo systemctl start nfs-lock.service 
      sudo systemctl start nfs-idmap.service
      
  5. Export root FS to NFS. (Change IMAGE and MACHINE to fit your build).
    1. Unpack rootfs to a dedicated directory:
      
      IMAGE=weston
      MACHINE=wheat
      NFS_ROOT=/nfs/${MACHINE}
      sudo mkdir -p "${NFS_ROOT}"
      sudo rm -rf "${NFS_ROOT}"/*
      sudo tar -xjf "${WORK}/build/tmp/deploy/images/${MACHINE}/core-image-${IMAGE}-${MACHINE}.tar.bz2" -C "${NFS_ROOT}"
      sync
      
    2. Edit /etc/exports:
      sudo vi /etc/exports
      

      add

      /nfs/wheat	*(rw,no_subtree_check,sync,no_root_squash,no_all_squash)
      

      Save the file and exit.

    3. Force NFS server to re-read /etc/exports
      sudo exportfs -a
  6. Verify that NFS is working.
    [builduser@buildmachine ~]$ showmount -e localhost
    Export list for localhost:
    /nfs/wheat *
    
  7. Boot into U-Boot command prompt
    For Wheat board