summaryrefslogtreecommitdiffstats
path: root/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst')
-rw-r--r--bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst155
1 files changed, 74 insertions, 81 deletions
diff --git a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
index a9c33709ab..654196ca24 100644
--- a/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
+++ b/bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst
@@ -18,28 +18,32 @@ it.
Obtaining BitBake
=================
-See the :ref:`bitbake-user-manual/bitbake-user-manual-hello:obtaining bitbake` section for
+See the :ref:`bitbake-user-manual/bitbake-user-manual-intro:obtaining bitbake` section for
information on how to obtain BitBake. Once you have the source code on
your machine, the BitBake directory appears as follows::
$ ls -al
- total 100
- drwxrwxr-x. 9 wmat wmat 4096 Jan 31 13:44 .
- drwxrwxr-x. 3 wmat wmat 4096 Feb 4 10:45 ..
- -rw-rw-r--. 1 wmat wmat 365 Nov 26 04:55 AUTHORS
- drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 bin
- drwxrwxr-x. 4 wmat wmat 4096 Jan 31 13:44 build
- -rw-rw-r--. 1 wmat wmat 16501 Nov 26 04:55 ChangeLog
- drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 classes
- drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 conf
- drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 contrib
- -rw-rw-r--. 1 wmat wmat 17987 Nov 26 04:55 COPYING
- drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 doc
- -rw-rw-r--. 1 wmat wmat 69 Nov 26 04:55 .gitignore
- -rw-rw-r--. 1 wmat wmat 849 Nov 26 04:55 HEADER
- drwxrwxr-x. 5 wmat wmat 4096 Jan 31 13:44 lib
- -rw-rw-r--. 1 wmat wmat 195 Nov 26 04:55 MANIFEST.in
- -rw-rw-r--. 1 wmat wmat 2887 Nov 26 04:55 TODO
+ total 108
+ drwxr-xr-x 9 fawkh 10000 4096 feb 24 12:10 .
+ drwx------ 36 fawkh 10000 4096 mar 2 17:00 ..
+ -rw-r--r-- 1 fawkh 10000 365 feb 24 12:10 AUTHORS
+ drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 bin
+ -rw-r--r-- 1 fawkh 10000 16501 feb 24 12:10 ChangeLog
+ drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 classes
+ drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 conf
+ drwxr-xr-x 5 fawkh 10000 4096 feb 24 12:10 contrib
+ drwxr-xr-x 6 fawkh 10000 4096 feb 24 12:10 doc
+ drwxr-xr-x 8 fawkh 10000 4096 mar 2 16:26 .git
+ -rw-r--r-- 1 fawkh 10000 31 feb 24 12:10 .gitattributes
+ -rw-r--r-- 1 fawkh 10000 392 feb 24 12:10 .gitignore
+ drwxr-xr-x 13 fawkh 10000 4096 feb 24 12:11 lib
+ -rw-r--r-- 1 fawkh 10000 1224 feb 24 12:10 LICENSE
+ -rw-r--r-- 1 fawkh 10000 15394 feb 24 12:10 LICENSE.GPL-2.0-only
+ -rw-r--r-- 1 fawkh 10000 1286 feb 24 12:10 LICENSE.MIT
+ -rw-r--r-- 1 fawkh 10000 229 feb 24 12:10 MANIFEST.in
+ -rw-r--r-- 1 fawkh 10000 2413 feb 24 12:10 README
+ -rw-r--r-- 1 fawkh 10000 43 feb 24 12:10 toaster-requirements.txt
+ -rw-r--r-- 1 fawkh 10000 2887 feb 24 12:10 TODO
At this point, you should have BitBake cloned to a directory that
matches the previous listing except for dates and user names.
@@ -52,7 +56,7 @@ directory to where your local BitBake files are and run the following
command::
$ ./bin/bitbake --version
- BitBake Build Tool Core version 1.23.0, bitbake version 1.23.0
+ BitBake Build Tool Core version 2.3.1
The console output tells you what version
you are running.
@@ -99,7 +103,7 @@ discussion mailing list about the BitBake build tool.
This example was inspired by and drew heavily from
`Mailing List post - The BitBake equivalent of "Hello, World!"
- <http://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html>`_.
+ <https://www.mail-archive.com/yocto@yoctoproject.org/msg09379.html>`_.
As stated earlier, the goal of this example is to eventually compile
"Hello World". However, it is unknown what BitBake needs and what you
@@ -130,38 +134,23 @@ Following is the complete "Hello World" example.
directory. Run the ``bitbake`` command and see what it does::
$ bitbake
- The BBPATH variable is not set and bitbake did not
- find a conf/bblayers.conf file in the expected location.
+ ERROR: The BBPATH variable is not set and bitbake did not find a conf/bblayers.conf file in the expected location.
Maybe you accidentally invoked bitbake from the wrong directory?
- DEBUG: Removed the following variables from the environment:
- GNOME_DESKTOP_SESSION_ID, XDG_CURRENT_DESKTOP,
- GNOME_KEYRING_CONTROL, DISPLAY, SSH_AGENT_PID, LANG, no_proxy,
- XDG_SESSION_PATH, XAUTHORITY, SESSION_MANAGER, SHLVL,
- MANDATORY_PATH, COMPIZ_CONFIG_PROFILE, WINDOWID, EDITOR,
- GPG_AGENT_INFO, SSH_AUTH_SOCK, GDMSESSION, GNOME_KEYRING_PID,
- XDG_SEAT_PATH, XDG_CONFIG_DIRS, LESSOPEN, DBUS_SESSION_BUS_ADDRESS,
- _, XDG_SESSION_COOKIE, DESKTOP_SESSION, LESSCLOSE, DEFAULTS_PATH,
- UBUNTU_MENUPROXY, OLDPWD, XDG_DATA_DIRS, COLORTERM, LS_COLORS
-
- The majority of this output is specific to environment variables that
- are not directly relevant to BitBake. However, the very first
- message regarding the ``BBPATH`` variable and the
- ``conf/bblayers.conf`` file is relevant.
When you run BitBake, it begins looking for metadata files. The
:term:`BBPATH` variable is what tells BitBake where
- to look for those files. ``BBPATH`` is not set and you need to set
- it. Without ``BBPATH``, BitBake cannot find any configuration files
+ to look for those files. :term:`BBPATH` is not set and you need to set
+ it. Without :term:`BBPATH`, BitBake cannot find any configuration files
(``.conf``) or recipe files (``.bb``) at all. BitBake also cannot
find the ``bitbake.conf`` file.
-#. **Setting BBPATH:** For this example, you can set ``BBPATH`` in
+#. **Setting BBPATH:** For this example, you can set :term:`BBPATH` in
the same manner that you set ``PATH`` earlier in the appendix. You
should realize, though, that it is much more flexible to set the
- ``BBPATH`` variable up in a configuration file for each project.
+ :term:`BBPATH` variable up in a configuration file for each project.
From your shell, enter the following commands to set and export the
- ``BBPATH`` variable::
+ :term:`BBPATH` variable::
$ BBPATH="projectdirectory"
$ export BBPATH
@@ -175,24 +164,18 @@ Following is the complete "Hello World" example.
("~") character as BitBake does not expand that character as the
shell would.
-#. **Run BitBake:** Now that you have ``BBPATH`` defined, run the
+#. **Run BitBake:** Now that you have :term:`BBPATH` defined, run the
``bitbake`` command again::
$ bitbake
- ERROR: Traceback (most recent call last):
- File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped
- return func(fn, *args)
- File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 173, in parse_config_file
- return bb.parse.handle(fn, data, include)
- File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 99, in handle
- return h['handle'](fn, data, include)
- File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 120, in handle
- abs_fn = resolve_file(fn, data)
- File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 117, in resolve_file
- raise IOError("file %s not found in %s" % (fn, bbpath))
- IOError: file conf/bitbake.conf not found in /home/scott-lenovo/hello
-
- ERROR: Unable to parse conf/bitbake.conf: file conf/bitbake.conf not found in /home/scott-lenovo/hello
+ ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/__init__.py
+ Traceback (most recent call last):
+ File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 127, in resolve_file(fn='conf/bitbake.conf', d=<bb.data_smart.DataSmart object at 0x7f22919a3df0>):
+ if not newfn:
+ > raise IOError(errno.ENOENT, "file %s not found in %s" % (fn, bbpath))
+ fn = newfn
+ FileNotFoundError: [Errno 2] file conf/bitbake.conf not found in <projectdirectory>
+
This sample output shows that BitBake could not find the
``conf/bitbake.conf`` file in the project directory. This file is
@@ -205,7 +188,7 @@ Following is the complete "Hello World" example.
recipe files. For this example, you need to create the file in your
project directory and define some key BitBake variables. For more
information on the ``bitbake.conf`` file, see
- http://git.openembedded.org/bitbake/tree/conf/bitbake.conf.
+ https://git.openembedded.org/bitbake/tree/conf/bitbake.conf.
Use the following commands to create the ``conf`` directory in the
project directory::
@@ -216,7 +199,7 @@ Following is the complete "Hello World" example.
use some editor to create the ``bitbake.conf`` so that it contains
the following::
- PN = "${@bb.parse.BBHandler.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
+ PN = "${@bb.parse.vars_from_file(d.getVar('FILE', False),d)[0] or 'defaultpkgname'}"
TMPDIR = "${TOPDIR}/tmp"
CACHE = "${TMPDIR}/cache"
@@ -226,12 +209,12 @@ Following is the complete "Hello World" example.
.. note::
- Without a value for PN , the variables STAMP , T , and B , prevent more
- than one recipe from working. You can fix this by either setting PN to
+ Without a value for :term:`PN`, the variables :term:`STAMP`, :term:`T`, and :term:`B`, prevent more
+ than one recipe from working. You can fix this by either setting :term:`PN` to
have a value similar to what OpenEmbedded and BitBake use in the default
- bitbake.conf file (see previous example). Or, by manually updating each
- recipe to set PN . You will also need to include PN as part of the STAMP
- , T , and B variable definitions in the local.conf file.
+ ``bitbake.conf`` file (see previous example). Or, by manually updating each
+ recipe to set :term:`PN`. You will also need to include :term:`PN` as part of the :term:`STAMP`,
+ :term:`T`, and :term:`B` variable definitions in the ``local.conf`` file.
The ``TMPDIR`` variable establishes a directory that BitBake uses
for build output and intermediate files other than the cached
@@ -254,18 +237,14 @@ Following is the complete "Hello World" example.
exists, you can run the ``bitbake`` command again::
$ bitbake
- ERROR: Traceback (most recent call last):
- File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped
- return func(fn, *args)
- File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 177, in _inherit
- bb.parse.BBHandler.inherit(bbclass, "configuration INHERITs", 0, data)
- File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 92, in inherit
- include(fn, file, lineno, d, "inherit")
- File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 100, in include
- raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno)
- ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
-
- ERROR: Unable to parse base: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
+ ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py
+ Traceback (most recent call last):
+ File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 67, in inherit(files=['base'], fn='configuration INHERITs', lineno=0, d=<bb.data_smart.DataSmart object at 0x7fab6815edf0>):
+ if not os.path.exists(file):
+ > raise ParseError("Could not inherit file %s" % (file), fn, lineno)
+
+ bb.parse.ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass
+
In the sample output,
BitBake could not find the ``classes/base.bbclass`` file. You need
@@ -284,7 +263,10 @@ Following is the complete "Hello World" example.
$ mkdir classes
Move to the ``classes`` directory and then create the
- ``base.bbclass`` file by inserting this single line: addtask build
+ ``base.bbclass`` file by inserting this single line::
+
+ addtask build
+
The minimal task that BitBake runs is the ``do_build`` task. This is
all the example needs in order to build the project. Of course, the
``base.bbclass`` can have much more depending on which build
@@ -328,10 +310,19 @@ Following is the complete "Hello World" example.
BBFILES += "${LAYERDIR}/*.bb"
BBFILE_COLLECTIONS += "mylayer"
BBFILE_PATTERN_mylayer := "^${LAYERDIR_RE}/"
+ LAYERSERIES_CORENAMES = "hello_world_example"
+ LAYERSERIES_COMPAT_mylayer = "hello_world_example"
For information on these variables, click on :term:`BBFILES`,
- :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS` or :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>`
- to go to the definitions in the glossary.
+ :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS`, :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>`
+ or :term:`LAYERSERIES_COMPAT` to go to the definitions in the glossary.
+
+ .. note::
+
+ We are setting both ``LAYERSERIES_CORENAMES`` and :term:`LAYERSERIES_COMPAT` in this particular case, because we
+ are using bitbake without OpenEmbedded.
+ You should usually just use :term:`LAYERSERIES_COMPAT` to specify the OE-Core versions for which your layer
+ is compatible, and add the meta-openembedded layer to your project.
You need to create the recipe file next. Inside your layer at the
top-level, use an editor and create a recipe file named
@@ -389,12 +380,14 @@ Following is the complete "Hello World" example.
target::
$ bitbake printhello
+ Loading cache: 100% |
+ Loaded 0 entries from dependency cache.
Parsing recipes: 100% |##################################################################################|
- Time: 00:00:00
Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
- NOTE: Preparing RunQueue
- NOTE: Executing RunQueue Tasks
+ Initialising tasks: 100% |###############################################################################|
+ NOTE: No setscene tasks
+ NOTE: Executing Tasks
********************
* *
* Hello, World! *