Difference between revisions of "Yocto"

From ArchWiki
Jump to navigation Jump to search
m (added inetutils package (provides hostname) whereas it is no longer installed with base)
 
(14 intermediate revisions by 11 users not shown)
Line 1: Line 1:
 
[[Category:Development]]
 
[[Category:Development]]
{{Style|Several [[Help:Style]] issues.}}
+
[[ja: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 [http://wor.github.io/bash/2013/08/11/embedded-excursions-part-1.html here].
  
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 [http://wor.github.io/bash/2013/08/11/embedded-excursions-part-1.html here].
+
To use bitbake as a standalone tool, install {{AUR|bitbake}}. To edit bitbake recipes in vim, install {{AUR|bitbake-vim}}.
  
 
For this guide the focus will be on YP Core 1.8 (Fido) and newer.
 
For this guide the focus will be on YP Core 1.8 (Fido) and newer.
  
 
{{Note|Arch Linux is not validated to work with Yocto/Poky.}}
 
{{Note|Arch Linux is not validated to work with Yocto/Poky.}}
 +
{{Note|From YP Core 2.2 (Morty) and newer python3 is supported}}
  
 
== 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.
+
[[Install]] the {{Pkg|git}}, {{Pkg|diffstat}}, {{Pkg|unzip}}, {{Pkg|texinfo}}, {{Pkg|python}}, {{Pkg|chrpath}}, {{Pkg|wget}}, {{Pkg|xterm}}, {{Pkg|sdl}}, {{Pkg|rpcsvc-proto}}, {{Pkg|socat}}, {{Pkg|cpio}} and {{Pkg|inetutils}} packages.
 
 
{{Note| For the 64-bit version of Arch Linux, [[Install]] the {{Pkg|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)
+
Enable the [[multilib]] repository and install the {{Grp|multilib-devel}} group.
}}
 
  
Clone the official git repository. In this example the '''fido''' branch is used.
+
Clone the official git repository. In this example the ''morty'' branch is used.
  
  $ <nowiki>git clone --branch fido git://git.yoctoproject.org/poky.git ~/poky</nowiki>
+
  $ <nowiki>git clone --branch morty git://git.yoctoproject.org/poky.git ~/poky</nowiki>
  
YP Core requires the use of {{Pkg|python2}}, from the [[Python#Python_2|Python]] page
+
=== YP Core from Fido but before Morty ===
 +
YP Core required {{Pkg|python2}}, from the [[Python#Python_2|Python]] page:
  
 
  $ mkdir -p ~/bin
 
  $ mkdir -p ~/bin
 
  $ ln -s /usr/bin/python2 ~/bin/python
 
  $ ln -s /usr/bin/python2 ~/bin/python
 
  $ ln -s /usr/bin/python2-config ~/bin/python-config
 
  $ ln -s /usr/bin/python2-config ~/bin/python-config
  $ export PATH=~/bin/python2:$PATH
+
  $ export PATH=~/bin:$PATH
 +
 
 +
{{Note|You will probably not get notified with '''any message''' if building the environment script fails because of invalid Python version.}}
  
 
== Build core-image-minimal ==
 
== Build core-image-minimal ==
  
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}}
+
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 ''bitbake'':
  
 
  $ cd ~/poky
 
  $ cd ~/poky
 
  $ source oe-init-build-env build-qemux86
 
  $ source oe-init-build-env build-qemux86
 +
 
{{Tip|
 
{{Tip|
In {{ic|~/poky/build-qemux86/conf/local.conf}}
+
In {{ic|~/poky/build-qemux86/conf/local.conf}}:
* Change the directory for downloads in order to reuse them, example {{ic|<nowiki>DL_DIR ?= "~/poky-downloads"</nowiki>}}
+
* Change the directory for downloads in order to reuse them, example {{ic|<nowiki>DL_DIR ?= "~/poky-downloads"</nowiki>}}.
* The build system can use a substantial amount of disk space during the build process, in order to preserve disk space add the line {{ic|<nowiki>INHERIT += "rm_work"</nowiki>}}}}
+
* The build system can use a substantial amount of disk space during the build process, in order to preserve disk space add the line {{ic|<nowiki>INHERIT += "rm_work"</nowiki>}}.}}
$ 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.
 
  
 +
{{hc|$ bitbake core-image-minimal|<nowiki>
 +
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
  
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]
+
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.
 +
</nowiki>}}
 +
 
 +
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].
  
 
{{Note|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.}}
 
{{Note|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.}}
Line 79: Line 78:
 
== Run core-image-minimal ==
 
== Run core-image-minimal ==
  
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
+
{{hc|$ runqemu qemux86|2=
+
Continuing with the following parameters:
Continuing with the following parameters:
+
KERNEL: [/home/user/poky/build-qemux86/tmp/deploy/images/qemux86/bzImage-qemux86.bin]
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]
ROOTFS: [/home/user/poky/build-qemux86/tmp/deploy/images/qemux86/core-image-minimal-qemux86-20150804095542.rootfs.ext4]
+
FSTYPE: [ext4]
FSTYPE: [ext4]
+
Setting up tap interface under sudo
Setting up tap interface under sudo
+
[sudo] password for user:  
[sudo] password for user:  
+
Acquiring lockfile for tap0...
Acquiring lockfile for tap0...
+
Running qemu-system-i386...
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 "
/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
Set 'tap0' nonpersistent
+
Releasing lockfile of preconfigured tap device 'tap0'
Releasing lockfile of preconfigured tap device 'tap0'
+
}}
  
{{Tip| If the kernel was recently updated, rebooting might help you avoid issues with tunctl}}
+
{{Tip| If the kernel was recently updated, rebooting might help you avoid issues with ''tunctl''.}}

Latest revision as of 17:04, 9 October 2019

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.

To use bitbake as a standalone tool, install bitbakeAUR. To edit bitbake recipes in vim, install bitbake-vimAUR.

For this guide the focus will be on YP Core 1.8 (Fido) and newer.

Note: Arch Linux is not validated to work with Yocto/Poky.
Note: From YP Core 2.2 (Morty) and newer python3 is supported

Installation

Install the git, diffstat, unzip, texinfo, python, chrpath, wget, xterm, sdl, rpcsvc-proto, socat, cpio and inetutils packages.

Enable the multilib repository and install the multilib-devel group.

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

$ git clone --branch morty git://git.yoctoproject.org/poky.git ~/poky

YP Core from Fido but before Morty

YP Core required 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:$PATH
Note: You will probably not get notified with any message if building the environment script fails because of invalid Python version.

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

In ~/poky/build-qemux86/conf/local.conf:

  • Change the directory for downloads in order to reuse them, example DL_DIR ?= "~/poky-downloads".
  • The build system can use a substantial amount of disk space during the build process, in order to preserve disk space add the line INHERIT += "rm_work".
$ 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.

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

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'
Tip: If the kernel was recently updated, rebooting might help you avoid issues with tunctl.