Yocto tests

From ElphelWiki

Jump to: navigation, search

Contents

About

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.

Setup

#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
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 git://git.code.sf.net/p/elphel/meta-ezynq meta-ezynq
cd meta-ezynq; git checkout b046b97faaee5cf5f83b554ae0a24d5cce8606c6; cd ..

git clone -b master git://git.code.sf.net/p/elphel/meta-elphel393 meta-elphel393
cd meta-elphel393; git checkout 9e09294803fc370657424235b395d205dd0994a3; cd ..

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

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

BBLAYERS_CONF="conf/bblayers.conf"

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

LOCAL_CONF="conf/local.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

Notes

Build bootloader

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

Output

Notes

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

Build kernel

bitbake linux-xlnx
or
bitbake virtual/kernel

Output

Notes

poky/build/tmp/work/MACHINE-poky-linux-gnueabi/linux-xlnx/.../linux

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

Output

Notes

  • Current packages:
elphel393.bb:
IMAGE_INSTALL = "packagegroup-core-boot python-core ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
  • Also works:
elphel393.bb:
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
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 \
                       php-cli"
    • Why php-cli and not just php?
meta-oe/meta-oe/recipes-devtools/php/php.inc:
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=192.168.1.10 earlyprintk ramdisk_size=65536";
zynq_zed.h:
"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

meta-elphel393/
    recipes-kernel/
        linux/
            linux-xlnx_3.8.bb
            linux-xlnx.inc
            linux-xlnx/
                elphel393_defconfig_3.8.cfg
                elphel393.dts
                xilinx_nandps.patch

bitbake linux-xlnx

poky/build/tmp/work/elphel393-poky-linux-gnueabi/linux-xlnx/.../linux/

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

http://www.denx.de/wiki/DULG/Appendix

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" 
BB_GENERATE_MIRROR_TARBALLS = "1"
  • 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" 
#BB_GENERATE_MIRROR_TARBALLS = "1"

Personal tools
Namespaces
Variants
Actions
Navigation
Toolbox