Difference between revisions of "Yocto tests"

From ElphelWiki
Jump to: navigation, search
Line 250: Line 250:
* PL status (1=programmed, 0=not):
* PL status (1=programmed, 0=not):
  cat /sys/devices/amba.0/f8007000.ps7-dev-cfg/prog_done
  cat /sys/devices/amba.0/f8007000.ps7-dev-cfg/prog_done
* Program
* Program (the driver understands both *.bit and *.bit.bin)
  cat test.bit.bin > /dev/xdevcfg
  cat test.bit > /dev/xdevcfg

Revision as of 15:59, 4 December 2013


  • All of the described things happen in Kubuntu 13.04
  • Building Linux images for Zynq platform - ARMv7

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:

  • boot.bin - u-boot as the first stage bootloader
  • devicetree.dtb - device tree with described interfaces, zynq registers, interrupts and drivers
  • uImage - kernel, drivers
  • uramdisk.image.gz - applications

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


  • Step 1:

git clone -b dora git://git.yoctoproject.org/poky.git
cd poky # (just for convenience)
git clone git://git.code.sf.net/p/elphel/meta-elphel393 meta-elphel393
git clone git://git.code.sf.net/p/elphel/meta-ezynq meta-ezynq
git clone -b dora https://github.com/openembedded/meta-oe.git

  • Step 2: Init environment

cd poky
. ./oe-init-build-env

  • Step 3: Edit build/conf/bblayers.conf - add paths to BBLAYERS:

<absolute-path>/poky/meta-elphel393 \
<absolute-path>/poky/meta-ezynq \
<absolute-path>/poky/meta-oe/meta-oe \
<absolute-path>/poky/meta-oe/meta-webserver \

  • Step 4: Edit build/conf/local.conf - set MACHINE and other things:

 BB_NUMBER_THREADS = "8" (depends on the PC's CPU)
 PARALLEL_MAKE = "-j 8" (depends on the PC's CPU)
 MACHINE ?= "elphel393" (based on MACHINE="zedboard" )


  • Currently having 4 MACHINES: elphel393, microzed, zc706 and zedboard

Build ezynq-u-boot

bitbake ezynq-u-boot


  • poky/build/tmp/deploy/images/boot.bin


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

Build kernel

bitbake linux-xlnx


  • poky/build/tmp/deploy/images/uImage (kernel)
  • poky/build/tmp/deploy/images/devicetree.dtb (or some *.dtb)


  • Sources are cloned to:


  • If you change files like debug drivers for example, when done editing run:

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


  • poky/build/tmp/deploy/images/uramdisk.image.gz (the file has *.u-boot extension after it's built)


  • 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

  • The default UNPACKED ramdisk max size for zynq is 16MB - once it gets bigger you get KERNEL PANIC - the solution is modifying the device tree - then recompile into DTB:
*.dts, add to bootargs parameter ramdisk_size=32768 (takes KB), example:
bootargs = "console=ttyPS0,115200 root=/dev/ram rw ip= earlyprintk ramdisk_size=65536";
  • The default COMPRESSED ramdisk max size for zynq is 10MB set in u-boot - change according to your needs, example:
"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 ezynq-u-boot linux-xlnx core-image-elphel393

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

  • Step 1: build

bitbake meta-toolchain

  • Step 2: install - launch installer from <some-path>/poky/build/tmp/deploy/

Apply a patch from a recipe


  • Goal: apply a patch to linux-xlnx files
  • Step 1:

bitbake linux-xlnx

  • Step 2: Go to where the linux-xlnx got cloned - find and edit the target file:


  • Step 3: In the mentioned above directory run:

git diff > somefile.patch

  • Step 4: Copy the patch file into recipes/kernel/linux/linux-xlnx/.
  • Step 5: Edit the recipe, here it's linux-xlnx.inc, add a line like the following:

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"

  • Step 6(?):

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

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

  • Define FILESEXTRAPATHS_prepend := "${THISDIR}/files:" for files that come with the bbappend - so the fetcher could find them
  • Try to add "_append" & "_prepend" to functions
  • If some do_function is incompatible just rewrite it

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

    • (Is there a better solution for kubuntu 13.04? in kubuntu 12.10 there is no such error - or is it just newer version?) To fix the ERROR="Could not inherit file classes/vala.bbclass" in bitbake copy vala.bbclass from oe-core? or delete the conflicting recipes (2?)?
    • (Is there a better solution for kubuntu 13.04? in kubuntu 12.10 there is no such error - or is it just newer version?) To fix the ERROR="Failed to parse krb5_1.11.3.bb" in bitbake delete the directory meta-oe/meta-oe/recipes-connectivity/krb5

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