VAR-SOM-MX6 Yocto GS R5 B2: Difference between revisions

From Variscite Wiki
 
(71 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{PageHeader|VAR-SOM-MX6 - Yocto fsl-L3.10.17_1.0.0 Dora R5 Beta2}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__
{{PageHeader|VAR-SOM-MX6 - Yocto fsl-L3.10.17_1.0.0 Dora R5}} {{DocImage|category1=VAR-SOM-MX6|category2=Yocto}} __toc__
 
[[File:Const.jpg]]


= Introduction =
= Introduction =
Line 35: Line 33:
|-
|-
| Nand Recovery
| Nand Recovery
|  
| NAND-recovery SD V30 - can be downloaded from FTP
|-
|-
| NAND Flash size support<br/>
| NAND Flash size support<br/>
| 0.5,1.0,2.0,4.0 GB<br/>
| 128MB-1GB<br/>
|-
| eMMC<br/>
| up to 64GB<br/>
|-
|-
| DDR size support configuration<br/>
| DDR size support configuration<br/>
| Solo:0.5,1.0 GB DualLite: 1.0GB Dual: 0.5,1.0GB Quad: 1.0,2.0 GB<br/>
| Solo: up to 512MB. DualLite/Dual/Quad: up to 4GB<br/>
|-
|-
| SD-Card<br/>
| SD-Card<br/>
Line 50: Line 51:
|-
|-
| WLAN <br/>
| WLAN <br/>
| 802.11 b/g/n<br/>
| Support for Wilink8, Dual band 5.0ghz + MIMO b/g/n<br/>
|-
|-
| Bluetooth<br/>
| Bluetooth<br/>
Line 68: Line 69:
|-
|-
| USB OTG<br/>
| USB OTG<br/>
| Device only. Host will be supported on next release<br/>
| Device / Host<br/>
|-
|-
| Uarts<br/>
| Uarts<br/>
Line 98: Line 99:


For example, if your building machine is an Ubuntu machine:
For example, if your building machine is an Ubuntu machine:
<pre>sudo apt-get install gawk wget git-core diffstat unzip texinfo build-essential chrpath libsdl1.2-dev xterm</pre>
<pre>sudo apt-get install gawk wget git-core diffstat unzip texinfo build-essential chrpath libsdl1.2-dev xterm lzop</pre>
Variscite Yocto build is tested with Ubuntu 12.04 lts.
Variscite Yocto build is tested with Ubuntu 12.04 lts.


= Get Yocto Dora for i.MX6 with Variscite VAR-SOM-MX6 support =
= Download Yocto Dora for i.MX6 with Variscite VAR-SOM-MX6 support =


Use &nbsp;"repo" to fetch Yocto and apply Variscite's patches for the BSP support.
Use &nbsp;"repo" to fetch Yocto and apply Variscite's patches for the BSP support:


Install the `repo` utility:
* Install the `repo` utility:
<pre>$ mkdir ~/bin (this step may not be needed if the bin folder already exists)
<pre>$ 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
$ curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
Line 111: Line 112:
Add the following line to the .bashrc file to ensure that the ~/bin folder is in your PATH variable
Add the following line to the .bashrc file to ensure that the ~/bin folder is in your PATH variable
$ export PATH=~/bin:$PATH</pre>
$ export PATH=~/bin:$PATH</pre>
{{note| NOTE:<br>we uploaded as a reference the repo we used.|info}}
{{note| NOTE:<br>Reference repo is available on FTP.|info}}


Clone Yocto Dora from github.
* Clone Yocto Dora from Freescale's git:
<pre>$ cd ~
<pre>$ cd ~
$ mkdir var-som-mx6-dora-v5
$ mkdir var-som-mx6-dora-v5
Line 119: Line 120:
$ git config --global user.name "Your Name"
$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ git config --global user.email "Your Email"
$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.10.17-1.0.0_ga
$ repo init -u https://source.codeaurora.org/external/imx/fsl-arm-yocto-bsp.git -b imx-3.10.17-1.0.0_ga
$ repo sync
$ repo sync
</pre>
</pre>
Download var_yocto_v5b2.tar.bz2 from Variscite's FTP.
* Download ftp.variscite.com/VAR-SOM-MX6/Software/Linux/Yocto/Release5/var_yocto_v5r4.tar.bz2 <br>
<pre>$ tar xvf var_yocto_v5b2.tar.bz2
* Extract tarball:
<pre>$ cd ~/var-som-mx6-dora-v5
$ tar xvf ~/Downloads/var_yocto_v5r4.tar.bz2
$ variscite/install</pre>
$ variscite/install</pre>
{{note|Comment:<br/>This method will preserve the git repositories. It will enable you to track Variscite's changes, and your own.|info}}
{{note|Comment:<br/>This method will preserve the git repositories. It will enable you to track Variscite's changes, and your own.|info}}
Line 132: Line 135:
<pre>$ . ./setup-environment build_var
<pre>$ . ./setup-environment build_var
</pre>
</pre>
{{note|Comment:<br/>If you close your terminal and wishto build Yocto again, you should change directory to ~/var-som-mx6-dora-v3 and run the above command again. build_var is your build directory and all bitbake commands should run from it|info}}
{{note|Comment:<br/>If you close your terminal and wish to build Yocto again, you should change directory to ~/var-som-mx6-dora-v5 and run the above command again. build_var is your build directory and all bitbake commands should run from it|info}}


== local.conf customizations<br/> ==
'''local.conf customizations'''


Edit you local.conf file:
Edit you local.conf file:
<pre>$ gedit conf/local.conf  
<pre>$ gedit conf/local.conf  
</pre>
</pre>
Change your SOM version, parallel build and download directory:
Change parallel build and download directory:
Set the build parameters to fully utilize your host machine's resources <br>
BB_NUMBER_THREADS = '4'<br/>
PARALLEL_MAKE = '-j 6' <br>
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. <br>


=== Parallel build<br/> ===
Change packages download directory:
 
By defualt the path is set to "/opt/yocto_dl". Change ownership settings:
Set the build parameters to fully utilize your host machine BB_NUMBER_THREADS = '4'<br/>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.
<pre>$ sudo mkdir /opt/yocto_dl
 
$ sudo chown <uname>.<uname> /opt/yocto_dl
=== Download directory. ===
</pre>
 
Recommended to save download time and space. DL_DIR = "/home/&lt;uname&gt;/yocto_dl"


= Build your image =
= Build your image =
Line 168: Line 173:
|}
|}


The resulted images are locaated in tmp/deploy/images/varsomimx6q.<br/>Looking at tmp/deploy/images/varsomimx6 you will find 6 main files that are linked to the actual file<br/>
The resulted images are locaated in tmp/deploy/images/varsomimx6.<br/>Looking at tmp/deploy/images/varsomimx6 you will find 6 main files that are linked to the actual file<br/>


{| class="wikitable"
{| class="wikitable"
Line 180: Line 185:
| var-image-x11-varsomimx6.sdcard
| var-image-x11-varsomimx6.sdcard
|  
|  
Flash into SD-card and use boot select to boot from.
This image is for SD-Card boot. However, since default u-boot is built for NAND flash, follow the following procedure to replace with SD-Card U-boot.
<pre>$ sudo dd if=tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.sdcard of=/dev/devxxx bs=1024k
Booting from SD-Card is explained in details below.
<pre>$ sudo dd if=tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.sdcard of=/dev/sdX bs=1024k
</pre>
</pre>
Build u-boot out of tree for mmc as explained below and
Build u-boot out of tree for mmc as explained below and
<pre>$ sudo dd if=SPL of=/dev/sdf bs=1K seek=1; sync
<pre>$ sudo dd if=SPL of=/dev/sdX bs=1K seek=1; sync
$ sudo dd if=u-boot.img of=/dev/sdf bs=1K seek=69; sync
$ sudo dd if=u-boot.img of=/dev/sdX bs=1K seek=69; sync
</pre>
</pre>
devxxx = mmcblk0 or sdX. Do dmesg after you insert an SD-Card into your build system to figure out the device name<br/>{{note|Comment:<br/>Use "$ sudo gparted /dev/devxxx"
devxxx = mmcblk0 or sdX. Do dmesg after you insert an SD-Card into your build system to figure out the device name<br/>{{note|Comment:<br/>Use "$ sudo gparted /dev/devxxx"
Line 209: Line 215:
$ sudo cp tmp/deploy/images/varsomimx6/SPL /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/SPL /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/uImage    /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/uImage    /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6q-var-som-ldo.dtb /media/rootfs/opt/images/imx6q-var-som-ldo.dtb
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6q-var-som.dtb /media/rootfs/opt/images/imx6q-var-som.dtb
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6q-var-som.dtb /media/rootfs/opt/images/imx6q-var-som.dtb
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6sl-var-som.dtb /media/rootfs/opt/images/imx6sl-var-som.dtb
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6dl-var-som.dtb /media/rootfs/opt/images/imx6dl-var-som.dtb
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6dl-var-som.dtb /media/rootfs/opt/images/imx6dl-var-som.dtb
$ sudo cp tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.ubi /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.ubi /media/rootfs/opt/images
Line 223: Line 227:
$ nandwrite -p /dev/mtd1 /opt/images/u-boot.img  
$ nandwrite -p /dev/mtd1 /opt/images/u-boot.img  
Select one of:
Select one of:
i.MX6Q
i.MX6Q / i.MX6D
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6q-var-som.dtb  
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6q-var-som.dtb  
i.MX6Q 1.2GHz
i.MX6DualLite / i.MX6 Solo
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6q-var-som-ldo.dtb
i.MX6DualLite
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6dl-var-som.dtb  
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6dl-var-som.dtb  
i.MX6Solo
 
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6sl-var-som.dtb
 
Linux kernel:
Linux kernel:
$ flash_eraseall /dev/mtd2
$ flash_eraseall /dev/mtd2
Line 249: Line 251:
|}
|}


= Next steps <br/> =
= UBIFS =
 
By default we create ubifs image for 0.5GB nand size.
You can change the size by editing ~/var-som-mx6-dora-v5/sources/meta-variscite/conf/machine/varsomimx6.conf <br>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-1gb-ubi.inc"
* "include conf/machine/include/var-2gb-ubi.inc"
* "include conf/machine/include/var-4gb-ubi.inc"
 
Anther option is to create the ubifs image manualy. 4GB nand example:
<pre>$ cd ~/var-som-mx6-dora-v5
$ sudo mkdir rootfs
$ sudo tar xvf build_var/tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.tar.bz2 -C rootfs/
$ sudo mkfs.ubifs -r rootfs/ -o var-image-x11-varsomimx6q4.ubifs -m 4096 -e 504KiB -c 7835
$ ubinize -o var-image-x11-varsomimx6q4.ubi -m 4096 -p 512KiB -s 4096 -O 4096 ubinize.cfg
</pre>
<pre>$ cat ubinize.cfg
[ubifs]
mode=ubi
image=var-image-x11-varsomimx6q4.ubifs
vol_id=0
vol_type=dynamic
vol_name=rootfs
vol_flags=autoresize
</pre>
 
= 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.
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.
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:
Next steps:<br>
* Build and deploy the compiler and tools.
* Build and deploy the compiler and tools.
* Fetch u-boot and compile it out of Yocto tools.
* Fetch u-boot and compile it out of Yocto tools.
* Fetch Linux kernel and compile it out of Yocto tools.
* Fetch Linux kernel and compile it out of Yocto tools.


= Toolchain =
= Toolchain installation for out of Yocto builds=


Build the toolchain by:
Build the toolchain by:
Line 269: Line 298:
Install the tools by running:
Install the tools by running:
<pre>$ tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.5.1.sh</pre>
<pre>$ tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.5.1.sh</pre>
Reply to all defaults 'y'<br>
The toolchain name depend on your build machine and may change.
The toolchain name depend on your build machine and may change.


= Build U-Boot out of Yocto tree<br/> =
= Build U-Boot out of Yocto tree =


Get sources:  
{{note|Note:<br/>This is a single u-boot image that supports all VAR-SOM-MX6 SOM's.|info}}
Obtain sources:  
<pre>$ cd ~/var-som-mx6-dora-v5
<pre>$ cd ~/var-som-mx6-dora-v5
$ git clone git://github.com/varigit/uboot-imx
$ git clone git://github.com/varigit/uboot-imx
{{note|Note:<br/>This is a single u-boot image that support in binary all VAR-SOM-MX6 SOM's.|info}}
$ cd uboot-imx/
$ cd uboot-imx/
$ git checkout -b imx_v2013.10_beta_var3 remotes/origin/imx_v2013.10_beta_var3
$ git checkout -b imx_v2013.10_beta_var4 remotes/origin/imx_v2013.10_beta_var4
</pre>  
</pre>  
* follow above procedure for installing the toolchain
Build u-boot:  
Build u-boot:  
<pre>$ export PATH=/opt/poky/1.5.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH
<pre>$ export PATH=/opt/poky/1.5.1/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
$ 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
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-  mx6var_som_sd_config
or
or
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-  mx6var_som_nand_config
$ 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-
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi-
</pre>  
</pre>  
Flash u-boot to the sd-card:  
Flash u-boot to the sd-card:  
<pre>$
<pre>$ sudo dd if=SPL of=/dev/sdxxx bs=1K seek=1; sync
$ 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
$ sudo dd if=u-boot.img of=/dev/sdxxx bs=1K seek=69; sync
</pre>
</pre>
In case of UBI copy it to the sd-card:  
In case of UBI copy it to the sd-card:  
<pre>$ sudo cp SPL/media/rootfs/opt/images
<pre>$ sudo cp SPL /media/rootfs/opt/images
$ sudo cp u-boot.img /media/rootfs/opt/images
$ sudo cp u-boot.img /media/rootfs/opt/images
</pre>
</pre>
Un mount the sdcard.
<br>
Eject SD-Card gracefully from host machine
<pre>$ sudo umount /dev/sdxxx
</pre>
{{note|Comment:<br/>Replace /dev/sdxxx with the actual device name. Use dmesq to find the right one.|info}}


= Build Linux out of Yocto tree<br/> =
= Build Linux out of Yocto tree =
Get sources:  
Get sources:  
<pre>$ cd ~/var-som-mx6-dora-v5/
<pre>$ cd ~/var-som-mx6-dora-v5/
$ git clone git://github.com/varigit/linux-2.6-imx.git
$ git clone git://github.com/varigit/linux-2.6-imx.git
$ cd linux-2.6-imx/
$ cd linux-2.6-imx/
$ git checkout -b imx_3.10.17_1.0.0_ga_beta_var2 remotes/origin/imx_3.10.17_1.0.0_ga_beta_var2
$ git checkout -b imx_3.10.17_1.0.0_ga_var3 remotes/origin/imx_3.10.17_1.0.0_ga_var3
</pre>  
</pre>  
Build the Linux kernel:
Build the Linux kernel:
<pre>$ export PATH=/opt/poky/1.5.1/sysroots/x86_64-pokysdk-linux/usr/bin:/opt/poky/1.5.1/sysroots/x86_64-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi:$PATH
<pre>$ export PATH=/opt/poky/1.5.1/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- mrproper
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx_v7_var_defconfig
$ make ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx_v7_var_defconfig
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- uImage
$ make -j6 LOADADDR=0x10008000 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- uImage
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules
$ make -j6 LOADADDR=0x10008000 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- modules
Build the device tree
Build the device tree for Dualite/Solo
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6dl-var-som.dtb
$ 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
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6q-var-som.dtb
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6q-var-som-ldo.dtb
 
$ make -j6 ARCH=arm CROSS_COMPILE=arm-poky-linux-gnueabi- imx6sl-var-som.dtb
</pre>
</pre>
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 the uImage and device tree to the sd-card boot partition or to the opt/image in order to be flashed to the nand.

Latest revision as of 14:30, 15 December 2020

VAR-SOM-MX6 - Yocto fsl-L3.10.17_1.0.0 Dora R5

Introduction

  • This Yocto Dora release is based on Freescale fsl-L3.10.17_1.0.0GA release.
  • This is the second beta version. Major features added:
    • New SPL based u-boot. This single image support in binary format all SOM versions.
    • New external Wlink6/Wilink8 drivers.
    • Support for on SOM eMMC
  • Linux kernel: linux-imx_3.10.17_1.0.0_ga.
  • Uboot: imx_v2013.10_beta_var3.
  • Yocto Dora: Based on fsl-L3.10.17_1.0.0_iMX6qdls Freescale release (previous versions were based on the community release). Yocto Dora was re-structured as most of Variscite support code is located in meta-variscite folder.

Supported hardware and features

Feature
Description
Board support
VAR-DVK-MX6,VAR-SOM-MX6
CPU

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

Software platform

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

Nand Recovery NAND-recovery SD V30 - can be downloaded from FTP
NAND Flash size support
128MB-1GB
eMMC
up to 64GB
DDR size support configuration
Solo: up to 512MB. 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 Dora release 2 for Freescale i.MX6 version 4.1.

Installing required packages

Follow the link below and install all the 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

Variscite Yocto build is tested with Ubuntu 12.04 lts.

Download Yocto Dora for i.MX6 with Variscite VAR-SOM-MX6 support

Use  "repo" to fetch Yocto and apply Variscite's patches for the BSP support:

  • Install the `repo` utility:
$ 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
Add the following line to the .bashrc file to ensure that the ~/bin folder is in your PATH variable
$ export PATH=~/bin:$PATH
NOTE:
Reference repo is available on FTP.
  • Clone Yocto Dora from Freescale's git:
$ cd ~
$ mkdir var-som-mx6-dora-v5
$ cd var-som-mx6-dora-v5
$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"
$ repo init -u https://source.codeaurora.org/external/imx/fsl-arm-yocto-bsp.git -b imx-3.10.17-1.0.0_ga
$ repo sync
  • Download ftp.variscite.com/VAR-SOM-MX6/Software/Linux/Yocto/Release5/var_yocto_v5r4.tar.bz2
  • Extract tarball:
$ cd ~/var-som-mx6-dora-v5
$ tar xvf ~/Downloads/var_yocto_v5r4.tar.bz2
$ variscite/install
Comment:
This method will preserve the git repositories. It will enable you to track Variscite's changes, and your own.

Setup and Customize your Yocto build

Setup the environment and use build_var folder

$ . ./setup-environment build_var
Comment:
If you close your terminal and wish to build Yocto again, you should change directory to ~/var-som-mx6-dora-v5 and run the above command again. build_var is your build directory and all bitbake commands should run from it

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 defualt the path is set to "/opt/yocto_dl". Change ownership settings:

$ sudo mkdir /opt/yocto_dl
$ sudo chown <uname>.<uname> /opt/yocto_dl

Build your image

$ bitbake var-image-x11 

Other image build options:

image name
description
core-image-base
A console-only image that fully supports the target device hardware.
var-image-test
Image contains core-image-base plus Freescale test applications and multimedia components.
var-image-x11
Image contains core-image-sato with Freescale test applications and multimedia with hardware accelerated X11

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

Image Name
How to use
var-image-x11-varsomimx6.ext3
Not in Use
var-image-x11-varsomimx6.sdcard

This image is for SD-Card boot. However, since default u-boot is built for NAND flash, follow the following procedure to replace with SD-Card U-boot. Booting from SD-Card is explained in details below.

$ sudo dd if=tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.sdcard of=/dev/sdX bs=1024k

Build u-boot out of tree for mmc as explained below and

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

devxxx = mmcblk0 or sdX. Do dmesg after you insert an SD-Card into your build system to figure out the device name

Comment:
Use "$ sudo gparted /dev/devxxx"
  • Lable the second partition and call it "rootfs".
  • Increase the second partition to include all avilable sd-card space.
var-image-x11-varsomimx6.tar.bz2

Used to create an NFS root file system on the host.

$ sudo mkdir ../rootfs
$ sudo rm -rf ../rootfs/*
$ sudo tar xvf tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.tar.bz2 -C ../rootfs

See apendix for setting an NFS server

var-image-x11-varsomimx6.ubi

Use the sdcard created above. Copy the file into it and use the folwing commands to flash them into nand.
Coping files (mount the sd-card created above first):

$ sudo mkdir /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/u-boot.img /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/SPL /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/uImage     /media/rootfs/opt/images
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6q-var-som.dtb /media/rootfs/opt/images/imx6q-var-som.dtb
$ sudo cp tmp/deploy/images/varsomimx6/uImage-imx6dl-var-som.dtb /media/rootfs/opt/images/imx6dl-var-som.dtb
$ sudo cp tmp/deploy/images/varsomimx6/var-image-x11-varsomimx6.ubi /media/rootfs/opt/images
$ sudo umount /media/rootfs
$ sudo umount /media/BOT_varsomi

Flashing on target:

$ flash_eraseall /dev/mtd0
$ kobs-ng init -x /opt/images/SPL  --search_exponent=1 -v
$ flash_eraseall /dev/mtd1
$ nandwrite -p /dev/mtd1 /opt/images/u-boot.img 
Select one of:
i.MX6Q / i.MX6D
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6q-var-som.dtb 
i.MX6DualLite / i.MX6 Solo
$ nandwrite -p /dev/mtd1 -s 0x1e0000 /opt/images/imx6dl-var-som.dtb 


Linux kernel:
$ flash_eraseall /dev/mtd2
$ nandwrite -p /dev/mtd2 /opt/images/uImage
UBIFS:
$ flash_eraseall /dev/mtd3
$ ubiformat /dev/mtd3 -f /opt/images/var-image-x11-varsomimx6.ubi -s 2048 -O 2048
uImage
u-boot SPL


UBIFS

By default we create ubifs image for 0.5GB nand size. You can change the size by editing ~/var-som-mx6-dora-v5/sources/meta-variscite/conf/machine/varsomimx6.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-1gb-ubi.inc"
  • "include conf/machine/include/var-2gb-ubi.inc"
  • "include conf/machine/include/var-4gb-ubi.inc"

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

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

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:

poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.5.sh.

Install the tools by running:

$ tmp/deploy/sdk/poky-eglibc-x86_64-meta-toolchain-cortexa9hf-vfp-neon-toolchain-1.5.1.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-dora-v5
$ git clone git://github.com/varigit/uboot-imx
$ cd uboot-imx/
$ git checkout -b imx_v2013.10_beta_var4 remotes/origin/imx_v2013.10_beta_var4
  • follow above procedure for installing the toolchain

Build u-boot:

$ export PATH=/opt/poky/1.5.1/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


Eject SD-Card gracefully from host machine

Build Linux out of Yocto tree

Get sources:

$ cd ~/var-som-mx6-dora-v5/
$ git clone git://github.com/varigit/linux-2.6-imx.git
$ cd linux-2.6-imx/
$ git checkout -b imx_3.10.17_1.0.0_ga_var3 remotes/origin/imx_3.10.17_1.0.0_ga_var3

Build the Linux kernel:

$ export PATH=/opt/poky/1.5.1/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 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

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/

Useful Bitbake commands

Bitbake Cheat Sheet

Useful bitbake commands

i.MX Yocto Project: ltib versus bitbake