Yocto Raspberry Pi

From Flav's Wiki
Jump to: navigation, search

Read

Read this links:

  1. http://framboisepi.fr/construction-dune-image-raspberry-pi-avec-le-bsp-yocto-v2/[1]
  2. http://mytechpg.blogspot.fr/2013/06/raspberrypi-and-yocto.html[2]
  3. https://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html[3]
  4. http://www.pimpmypi.com/blog/blogPost.php?blogPostID=7[4]
  5. http://www.lembarque.com/fichiers/cms/file/Ficheux%20Yocto_RPi.pdf[5]
  6. http://www.cnx-software.com/2013/07/05/12mb-minimal-image-for-raspberry-pi-using-the-yocto-project/[6]

First Build

This build is based on [1]

Get the package

Base on what I've found on internet I've created a this download script

getyocto

#
#http://framboisepi.fr/construction-dune-image-raspberry-pi-avec-le-bsp-yocto-v2/
#
git clone -b dora git://git.yoctoproject.org/poky.git
cd poky
git clone -b dora git://git.yoctoproject.org/meta-raspberrypi

Run it then:

git clone -b dora https://github.com/openembedded/meta-oe.git

Build

source oe-init-build-env raspberryPiBuild/
vi conf/local.conf
vi conf/bblayers.conf

Set this:

BLAYERS ?= " \
  /home/flav/raspberrypi/poky/meta \
  /home/flav/raspberrypi/poky/meta-yocto \
  /home/flav/raspberrypi/poky/meta-yocto-bsp \
  /home/flav/raspberrypi/poky/meta-raspberrypi \
  /home/flav/raspberrypi/poky/meta-oe/meta-oe \
  "

Then:

bitbake core-image-minimal

This will take a lot of time and use about 16GB of disk. My build failed several times by lack of space. To save space durring build set INHERIT += "rm_work" in conf file.

Install

Write the image to disk:

cd cd tmp/deploy/images/raspberrypi/
dd bs=1M if=core-image-minimal-raspberrypi.rpi-sdimg of=/dev/sdb


Image fails: When rebooting the RPi when tring to log with root it can't set group.

Second Build

Download

. getyocto

Download of meta OpenEmbedded

git clone -b dora https://github.com/openembedded/meta-oe.git

Configure

source oe-init-build-env raspberryPiBuild/


Changes in conf/local.conf

*** local.conf.orig     2014-04-09 01:21:22.103206722 +0200
--- local.conf  2014-04-09 01:47:17.150917677 +0200
***************
*** 18,28 ****
--- 18,32 ----
  # option determines how many tasks bitbake should run in parallel:
  #
  #BB_NUMBER_THREADS ?= "4"
+ # (Flav) 2 tasks in parallel for my little machine
+ BB_NUMBER_THREADS ?= "2"
  #
  # The second option controls how many processes make should run in parallel when
  # running compile tasks:
  #
  #PARALLEL_MAKE ?= "-j 4"
+ # (Flav) 2 processes for compile
+ PARALLEL_MAKE ?= "-j 2"
  #
  # For a quad-core machine, BB_NUMBER_THREADS = "4", PARALLEL_MAKE = "-j 4" would
  # be appropriate for example.
***************
*** 47,52 ****
--- 51,60 ----
  #MACHINE ?= "genericx86-64"
  #MACHINE ?= "mpc8315e-rdb"
  #MACHINE ?= "routerstationpro"
+
+ # (Flav) our machine is Raspberry Pi
+ MACHINE ?= "raspberrypi"
+
  #
  # This sets the default machine to be qemux86 if no other machine is selected:
  MACHINE ??= "qemux86"
***************
*** 63,69 ****
  # The default is a downloads directory under TOPDIR which is the build directory.
  #
  #DL_DIR ?= "${TOPDIR}/downloads"
!
  #
  # Where to place shared-state files
  #
--- 71,78 ----
  # The default is a downloads directory under TOPDIR which is the build directory.
  #
  #DL_DIR ?= "${TOPDIR}/downloads"
! # (Flav) do download once only
! DL_DIR ?= "/media/rpi_make/raspberrypi/poky_downloads"
  #
  # Where to place shared-state files
  #
***************
*** 119,125 ****
  #  - 'package_rpm' for rpm style packages
  # E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
  # We default to rpm:
! PACKAGE_CLASSES ?= "package_rpm"

  #
  # SDK/ADT target architecture
--- 128,136 ----
  #  - 'package_rpm' for rpm style packages
  # E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
  # We default to rpm:
! #PACKAGE_CLASSES ?= "package_rpm"
! # (Flav) I like .deb
! PACKAGE_CLASSES ?= "package_deb"

  #
  # SDK/ADT target architecture
***************
*** 233,235 ****
--- 244,251 ----
  # track the version of this file when it was generated. This can safely be ignored if
  # this doesn't mean anything to you.
  CONF_VERSION = "1"
+ # (Flav) ??? http://www.pimpmypi.com/blog/blogPost.php?blogPostID=7 ??? Finally, we need to hide some packages (recipes) from bitbake as they're not yet compatible with the meta-yocto/oe-core layers we are using. So add the following line right at the bottom of the file:
+ # is this still needed?
+ BBMASK = "meta-raspberrypi/recipes-multimedia/libav|meta-raspberrypi/recipes-core/systemd"
+ # delete build files
+ INHERIT += "rm_work"
*** bblayers.conf.orig  2014-04-09 01:51:24.180142252 +0200
--- bblayers.conf       2014-04-09 01:52:18.836412792 +0200
***************
*** 9,14 ****
--- 9,16 ----
    /media/rpi_make/raspberrypi/poky/meta \
    /media/rpi_make/raspberrypi/poky/meta-yocto \
    /media/rpi_make/raspberrypi/poky/meta-yocto-bsp \
+   /media/rpi_make/raspberrypi/poky/meta-raspberrypi \
+   /media/rpi_make/raspberrypi/poky/meta-oe/meta-oe \
    "
  BBLAYERS_NON_REMOVABLE ?= " \
    /media/rpi_make/raspberrypi/poky/meta \

Install

cd tmp/deploy/images/raspberrypi/
dd bs=1M if=core-image-minimal-raspberrypi.rpi-sdimg of=/dev/sdb

Result

it works

Build 3

This build is based on [5]

Download

We no not download one more time just create a different build directory

cd /media/rpi_make/raspberrypi/poky

Configure

. ./oe-init-build-env rpi-build
*** local.conf.orig     2014-04-09 21:26:52.605873993 +0200
--- local.conf  2014-04-09 21:29:57.034788340 +0200
***************
*** 18,28 ****
--- 18,30 ----
  # option determines how many tasks bitbake should run in parallel:
  #
  #BB_NUMBER_THREADS ?= "4"
+ BB_NUMBER_THREADS ?= "2"
  #
  # The second option controls how many processes make should run in parallel when
  # running compile tasks:
  #
  #PARALLEL_MAKE ?= "-j 4"
+ PARALLEL_MAKE ?= "-j 2"
  #
  # For a quad-core machine, BB_NUMBER_THREADS = "4", PARALLEL_MAKE = "-j 4" would
  # be appropriate for example.
***************
*** 47,52 ****
--- 49,55 ----
  #MACHINE ?= "genericx86-64"
  #MACHINE ?= "mpc8315e-rdb"
  #MACHINE ?= "routerstationpro"
+ MACHINE ?= "raspberrypi"
  #
  # This sets the default machine to be qemux86 if no other machine is selected:
  MACHINE ??= "qemux86"
***************
*** 63,68 ****
--- 66,72 ----
  # The default is a downloads directory under TOPDIR which is the build directory.
  #
  #DL_DIR ?= "${TOPDIR}/downloads"
+ DL_DIR ?= "/media/rpi_make/raspberrypi/poky_downloads"

  #
  # Where to place shared-state files
***************
*** 119,125 ****
  #  - 'package_rpm' for rpm style packages
  # E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
  # We default to rpm:
! PACKAGE_CLASSES ?= "package_rpm"

  #
  # SDK/ADT target architecture
--- 123,130 ----
  #  - 'package_rpm' for rpm style packages
  # E.g.: PACKAGE_CLASSES ?= "package_rpm package_deb package_ipk"
  # We default to rpm:
! #PACKAGE_CLASSES ?= "package_rpm"
! PACKAGE_CLASSES ?= "package_deb"

  #
  # SDK/ADT target architecture
***************
*** 233,235 ****
--- 238,241 ----
  # track the version of this file when it was generated. This can safely be ignored if
  # this doesn't mean anything to you.
  CONF_VERSION = "1"
+ INHERIT += "rm_work"
*** bblayers.conf.orig  2014-04-09 21:32:17.739486043 +0200
--- bblayers.conf       2014-04-09 21:32:52.971660904 +0200
***************
*** 9,14 ****
--- 9,15 ----
    /media/rpi_make/raspberrypi/poky/meta \
    /media/rpi_make/raspberrypi/poky/meta-yocto \
    /media/rpi_make/raspberrypi/poky/meta-yocto-bsp \
+   /media/rpi_make/raspberrypi/poky/meta-raspberrypi \
    "
  BBLAYERS_NON_REMOVABLE ?= " \
    /media/rpi_make/raspberrypi/poky/meta \

Build

bitbake rpi-basic-image

or if you want to know exact duration:

/usr/bin/time -f "\n%E elapsed,\n%U user,\n%S system,\n%M memory\n%x status" bitbake rpi-basic-image

Install

cd tmp/deploy/images/raspberrypi/
dd bs=1M if=rpi-basic-image-raspberrypi.rpi-sdimg of=/dev/sdb

References

  1. 1.0 1.1 http://framboisepi.fr/construction-dune-image-raspberry-pi-avec-le-bsp-yocto-v2/
  2. http://mytechpg.blogspot.fr/2013/06/raspberrypi-and-yocto.html
  3. https://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html
  4. http://www.pimpmypi.com/blog/blogPost.php?blogPostID=7
  5. 5.0 5.1 http://www.lembarque.com/fichiers/cms/file/Ficheux%20Yocto_RPi.pdf
  6. http://www.cnx-software.com/2013/07/05/12mb-minimal-image-for-raspberry-pi-using-the-yocto-project/