VAR-SOM-MX6 Yocto Fido R1: Difference between revisions

From Variscite Wiki
Line 196: Line 196:
|-
|-
| uImage
| uImage
|  
| Linux kernel image
|-
|-
| u-boot
| SPL-nand,u-boot-nand-2014.04-r0.img
| SPL
| SPl and u-boot built for nand
|
|-
| SPL-sd,u-boot-sd-2014.04-r0.img
| SPl and u-boot built for sdcard/eMMC





Revision as of 06:00, 19 August 2015

VAR-SOM-MX6 - Yocto fsl-3.14.38_6qp_beta Fido R1

Introduction

  • Variscite Yocto Fido release version 1.
    • Linux kernel: linux-imx_3.14.38
    • Uboot: imx_v2013.10_var4.
    • QT5 X, QT5 Embedded

Supported hardware and features

Feature
Description
Board support
VAR-DVK-MX6
VAR-SOLOCustomBoard
VAR-SOM-MX6
SOM-SOLO
DART-MX6
CPU

i.MX6 Quad
i.MX6 Dual
i.MX6 Dual lite
i.MX6 Solo

Software platform

Yocto Daisy release.
Freescale release version 4.1
Meta freescale community release for Daisy

Nand Recovery
Version 43
NAND Flash size support
128MB up to 1GB
eMMC
up to 64GB
DDR size support configuration
Solo:up to 1GB. DualLite, Dual, Quad: up to 4GB
SD-Card
+
Ethernet
10/100/1000 Mbps Ethernet
WLAN
Support for Wilink8, Dual band 5.0ghz + MIMO b/g/n
Bluetooth
4.0
CAN bus
+
I2C
+
SPI
+
USB host
+
USB OTG
Device / Host
Uarts
x3, up to 3.6 Mbps. Minicom avilable to use with the port
RTC
+
Display HDMI 720P,1080P LVDS0 (On board LVDS to RGB bridge, EVK supports 800x480 resolution) LVDS1 external display
Audio Line IN/ Line out
Camera ov5640 camera sensor. CB402 board can be purchased separately
SATA +

Variscite Yocto Fido release V1 for Freescale i.MX6.

Installing required packages

Follow the link below and install all required packages on your machine.

www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html

For example, if your building machine is an Ubuntu machine:

sudo apt-get install gawk wget git-core diffstat unzip texinfo build-essential chrpath libsdl1.2-dev xterm lzop lib32ncurses5-dev

Variscite Yocto build was tested with Ubuntu 12.04 LTS only!

Create a Github account and an SSH public key

Create a www.github.com account

NOTE:
Contact support@variscite.com and provide your Github account ID. We will add you to the approved users' list.

Follow ssh generation instructions.
It will allow all authentication process to be automatic in the yocto build using Variscite's GITs
https://help.github.com/articles/generating-ssh-keys/

Download Yocto Fido for i.MX6 Freescale source

$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ 
$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
$ 
$ mkdir ~/var-som-mx6-yocto-fido
$ cd ~/var-som-mx6-yocto-fido
$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.14.38-6QP_beta
$ repo sync

Download Yocto Fido i.MX6 with Meta Variscite VAR-SOM-MX6 support

$ cd ~/var-som-mx6-yocto-fido/sources
$ git clone https://github.com/varigit/meta-variscite-mx6/
$ cd meta-variscite-mx6/
$ git checkout -b imx_3.14.38_6qp_beta-var01 remotes/origin/imx_3.14.38_6qp_beta-var01
$ cp scripts/var-setup-release.sh ../../

Setup and build Yocto QT5/X

Setup the environment and use build_var folder
Note: Run only once!

$ cd ~/var-som-mx6-yocto-fido
$ source var-setup-release.sh -b build_x11 -e x11
Comment:
If you close your terminal and wish to build Yocto again, you should run (instead of var-setup-release.sh):

$ cd ~/var-som-mx6-yocto-fido

$ . ./setup-environment build_x11
NOTE:
If you don't need Chromium browser edit conf/local.conf and comment out the chromium line.

Setup and build Yocto QT5/Embedded

Setup the environment and use build_var folder
Note: Run only once!

$ cd ~/var-som-mx6-yocto-fido

$ source var-setup-release.sh -b build_fb -e fb
Comment:
If you close your terminal and wish to build Yocto again, you should do:

$ cd ~/var-som-mx6-yocto-fido

$ . ./setup-environment build_fb

local.conf customizations

Edit you local.conf file:

$ gedit conf/local.conf 

Change parallel build and download directory: Set the build parameters to fully utilize your host machine's resources
BB_NUMBER_THREADS = '4'
PARALLEL_MAKE = '-j 6'
BB_NUMBER_THREADS should be your host machine's number of threads minus 2 or same. PARALLEL_MAKE should be the number of threads your host machine has plus two.

Change packages download directory. By default it is set to: DL_DIR ?= "${BSPDIR}/downloads/" change it to a global folder like DL_DIR ?= "/opt/yocto_dl/". Don't forget to create the folder and make it available without a sudo permissions.

Build your image

Due to NAND flash size limitation on Variscite's default EVK (512MB), we have created a "QT5-minimal" image. which is similar to Freescale's QT5 image, but QT demos removed

$ bitbake fsl-image-qt5-minimal 

You can also build

$ bitbake fsl-image-qt5 

The last one will build without the ubifs product.

Build Results

The resulted images are locaated in tmp/deploy/images/var-som-mx6.
Looking at tmp/deploy/images/var-som-mx6 you will find 6 main files that are linked to the actual file

Image Name
How to use
fsl-image-qt5-minimal-var-som-mx6.ext3
Not in Use
fsl-image-qt5-minimal-var-som-mx6.sdcard This image is for SD-Card boot. Default u-boot is built for SDCARD. Booting from SD-Card is explained in details below. See section 8.1 below for the sdcard structure.
fsl-image-qt5-minimal-var-som-mx6.tar.bz2 Used to create an NFS root file system on the host. See apendix for setting an NFS server
fsl-image-qt5-minimal-var-som-mx6.ubi Use the sdcard created above. Copy the file into it and use the following commands to flash them into nand.
Coping files (mount the sd-card created above first):
uImage Linux kernel image
SPL-nand,u-boot-nand-2014.04-r0.img SPl and u-boot built for nand
SPL-sd,u-boot-sd-2014.04-r0.img SPl and u-boot built for sdcard/eMMC


SDCARD structure

Sdcard part.png
The SDCARD is devided into 3 sections as shown in the picture above.
The first unallocated 4MB are saved space for SPL and u-boot.img. it can be replaced with a dd command described in u-boot out of tree section below.
The second partition is a fat16 partition used for the device tree files and Linux uImage file. You can copy them as described in the Linux out of tree section.
The third partition is an ext3 partition that contain the complete file system and modules. Modules can be replaced as described in the Linux out of tree section.

QT5/Embedded environment variables

The QT5/Embedded require environment variables to run correctly. You need to have them avilable on the target. For example /etc/profile.d/tslib.sh can be edited.

export TSLIB_TSDEVICE=/dev/input/touchscreen0
export TSLIB_CALIBFILE=/etc/pointercal
export TSLIB_CONFFILE=/etc/ts.conf
export QT_QPA_GENERIC_PLUGINS=tslib:/dev/input/event0
export QT_QPA_EGLFS_PHYSICAL_HEIGHT=480
export QT_QPA_EGLFS_PHYSICAL_WIDTH=800
export QT_QPA_EGLFS_HEIGHT=480
export QT_QPA_EGLFS_WIDTH=800
export QT_EGLFS_IMX6_NO_FB_MULTI_BUFFER=1
export QT_QPA_EGLFS_DEPTH=24
export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x480:mmSize=800x480

UBIFS

By default we create ubifs image for 0.5GB nand size. You can change the size by editing ~/variscite-yocto-manifest/sources/meta-variscite/conf/machine/var-som-mx6.conf
and change "include conf/machine/include/var-512MB-ubi.inc" into one of:

  • "include conf/machine/include/var-512MB-ubi.inc"
  • "include conf/machine/include/var-128MB-ubi.inc"
  • "include conf/machine/include/var-256MB-ubi.inc"


Anther option is to create the ubifs image manualy. 4GB nand example:

$ cd ~/variscite-yocto-manifest
$ sudo mkdir rootfs
$ sudo tar xvf build_var/tmp/deploy/images/var-som-mx6/fsl-image-qt5-var-som-mx6.tar.bz2 -C rootfs/
$ sudo mkfs.ubifs -r rootfs/ -o fsl-image-qt5-var-som-mx6q4.ubifs -m 4096 -e 504KiB -c 7835
$ ubinize -o fsl-image-qt5-var-som-mx6q4.ubi -m 4096 -p 512KiB -s 4096 -O 4096 ubinize.cfg
$ cat ubinize.cfg 
[ubifs]
mode=ubi
image=fsl-image-qt5-var-som-mx6.ubifs
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize

DDR size and Contiguous Memory Allocator

By default Freescale allocates 256MB of RAM to the Contiguous Memory allocator. This is for proper operation of the IPU VPU, X11 etc. On VAR-SOM-SOLO with 256MB DDR RAM size, it will cause a kernel freeze during boot. Adding cma=32MB to the bootargs parameters is required to fix.

Next steps

In sections 1-6 we explained how to build Yocto for VAR-SOM-MX6. We explained the results for nand (UBI) and for sd-card. At this point you should have a bootable sd-card with UBI images on it. You should be able to boot from the sd-card using the boot select button and flash the nand. Next steps:

  • Build and deploy the compiler and tools.
  • Fetch u-boot and compile it out of Yocto tools.
  • Fetch Linux kernel and compile it out of Yocto tools.

Toolchain installation for out of Yocto builds

Build the toolchain by:

$ bitbake meta-ide-support
$ bitbake meta-toolchain

The output will be located at tmp/deploy/sdk/. On a 64 bit Ubuntu you will get:

sdk/poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.8.sh

Install the tools by running:

$ tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.8.sh

Reply to all defaults 'y'
The toolchain name depend on your build machine and may change.

Build U-Boot out of Yocto tree

Note:
This is a single u-boot image that supports all VAR-SOM-MX6 SOM's.

Obtain sources:

$ cd ~/var-som-mx6-yocto-fido
$ git clone https://github.com/varigit/uboot-imx
$ cd uboot-imx/
  • follow above procedure for installing the toolchain

Build u-boot:

$ export PATH=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH
clean tree:
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- mrproper
Choose build for SD-Card or NAND Flash:
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-  mx6var_som_sd_config
or
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-  mx6var_som_nand_config
Build U-BOOT:
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-

Flash u-boot to the sd-card:

$ sudo dd if=SPL of=/dev/sdxxx bs=1K seek=1; sync
$ sudo dd if=u-boot.img of=/dev/sdxxx bs=1K seek=69; sync

In case of UBI copy it to the sd-card:

$ sudo cp SPL /media/rootfs/opt/images
$ sudo cp u-boot.img /media/rootfs/opt/images

refer to "fsl-image-qt5-var-som-mx6.ubi" section above for flashing images from SD-Card into NAND-flash
Eject SD-Card gracefully from host machine

Build Linux out of Yocto tree

Get sources:

$ cd ~/variscite-yocto-manifest/
$ git clone https://github.com/varigit/linux-2.6-imx.git
$ cd linux-2.6-imx/
$ git checkout -b imx_3.14.38_6qp_beta-var01 remotes/origin/imx_3.14.38_6qp_beta-var01

Build the Linux kernel:

$ export PATH=/opt/poky/1.8/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- mrproper
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx_v7_var_defconfig
$ make -j6 LOADADDR=0x10008000 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- uImage
$ make -j6 LOADADDR=0x10008000 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules
Build all device tree:
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- dtbs
Build device tree for a specific device
Build the device tree for Dualite/Solo
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6dl-var-som.dtb
Build the device tree for Quad/Dual
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6q-var-som.dtb
Build the device tree for VAR-SOM-SOLO
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6dl-var-som-solo.dtb
Build the device tree for VAR-SOM-SOLO on VAR-SOLOCustomBoard
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6dl-var-som-solo-vsc.dtb  
Build the device tree for DART-MX6
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6q-var-dart.dtb



Copy the uImage and device tree to the sd-card boot partition or to the opt/image in order to be flashed to the nand. Copy modules to the sd-card

$ sudo make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules_install INSTALL_MOD_PATH=/media/rootfs/
$ cp arch/arm/boot/uImage /media/BOT_varsomi
$ cp arch/arm/boot/dts/*var*.dtb /media/BOT_varsomi

Useful Bitbake commands

Bitbake Cheat Sheet

Useful bitbake commands

i.MX Yocto Project: ltib versus bitbake