VAR-SOM-MX6 Yocto Fido R3 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
For example, if your building machine is an Ubuntu machine:
sudo apt-get install gawk wget git-core diffstat unzip texinfo gcc-multilib build-essential chrpath socat libsdl1.2-dev xterm lib32ncurses5-dev
Variscite Yocto build was tested with Ubuntu 12.04 LTS and Ubuntu 14.04 LTS only!
Documentation
Documentation are available for Download from FreescaleFidoDocuments
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 $ export PATH=~/bin:$PATH $ $ 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_ga $ 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-var02 remotes/origin/imx_3.14.38_6qp-var02 $ cp scripts/var-setup-release.sh ../../ $ cd ../meta-fsl-bsp-release $ patch -p1 < ../meta-variscite-mx6/patch/0001-Fix-FSL-multi-patch-append-bug.patch $ patch -p1 < ../meta-variscite-mx6/patch/0001-Fix-FSL-multi-platform-on-mesa-demos.patch
Setup and build Yocto
You can create an image for QT5/X11 or create an image for QT5/Embedded. Please select one of the following option:
Setup and build Yocto QT5/X
fsl-image-qt5 will build without the ubifs product but with all Freescale's QT5 demos.
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 $ bitbake fsl-image-qt5-minimal or $ bitbake fsl-image-qt5
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
$ bitbake fsl-image-qt5-minimal
or
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 $ bitbake fsl-image-qt5
If you close your terminal and wish to build Yocto again, you should do:
$ cd ~/var-som-mx6-yocto-fido
$ . ./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.
If you don't need Chromium browser edit conf/local.conf and comment out the chromium line.
Build Results
The resulted images are locaated in tmp/deploy/images/var-som-mx6.
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. It can be flashed as-is on an SD card that can then be used to boot your system 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 the Create a bootable SD card section below. | |||
fsl-image-qt5-minimal-var-som-mx6.tar.bz2 | Used to create an NFS root file system on the host. See appendix for setting an NFS server | |||
fsl-image-qt5-minimal-var-som-mx6.ubi | A complete UBIFS file-system binary, for NAND Flash | |||
uImage | Linux kernel image, same binary for SD card or NAND Flash | |||
SPL-nand | SPL built for NAND-Flash. The SPL is a pre-U-Boot SW component, required for DDR initialization | |||
u-boot-nand-2015.04-r0.img | U-Boot built for NAND Flash. | |||
SPL-sd | SPL built for SD card boot | |||
u-boot-sd-2015.04-r0.img | U-Boot built for SD card boot, or eMMC boot in case of DART-MX6. | |||
Device Tree Name |
SOM type |
Carrier Board type |
LCD Type |
Evaluation Kit name |
uImage-imx6q-var-som.dtb | VAR-SOM-MX6_V2 (Quad / Dual) | VAR-MX6CustomBoard | Capacitive/Resistive touch | VAR-DVK-MX6_V2-PRO VAR-STK-MX6_V2 |
uImage-imx6q-var-som-vsc.dtb | VAR-SOM-MX6_V2 (Quad / Dual) | VAR-SOLOCustomBoard | Capacitive LVDS touch | N/A |
uImage-imx6dl-var-som.dtb | VAR-SOM-MX6_V2 (DualLite/ Solo) | VAR-MX6CustomBoard | Capacitive/Resistive touch | N/A |
uImage-imx6dl-var-som-solo-vsc.dtb | VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-SOLOCustomBoard | Capacitive LVDS touch | VAR-DVK-SOLO/DUAL VAR-STK-SOLO/DUAL |
uImage-imx6dl-var-som-solo.dtb | VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-MX6CustomBoard | Capacitive/Resistive touch | N/A |
uImage-imx6q-var-dart.dtb | VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-DT6CustomBoard | Capacitive LVDS touch | VAR-STK-DT6.VAR-DVK-DT6 |
Create a bootable SD card
SD card structure
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-qt5-minimal-var-som-mx6.sdcard or fsl-image-qt5-var-som-mx6.sdcard depend on your build. This is a complete image to be flashed directly to an SD card.
Example usage:
$ cd ~/var-som-mx6-yocto-fido/build_x11 $ sudo dd if=tmp/deploy/images/var-som-mx6/fsl-image-qt5-var-som-mx6.sdcard of=/dev/sdX bs=1M Replace sdX with the right device name. This can be obtained by "dmesg" command on your host Linux PC, after the SD card reader is inserted.
- Note: Booting your system from an SD card requires pressing the boot-select button, or switching the relevant DIP switch to "Boot from SD card", according to the relevant start-up guide of your system"
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 the var-create-yocto-sdcard.sh script which creates our NAND/eMMC recovery rescue SD card - an SD card based on the fsl-image-qt5-var-som-mx6 filesystem, which utilizes the full capacity of the used SD card, and copies the NAND-Flash burning scripts and relevant binaries for your convenience.
Later, you will be able to follow either the more automatic VAR-SOM-MX6 Yocto NAND Recovery guide or the more manual VAR-SOM-MX6 NAND Flash burning guide to burn your images to NAND-Flash or eMMC.
See usage below:
$ cd ~/var-som-mx6-yocto-fido/build_x11 $ sudo ../sources/meta-variscite-mx6/scripts/var_mk_yocto_sdcard/var-create-yocto-sdcard.sh /dev/sdX Replace sdX with the right device name.
The script assumes both fsl-image-qt5-minimal and fsl-image-qt5 recipes were bitbaked. It is very easy to modify it and adopt it to your requirements.
Flash images to NAND
Please refer to VAR-SOM-MX6 NAND Flash burning
Boot the board with a bootable SD card
Booting your specific Developer Kit
Select the one you are using.
MX6CustomBoard
Booting your MX6CustomBoard system from SD card requires while powering up the system. See picture below.
To boot a board using an SD card, follow the steps below:
- Power-off the board.
- Insert the SD card into the SD/MMC slot of the carrier board (DVK)
- Push the middle button (Boot Select) and hold
- Power-up the board
- Release the middle button (Boot Select) after system starts to boot.
- The board will automatically boot into Linux from the SD card
SoloCustomBoard
Booting your system requires switching the relevant DIP switch to "Boot from MMC". See picture below.
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 MMC"
- Power-up board
- The board will automatically boot into Linux from SD card
DT6CustomBoard
Booting your system requires switching the relevant DIP switch to "Boot from SD card". See picture below.
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 the SOM configuration:
- CPU type and frequency
- Production information
- RAM size
- Boot Device: eMMC, SD or NAND
- NAND size (if boot device is NAND)
For example:
U-Boot SPL 2015.04 (Mar 20 2016 - 11:29:03) i.MX6Q SOC P-STD 996 MHz CPU (running at 792 MHz) Part number: VSM-MX6-C01 Assembly: AS16 Date of production: 2016 Mar 21 RAM: 1 GiB Boot Device: NAND NAND : 512 MiB
As explained in the above Build Results table, we have 6 optional configurations.
We implemented an automatic device tree selection in U-Boot, when booting from SD card, so when the kernel boots, the U-Boot will load the corresponding device tree according to On-SOM configuration.
Based on the hardware we will set 2 environment variables in U-Boot.
- fdt_file - Will be set to reflect the SOM/CustomBoard pair.
- screen_alternate=yes - Will be appended to bootargs in case you are using the capacitive display.
The table below list the possible options:
SOM type |
Carrier Board type |
LCD Type |
Evaluation Kit name |
Device Tree Name |
Screen Alternate |
---|---|---|---|---|---|
VAR-SOM-MX6_V2 (Quad / Dual) | VAR-MX6CustomBoard | Capacitive touch | VAR-DVK-MX6_V2-PRO VAR-STK-MX6_V2 |
imx6q-var-som.dtb | Yes |
VAR-SOM-MX6_V2 (Quad / Dual) | VAR-MX6CustomBoard | Resistive touch | VAR-DVK-MX6_V2-PRO VAR-STK-MX6_V2 |
imx6q-var-som.dtb | No |
VAR-SOM-MX6_V2 (Quad / Dual) | VAR-SOLOCustomBoard | Capacitive LVDS touch | N/A | imx6q-var-som-vsc.dtb | N/A |
VAR-SOM-MX6_V2 (DualLite/ Solo) | VAR-MX6CustomBoard | Capacitive touch | N/A | imx6dl-var-som.dtb | Yes |
VAR-SOM-MX6_V2 (DualLite/ Solo) | VAR-MX6CustomBoard | Resistive touch | N/A | imx6dl-var-som.dtb | No |
VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-SOLOCustomBoard | Capacitive LVDS touch | VAR-DVK-SOLO/DUAL VAR-STK-SOLO/DUAL | imx6dl-var-som-solo-vsc.dtb | N/A |
VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-MX6CustomBoard | Capacitive/Resistive touch | N/A | imx6dl-var-som-solo.dtb | N/A |
VAR-SOM-SOLO / VAR-SOM-DUAL | VAR-DT6CustomBoard | Capacitive LVDS touch | VAR-STK-DT6.VAR-DVK-DT6 | imx6q-var-dart.dtb | N/A |
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 requirements. For example:
$ setenv fdt_file=imx6q-var-som.dtb $ screen_alternate=yes $ saveenv
Will select device tree that has i.MX6 Quad/Dual running on MX6CustomBoard.
Make sure you don't set an illegal value like "imx6q-var-som.dtb" in a QUAD that is running on SoloCustomBoard.
What happen when you flash to eMMC/NAND
When you flash to NAND we use the same algorithm as the table above but we pick and choose specific device tree and flash it.
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 ~/var-som-mx6-yocto-fido/sources/meta-variscite-mx6/conf/machine/var-som-mx6.conf
and comment / uncomment the relevant section based on size.
Another option is to create the ubifs image manualy. 4GB NAND example:
$ cd ~/var-som-mx6-yocto-fido $ sudo mkdir rootfs $ sudo tar xvf build_x11/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.
Update Yocto Fido i.MX6 Meta Variscite VAR-SOM-MX6 support
From time to time we will post updates to meta-variscite. 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-som-mx6-yocto-fido/sources/meta-variscite-mx6/ $ git fetch origin $ git pull Set your enviroment $ cd ~/var-som-mx6-yocto-fido $ . ./setup-environment build_x11 In order to update the kernel $ bitbake -c cleanall linux-variscite $ bitbake -c cleanall ti-compat-wireless-wl18xx and build your image $ bitbake fsl-image-qt5