Difference between revisions of "Yocto Project my own quick start"

From KoanSoftware Wiki
Jump to: navigation, search
(BitBake requires Python 2.7.3 or later)
(Edit the configuration files)
 
(41 intermediate revisions by 2 users not shown)
Line 1: Line 1:
This page is an excerpt from [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html Yocto Project Quick Start Copyright © 2010-2012 Linux Foundation]
+
This page is an excerpt from [http://www.yoctoproject.org/docs/current/yocto-project-qs/yocto-project-qs.html Yocto Project Quick Start Copyright © 2010-2020 Linux Foundation]
  
  
== The Packages ==
+
== The required packages ==
  
Packages and package installation vary depending on your development system. In general, you need to have root access and then install the required packages. The next few sections show you how to get set up with the right packages for Ubuntu, Fedora, and openSUSE.
+
Packages and package installation vary depending on your development system. In general, you need to have root access and then install the required packages. The next few sections show you how to get set up with the right packages for Ubuntu.
Ubuntu
 
  
If your distribution is Ubuntu, you need to be running the bash shell. You can be sure you are running this shell by entering the following command and selecting "No" at the prompt:
+
If you have different distributions, please refer to the [https://docs.yoctoproject.org/brief-yoctoprojectqs/index.html Yocto Project Documentation]
  
    $ sudo dpkg-reconfigure dash               
+
You must install essential host packages on your build host.
 +
The following command installs the host packages based on an Ubuntu distribution:
  
The packages you need for a supported Ubuntu distribution are shown in the following command:
+
$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath \
 +
socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping \
 +
python3-git python3-jinja2 python3-subunit zstd liblz4-tool file locales libacl1
 +
 +
$ sudo locale-gen en_US.UTF-8
  
    $ sudo apt-get install sed wget cvs subversion git-core coreutils \
+
== Development Code - branch 5.0 'scarthgap' LTS ==
    unzip texi2html texinfo libsdl1.2-dev docbook-utils gawk \
 
    python-pysqlite2 diffstat help2man make gcc build-essential \
 
    g++ desktop-file-utils chrpath libgl1-mesa-dev libglu1-mesa-dev \
 
    mercurial autoconf automake groff libtool xterm
 
  
 +
Yocto Project code can be found in the Yocto Project Source Repositories.
 +
To check out current development code using git:
  
The following list shows the required packages by function given a supported Ubuntu Linux distribution:
+
$ cd $HOME/yocto
 +
$ git clone git://git.yoctoproject.org/poky -b scarthgap
  
* Essentials: Packages needed to build an image on a headless system:
+
poky/
 +
├── bitbake
 +
├── contrib
 +
├── documentation
 +
├── LICENSE
 +
├── LICENSE.GPL-2.0-only
 +
├── LICENSE.MIT
 +
├── MAINTAINERS.md
 +
├── MEMORIAM
 +
├── meta
 +
├── meta-poky
 +
├── meta-selftest
 +
├── meta-skeleton
 +
├── meta-yocto-bsp
 +
├── oe-init-build-env
 +
├── README.hardware.md -> meta-yocto-bsp/README.hardware.md
 +
├── README.md -> README.poky.md
 +
├── README.OE-Core.md
 +
├── README.poky.md -> meta-poky/README.poky.md
 +
├── README.qemu.md
 +
├── scripts
 +
└── SECURITY.md
  
  $ sudo apt-get install gawk wget git-core diffstat unzip texinfo \
+
In addition you can install an optional but frequently essential metalayer
    build-essential chrpath
 
                           
 
  
* Graphical Extras: Packages recommended if the host system has graphics support:
+
$ cd $HOME/yocto/poky
 +
$ git clone git://git.openembedded.org/meta-openembedded -b scarthgap
  
  $ sudo apt-get install libsdl1.2-dev xterm
+
== Initializing the Build Environment ==
                           
 
  
* Documentation: Packages needed if you are going to build out the Yocto Project documentation manuals:
+
From the parent directory your Source Directory, initialize your environment and provide a meaningful Build Directory name:
  
  $ sudo apt-get install make xsltproc docbook-utils fop
+
$ cd $HOME/yocto/poky
                           
+
$ source oe-init-build-env
  
* ADT Installer Extras: Packages needed if you are going to be using the Application Development Toolkit (ADT) Installer:
+
At this point, the '''build''' directory has been created for you and it is now your current working directory.
 +
This is the default tree you should have to build.
  
  $ sudo apt-get install autoconf automake libtool libglib2.0-dev
+
poky/
 +
├── bitbake
 +
├── build          <----- run bitbake inside here
 +
├── contrib
 +
├── documentation
 +
├── LICENSE
 +
├── LICENSE.GPL-2.0-only
 +
├── LICENSE.MIT
 +
├── meta
 +
├── meta-poky
 +
├── meta-selftest
 +
├── meta-skeleton
 +
├── meta-yocto-bsp
 +
├── oe-init-build-env
 +
├── README.hardware -> meta-yocto-bsp/README.hardware
 +
├── README.OE-Core
 +
├── README.poky -> meta-poky/README.poky
 +
├── README.qemu
 +
└── scripts
  
 +
== Edit the configuration files ==
  
== BitBake requires Python 2.7.3 or later ==
+
Add meta-openembedded/meta-oe to the bblayers.conf
  
BitBake requires Python 2.7.3 or later <BR>
+
bitbake-layers add-layer ../meta-openembedded/meta-oe
If you have Ubuntu older that 12.04 LTS you have to install Python 2.7.5 manually
 
  
sudo apt-get install libreadline5-dev libncursesw5-dev libssl-dev libsqlite3-dev tk-dev libgdbm-dev libc6-dev libbz2-dev
 
 
wget http://www.python.org/ftp/python/2.7.5/Python-2.7.5.tar.bz2
 
tar xjvf Python-2.7.5.tar.bz2
 
cd Python-2.7.5
 
 
./configure
 
make
 
sudo make install
 
 
python -V
 
  
== Development Code ==
+
Remember also to edit the file $HOME/yocto/poky/build/conf/local.conf
 +
and check the following variables:
  
Yocto Project code can be found in the Yocto Project Source Repositories.
+
MACHINE ?= "qemuarm"
To check out current development code using git:
+
DISTRO ?= "poky"
 +
PACKAGE_CLASSES ?= "package_ipk"
 +
INHERIT += "rm_work"
  
    $ git clone git://git.yoctoproject.org/poky.git
+
== Building the Image ==
  
This creates a standard Poky tree
+
At this point, you need to select an image to build.
 +
If this is your first build using the Yocto Project, you should try the smallest and simplest image:
  
  .
+
  $ bitbake core-image-minimal 
└── poky
 
    ├── bitbake
 
    ├── documentation
 
    ├── LICENSE
 
    ├── meta
 
    ├── meta-hob
 
    ├── meta-skeleton
 
    ├── meta-yocto
 
    ├── meta-yocto-bsp
 
    ├── oe-init-build-env
 
    ├── README
 
    ├── README.hardware
 
    └── scripts
 
  
== Initializing the Build Environment ==
+
Now you just wait for the build to finish.
  
From the parent directory your Source Directory, initialize your environment and provide a meaningful Build Directory name:
+
== Starting the QEMU Emulator ==
  
    $ source poky/oe-init-build-env mybuilds
+
Before you start the QEMU emulator, be sure you have already to set up the emulation environment.  
 
 
At this point, the mybuilds directory has been created for you and it is now your current working directory. If you don't provide your own directory name it defaults to build, which is inside the Source Directory.
 
 
 
 
 
== Building the Image ==
 
 
 
At this point, you need to select an image to build for the BeagleBoard xM. If this is your first build using the Yocto Project, you should try the smallest and simplest image:
 
 
 
    $ bitbake core-image-minimal 
 
  
Now you just wait for the build to finish.
+
The following command setup the emulation environment and launch QEMU.
  
 +
$ runqemu qemuarm
  
== Starting the QEMU Emulator ==
+
Or if you prefer, open a new shell terminal, setup the environment again and run
  
Before you start the QEMU emulator, be sure you have already to set up the emulation environment.
+
$ runqemu qemuarm nographic
  
The following commands setup the emulation environment and launch QEMU. This example assumes the root filesystem (.ext3 file) and the pre-built kernel image file both reside in your home directory. The kernel and filesystem are for a 32-bit target architecture.
+
== Building cross-compiler ==
  
    $ runqemu qemux86 tmp/deploy/images/bzImage-qemux86.bin tmp/deploy/images/core-image-minimal-qemux86.ext3
+
If you want you can create a re-distribuible cross-compiler targeted at your MACHINE.
  
The environment in which QEMU launches varies depending on the filesystem image and on the target architecture. For example, if you source the environment for the ARM target architecture and then boot the minimal QEMU image, the emulator comes up in a new shell in command-line mode. However, if you boot the SDK image, QEMU comes up with a GUI.
+
$ bitbake meta-toolchain

Latest revision as of 14:42, 17 October 2024

This page is an excerpt from Yocto Project Quick Start Copyright © 2010-2020 Linux Foundation


The required packages

Packages and package installation vary depending on your development system. In general, you need to have root access and then install the required packages. The next few sections show you how to get set up with the right packages for Ubuntu.

If you have different distributions, please refer to the Yocto Project Documentation

You must install essential host packages on your build host. The following command installs the host packages based on an Ubuntu distribution:

$ sudo apt install gawk wget git diffstat unzip texinfo gcc build-essential chrpath \
socat cpio python3 python3-pip python3-pexpect xz-utils debianutils iputils-ping \
python3-git python3-jinja2 python3-subunit zstd liblz4-tool file locales libacl1

$ sudo locale-gen en_US.UTF-8

Development Code - branch 5.0 'scarthgap' LTS

Yocto Project code can be found in the Yocto Project Source Repositories. To check out current development code using git:

$ cd $HOME/yocto
$ git clone git://git.yoctoproject.org/poky -b scarthgap
poky/
├── bitbake
├── contrib
├── documentation
├── LICENSE
├── LICENSE.GPL-2.0-only
├── LICENSE.MIT
├── MAINTAINERS.md
├── MEMORIAM
├── meta
├── meta-poky
├── meta-selftest
├── meta-skeleton
├── meta-yocto-bsp
├── oe-init-build-env
├── README.hardware.md -> meta-yocto-bsp/README.hardware.md
├── README.md -> README.poky.md
├── README.OE-Core.md
├── README.poky.md -> meta-poky/README.poky.md
├── README.qemu.md
├── scripts
└── SECURITY.md

In addition you can install an optional but frequently essential metalayer

$ cd $HOME/yocto/poky
$ git clone git://git.openembedded.org/meta-openembedded -b scarthgap

Initializing the Build Environment

From the parent directory your Source Directory, initialize your environment and provide a meaningful Build Directory name:

$ cd $HOME/yocto/poky
$ source oe-init-build-env

At this point, the build directory has been created for you and it is now your current working directory. This is the default tree you should have to build.

poky/
├── bitbake
├── build          <----- run bitbake inside here
├── contrib
├── documentation
├── LICENSE
├── LICENSE.GPL-2.0-only
├── LICENSE.MIT
├── meta
├── meta-poky
├── meta-selftest
├── meta-skeleton
├── meta-yocto-bsp
├── oe-init-build-env
├── README.hardware -> meta-yocto-bsp/README.hardware
├── README.OE-Core
├── README.poky -> meta-poky/README.poky
├── README.qemu
└── scripts

Edit the configuration files

Add meta-openembedded/meta-oe to the bblayers.conf

bitbake-layers add-layer ../meta-openembedded/meta-oe


Remember also to edit the file $HOME/yocto/poky/build/conf/local.conf and check the following variables:

MACHINE ?= "qemuarm"
DISTRO ?= "poky"
PACKAGE_CLASSES ?= "package_ipk"
INHERIT += "rm_work"

Building the Image

At this point, you need to select an image to build. If this is your first build using the Yocto Project, you should try the smallest and simplest image:

$ bitbake core-image-minimal  

Now you just wait for the build to finish.

Starting the QEMU Emulator

Before you start the QEMU emulator, be sure you have already to set up the emulation environment.

The following command setup the emulation environment and launch QEMU.

$ runqemu qemuarm

Or if you prefer, open a new shell terminal, setup the environment again and run

$ runqemu qemuarm nographic

Building cross-compiler

If you want you can create a re-distribuible cross-compiler targeted at your MACHINE.

$ bitbake meta-toolchain