Difference between revisions of "Yocto"

From ArchWiki
Jump to navigation Jump to search
m (Updated the summary)
(Attempt to make the page more clear, by reworking it.)
Line 8: Line 8:
 
== Installation ==
 
== Installation ==
  
 +
[[Install]] the {{Pkg|git}}, {{Pkg|diffstat}}, {{Pkg|unzip}}, {{Pkg|texinfo}}, {{Pkg|python2}}, {{Pkg|chrpath}}, {{Pkg|wget}}, {{Pkg|xterm}}, {{Pkg|sdl}}, {{Pkg|socat}} and {{Pkg|cpio}} packages.
  
=== Multilib ===
+
[[Install]] the {{Pkg|gcc-multilib}} package from the official [[multilib]] repository.
 
 
[[Multilib#Enabling|Enable Multilib]] repository by uncommenting both of these lines in /etc/pacman.conf
 
 
 
[multilib]
 
Include = /etc/pacman.d/mirrorlist
 
 
 
Then update the package list and upgrade with {{ic|pacman -Syu}}.
 
 
 
=== Install dependencies ===
 
 
 
pacman -S git diffstat unzip texinfo python2 chrpath \
 
          gcc-multilib wget xterm sdl socat cpio
 
 
 
 
You may recieve the following conflicts
 
You may recieve the following conflicts
  
Line 30: Line 18:
 
Resolve these by choosing 'y' (we actually want the multilib versions)
 
Resolve these by choosing 'y' (we actually want the multilib versions)
  
 
+
Clone the official git repository. In this example the '''fido''' branch is used.
== Test your installation ==
 
 
 
In order to test that yocto is properly working, we will build '''core-image-minimal'''
 
 
 
=== Clone the git repository ===
 
 
 
Before we begin we need to clone the official git repository. Here we will use the '''fido''' branch.
 
  
 
  $ git clone --branch fido git://git.yoctoproject.org/poky.git poky
 
  $ git clone --branch fido git://git.yoctoproject.org/poky.git poky
  
=== python2 ===
+
YP Core requires the use of {{Pkg|python2}}, from the [[Python#Python_2|Python]] page
  
Yocto currently requires the use of python2, but the default in Arch Linux is python3.
+
$ mkdir -p ~/bin
In the [[Python#Python_2|Python]] page there is an explanation about how to trick the environment.
+
$ ln -s /usr/bin/python2 ~/bin/python
 +
$ ln -s /usr/bin/python2-config ~/bin/python-config
 +
$ export PATH=~/bin/python2:$PATH
  
We will do almost the same, but also add a simple script file so that it can be easily sourced later.
+
== Build core-image-minimal ==
  
$ mkdir -p ~/bin/python2
+
Time to build the '''core-image-minimal''' target. First place yourself in the {{ic|poky}} directory and source the environment script. Then build it with {{ic|bitbake}}
$ ln -s /usr/bin/python2 ~/bin/python2/python
 
$ ln -s /usr/bin/python2-config ~/bin/python2/python-config
 
  
Now create the file {{ic|~/bin/python2-env}} and insert the following text within it
+
$ cd poky
 +
$ source oe-init-build-env build-qemux86
  
export PATH=~/bin/python2:$PATH
 
 
=== Setup and build the minimal image ===
 
 
First you need to source the '''python2-env''' file we just created and then initialize the yocto environment.
 
In the example below we create a folder named '''build-qemux86''', the source command will also place you in this folder.
 
From here we can now build the '''core-image-minimal'''.
 
 
$ cd poky
 
$ source ~/bin/python2-env && source oe-init-build-env build-qemux86
 
 
  $ bitbake core-image-minimal
 
  $ bitbake core-image-minimal
 +
 
  WARNING: Host distribution "Arch-Linux" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
 
  WARNING: Host distribution "Arch-Linux" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
 
  Parsing recipes: 100%
 
  Parsing recipes: 100%
Line 92: Line 65:
 
   
 
   
 
  Summary: There were 2 WARNING messages shown.
 
  Summary: There were 2 WARNING messages shown.
 +
  
 
This will take some time to complete. For more details about yocto there is a [http://www.yoctoproject.org/docs/1.8/yocto-project-qs/yocto-project-qs.html Quick Start Guide]
 
This will take some time to complete. For more details about yocto there is a [http://www.yoctoproject.org/docs/1.8/yocto-project-qs/yocto-project-qs.html Quick Start Guide]
Line 97: Line 71:
 
The first warning about Arch Linux not been validated is expected. The second warning can happen when failing to download a resource, the build system will then attempt to get that resource from the next mirror.
 
The first warning about Arch Linux not been validated is expected. The second warning can happen when failing to download a resource, the build system will then attempt to get that resource from the next mirror.
  
=== Run the image in QEMU ===
+
== Run core-image-minimal in QEMU ==
  
 
To run this image in QEMU, start it with the '''runqemu''' command as follows
 
To run this image in QEMU, start it with the '''runqemu''' command as follows
 
  
 
  $ runqemu qemux86
 
  $ runqemu qemux86

Revision as of 12:59, 5 August 2015

Tango-edit-clear.pngThis article or section needs language, wiki syntax or style improvements. See Help:Style for reference.Tango-edit-clear.png

Reason: Several Help:Style issues. (Discuss in Talk:Yocto#)

The Yocto Project (YP) is a popular open-source collaboration project focused on embedded Linux developers. In early versions of YP it could be problematic to get it running on Arch Linux. In later versions this is no longer the case, and hopefully in the future it will be even easier. For information about how to get it running on older version, there is a good guide here.

For this guide the focus will be on YP Core 1.8 (Fido) and newer. Note that Arch Linux is still not validated to work with Yocto/Poky.

Installation

Install the git, diffstat, unzip, texinfo, python2, chrpath, wget, xterm, sdl, socat and cpio packages.

Install the gcc-multilib package from the official multilib repository. You may recieve the following conflicts

:: gcc-multilib and gcc are in conflict. Remove gcc? [y/N] y
:: gcc-libs-multilib and gcc-libs are in conflict. Remove gcc-libs? [y/N] y

Resolve these by choosing 'y' (we actually want the multilib versions)

Clone the official git repository. In this example the fido branch is used.

$ git clone --branch fido git://git.yoctoproject.org/poky.git poky

YP Core requires the use of python2, from the Python page

$ mkdir -p ~/bin
$ ln -s /usr/bin/python2 ~/bin/python
$ ln -s /usr/bin/python2-config ~/bin/python-config
$ export PATH=~/bin/python2:$PATH

Build core-image-minimal

Time to build the core-image-minimal target. First place yourself in the poky directory and source the environment script. Then build it with bitbake

$ cd poky
$ source oe-init-build-env build-qemux86
$ bitbake core-image-minimal

WARNING: Host distribution "Arch-Linux" has not been validated with this version of the build system; you may possibly experience unexpected failures. It is recommended that you use a tested distribution.
Parsing recipes: 100%
|########################################################################################################################################################################################################################################################################################| Time: 00:02:42
Parsing of 884 .bb files complete (0 cached, 884 parsed). 1285 targets, 41 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies

Build Configuration:
BB_VERSION        = "1.26.0"
BUILD_SYS         = "x86_64-linux"
NATIVELSBSTRING   = "Arch-Linux"
TARGET_SYS        = "i586-poky-linux"
MACHINE           = "qemux86"
DISTRO            = "poky"
DISTRO_VERSION    = "1.8"
TUNE_FEATURES     = "m32 i586"
TARGET_FPU        = ""
meta              
meta-yocto        
meta-yocto-bsp    = "fido:08d32590411568e7bf11612ac695a6e9c6df6286"

NOTE: Preparing RunQueue
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: Failed to fetch URL http://downloads.sourceforge.net/project/libpng/libpng16/1.6.16/libpng-1.6.16.tar.xz, attempting MIRRORS if available
NOTE: Tasks Summary: Attempted 1989 tasks of which 9 didn't need to be rerun and all succeeded.

Summary: There were 2 WARNING messages shown.


This will take some time to complete. For more details about yocto there is a Quick Start Guide

The first warning about Arch Linux not been validated is expected. The second warning can happen when failing to download a resource, the build system will then attempt to get that resource from the next mirror.

Run core-image-minimal in QEMU

To run this image in QEMU, start it with the runqemu command as follows

$ runqemu qemux86

Continuing with the following parameters:
KERNEL: [/home/user/poky/build-qemux86/tmp/deploy/images/qemux86/bzImage-qemux86.bin]
ROOTFS: [/home/user/poky/build-qemux86/tmp/deploy/images/qemux86/core-image-minimal-qemux86-20150804095542.rootfs.ext4]
FSTYPE: [ext4]
Setting up tap interface under sudo
[sudo] password for user: 
Acquiring lockfile for tap0...
Running qemu-system-i386...
/home/user/poky/build-qemux86/tmp/sysroots/x86_64-linux/usr/bin/qemu-system-i386 -kernel /home/user/poky/build-qemux86/tmp/deploy/images/qemux86/bzImage-qemux86.bin -net nic,vlan=0 -net tap,vlan=0,ifname=tap0,script=no,downscript=no -cpu qemu32 -hda /home/user/poky/build-qemux86/tmp/deploy/images/qemux86/core-image-minimal-qemux86-20150804095542.rootfs.ext4 -show-cursor -usb -usbdevice wacom-tablet -vga vmware -no-reboot -m 256 --append "vga=0 uvesafb.mode_option=640x480-32 root=/dev/hda rw mem=256M ip=192.168.7.2::192.168.7.1:255.255.255.0 oprofile.timer=1 rootfstype=ext4 "
Set 'tap0' nonpersistent
Releasing lockfile of preconfigured tap device 'tap0'

If you have updated the host kernel (ie pacman -Syyu) but not rebooted your system, then you will most likely get into problems with tunctl. The solution is simple, reboot.