diff options
author | Fawzi KHABER <fawzi.khaber@smile.fr> | 2023-03-02 17:14:31 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-03-07 21:24:44 +0000 |
commit | e0a6ba834eb1d985ce2726b746ed7014e9f19489 (patch) | |
tree | 72669d82114baba54a92e4533df1249724dea8c6 /bitbake | |
parent | 28e334e8a481a8d3b159f7d7cb3f8eb3e7b5c2fa (diff) | |
download | poky-e0a6ba834eb1d985ce2726b746ed7014e9f19489.tar.gz |
bitbake: bitbake-user-manual: update Hello World example
Fix broken link "Obtaining bitbake".
Update documentation for the bitbake hello world example, the output was
outdated.
Fix LAYERSERIES_COMPAT warning by adding dunfell as default compatible release.
Add proper formating for base.bbclass command.
Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com>
Reviewed-by: Ever ATILANO <ever.atilano@smile.fr>
Reviewed-by: Yoann CONGAL <yoann.congal@smile.fr>
(Bitbake rev: e859ce61a7422425960342a47785468cef49caa1)
Signed-off-by: Fawzi KHABER <fawzi.khaber@smile.fr>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/doc/bitbake-user-manual/bitbake-user-manual-hello.rst | 127 |
1 files changed, 60 insertions, 67 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 722dc5a2cc..c8251d2a04 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. | |||
18 | Obtaining BitBake | 18 | Obtaining BitBake |
19 | ================= | 19 | ================= |
20 | 20 | ||
21 | See the :ref:`bitbake-user-manual/bitbake-user-manual-hello:obtaining bitbake` section for | 21 | See the :ref:`bitbake-user-manual/bitbake-user-manual-intro:obtaining bitbake` section for |
22 | information on how to obtain BitBake. Once you have the source code on | 22 | information on how to obtain BitBake. Once you have the source code on |
23 | your machine, the BitBake directory appears as follows:: | 23 | your machine, the BitBake directory appears as follows:: |
24 | 24 | ||
25 | $ ls -al | 25 | $ ls -al |
26 | total 100 | 26 | total 108 |
27 | drwxrwxr-x. 9 wmat wmat 4096 Jan 31 13:44 . | 27 | drwxr-xr-x 9 fawkh 10000 4096 feb 24 12:10 . |
28 | drwxrwxr-x. 3 wmat wmat 4096 Feb 4 10:45 .. | 28 | drwx------ 36 fawkh 10000 4096 mar 2 17:00 .. |
29 | -rw-rw-r--. 1 wmat wmat 365 Nov 26 04:55 AUTHORS | 29 | -rw-r--r-- 1 fawkh 10000 365 feb 24 12:10 AUTHORS |
30 | drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 bin | 30 | drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 bin |
31 | drwxrwxr-x. 4 wmat wmat 4096 Jan 31 13:44 build | 31 | -rw-r--r-- 1 fawkh 10000 16501 feb 24 12:10 ChangeLog |
32 | -rw-rw-r--. 1 wmat wmat 16501 Nov 26 04:55 ChangeLog | 32 | drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 classes |
33 | drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 classes | 33 | drwxr-xr-x 2 fawkh 10000 4096 feb 24 12:10 conf |
34 | drwxrwxr-x. 2 wmat wmat 4096 Nov 26 04:55 conf | 34 | drwxr-xr-x 5 fawkh 10000 4096 feb 24 12:10 contrib |
35 | drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 contrib | 35 | drwxr-xr-x 6 fawkh 10000 4096 feb 24 12:10 doc |
36 | -rw-rw-r--. 1 wmat wmat 17987 Nov 26 04:55 COPYING | 36 | drwxr-xr-x 8 fawkh 10000 4096 mar 2 16:26 .git |
37 | drwxrwxr-x. 3 wmat wmat 4096 Nov 26 04:55 doc | 37 | -rw-r--r-- 1 fawkh 10000 31 feb 24 12:10 .gitattributes |
38 | -rw-rw-r--. 1 wmat wmat 69 Nov 26 04:55 .gitignore | 38 | -rw-r--r-- 1 fawkh 10000 392 feb 24 12:10 .gitignore |
39 | -rw-rw-r--. 1 wmat wmat 849 Nov 26 04:55 HEADER | 39 | drwxr-xr-x 13 fawkh 10000 4096 feb 24 12:11 lib |
40 | drwxrwxr-x. 5 wmat wmat 4096 Jan 31 13:44 lib | 40 | -rw-r--r-- 1 fawkh 10000 1224 feb 24 12:10 LICENSE |
41 | -rw-rw-r--. 1 wmat wmat 195 Nov 26 04:55 MANIFEST.in | 41 | -rw-r--r-- 1 fawkh 10000 15394 feb 24 12:10 LICENSE.GPL-2.0-only |
42 | -rw-rw-r--. 1 wmat wmat 2887 Nov 26 04:55 TODO | 42 | -rw-r--r-- 1 fawkh 10000 1286 feb 24 12:10 LICENSE.MIT |
43 | -rw-r--r-- 1 fawkh 10000 229 feb 24 12:10 MANIFEST.in | ||
44 | -rw-r--r-- 1 fawkh 10000 2413 feb 24 12:10 README | ||
45 | -rw-r--r-- 1 fawkh 10000 43 feb 24 12:10 toaster-requirements.txt | ||
46 | -rw-r--r-- 1 fawkh 10000 2887 feb 24 12:10 TODO | ||
43 | 47 | ||
44 | At this point, you should have BitBake cloned to a directory that | 48 | At this point, you should have BitBake cloned to a directory that |
45 | matches the previous listing except for dates and user names. | 49 | 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 | |||
52 | command:: | 56 | command:: |
53 | 57 | ||
54 | $ ./bin/bitbake --version | 58 | $ ./bin/bitbake --version |
55 | BitBake Build Tool Core version 1.23.0, bitbake version 1.23.0 | 59 | BitBake Build Tool Core version 2.3.1 |
56 | 60 | ||
57 | The console output tells you what version | 61 | The console output tells you what version |
58 | you are running. | 62 | you are running. |
@@ -130,23 +134,8 @@ Following is the complete "Hello World" example. | |||
130 | directory. Run the ``bitbake`` command and see what it does:: | 134 | directory. Run the ``bitbake`` command and see what it does:: |
131 | 135 | ||
132 | $ bitbake | 136 | $ bitbake |
133 | The BBPATH variable is not set and bitbake did not | 137 | ERROR: The BBPATH variable is not set and bitbake did not find a conf/bblayers.conf file in the expected location. |
134 | find a conf/bblayers.conf file in the expected location. | ||
135 | Maybe you accidentally invoked bitbake from the wrong directory? | 138 | Maybe you accidentally invoked bitbake from the wrong directory? |
136 | DEBUG: Removed the following variables from the environment: | ||
137 | GNOME_DESKTOP_SESSION_ID, XDG_CURRENT_DESKTOP, | ||
138 | GNOME_KEYRING_CONTROL, DISPLAY, SSH_AGENT_PID, LANG, no_proxy, | ||
139 | XDG_SESSION_PATH, XAUTHORITY, SESSION_MANAGER, SHLVL, | ||
140 | MANDATORY_PATH, COMPIZ_CONFIG_PROFILE, WINDOWID, EDITOR, | ||
141 | GPG_AGENT_INFO, SSH_AUTH_SOCK, GDMSESSION, GNOME_KEYRING_PID, | ||
142 | XDG_SEAT_PATH, XDG_CONFIG_DIRS, LESSOPEN, DBUS_SESSION_BUS_ADDRESS, | ||
143 | _, XDG_SESSION_COOKIE, DESKTOP_SESSION, LESSCLOSE, DEFAULTS_PATH, | ||
144 | UBUNTU_MENUPROXY, OLDPWD, XDG_DATA_DIRS, COLORTERM, LS_COLORS | ||
145 | |||
146 | The majority of this output is specific to environment variables that | ||
147 | are not directly relevant to BitBake. However, the very first | ||
148 | message regarding the :term:`BBPATH` variable and the | ||
149 | ``conf/bblayers.conf`` file is relevant. | ||
150 | 139 | ||
151 | When you run BitBake, it begins looking for metadata files. The | 140 | When you run BitBake, it begins looking for metadata files. The |
152 | :term:`BBPATH` variable is what tells BitBake where | 141 | :term:`BBPATH` variable is what tells BitBake where |
@@ -179,20 +168,14 @@ Following is the complete "Hello World" example. | |||
179 | ``bitbake`` command again:: | 168 | ``bitbake`` command again:: |
180 | 169 | ||
181 | $ bitbake | 170 | $ bitbake |
182 | ERROR: Traceback (most recent call last): | 171 | ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/__init__.py |
183 | File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped | 172 | Traceback (most recent call last): |
184 | return func(fn, *args) | 173 | 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>): |
185 | File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 173, in parse_config_file | 174 | if not newfn: |
186 | return bb.parse.handle(fn, data, include) | 175 | > raise IOError(errno.ENOENT, "file %s not found in %s" % (fn, bbpath)) |
187 | File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 99, in handle | 176 | fn = newfn |
188 | return h['handle'](fn, data, include) | 177 | FileNotFoundError: [Errno 2] file conf/bitbake.conf not found in <projectdirectory> |
189 | File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 120, in handle | 178 | |
190 | abs_fn = resolve_file(fn, data) | ||
191 | File "/home/scott-lenovo/bitbake/lib/bb/parse/__init__.py", line 117, in resolve_file | ||
192 | raise IOError("file %s not found in %s" % (fn, bbpath)) | ||
193 | IOError: file conf/bitbake.conf not found in /home/scott-lenovo/hello | ||
194 | |||
195 | ERROR: Unable to parse conf/bitbake.conf: file conf/bitbake.conf not found in /home/scott-lenovo/hello | ||
196 | 179 | ||
197 | This sample output shows that BitBake could not find the | 180 | This sample output shows that BitBake could not find the |
198 | ``conf/bitbake.conf`` file in the project directory. This file is | 181 | ``conf/bitbake.conf`` file in the project directory. This file is |
@@ -254,18 +237,14 @@ Following is the complete "Hello World" example. | |||
254 | exists, you can run the ``bitbake`` command again:: | 237 | exists, you can run the ``bitbake`` command again:: |
255 | 238 | ||
256 | $ bitbake | 239 | $ bitbake |
257 | ERROR: Traceback (most recent call last): | 240 | ERROR: Unable to parse /home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py |
258 | File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 163, in wrapped | 241 | Traceback (most recent call last): |
259 | return func(fn, *args) | 242 | 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>): |
260 | File "/home/scott-lenovo/bitbake/lib/bb/cookerdata.py", line 177, in _inherit | 243 | if not os.path.exists(file): |
261 | bb.parse.BBHandler.inherit(bbclass, "configuration INHERITs", 0, data) | 244 | > raise ParseError("Could not inherit file %s" % (file), fn, lineno) |
262 | File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/BBHandler.py", line 92, in inherit | 245 | |
263 | include(fn, file, lineno, d, "inherit") | 246 | bb.parse.ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass |
264 | File "/home/scott-lenovo/bitbake/lib/bb/parse/parse_py/ConfHandler.py", line 100, in include | 247 | |
265 | raise ParseError("Could not %(error_out)s file %(fn)s" % vars(), oldfn, lineno) | ||
266 | ParseError: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass | ||
267 | |||
268 | ERROR: Unable to parse base: ParseError in configuration INHERITs: Could not inherit file classes/base.bbclass | ||
269 | 248 | ||
270 | In the sample output, | 249 | In the sample output, |
271 | BitBake could not find the ``classes/base.bbclass`` file. You need | 250 | BitBake could not find the ``classes/base.bbclass`` file. You need |
@@ -284,7 +263,10 @@ Following is the complete "Hello World" example. | |||
284 | $ mkdir classes | 263 | $ mkdir classes |
285 | 264 | ||
286 | Move to the ``classes`` directory and then create the | 265 | Move to the ``classes`` directory and then create the |
287 | ``base.bbclass`` file by inserting this single line: addtask build | 266 | ``base.bbclass`` file by inserting this single line:: |
267 | |||
268 | addtask build | ||
269 | |||
288 | The minimal task that BitBake runs is the ``do_build`` task. This is | 270 | The minimal task that BitBake runs is the ``do_build`` task. This is |
289 | all the example needs in order to build the project. Of course, the | 271 | all the example needs in order to build the project. Of course, the |
290 | ``base.bbclass`` can have much more depending on which build | 272 | ``base.bbclass`` can have much more depending on which build |
@@ -328,10 +310,19 @@ Following is the complete "Hello World" example. | |||
328 | BBFILES += "${LAYERDIR}/*.bb" | 310 | BBFILES += "${LAYERDIR}/*.bb" |
329 | BBFILE_COLLECTIONS += "mylayer" | 311 | BBFILE_COLLECTIONS += "mylayer" |
330 | BBFILE_PATTERN_mylayer := "^${LAYERDIR_RE}/" | 312 | BBFILE_PATTERN_mylayer := "^${LAYERDIR_RE}/" |
313 | LAYERSERIES_CORENAMES = "hello_world_example" | ||
314 | LAYERSERIES_COMPAT_mylayer = "hello_world_example" | ||
331 | 315 | ||
332 | For information on these variables, click on :term:`BBFILES`, | 316 | For information on these variables, click on :term:`BBFILES`, |
333 | :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS` or :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>` | 317 | :term:`LAYERDIR`, :term:`BBFILE_COLLECTIONS`, :term:`BBFILE_PATTERN_mylayer <BBFILE_PATTERN>` |
334 | to go to the definitions in the glossary. | 318 | or :term:`LAYERSERIES_COMPAT` to go to the definitions in the glossary. |
319 | |||
320 | .. note:: | ||
321 | |||
322 | We are setting both LAYERSERIES_CORENAMES and LAYERSERIES_COMPAT in this particular case, because we | ||
323 | are using bitbake without OpenEmbedded. | ||
324 | You should usually just use LAYERSERIES_COMPAT to specify the OE-Core versions for which your layer | ||
325 | is compatible, and add the meta-openembedded layer to your project. | ||
335 | 326 | ||
336 | You need to create the recipe file next. Inside your layer at the | 327 | You need to create the recipe file next. Inside your layer at the |
337 | top-level, use an editor and create a recipe file named | 328 | top-level, use an editor and create a recipe file named |
@@ -389,12 +380,14 @@ Following is the complete "Hello World" example. | |||
389 | target:: | 380 | target:: |
390 | 381 | ||
391 | $ bitbake printhello | 382 | $ bitbake printhello |
383 | Loading cache: 100% | | ||
384 | Loaded 0 entries from dependency cache. | ||
392 | Parsing recipes: 100% |##################################################################################| | 385 | Parsing recipes: 100% |##################################################################################| |
393 | Time: 00:00:00 | ||
394 | Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors. | 386 | Parsing of 1 .bb files complete (0 cached, 1 parsed). 1 targets, 0 skipped, 0 masked, 0 errors. |
395 | NOTE: Resolving any missing task queue dependencies | 387 | NOTE: Resolving any missing task queue dependencies |
396 | NOTE: Preparing RunQueue | 388 | Initialising tasks: 100% |###############################################################################| |
397 | NOTE: Executing RunQueue Tasks | 389 | NOTE: No setscene tasks |
390 | NOTE: Executing Tasks | ||
398 | ******************** | 391 | ******************** |
399 | * * | 392 | * * |
400 | * Hello, World! * | 393 | * Hello, World! * |