I will assume you have a working installation of one of the supported GNU/Linux distributions. The first thing to do is to add the needed packages. For my OpenSUSE distribution it's :
$ sudo zypper install python gcc gcc-c++ git chrpath make wget diffstat texinfo python-curses libSDL-devel xterm
Packages for other distributions can be found here.
Now that you have your packages installed, it's time to install yocto. First go into the appropriate directory and run this command :
$ git clone git://git.yoctoproject.org/poky Cloning into 'poky'... remote: Counting objects: 194352, done. remote: Compressing objects: 100% (49348/49348), done. remote: Total 194352 (delta 140471), reused 194262 (delta 140381) Receiving objects: 100% (194352/194352), 91.93 MiB | 1.28 MiB/s, done. Resolving deltas: 100% (140471/140471), done.
You now have a
poky directory, go in it. As i said before, my computer "target" (the one i want to run the distribution with OpenCPN) is very specific, so i need a specific layer-type : a BSP for i5 Ivy Bridge. If you have other architectures try to look for your processor here. If there isn't any BSP adapted, the distribution will still be working but with generic settings. Get your BSP (git source is preferred, you can find the git repository in READMEs), for me it's :
$ git clone git://git.yoctoproject.org/meta-intel Cloning into 'meta-intel'... remote: Counting objects: 6826, done. remote: Compressing objects: 100% (2481/2481), done. remote: Total 6826 (delta 3653), reused 6626 (delta 3453) Receiving objects: 100% (6826/6826), 2.24 MiB | 831 KiB/s, done. Resolving deltas: 100% (3653/3653), done.
meta-intelBSP actually contains all BSP for Intel processors. You will have to find your "real" BSP layer inside the
meta-inteldirectory, to do this go through all the
READMEfiles in sub folders. For me the BSP is called
Then clone the openembedded repository :
$ git clone git://git.openembedded.org/meta-openembedded
Once you have this, you may download my layer for OpenCPN :
$ git clone https://github.com/alan-mushi/meta-opencpn.git
When you have all your layers you have to configure a bit yocto. Start by execute :
poky$ source oe-init-build-env thinkpad
This script will create a folder named
thinkpad and move into it. You can choose another name or supply none (the default folder is called
build). You will have to execute this command to setup the environment variables and paths. It's actually what you should start to do when you want to work with yocto, thus, i will not write it down in the next pages.
Go into the
conf folder, and edit the two files in it (
bblayers.conf you have to add your BSP and layers in the
BBLAYERS variable. For me it's :
BBLAYERS ?= " \ /home/intel/poky/meta \ /home/intel/poky/meta-yocto \ /home/intel/poky/meta-yocto-bsp \ /home/intel/poky/meta-intel \ /home/intel/poky/meta-intel/meta-chiefriver \ /home/intel/poky/meta-openembedded/meta-oe \ /home/intel/poky/meta-openembedded/meta-systemd \ /home/intel/poky/meta-opencpn \ "
/home/intel/wiki/poky/meta-intel/meta-chiefriverwith your actual BSP layer. You need to set both paths for your BSP (e.g.
meta-intel/meta-chiefriver). The full paths for a lot of things in yocto as to be the full path. You will have to modify my examples to suit your paths.
The second configuration file (
local.conf) handles more options but we will only focus on some. The two first options has to be set to twice the number of cores your processor have. For me it's :
(line 20) BB_NUMBER_THREADS ?= "16" (line 25) PARALLEL_MAKE ?= "-j 16"
Then you specify the machine type (same name as your BSP) :
(line 51) MACHINE ??= "chiefriver"
A last very useful option is the download directory for source code (if you have multiple build environment with
oe-init-build-env you can share the sources files) :
(line 64) DL_DIR ?= "/home/intel/Downloads/yocto"
You also need to add these at the end of the
local.conf file to be more specific about the target's hardware :
MACHINE_FEATURES_append = " acpi alsa apm bluetooth ext2 keyboard pci pcmcia screen touchscreen usbgadget usbhost wifi"
This is it for this file, there is a lot more options in this configuration file, it's well documented so don't be afraid to modify theses options to better suit your needs.
Finally, add those lines to the
meta-yocto/conf/distro/poky.conf file. This will add the software part of the configuration line above and set
systemd as default init manager :
DISTRO_FEATURES_append = " alsa bluetooth ext2 ipsec keyboard pci pcmcia systemd usbgadget usbhost wayland wifi pam" VIRTUAL-RUNTIME_init_manager = "systemd"
Now that our environment is setup, we can build.