How to start with YOCTO


The new page about how to start with YOCTO is now here:
How to develop your own software: uBoot, Linux, Filesystem, YOCTO

Note: Below is the old page, but it still can be useful.

Content

See also


On this page, you will find step-by-step instructions to build iMX6 Rex from YOCTO project. YOCTO is just another way to build uBoot, Linux Kernel & Filesystem. Difference from the standard direct compilation is, that Freescale now officially adds all their support through YOCTO. If you need to use special things from the iMX6 like GPU or cameras, you may really want to consider using YOCTO to prepare uBoot and Linux for your board.

iMX6 Rex has not been completely ported to YOCTO yet, but on these pages you can find the steps which can help you to do it by yourself in the case you need YOCTO urgently.

Setup a host computer

Install Ubuntu 12.04 LTS:
You can install it into a virtual machine, e.g. VMware Player. Go to http://releases.ubuntu.com/12.04/ and download for example this image (for 64bit PC): http://releases.ubuntu.com/12.04/ubuntu-12.04.5-desktop-amd64.iso
Note: I had a problem to run Ubuntu 12.04, but it’s easy to fix. When I logged in, I was getting a black screen. I had to disable 3D support in the virtual machine settings and then it worked oki.

Login into Ubuntu and install necessary packages:

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

Note: Find more information at https://community.freescale.com/docs/DOC-1616

Install the `repo` utility:

mkdir ~/bin
curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
chmod a+x ~/bin/repo
PATH=${PATH}:~/bin

Install tftp

sudo apt-get install xinetd tftpd tftp

Create this file:

sudo nano /etc/xinetd.d/tftp

and insert this inside:

service tftp
{
protocol        = udp
port            = 69
socket_type     = dgram
wait            = yes
user            = nobody
server          = /usr/sbin/in.tftpd
server_args     = /tftp    
disable         = no
}

Create ‘tftp’ directory (later we will be using this directory for file transfer from the host to our iMX6 Rex board):

sudo mkdir /tftp
sudo chmod -R 777 /tftp
sudo chown -R nobody /tftp

Now, initialize tftp:

sudo /etc/init.d/xinetd restart

Compile your first uBoot & Kernel from YOCTO

Download the BSP source (you may need to be registered at Github, use your_email and yourname to set ‘git config –global’):

mkdir fsl-community-bsp
cd fsl-community-bsp
git config --global user.email "your_email@example.com"
git config --global user.name "yourname"
repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b daisy //check the latest branch, you can use for example -b jethro
repo sync

Create a new branch:

repo start imx6rex --all

Setup the environment for iMX6:

source setup-environment build

Note: We will use ‘imx6qsabresd’, but if you need, you can set a different board here (you don’t have to do this step):

nano conf/local.conf

Run the first compilation. It will take quite a while. For test, you can run this minimal image (A small image just capable of allowing a device to boot):

bitbake core-image-minimal

Note: Normally, you may want to run ‘bitbake core-image-base’ (A console-only image that fully supports the target device hardware)

The final outputs and images are located at:

cd tmp/deploy/images 

!!!BE AWARE!!! Dont forget, at this moment, these are sabresd images. We need to apply changes to the iMX6 Rex. Follow next steps.

Add support for iMX6 Rex

Download the iMX6 Rex patches from github:

cd ~/fsl-community-bsp/sources
git clone -b master https://github.com/FEDEVEL/meta-imx6rex.git

Important! You need to add information about meta-imx6rex into the bblayers.conf file. Do this:

 
gedit ~/fsl-community-bsp/build/conf/bblayers.conf

and add this:

 
${BSPDIR}/sources/meta-imx6rex \

The whole file may then look like this:

 
LCONF_VERSION = "6"

BBPATH = "${TOPDIR}"
BSPDIR := "${@os.path.abspath(os.path.dirname(d.getVar('FILE', True)) + '/../..')}"

BBFILES ?= ""
BBLAYERS = " \
  ${BSPDIR}/sources/poky/meta \
  ${BSPDIR}/sources/poky/meta-yocto \
  \
  ${BSPDIR}/sources/meta-openembedded/meta-oe \
  \
  ${BSPDIR}/sources/meta-fsl-arm \
  ${BSPDIR}/sources/meta-fsl-arm-extra \
  ${BSPDIR}/sources/meta-fsl-demos \
  ${BSPDIR}/sources/meta-imx6rex \
"

Test if you can see the meta-imx6rex:

 
cd ~/fsl-community-bsp/build/
bitbake-layers show-layers

There should be this line:

 
meta-imx6rex          /home/fedevel/fsl-community-bsp/sources/meta-imx6rex  6

How to build images for iMX6 Rex

After you added support for iMX6 Rex layer, you can recompile the u-Boot and use it on an iMX6 Rex board:

 
cd ~/fsl-community-bsp/build/
bitbake -c clean u-boot-fslc
bitbake core-image-minimal

Or, you can recompile linux an use it on the iMX6 Rex:

 
cd ~/fsl-community-bsp/build/
bitbake -c clean linux-imx
bitbake core-image-minimal

There are more options, than just ‘core-image-minimal’. You can list all the possible ‘images’ which you can build. Run this command:

 
bitbake-layers show-recipes "*-image-*"

Then just use ‘bitbake’ to build the image you like, e.g.:

bitbake fsl-image-multimedia-full

Create an SD card

Check if the files were compiled correctly. Check if the timestamp of the files is ok:

cd ~/fsl-community-bsp/build/
ls -la tmp/deploy/images/imx6qsabresd/

Insert an SD card into your PC. To check how it’s mounted, run: ‘dmesg | tail’. Use the correct /dev/ and copy the images to the SD card (be sure you copy the file you have created … e.g. minimal vs base):

sudo dd if=tmp/deploy/images/imx6qsabresd/core-image-minimal-imx6qsabresd.sdcard of=/dev/sdb
umount /media/Boot\ imx6qs 

To test it, remove the SD from PC and insert it into the iMX6 Rex SD slot placed on the edge. Connect power. Once you are in the u-Boot, insert this command to boot from SD:

mw.l 0x020d8040 0x3040; mw.l 0x020d8044 0x10000000; reset

How to modify and recompile u-Boot & Linux

If you would like to modify u-Boot or Linux, continue reading at How to add support of custom board into YOCTO