Difference between revisions of "Yocto tests"

From ElphelWiki
Jump to: navigation, search
m
m
(30 intermediate revisions by the same user not shown)
Line 1: Line 1:
==About==
+
==<font color="blue">About</font>==
 
* All of the described things happen in Kubuntu 13.04
 
* All of the described things happen in Kubuntu 13.04
 
* Building Linux images for Zynq platform - ARMv7
 
* Building Linux images for Zynq platform - ARMv7
  
==GIT==
+
 
 +
 
 +
==<font color="blue">Output targets</font>==
 +
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.
 +
 
 +
 
 +
 
 +
==<font color="blue">Setup</font>==
 +
* Step 1:
 
<font size='2'>
 
<font size='2'>
 
  git clone -b dylan git://git.yoctoproject.org/poky.git
 
  git clone -b dylan git://git.yoctoproject.org/poky.git
  git clone -b dylan https://github.com/Xilinx/meta-xilinx.git meta-xilinx
+
  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-elphel393 meta-elphel393
 +
git clone git://git.code.sf.net/p/elphel/meta-ezynq meta-ezynq
 +
git clone -b dylan https://github.com/openembedded/meta-oe.git
 
</font>
 
</font>
 
+
* Step 2: Init environment
==Configure==
 
* Step 1: Init environment
 
 
<font size='2'>
 
<font size='2'>
 
  cd poky
 
  cd poky
 
  . ./oe-init-build-env
 
  . ./oe-init-build-env
 
</font>
 
</font>
* Step 2: Edit ''build/conf/bblayers.conf'' - add paths to BBLAYERS:
+
* Step 3: Edit ''build/conf/bblayers.conf'' - add paths to BBLAYERS:
 
<font size='2'>
 
<font size='2'>
  <absolute-path>/meta-xilinx \
+
  <absolute-path>/poky/meta-elphel393 \
  <absolute-path>/meta-xilinx/meta-zedboard \
+
<absolute-path>/poky/meta-ezynq \
  <absolute-path>/meta-elphel393 \
+
  <absolute-path>/poky/meta-oe/meta-oe \
 +
  <absolute-path>/poky/meta-oe/meta-webserver \
 
</font>
 
</font>
* Step 3: Edit ''build/conf/local.conf'' - set MACHINE and other things:
+
* Step 4: Edit ''build/conf/local.conf'' - set MACHINE and other things:
 
<font size='2'>
 
<font size='2'>
 
   BB_NUMBER_THREADS = "8" (depends on the PC's CPU)
 
   BB_NUMBER_THREADS = "8" (depends on the PC's CPU)
 
   PARALLEL_MAKE = "-j 8" (depends on the PC's CPU)
 
   PARALLEL_MAKE = "-j 8" (depends on the PC's CPU)
   MACHINE ?= "zedboard"
+
   MACHINE ?= "elphel393" (based on MACHINE="zedboard" )
 +
</font>
 +
 
 +
====Notes====
 +
* Currently having 4 MACHINES: elphel393, microzed, zc706 and zedboard
 +
 
 +
 
 +
 
 +
==<font color="blue">Build ezynq-u-boot</font>==
 +
<font size='2'>
 +
bitbake ezynq-u-boot
 
</font>
 
</font>
 +
====Output====
 +
* poky/build/tmp/deploy/images/'''boot.bin'''
 +
 
====Notes====
 
====Notes====
 
<font color="red">
 
<font color="red">
*MACHINE="zedboard" is used to build the kernel. Doesn't matter for ramdisk.image.gz because the recipes don't have any bbappends for core-images.
+
* Is there a way to build it by running ''bitbake elphel393'' (elphel393 is the name of the ramdisk core image - currently coincides with the name of the MACHINE)
 
</font>
 
</font>
  
==Build kernel==
+
 
 +
 
 +
==<font color="blue">Build kernel</font>==
 
<font size='2'>
 
<font size='2'>
 
  bitbake linux-xlnx
 
  bitbake linux-xlnx
 
</font>
 
</font>
 +
====Output====
 +
* poky/build/tmp/deploy/images/'''uImage''' (kernel)
 +
* poky/build/tmp/deploy/images/'''devicetree.dtb''' (or some *.dtb)
  
 
====Notes====
 
====Notes====
 +
* Sources are cloned to:
 +
<font size='2'>
 +
'''poky/build/tmp/work/MACHINE-poky-linux-gnueabi/linux-xlnx/.../linux'''
 +
</font>
 +
* If you change files like debug drivers for example, when done editing run:
 +
<font size='2'>
 +
bitbake linux-xlnx -c compile
 +
bitbake linux-xlnx -c deploy
 +
</font>
 
<font color="red">
 
<font color="red">
* The '''dtc''' script for converting device tree between *.dts and *.dtb formats is built along with the kernel.
+
* When linux-xlnx is 'clean' it is built with the ramdisk.image.gz by ''bitbake elphel393'', however the boot.bin does not, why?
 
</font>
 
</font>
  
==Build ramdisk.image.gz==
+
 
 +
 
 +
==<font color="blue">Build ramdisk.image.gz</font>==
 
<font size='2'>
 
<font size='2'>
 
  bitbake elphel393
 
  bitbake elphel393
 
</font>
 
</font>
 +
====Output====
 +
* poky/build/tmp/deploy/images/'''uramdisk.image.gz''' (the file has *.u-boot extension after it's built)
 +
 
====Notes====
 
====Notes====
 
<font size='2'>
 
<font size='2'>
Line 57: Line 105:
 
  IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
 
  IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
 
  IMAGE_INSTALL_append = "python-core"
 
  IMAGE_INSTALL_append = "python-core"
* Why ''python-core'' and not just ''python''?
+
* 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
+
** ''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.
 
** 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.
 
** Does '''hob''' install all the PACKAGES if ''python'' is checked? Haven't tried, also the used '''hob''' version doesn't support saving recipes.
* '''(Is there a better solution?)''' Adding packages : '''apache2''', '''php''', '''i2c-tools''', '''mtd-utils''', '''net-tools''' steps:
+
* Steps for adding packages:
**Clone '''meta-oe''' from OpenEmbedded:
 
git clone -b dylan https://github.com/openembedded/meta-oe.git
 
**Lines to ''bblayers.conf'':
 
    <absolute-path>/meta-oe/meta-oe \
 
    <absolute-path>/poky/meta-oe/meta-perl \
 
    <absolute-path>/poky/meta-oe/meta-webserver \
 
 
** ''elphel393.bb'' '''(some discussions mention the leading space is mandatory but somehow it works even without it)''':
 
** ''elphel393.bb'' '''(some discussions mention the leading space is mandatory but somehow it works even without it)''':
 
  IMAGE_INSTALL_append = "'''<mandatory space?>'''python-core \
 
  IMAGE_INSTALL_append = "'''<mandatory space?>'''python-core \
Line 73: Line 115:
 
                         mtd-utils \
 
                         mtd-utils \
 
                         net-tools \
 
                         net-tools \
 +
                        openssh \
 
                         modphp \
 
                         modphp \
 
                         apache2 \
 
                         apache2 \
Line 79: Line 122:
 
  meta-oe/meta-oe/recipes-devtools/php/php.inc:
 
  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 = "${PN}-dbg ${PN}-cli ${PN}-cgi ${PN}-fpm ${PN}-fpm-apache2 ${PN}-pear ${PN}-dev ${PN}-staticdev ${PN}-doc ${PN}"
*** PACKAGES includes ''php''. What is installed? (No ''php-cli'': missing /usr/bin/php) Didn't investigate.
+
*** 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.
 
*** What does hob build if ''php'' is checked? Didn't test.
*** Using ''php-cli'' installs php in the /usr/bin/. Tested.
 
 
*** Using ''php-cli'' increases the unpacked image size from ~16MB to ~50MB.
 
*** Using ''php-cli'' increases the unpacked image size from ~16MB to ~50MB.
**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'''="'''Could not inherit file classes/vala.bbclass'''" in bitbake copy vala.bbclass from oe-core? or delete the conflicting recipes (2?)?
**To fix the '''ERROR'''="'''Failed to parse krb5_1.11.3.bb'''" in bitbake delete the directory ''meta-oe/meta-oe/recipes-connectivity/krb5''
+
**'''(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''
 +
</font>
 +
</font>
 
====U-boot and device tree related notes====
 
====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 [http://forums.xilinx.com/t5/Embedded-Linux/Need-bigger-ramdisk-32MB-on-ZC702/m-p/303457#M5775 modifying the device tree] - then recompile into DTB:'''
 
* '''The default UNPACKED ramdisk max size for zynq is 16MB - once it gets bigger you get KERNEL PANIC - the solution is [http://forums.xilinx.com/t5/Embedded-Linux/Need-bigger-ramdisk-32MB-on-ZC702/m-p/303457#M5775 modifying the device tree] - then recompile into DTB:'''
 
  *.dts, add to '''bootargs''' parameter ''ramdisk_size=32768'' (takes KB), example:
 
  *.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=32768'''";
+
  bootargs = "console=ttyPS0,115200 root=/dev/ram rw ip=192.168.1.10 earlyprintk '''ramdisk_size=65536'''";
 
* '''The default COMPRESSED ramdisk max size for zynq is 10MB set in u-boot''' - change according to your needs, example:
 
* '''The default COMPRESSED ramdisk max size for zynq is 10MB set in u-boot''' - change according to your needs, example:
 
  ''zynq_zed.h'':
 
  ''zynq_zed.h'':
Line 102: Line 146:
 
  devicetree = 0x3000000 - 0x2A00000 = 0x600000 = 6MB
 
  devicetree = 0x3000000 - 0x2A00000 = 0x600000 = 6MB
  
</font>
 
</font>
 
  
==Build toolchain==
+
 
 +
==<font color="blue">Build everything all together</font>==
 +
bitbake ezynq-u-boot linux-xlnx elphel393
 +
 
 +
 
 +
 
 +
==<font color="blue">Build toolchain (not necessary)</font>==
 
* Step 1: build
 
* Step 1: build
 
<font size='2'>
 
<font size='2'>
Line 112: Line 160:
  
 
* Step 2: install - launch installer from <some-path>/poky/build/tmp/deploy/
 
* Step 2: install - launch installer from <some-path>/poky/build/tmp/deploy/
 +
 +
 +
 +
==<font color="blue">Add a patch to a recipe</font>==
 +
* Example file tree ([https://sourceforge.net/p/elphel/meta-elphel393 meta-elphel393]):
 +
<font size="2">
 +
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''
 +
</font>
 +
* Goal: apply a patch to linux-xlnx files
 +
* Step 1:
 +
<font size="2">
 +
bitbake linux-xlnx
 +
</font>
 +
* Step 2: Go to where the linux-xlnx got cloned - find and edit the target file:
 +
<font size="2">
 +
poky/build/tmp/work/elphel393-poky-linux-gnueabi/linux-xlnx/.../linux/
 +
</font>
 +
* Step 3: In the mentioned above directory run:
 +
<font size="2">
 +
git diff > somefile.patch
 +
</font>
 +
* 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:
 +
<font size="2">
 +
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"
 +
</font>
 +
* Step 6(?):
 +
<font size="2">
 +
bitbake linux-xlnx -c clean -f
 +
bitbake linux-xlnx
 +
</font>

Revision as of 01:27, 13 November 2013

About

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


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.


Setup

  • Step 1:

git clone -b dylan 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 dylan 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" )

Notes

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


Build ezynq-u-boot

bitbake ezynq-u-boot

Output

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

Notes

  • Is there a way to build it by running bitbake elphel393 (elphel393 is the name of the ramdisk core image - currently coincides with the name of the MACHINE)


Build kernel

bitbake linux-xlnx

Output

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

Notes

  • Sources are cloned to:

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

  • 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 elphel393, however the boot.bin does not, why?


Build ramdisk.image.gz

bitbake elphel393

Output

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

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.
    • (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

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=192.168.1.10 earlyprintk ramdisk_size=65536";
  • The default COMPRESSED ramdisk max size for zynq is 10MB set in u-boot - change according to your needs, example:
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 ezynq-u-boot linux-xlnx elphel393


Build toolchain (not necessary)

  • Step 1: build

bitbake meta-toolchain

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


Add a patch to 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

  • 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:

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

  • 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