DART-6UL Yocto Fido R2 Build Yocto release: Difference between revisions

From Variscite Wiki
 
(19 intermediate revisions by 2 users not shown)
Line 6: Line 6:
[http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html]
[http://www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html www.yoctoproject.org/docs/latest/yocto-project-qs/yocto-project-qs.html]


For example, if your building machine is an Ubuntu machine:
Please make sure you host PC is running Ubuntu 14.04 and install the following packages:
<pre>sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm lib32ncurses5-dev</pre>
<pre>
Variscite Yocto build was tested with Ubuntu 12.04 LTS and  Ubuntu 14.04 LTS only!
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev
sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev
sudo apt-get install python-git xterm sed cvs subversion coreutils texi2html
sudo apt-get install docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev mercurial automake groff curl lzop asciidoc u-boot-tools mtd-utils
</pre>


= Documentation =
= Documentation =
Documentation are available for Download from [ftp://ftp.variscite.com/DART-6UL/Software/Linux/Yocto/Fido1.8-52/fsl-yocto-L3.14.52_1.1.0-ga.tar.gz YoctoFslFidoDocumentation]
Documentation are available for Download from [ftp://customerv:Variscite1@ftp.variscite.com/DART-6UL/Software/Linux/Yocto/Fido1.8-52/fsl-yocto-L3.14.52_1.1.0-ga.tar.gz YoctoFslFidoDocumentation]
 
{{note| NOTE:<br/>Variscite provides a scripts that automatically performs step 3-5.3
if you system fails to build using this script, probably something is wrong with your enviroment, such as packages installation..etc<br>
Example scripts 6ul_build_x11.sh and 6ul_build_qt5.sh can be found here :ftp://customerv:Variscite1@ftp.variscite.com/DART-6UL/Software/Yocto_docs/Fido1.8-52
 
|info}}


= Download Yocto Fido for i.MX6UL Freescale source =
= Download Yocto Fido for i.MX6UL Freescale source =
Line 24: Line 35:
$ mkdir ~/var-dart-6ul-yocto-fido
$ mkdir ~/var-dart-6ul-yocto-fido
$ cd ~/var-dart-6ul-yocto-fido
$ cd ~/var-dart-6ul-yocto-fido
$ repo init -u git://git.freescale.com/imx/fsl-arm-yocto-bsp.git -b imx-3.14.52-1.1.0_ga
$ repo init -u https://source.codeaurora.org/external/imx/fsl-arm-yocto-bsp.git -b imx-3.14.52-1.1.0_ga
$ repo sync
$ repo sync
</pre>
</pre>


= Download Yocto Fido i.MX6UL with Meta Variscite DART-6UL support =
= Download Yocto Fido i.MX6UL with Meta Variscite DART-6UL support =
<pre>$ cd ~/var-dart-6ul-yocto-fido/sources
<pre>
$ git clone https://github.com/varigit/meta-variscite-6ul/
$ cd ~/var-dart-6ul-yocto-fido/sources
$ cd meta-variscite-6ul/
$ git clone https://github.com/varigit/meta-variscite-mx6ul-mx7.git -b imx_3.14.52_6ul_ga-var01
$ git checkout -b imx_3.14.52_6ul_ga-var01 remotes/origin/imx_3.14.52_6ul_ga-var01
$ cp meta-variscite-mx6ul-mx7/scripts/var-setup-release.sh ../
$ cp scripts/var-setup-release.sh ../../
$ cd ../meta-fsl-bsp-release/
$ patch -p1 < ../meta-variscite-6ul/scripts/0001-Update-u-boot-prefferd-provider.patch
$ patch -p1 < ../meta-variscite-6ul/scripts/0001-use-older-kobs-ng-due-to-bugs.-5.1-instead-of-5.3.patch
</pre>
</pre>


= Setup and build Yocto =
= Setup and build Yocto =
You can create an image for X11 or create an image for QT5/Embedded. Please select one of the following option:
You can create an image for X11 or create an image for QT5/Embedded. Please select one of the following option:
* [[DART-6UL Yocto Fido R1 Build Yocto release#Setup_to_build_Yocto_GUI.2FX | GUI/X]]
* [[DART-6UL Yocto Fido R2 Build Yocto release#Setup_to_build_Yocto_GUI.2FX | GUI/X]]
* [[DART-6UL Yocto Fido R1 Build Yocto release#Setup_to_build_Yocto_QT5.2FEmbedded | QT/Embedded]]
* [[DART-6UL Yocto Fido R2 Build Yocto release#Setup_to_build_Yocto_QT5.2FFrame_Buffer | QT/Embedded]]
== Setup to build Yocto GUI/X ==
== Setup to build Yocto GUI/X ==


Line 49: Line 56:
<pre>$ cd ~/var-dart-6ul-yocto-fido
<pre>$ cd ~/var-dart-6ul-yocto-fido
$ source var-setup-release.sh -b build_x11 -e x11
$ source var-setup-release.sh -b build_x11 -e x11
</pre>
Optional: Direct downloads to /opt/yocto_downloads, make sure directory exists and all permissions are set
<pre>
sudo mkdir /opt/yocto_downloads
sudo chmod 777 /opt/yocto_downloads/
sed -i 's/DL_DIR ?= "${BSPDIR}\/downloads/DL_DIR = "\/opt\/yocto_downloads/g' conf/local.conf
</pre>
<pre>
$ bitbake fsl-image-gui  
$ bitbake fsl-image-gui  
</pre>
</pre>
Line 154: Line 171:


<pre>$ cd ~/var-dart-6ul-yocto-fido/build_x11
<pre>$ cd ~/var-dart-6ul-yocto-fido/build_x11
$ sudo dd  tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.sdcard of=/dev/sdxxx bs=1M
$ sudo dd  tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.sdcard of=/dev/sdX bs=1M
Replace sdxxx with the right device name.
Replace sdX with the right device name.
</pre>
</pre>
Drawbacks of the native .sdcard yocto-built image:
Drawbacks of the native .sdcard yocto-built image:
Line 166: Line 183:
See usage below:
See usage below:
<pre>$ cd ~/var-dart-6ul-yocto-fido/build_x11
<pre>$ cd ~/var-dart-6ul-yocto-fido/build_x11
$ sudo ../sources/meta-variscite-6ul/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh /dev/sdxxx
$ sudo ../sources/meta-variscite-mx6ul-mx7/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh /dev/sdX
Replace sdxxx with the right device name.
Replace sdX with the right device name.
</pre>The script assume fsl-image-qt5-minimal build was used. It is very easy to modify it and adopt it to your requirements.
</pre>The script assume fsl-image-qt5-minimal build was used. It is very easy to modify it and adopt it to your requirements.


Line 313: Line 330:


= Update Yocto Fido i.MX6UL Meta Variscite DART-6UL support =
= Update Yocto Fido i.MX6UL Meta Variscite DART-6UL support =
From time to time we will post updates to meta-variscite-6ul. This will include improve features and bug fix.
From time to time we will post updates to meta-variscite-mx6ul-mx7. This will include improve features and bug fix.
You can track the history log in the previous page to see if such an update was posted. In such a case follow the instructions below to update your tree.
You can track the history log in the previous page to see if such an update was posted. In such a case follow the instructions below to update your tree.
<pre>$ cd ~/var-dart-6ul-yocto-fido/sources/meta-variscite-6ul/
<pre>$ cd ~/var-dart-6ul-yocto-fido/sources/meta-variscite-mx6ul-mx7/
$ git fetch origin
$ git fetch origin
$ git pull
$ git pull

Latest revision as of 18:22, 2 December 2020

DART-6UL - Yocto fsl-3.14.52_6a Fido R2 Build Yocto release

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

Please make sure you host PC is running Ubuntu 14.04 and install the following packages:

sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev
sudo apt-get install autoconf libtool libglib2.0-dev libarchive-dev
sudo apt-get install python-git xterm sed cvs subversion coreutils texi2html
sudo apt-get install docbook-utils python-pysqlite2 help2man make gcc g++ desktop-file-utils libgl1-mesa-dev
sudo apt-get install libglu1-mesa-dev mercurial automake groff curl lzop asciidoc u-boot-tools mtd-utils

Documentation

Documentation are available for Download from YoctoFslFidoDocumentation


NOTE:
Variscite provides a scripts that automatically performs step 3-5.3

if you system fails to build using this script, probably something is wrong with your enviroment, such as packages installation..etc
Example scripts 6ul_build_x11.sh and 6ul_build_qt5.sh can be found here :ftp://customerv:Variscite1@ftp.variscite.com/DART-6UL/Software/Yocto_docs/Fido1.8-52

Download Yocto Fido for i.MX6UL 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
$ export PATH=~/bin:$PATH
$ 
$ mkdir ~/var-dart-6ul-yocto-fido
$ cd ~/var-dart-6ul-yocto-fido
$ repo init -u https://source.codeaurora.org/external/imx/fsl-arm-yocto-bsp.git -b imx-3.14.52-1.1.0_ga
$ repo sync

Download Yocto Fido i.MX6UL with Meta Variscite DART-6UL support

$ cd ~/var-dart-6ul-yocto-fido/sources
$ git clone https://github.com/varigit/meta-variscite-mx6ul-mx7.git -b imx_3.14.52_6ul_ga-var01
$ cp meta-variscite-mx6ul-mx7/scripts/var-setup-release.sh ../

Setup and build Yocto

You can create an image for X11 or create an image for QT5/Embedded. Please select one of the following option:

Setup to build Yocto GUI/X

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

$ cd ~/var-dart-6ul-yocto-fido
$ source var-setup-release.sh -b build_x11 -e x11

Optional: Direct downloads to /opt/yocto_downloads, make sure directory exists and all permissions are set

sudo mkdir /opt/yocto_downloads
sudo chmod 777 /opt/yocto_downloads/
sed -i 's/DL_DIR ?= "${BSPDIR}\/downloads/DL_DIR = "\/opt\/yocto_downloads/g' conf/local.conf
$ bitbake fsl-image-gui 


Comment:
If you close your terminal and wish to build Yocto again, you should run (instead of var-setup-release.sh):

$ cd ~/var-dart-6ul-yocto-fido
$ source ./setup-environment build_x11

$ bitbake fsl-image-gui

Setup to build Yocto QT5/Frame Buffer

Use the folowing commands to build and test QT over frame buffer.
Setup the environment and use build_var folder
Note: Run only once!

$ cd ~/var-dart-6ul-yocto-fido
$ source var-setup-release.sh -b build_fb -e fb
$ bitbake fsl-image-qt5 
Comment:
If you close your terminal and wish to build Yocto again, you should do:

$ cd ~/var-dart-6ul-yocto-fido
$ source ./setup-environment build_fb

$ bitbake fsl-image-qt5

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 Results

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

Image Name
How to use
fsl-image-gui-imx6ul-var-dart.ext3
Not in Use
fsl-image-gui-imx6ul-var-dart.sdcard This image is for SD-Card boot.
It can be flashed as-is on an SD-Card and you can boot your system
form SD-Card, according to the relevant startup-guide of your product (usually requires to press the boot select button, or toggle a dip-switch).

For detailed information refer to Create a sample SDCARD section below Create a bootable SD-Card.

fsl-image-gui-imx6ul-var-dart.tar.bz2 Used to create an NFS root file system on the host. See apendix for setting an NFS server
fsl-image-gui-imx6ul-var-dart.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):
zImage Linux kernel image
SPL-nand SPL built for NAND-Flash. The SPL is pre-u-boot SW component, required for DDR initialization
u-boot-nand-2015.10-r0.img U-Boot built for NAND Flash.
SPL-sd SPL built for SD-Card boot. The SPL is pre-u-boot SW component, required for DDR initialization
u-boot-sd-2015.10-r0.img u-boot built for SD-Card boot, or eMMC boot in case of DART-MX6.
Device Tree Name
Boot Device
zImage-imx6ul-var-dart-emmc_wifi.dtb Boot from internal eMMC with WI-FI enabled. (SDCARD & NAND disabled)
zImage-imx6ul-var-dart-nand_wifi.dtb Boot from internal NAND with WI-FI enabled. (SDCARD & eMMC disabled)
zImage-imx6ul-var-dart-sd_emmc.dtb SDCARD and eMMC enabled (WIFI & NAND disabled). You can boot from eMMC or SDCARD
zImage-imx6ul-var-dart-sd_nand.dtb SDCARD and NAND enabled (WIFI & eMMC disabled). You can boot from NAND or SDCARD

Create a bootable SD-Card

SD-Card structure

Sdcard part.png
The SD-Card is divided 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 contains the complete file system and modules.


Yocto pre-built bootable SD-Card

The Yocto build products contains many files as explained in Build Results section above including a ".sdcard" file. For example fsl-image-gui-imx6ul-var-dart.sdcard. This is a complete image to be flashed directly to an SD-Card.
Example usage:

$ cd ~/var-dart-6ul-yocto-fido/build_x11
$ sudo dd  tmp/deploy/images/imx6ul-var-dart/fsl-image-gui-imx6ul-var-dart.sdcard of=/dev/sdX bs=1M
Replace sdX with the right device name.

Drawbacks of the native .sdcard yocto-built image:

  • The second partition size doesn't use the entire SD-Card.
  • The second partition is not labeled as rootfs.
  • The NAND and eMMC flashing scripts are not included.

Create an extended SD-Card

Variscite provides var-create-yocto-sdcard.sh script that makes use of the .sdcard image mentioned above, extends the partitions of the SD-Card to the maximum available space, and copies the NAND-Flash burning scripts and relevant binaries for your convenience.
Later, you will be able to follow DART-6UL NAND Flash burning do burn your images to NAND-Flash or eMMC
See usage below:

$ cd ~/var-dart-6ul-yocto-fido/build_x11
$ sudo ../sources/meta-variscite-mx6ul-mx7/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh /dev/sdX
Replace sdX with the right device name.

The script assume fsl-image-qt5-minimal build was used. It is very easy to modify it and adopt it to your requirements.

Boot board with a bootable SD-Card

Note: Boot from SD-Card eliminates Wifi as the Wifi and SD-Card are using same SDIO interface.
A typical use-case, is to boot from SD-Card, flash eMMC or NAND-Flash, and re-boot form eMMC/NAND to have Wi-Fi operational.

Setting board dip-switches

Booting your system requires switching the relevant dip-switch to "Boot from SD-Card". See picture below.


Boot switch 6ul1.jpg


  • "00" - Boot from SDCARD - The picture mode
  • "01" - Boot from eMMC
  • "10" - Boot from NAND-Flash
  • "11" is illegal.

Be aware that your SOM has either eMMC or NAND but never both !

To boot board with SD-Card, Follow the steps below:

  • Power-off the board.
  • Insert the SD card into the SD/MMC slot of the carrier board (DVK)
  • Switch the relevant dip-switch to "Boot from SD-Card"
  • Power-up board
  • The board will automatically boot into Linux from SD-Card

Automatic device Tree selection in U-Boot

Upon reset you will see the U-BOOT-SPL printouts. It will print also the SOM configuration:
On-SOM storage: SD only, eMMC, NAND.
WIFI if chip exits.
For example:

U-Boot SPL 2015.10-00532-g482dc88 (Jan 03 2016 - 10:05:42)
i.MX6UL SOC 
Part number: DART-6U-A01
Assembly: AS11
Date of production: 2015 Dec 31
DART-6UL configuration: eMMC WIFI
Ram size: 512
Boot Device: SD

As explained in the above Build Results table we have 4 optional configurations.
We implemented in U-BOOT and automatic device tree selection, so when kernel boots, the u-boot will load the corresponding device tree according to On-SOM configuration.

Boot From
SOM Internal FLASH
SOM has WIFI/BT
Device Tree selected
SD eMMC Don't Care imx6ul-var-dart-sd_emmc.dtb
SD NAND Don't Care imx6ul-var-dart-sd_nand.dtb
eMMC eMMC Yes imx6ul-var-dart-emmc_wifi.dtb
eMMC eMMC NO imx6ul-var-dart-sd_emmc.dtb
NAND NAND YES imx6ul-var-dart-nand_wifi.dtb
NAND NAND NO imx6ul-var-dart-sd_nand.dtb

Note: Boot from SD-Card eliminates Wifi as the Wifi and SD-Card are using same SDIO interface.
A typical use-case, is to boot from SD-Card, flash eMMC or NAND-Flash, and re-boot form eMMC/NAND to have Wi-Fi operational.

Disable Automatic Device Tree selection

To disable the automatic device tree selection in u-boot:

$ setenv var_auto_fdt_file=N
$ saveenv

Now you can set the device tree to meet your requirments. For example:

$ setenv fdt_file=imx6ul-var-dart-sd_emmc.dtb
$ saveenv

Will select device tree that has SD and eMMC regardless if the SOM has WIFI.

$ setenv fdt_file=imx6ul-var-dart-sd_nand.dtb
$ saveenv

Will select device tree that has SD and NAND regardless if the SOM has WIFI.

Comment:
Make sure you don't set am illegal value like "imx6ul-var-dart-sd_nand.dtb" in a SOM that has eMMC flash.

Flash images to NAND/eMMC

Please refer to DART-6UL NAND Flash burning

QT5/Embedded runtime

Environment Variables

The QT5/Embedded require environment variables to run correctly. DART6Ul support QT Embedded over Linux Frame Buffer. For example /etc/profile.d/tslib.sh can be edited. The following example enable touch, mouse and keyboard:

export TSLIB_TSEVENTTYPE='INPUT'
export TSLIB_TSDEVICE='/dev/input/touchscreen0'
export TSLIB_CALIBFILE='/etc/pointercal'
export TSLIB_CONFFILE='/etc/ts.conf'
export TSLIB_CONSOLEDEVICE='none'
export TSLIB_FBDEVICE='/dev/fb0'
export TSLIB_PLUGINDIR='/usr/lib/ts'

export QT_QPA_PLATFORM=linuxfb:fb=/dev/fb0:size=800x480:mmSize=800x480
export QT_QPA_EVDEV_TOUCHSCREEN_PARAMETERS='/dev/input/touchscreen0'
export QT_QPA_GENERIC_PLUGINS='tslib:/dev/input/touchscreen0,evdevmouse:/dev/input/event5,evdevkeyboard:/dev/input/event3'

Running Application

$ cd /usr/share/qt5/examples/
$ touch/dials/dials --platform linuxfb
$ gui/rasterwindow/rasterwindow --platform linuxfb
$ touch/fingerpaint/fingerpaint  --platform linuxfb
$ widgets/mainwindows/mainwindow/mainwindow --platform linuxfb

Next steps

In sections 1-6 we explained how to build Yocto for DART-6UL. 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.

Update Yocto Fido i.MX6UL Meta Variscite DART-6UL support

From time to time we will post updates to meta-variscite-mx6ul-mx7. This will include improve features and bug fix. You can track the history log in the previous page to see if such an update was posted. In such a case follow the instructions below to update your tree.

$ cd ~/var-dart-6ul-yocto-fido/sources/meta-variscite-mx6ul-mx7/
$ git fetch origin
$ git pull
Set your enviroment
$ cd ~/var-dart-6ul-yocto-fido
$ source ./setup-environment build_x11
In order to update the kernel
$ bitbake -c cleanall linux-variscite
$ bitbake  -c cleanall u-boot-variscite
and build your image
$ bitbake fsl-image-gui

Useful Bitbake commands

Bitbake Cheat Sheet

Useful bitbake commands

i.MX Yocto Project: ltib versus bitbake