Difference between revisions of "Poky manual"

From ElphelWiki
Jump to: navigation, search
(Required packages)
(Setup)
Line 70: Line 70:
 
*  
 
*  
 
<font size='2'>
 
<font size='2'>
  $ git clone https://github.com/Elphel/elphel393.git
+
  git clone https://github.com/Elphel/elphel393.git
  $ cd elphel393
+
  cd elphel393
  $ ./setup.sh
+
  ./setup.sh
  $ cd poky
+
  cd poky
  $ . ./oe-init-build-env
+
  . ./oe-init-build-env
  $ bitbake u-boot device-tree linux-xlnx core-image-elphel393
+
  bitbake u-boot device-tree linux-xlnx core-image-elphel393
 
</font>
 
</font>
  

Revision as of 17:04, 13 May 2016

Description

  • Building embedded Linux image for Zynq ARMv7 platform - Elphel 10393 board

About

  • Yocto Poky revision = 2.0
  • Host OS = Kubuntu 14.04.3 LTS x64

Required packages

Ubuntu and Debian

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

Fedora

    sudo dnf install gawk make wget tar bzip2 gzip python unzip perl patch \
    diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath \
    ccache perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue socat \
    findutils which SDL-devel xterm
                       

OpenSUSE

    sudo zypper install python gcc gcc-c++ git chrpath make wget python-xml \
    diffstat makeinfo python-curses patch socat libSDL-devel xterm
                       

CentOS

    sudo yum install gawk make wget tar bzip2 gzip python unzip perl patch \
    diffutils diffstat git cpp gcc gcc-c++ glibc-devel texinfo chrpath socat \
    perl-Data-Dumper perl-Text-ParseWords perl-Thread-Queue SDL-devel xterm

Output files

Found in the poky's deploy directory:

  • files for rootfs in NAND Flash: poky/build/tmp/deploy/images/elphel393/nand/
  • files for rootfs on MMC (micro SD card): poky/build/tmp/deploy/images/elphel393/mmc/

These names are listed 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 = Secondary Program Loader that boots u-boot-dtb.img
  • u-boot-dtb.img - full size u-boot with a stripped device tree (cat u-boot.img some_stripped_devicetree.dtb > u-boot-dtb.img)
  • devicetree.dtb - device tree with listed interfaces, zynq registers, interrupts and drivers
  • uImage - kernel, drivers
  • rootfs.ubifs or rootfs.tar.gz - rootfs

Boot options

Boot from micro SD card (rootfs)

  • The micro SD card/adapter must be modified for this boot mode (to keep CD pin high) - only then the camera will boot
  • EXT4 partition mounted as /
  • Detailed instructions

Boot from NAND flash (rootfs)

  • The default boot option - power on.
  • A UBIFS image is written to /dev/mtd4 - is mounted as /
  • Detailed instructions

Notes

  • It is possible to unpack rootfs to RAM not mounting any partitions (/ in RAM, ramdisk):
    • Changes are not stored
    • Boot faster?
    • Work faster?
    • Modify env commands in the u-boot (in elphel393.h or when in the u-boot command line)
    • Carefully check the actual and hardcoded images' sizes in the u-boot (elphel393.h) and the device tree (elphel393_xxx.dts) with the actual sizes.

Setup

git clone https://github.com/Elphel/elphel393.git
cd elphel393
./setup.sh
cd poky
. ./oe-init-build-env
bitbake u-boot device-tree linux-xlnx core-image-elphel393

Build bootloader

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

Output

  • poky/build/tmp/deploy/images/<machine>/boot.bin
  • poky/build/tmp/deploy/images/<machine>/u-boot-dtb.img

Notes

  • Since Poky 1.5.1 switched from u-boot-xlnx to u-boot - some of the u-boot-xlnx reached the upstream
  • Since Poky 1.5.1 u-boot introduced Kconfig and currently (as of 2016/01/22) is still migrating from autoconf - keeping both build methods working together.
  • Current u-boot uses the board's device tree blob to make a stripped version for itself - uncompiled device tree files are present in the u-boot sources

Compile devicetree

bitbake device-tree

Output

  • poky/build/tmp/deploy/images/<machine>/devicetree.dtb

Build kernel

bitbake linux-xlnx
or
bitbake virtual/kernel

Output

  • poky/build/tmp/deploy/images/<machine>/uImage (kernel)

Notes

  • Kernel version is 4.0, linux-xlnx
  • Device Tree Blob is compiled separately in linux-xlnx
  • Uncompiled device tree files are present in the linux sources provided by linux-xlnx

Build ramdisk.image.gz

bitbake core-image-elphel393

Output

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


Notes

  • [FIXED] lighttpd-1.4.39, mod-cgi

compile warning:

implicit declaration of function 'chunkqueue_written'

results in lighttpd failing to start if mod-cgi is enabled:

Starting Lighttpd Web Server: 2016-01-26 18:42:17: (/data/GIT_fresh/poky/build/tmp/work/cortexa9-vfp-neon-poky-linux-gnueabi/lighttpd/1.4.36-r0/lighttpd-1.4.36/src/plugin.c.169) dlopen() failed for: /usr/lib/mod_cgi.so /usr/lib/mod_cgi.so: undefined symbol: chunkqueue_w 
2016-01-26 18:42:17: (/data/GIT_fresh/poky/build/tmp/work/cortexa9-vfp-neon-poky-linux-gnueabi/lighttpd/1.4.36-r0/lighttpd-1.4.36/src/server.c.679) loading plugins finally failed 
lighttpd.

Note: why 1.4.36?!!

solution: exclude the 0001-mod_cgi-buffers-data-without-bound.patch from the file list that comes with the poky/meta/recipes-extended/lighttpd_1.4.39.bb