Yocto tests

From ElphelWiki

Jump to: navigation, search



Required packages

src link:

  • Essentials. Packages needed to build an image on a headless system:
sudo apt-get install gawk wget git-core diffstat unzip texinfo build-essential chrpath
  • Graphical Extras. Packages recommended if the host system has graphics support:
sudo apt-get install libsdl1.2-dev xterm
  • Documentation. Packages needed if you are going to build out the Yocto Project documentation manuals:
sudo apt-get install make xsltproc docbook-utils fop dblatex xmlto
  • ADT Installer Extras. Packages needed if you are going to be using the Application Development Toolkit (ADT) Installer:
sudo apt-get install autoconf automake libtool libglib2.0-dev

Output targets

Output folder: poky/build/tmp/deploy/images

These names are as they appear in the u-boot configuration header file - actual output files have different names:

Copy them on the micro SD card > run boot once in the u-boot command line.

Boot options

a. Unpack the root file system image to RAM at boot time.

Check u-boot config file.

Keep uramdisk.image.gz along with other files on FAT partition.

b. Keep the root file system on EXT2(EXT3,etc.) partition of SD card.

Create uEnv.txt on FAT partition. uEnv.txt:

uenv_boot=fatload mmc 0 0x3F00000 ${kernel_image} && fatload mmc 0 0x3E00000 ${devicetree_image} && bootm 0x3F00000 - 0x3E00000
uenvcmd=run uenv_boot

Devicetree needs to be recompiled with changes in bootargs-line:

for ext2:


for ram:



#Part 1

git clone -b dora git://git.yoctoproject.org/poky.git poky
cd poky; git checkout 50e9ccb2aff7b9f9dca4fda99a6832c60f64de3b

git clone -b dora https://github.com/openembedded/meta-oe.git meta-oe 
#has changed to git clone -b fido https://github.com/openembedded/meta-openembedded?!!!!!!!!)
cd meta-oe; git checkout ee173678383683e972c7d4d6f0ef5790bfa50274; cd ..

git clone -b dora https://github.com/Xilinx/meta-xilinx.git meta-xilinx
cd meta-xilinx; git checkout aa7d677515ab7d45bbd3bdd6c5383f4143147c6d; cd ..

git clone -b master https://github.com/Elphel/meta-ezynq.git meta-ezynq
cd meta-ezynq; git checkout 626e02fc0b9070458baae3e9a0153a2820ec6565; cd ..

git clone -b master https://github.com/Elphel/meta-elphel393.git meta-elphel393
cd meta-elphel393; git checkout fcde04fa6f4f00c7fe593e5f96bf7b40dc50d2b3; cd ..

#Part 2 : init environment and auto-fill Yocto's conf-files

CURRENT_PATH=$(dirname $(readlink -f "$0"))
. ./oe-init-build-env


echo "BBLAYERS = \" \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-yocto \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-yocto-bsp \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-elphel393 \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-ezynq \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-oe/meta-oe \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-oe/meta-webserver \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-oe/meta-networking \\" >> $BBLAYERS_CONF
echo "  $CURRENT_PATH/meta-xilinx \\" >> $BBLAYERS_CONF
echo "  \"" >> $BBLAYERS_CONF


# number of parallel tasks (including compiles)
echo "BB_NUMBER_THREADS ?= \"8\"" >> $LOCAL_CONF
# number of parallel compiles
echo "PARALLEL_MAKE ?= \"-j 8\"" >> $LOCAL_CONF
# change the MACHINE
echo "MACHINE ?= \"elphel393\"" >> $LOCAL_CONF
# Elphel's MIRROR website, \n is important
echo "MIRRORS =+ \"http://.*/.*     http://mirror.elphel.com/elphel393_mirror/ \n \"" >> $LOCAL_CONF
  • Step 2: re-init environment
cd poky
. ./oe-init-build-env
  • Step 3: build bootable image (3 targets)
bitbake u-boot-ezynq linux-xlnx core-image-elphel393


Build bootloader

bitbake u-boot-ezynq
bitbake u-boot
bitbake virtual/bootloader



  • Is there a way to build it by running bitbake core-image-elphel393

Build kernel

bitbake linux-xlnx
bitbake virtual/kernel




bitbake linux-xlnx -c compile
bitbake linux-xlnx -c deploy

  • When linux-xlnx is 'clean' it is built with the ramdisk.image.gz by bitbake core-image-elphel393, however the boot.bin does not, why?

Build ramdisk.image.gz

bitbake core-image-elphel393



  • Select root file system format in the recipe:
IMAGE_FSTYPES = "tar.gz"
  • Current packages:
  • Also works:
IMAGE_INSTALL_append = "python-core"

  • Why python-core and not python?
    • poky/meta/recipes-devtools/python/python-2.7-manifest.inc has a list in PACKAGES, items from which should go into IMAGE_INSTALL
    • Among all there's no python in the PACKAGES list.
    • Does hob install all the PACKAGES if python is checked? Haven't tried, also the used hob version doesn't support saving recipes.

  • Steps for adding packages:
    • elphel393.bb (some discussions mention the leading space is mandatory but somehow it works even without it):
IMAGE_INSTALL_append = "<mandatory space?>python-core \
                       i2c-tools \
                       mtd-utils \
                       net-tools \
                       openssh \
                       modphp \
                       apache2 \
    • Why php-cli and not just php?
PACKAGES = "${PN}-dbg ${PN}-cli ${PN}-cgi ${PN}-fpm ${PN}-fpm-apache2 ${PN}-pear ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}"
      • PACKAGES list includes php. What is installed? (No php-cli: missing /usr/bin/php) Didn't investigate.

      • What does hob build if php is checked? Didn't test.
      • Using php-cli increases the unpacked image size from ~16MB to ~50MB.

U-boot and device tree related notes

*.dts, add to bootargs parameter ramdisk_size=32768 (takes KB), example:
bootargs = "console=ttyPS0,115200 root=/dev/ram rw ip= earlyprintk ramdisk_size=65536";
"sdboot=echo Copying Linux from SD to RAM... && " \
               "mmcinfo && " \
               "fatload mmc 0 0x3000000 ${kernel_image} && " \
               "fatload mmc 0 0x2A00000 ${devicetree_image} && " \
               "fatload mmc 0 0x2000000 ${ramdisk_image} && " \
               "bootm 0x3000000 0x2000000 0x2A00000\0" \

So, the max sizes:
compressed ramdisk    = 0x2A00000 - 0x2000000 = 0xA00000 = 10MB
devicetree = 0x3000000 - 0x2A00000 = 0x600000 = 6MB

Build everything all together

bitbake u-boot-ezynq linux-xlnx core-image-elphel393

Build toolchain (not necessary - needed only for building ezynq targets outside poky)

bitbake meta-toolchain

Apply a patch from a recipe


bitbake linux-xlnx


git diff > somefile.patch

Apply the patch when building for any MACHINE:

SRC_URI_append += "file://xilinx_nandps.patch"

or only a certain MACHINE="elphel393"

SRC_URI_append_elphel393 += "file://xilinx_nandps.patch"

bitbake linux-xlnx -c clean -f
bitbake linux-xlnx

Create *.bbappend for an existing package in meta-*

Switch to dora branch

cd poky; git checkout dora
cd meta-oe; git checkout dora
cd meta-elphel393; git checkout master

Branching in git

  • switch to a branch:
git checkout <name>
  • create a new local branch
git checkout -b <new-branch> <existing-branch>
  • delete a local branch
git branch -D <name>
  • create a new remote branch (from existing local)
git push origin <name>
  • delete a remote branch
git push origin :<name>

Disappeared errors

RTC config example in DTS


Program bitstream from Linux

  • PL status (1=programmed, 0=not):
cat /sys/devices/amba.0/f8007000.ps7-dev-cfg/prog_done
  • Program (the driver understands both *.bit and *.bit.bin)
cat test.bit > /dev/xdevcfg

Create and set up an own external mirror in Yocto/OpenEmbedded

  • To the build/conf/local.conf add:
SOURCE_MIRROR_URL = "file:///data/sources/"
INHERIT += "own-mirrors" 
  • Rebuild the target
It didn't store anything in /data/sources/, but in the build/downloads/ instead - tar.gz + tar.gz's made from cloned git repositories.
  • Upload the archives to your mirror website
  • To the build/conf/local.conf add:
MIRRORS =+ "http://.*/.*     http://mirror.elphel.com/elphel393_mirror/ \n "
  • If no need - comment out the files in the build/conf/local.conf:
#SOURCE_MIRROR_URL = "file:///data/sources/"
#INHERIT += "own-mirrors" 

For future consideration

from [meta-xilinx] Best kernel recipe to work against

On Wed, Jan 7, 2015 at 5:42 AM, Philip Balister <philip@balister.org> wrote:
> What's the officially supported best kernel to work against in meta-xilinx?
> linux-xlnx-3.14
> linux-yocto-3.17

So it does depend on your preference and requirements. There are still
some drivers missing from the mainline kernel, if you need those
drivers/peripherals then you will most likely need to use the
linux-xlnx kernel.

Shortlist of the main peripherals/drivers that are not yet in the
mainline/linux-yocto kernel:
 * USB (however there is now support upstream in 3.19)
 * PL devcfg
 * QSPI flash controller
 * NAND flash controller
(full list here: http://www.wiki.xilinx.com/Linux+Drivers)

Keep in mind though that the linux-xlnx kernels are short lived, so
you will need to continue updating to newer versions if you want
fixes, etc. And the recipes for the linux-xlnx kernels do not reflect
the actual releases of the linux-xlnx kernel particularly well (since
linux-xlnx releases against Vivado versions instead of linux kernel

For reference, with microblaze mainline/linux-yocto is the best
supported kernel.


Some links

1. u-boot environment variables: print all:

~: printenv

setenv examples:

~: setenv modeboot "run uenvboot"
~: setenv uenvboot "fatload mmc 0 0x3000000 uEnv.txt && env import -t 0x3000000 $filesize && run uenv_boot"

2. Unpack image into SD card ext2 partition:

sudo tar -xzf core-image-minimal-dev-microzed.tar.gz -C /media/rootfs/

Personal tools