Quick Start with Yocto project


The best thing to do is to rely on the Yocto Project documentation, starting with the Yocto Project Quick Start Guide.

Introducing the Yocto Preject Development Environment

yocto-environment

 

 

 

 

 

 

 

 

 

Use a Linux desktop system as a host. The Yocto Project works best with a major desktop distro like OpenSUSE, Fedora, CentOS, or Ubuntu, but (theoretically) can be made to work with any Linux system. Make sure to install all the necessary packages from the distro’s repository – see the Quick Start Guide for a list (scroll down to The Packages).

Downloading the Packages

wget http://downloads.yoctoproject.org/releases/yocto/yocto-1.2/poky-enzil-7.0.tar.bz2;

tar xvjf poky-denzil-7.0.tar.bz2

Alternatively, you can use the following command to get the same release using git:

git -b denzil git://git.yoctoproject.org/poky.git

Build the Packages

In either case, you end up with the Yocto Project build tools, in the form of an instance of the Poky build system. Poky is a reference system for the Yocto Project – it is a working example of the Yocto Project in action.

  1. Create a build directory and set up your working environment correctly with a single command:

    source poky/oe-init-build-env build

    This command sets environment variables, creates and populates a working directory called build as a subdirectory of your current working directory, and makes this new location your working directory. You are all set to build now… almost.

  2. Set up the main build configuration file conf/local.conf for your build. This is easier than it sounds. Simply edit that file and look for the following configuration lines to change or uncomment. Set threads to 2x the number of cores in your host system – for a quad-core host, for example, this number would be 8. This will greatly speed up your build by taking advantage of all available processor cores.

    BB_NUMBER_THREADS = "threads"
    PARALLEL_MAKE = "-j threads"
    MACHINE ?= "qemux86"

    The MACHINE setting specifies a familiar 32-bit Intel architecture with a twist – it is set up automatically to use the QEMU hardware emulator to run your new image without requiring any hardware. Other supported values for this setting are shown in conf/local.conf, including qemuarm as well as a number of hardware architectures.

  3. Build your distro. Note: this can take a while, as BitBake needs to download all the packages it needs for this build, even though we are just using the minimal system. Depending on the speed of your network connection, this can take between 1.5 and 4 hours. Subsequent builds only take about an hour.

    bitbake core-image-minimal

  4. Time to see the results! Boot your new image in a QEMU emulator. After the bootloader messages go past, log in using root, no password needed.

    runqemu qemux86

And that’s it! You have just built and run your embedded Linux distribution

 

Skip to toolbar