Difference between revisions of "R-Car/Boards/Yocto-Wheat"
(→Building the BSP for Renesas R-Car Wheat) |
m |
||
Line 12: | Line 12: | ||
https://www.renesas.com/en-eu/software/D3017410.html<br/> | https://www.renesas.com/en-eu/software/D3017410.html<br/> | ||
To download related Linux drivers, please use the following link:<br/> | To download related Linux drivers, please use the following link:<br/> | ||
− | + | https://www.renesas.com/en-eu/media/secret/solutions/automotive/rcar-demoboard/R-Car_Series_Evaluation_Software_Package_of_Linux_Drivers-20151228.zip<br/> | |
<br/> | <br/> | ||
Graphic drivers are required for X11 and Wayland.<br/> | Graphic drivers are required for X11 and Wayland.<br/> |
Revision as of 23:39, 17 November 2016
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
- Download evaluation version of proprietary graphics and multimedia drivers from Renesas.
To download Multimedia and Graphics library, please use the following link:
https://www.renesas.com/en-eu/software/D3017410.html
To download related Linux drivers, please use the following link:
https://www.renesas.com/en-eu/media/secret/solutions/automotive/rcar-demoboard/R-Car_Series_Evaluation_Software_Package_of_Linux_Drivers-20151228.zip
Graphic drivers are required for X11 and Wayland.
- 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
- 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
- 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
-
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.
-
Clone Renesas BSP layer and switch to the proper branch:
cd $WORK git clone git://github.com/CogentEmbedded/meta-rcar.git meta-renesas cd meta-rcar git checkout -b tmp 77de0c9726a96659e8da457639fc94901dfb49c7
-
Unzip downloaded proprietary driver modules to $WORK/proprietary folder.
You should see the following files:$ ls -1 $WORK/proprietary R-Car_Gen2_Series_Evaluation_Software_Package_for_Linux-*.tar.gz R-Car_Gen2_Series_Evaluation_Software_Package_of_Linux_Drivers-*.tar.gz
-
Populate meta-renesas with proprietary software packages
mmp packages:
PKGS_DIR=$WORK/proprietary cd $WORK/meta-renesas sh meta-rcar-gen2/docs/sample/copyscript/copy_mm_software_lcb.sh -f $PKGS_DIR
sgx packages:
PKGS_DIR=$WORK/proprietary cd $WORK/meta-renesas sh meta-rcar-gen2/docs/sample/copyscript/copy_gfx_software_wheat.sh -f $PKGS_DIR
-
Setup build environment
cd $WORK source poky/oe-init-build-env
-
Prepare default configuration files:
Without any proprietary packages:
cp $WORK/meta-rcar/meta-rcar-gen2/docs/sample/conf/wheat/bsp/*.conf conf/
With mmp packages:
cp $WORK/meta-rcar/meta-rcar-gen2/docs/sample/conf/wheat/mmp/*.conf conf/
With mmp+sgx packages:
cp $WORK/meta-rcar/meta-rcar-gen2/docs/sample/conf/wheat/sgx/*.conf conf/
-
Start the build
For weston/wayland:bitbake core-image-weston
-
Building image can take up to a few hours depending on your host system performance.
After the build has been completed successfully, 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.
-
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.
- 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:
-
Setup a TFTP server.
Ubuntu
Install tftpd-hpa package along with tftp tools:
sudo apt-get install tftp tftpd-hpa
Fedora
-
Install necessary packages:
sudo yum install tftp-server tftp
tftp-server is a part of xinetd. See Fedora manual for more information.
-
Enable TFTP server:
sudo vi /etc/xinetd.d/tftp
Setdisable = no
Save file and exit. -
Start xinetd:
sudo systemctl start xinetd.service sudo systemctl enable xinetd.service
-
Install necessary packages:
-
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/
-
Verify that TFTP server is working.
tftp localhost -c get uImage+dtb.r8a7792-wheat && ls uImage+dtb.r8a7792-wheat
-
Setup NFS server.
Debian/Ubuntu
-
Install necessary packages:
sudo apt-get install nfs-kernel-server nfs-common
-
Start NFS server:
sudo /etc/init.d/nfs-kernel-server start
Fedora
-
Install necessary packages:
sudo yum install nfs-utils
-
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
-
Install necessary packages:
-
Export root FS to NFS. (Change IMAGE and MACHINE to fit your build).
-
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
-
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.
-
Force NFS server to re-read /etc/exports
sudo exportfs -a
-
Unpack rootfs to a dedicated directory:
-
Verify that NFS is working.
[builduser@buildmachine ~]$ showmount -e localhost Export list for localhost: /nfs/wheat *
- Boot into U-Boot command prompt
-
Configure Ethernet, TFTP, and kernel command line in U-Boot:
setenv ipaddr <board-ip> setenv serverip <your-computer-ip> setenv bootcmd 'tftp 0x40007fc0 uImage+dtb.r8a7792-wheat;bootm 0x40007fc0 ' setenv bootargs 'console=ttySC10,38400 ignore_loglevel rw root=/dev/nfs nfsroot=<your-computer-ip>:<nfs-path>,nfsvers=3 ip=<board-ip>:<your-computer-ip>::255.255.255.0:wheat vmalloc=384M' saveenv
Replace <board-ip> with the proper IP address for the board. Replace <your-computer-ip> with the IP address of your computer, where tftp and nfs servers are installed. Replace <nfs-path> with the exported path of the root FS.
For example:setenv ipaddr 192.168.1.3 setenv serverip 192.168.1.2 setenv bootcmd 'tftp 0x40007fc0 uImage+dtb.r8a7792-wheat; bootm 0x40007fc0' setenv bootargs 'console=ttySC10,38400 ignore_loglevel rw root=/dev/nfs nfsroot=192.168.1.2:/nfs/wheat,nfsvers=3 ip=192.168.1.3:192.168.1.2::255.255.255.0:wheat vmalloc=384M' saveenv
The last command writes the configuration to NOR flash.
=> saveenv Saving Environment to Flash... Un-Protected 2 sectors Erasing Flash... .. done Erased 2 sectors Writing to Flash... 9....8....7....6....5....4....3....2....1....done Protected 2 sectors
You can also use
dhcp
command to obtain information from DHCP server.
Note: You can always see the environment with printenv command. Refer to U-Boot manual for details. -
Verify the connection over Ethernet from U-Boot:
ping <your-computer-ip>
You should see:
=> ping 192.168.1.2 sh_eth Waiting for PHY auto negotiation to complete... done sh_eth: 100Base/Full Using sh_eth device host 192.168.1.2 is alive
-
The board should boot the kernel:
U-Boot 2016.07-rc3-36259-g798dc6b-dirty (Oct 24 2016 - 20:09:57 +0300) CPU: Renesas Electronics R8A7792 rev 1.1 Board: Blanche DRAM: 1 GiB Flash: 64 MiB MMC: sh-sdhi: 0 In: serial_sh Out: serial_sh Err: serial_sh Net: smc911x-0 Hit any key to stop autoboot: 0 smc911x: MAC 00:de:ad:be:af:00 smc911x: detected LAN89218 controller smc911x: phy initialized smc911x: MAC 00:de:ad:be:af:00 Using smc911x-0 device TFTP from server 192.168.1.193; our IP address is 192.168.1.177 Filename 'uImage+dtb.r8a7792-wheat'. Load address: 0x40007fc0 Loading: ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ################################################################# ##################################### 806.6 KiB/s done Bytes transferred = 4182896 (3fd370 hex) smc911x: MAC 00:de:ad:be:af:00 ## Booting kernel from Legacy Image at 40007fc0 ... Image Name: 'Linux-4.6.0-yocto-standard' Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 4182832 Bytes = 4 MiB Load Address: 40008000 Entry Point: 40008000 Verifying Checksum ... OK XIP Kernel Image ... OK Starting kernel ...
Loading kernel and rootfs from microSD card
Both kernel and root FS can be loaded from a microSD card. The approach requires only a console cable. No Ethernet connection is needed.
- Find a reliable microSD card with an adapter to fit your computer. 4 GB should be enough for the task.
-
Plug the SD card into you computer. Locate the proper device for it, typically /dev/mmcblk0. Use
dmesg | tail
to print latest messages if in doubt.
WARNING! Be very careful. Do not select you root partition or any other device with important information. It may be destroyed!
Double-check that device name is correct by mounting and examining it's content. -
Make sure the SD card doesn't contain any important files.
WARNING! Next step may erase the SD card completely. All files my be lost. -
Format the card with one partition with EXT4 file system.
TBD Update this page with a script which formats the card -
Copy root fs to the sd card:
SD=<path-to-your-device-partition> SD_ROOT=/tmp/sd-tool sudo umount "${SD}" sudo mkdir -p "${SD_ROOT}" sudo mount "${SD}" "${SD_ROOT}" sudo rm -rf "${SD_ROOT}"/* sudo cp "${BUILDDIR}/tmp/deploy/images/${MACHINE}/uImage+dtb.r8a7792-wheat" "${SD_ROOT}/boot/" sudo tar -xjf "${BUILDDIR}/tmp/deploy/images/${MACHINE}/core-image-${IMAGE}-${MACHINE}.tar.bz2" -C "${SD_ROOT}" sudo umount "${SD}"
- Insert the SD card into microSD slot on the board.
- Boot the board into U-Boot command prompt. Refer to section Boot into U-Boot command prompt
-
Configure kernel command line in U-Boot:
setenv bootcmd 'ext4load mmc 0:1 0x40007fc0 /boot/uImage+dtb.r8a7792-wheat; bootm 0x40007fc0' setenv bootargs 'console=ttySC0,38400 ignore_loglevel rw rootfstype=ext4 root=/dev/mmcblk0p1 rootwait vmalloc=384M' saveenv
- Reset the board by pushing SW2 "Reset" on Wheat
-
The board should boot the kernel:
U-Boot 2016.07-rc3-36259-g798dc6b-dirty (Oct 24 2016 - 20:09:57 +0300) CPU: Renesas Electronics R8A7792 rev 1.1 Board: Blanche DRAM: 1 GiB Flash: 64 MiB MMC: sh-sdhi: 0 In: serial_sh Out: serial_sh Err: serial_sh Net: smc911x-0 Hit any key to stop autoboot: 0 3534603 bytes read in 498 ms (6.8 MiB/s) ## Booting kernel from Legacy Image at 40007fc0 ... Image Name: 'Linux-4.6.0-yocto-standard' Image Type: ARM Linux Kernel Image (uncompressed) Data Size: 4182832 Bytes = 4 MiB Load Address: 40008000 Entry Point: 40008000 Verifying Checksum ... OK XIP Kernel Image ... OK OK Starting kernel ...
Multiboot
U-Boot allows multiboot configurations. U-Boot can try different boot commands one by one until find the first working command. Use command line interface to configure u-boot. Dual source (MMC and NFS) boot configuration :
setenv mkBootcmdMMC 'setenv bootcmd ext4load mmc 1:0 0x40007fc0 /boot/uImage+dtb.r8a7792-wheat; bootm 0x40007fc0' setenv mkBootargsMMC 'setenv bootargs console=ttySC10,38400 ignore_loglevel rw rootfstype=ext4 root=/dev/mmcblk0p1 rootwait vmalloc=384M' setenv mkBootcmdTFTP 'setenv bootcmd tftp 0x40007fc0 uImage+dtb.r8a7792-wheat; bootm 0x40007fc0' setenv mkBootargsNFS 'setenv bootargs console=ttySC0,38400 ignore_loglevel rw root=/dev/nfs nfsroot=192.168.1.27:/nfs/wheat,nfsvers=3 ip=192.168.1.107:192.168.1.27::255.255.255.0:silk vmalloc=384M' setenv bootMMC 'run mkBootargsMMC; run mkBootcmdMMC; run bootcmd' setenv bootNET 'run mkBootargsNFS; run mkBootcmdTFTP; run bootcmd' setenv bootcmd 'run bootMMC; run bootNET'