[yocto] The BitBake equivalent of "Hello, World!"

Evade Flow evadeflow at gmail.com
Wed Oct 10 08:56:50 PDT 2012


It helps a lot if you run it from the build dir. :-%

build% ../../bitbake/bin/bitbake a
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
NOTE: Running task 1 of 1 (ID: 0,
/home/evadeflow/projects/bitbake_hello/LayerA/a.bb, do_build)
NOTE: package None: task do_build: Started
Hello, World!
NOTE: package None: task do_build: Succeeded
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
rerun and all succeeded.

Thanks again!


On Wed, Oct 10, 2012 at 11:45 AM, Evade Flow <evadeflow at gmail.com> wrote:
> Again, thanks *so* much for putting this together. I tried to do this
> once before and didn't have the tenacity to stick with it--it is a
> surprisingly daunting task. Having a smallest-possible example will, I
> think, be really helpful to developers who want to learn how to debug
> bitbake and contribute fixes.
>
> Interestingly, I tried running this and got the following result:
>
> bitbake_hello% ../bitbake-1.15.2/bin/bitbake a
> The BBPATH variable is not set
> DEBUG: Removed the following variables from the environment:
> http_proxy, CVS_RSH,
> SHLVL, LD_LIBRARY_PATH, EDITOR, SUDO_USER, USERNAME, PROMPT,
> PYTHONPATH, SUDO_UID,
> RPROMPT, SUDO_COMMAND, SUDO_GID, OLDPWD, MAIL
>
>
> I guess I either fat-fingered something during cut-and-paste, or it's
> due to some difference between the tarball I downloaded and the bitbake
> tag you were using. I'm behind a firewall, but I'll see if I can suck
> down the the actual git repo through my phone and see if that makes a
> difference.
>
> On Tue, Oct 9, 2012 at 6:31 PM, Patrick Turley
> <PatrickTurley at gamestop.com> wrote:
>> Success. The file tree depicted at the bottom of this mail is nearly the
>> smallest, valid BitBake project that prints "Hello, World!" Here's the
>> output:
>>
>>
>>     $ ../BitBake/bin/bitbake  a
>>     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
>>     NOTE: Running task 1 of 1 (ID: 0,
>> /home/pturley/Workspace/Hello/LayerA/a.bb, do_build)
>>     NOTE: package None: task do_build: Started
>>     Hello, World!
>>     NOTE: package None: task do_build: Succeeded
>>     NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be
>> rerun and all succeeded.
>>
>>
>> A few things to note:
>>
>> 1) This is not the *smallest* such BitBake project. For example, the
>> "DESCRIPTION" and "PV" variables need not be assigned in "a.bb". I set those
>> variables because I wanted "show-layers" and "show-recipes" to display
>> reasonable information.
>>
>> 2) Some of the variables set in "bitbake.conf" have "simplified" values. For
>> example, you would *not* want to use these values if there were multiple
>> recipes and you had to disambiguate the output from each of them.
>>
>> 3) On the other hand, *all* the variable assignments in "bitbake.conf" are
>> *essential* to BitBake itself. If you remove any one of those assignments,
>> BitBake will either declare an error or die (usually because some internal
>> variable is set to "None" and the BitBake code can't handle it).
>>
>>
>> ------------------------------------------------------------
>>
>>
>> ├── build
>> │   │
>> │   ├── classes
>> │   │   │
>> │   │   └── base.bbclass
>> │   │
>> │   │       +-----------------------------------------------
>> │   │       |  addtask build
>> │   │       +-----------------------------------------------
>> │   │
>> │   └── conf
>> │       │
>> │       ├── bblayers.conf
>> │       │
>> │       │   +-----------------------------------------------
>> │       │   |  BBLAYERS ?= " \
>> │       │   |    /home/pturley/Workspace/Hello/LayerA \
>> │       │   |    "
>> │       │   +-----------------------------------------------
>> │       │
>> │       └── bitbake.conf
>>>> │           +-----------------------------------------------
>> │           |  TMPDIR  = "${TOPDIR}/tmp"
>> │           |  CACHE   = "${TMPDIR}/cache"
>> │           |  STAMP   = "${TMPDIR}/stamps"
>> │           |  T       = "${TMPDIR}/work"
>> │           |  B       = "${TMPDIR}"
>> │           +-----------------------------------------------
>>>> ├── LayerA
>> │   │
>> │   ├── a.bb
>> │   │
>> │   │       +-----------------------------------------------
>> │   │       |  DESCRIPTION = "Layer A Recipe"
>> │   │       |  PN = 'a'
>> │   │       |  PV = '1'
>> │   │       |
>> │   │       |  python do_build() {
>> │   │       |      bb.plain("Hello, World!");
>> │   │       |  }
>> │   │       +-----------------------------------------------
>> │   │
>> │   └── conf
>> │       │
>> │       └── layer.conf
>>>> │           +-----------------------------------------------
>> │           |  BBPATH .= ":${LAYERDIR}"
>> │           |
>> │           |  BBFILES += "${LAYERDIR}/*.bb"
>> │           |
>> │           |  BBFILE_COLLECTIONS += "A"
>> │           |  BBFILE_PATTERN_A := "^${LAYERDIR}/"
>> │           +-----------------------------------------------
>>>> └── BitBake
>>
>>    The BitBake directory origin is:
>>
>>        http://git.openembedded.org/bitbake/
>>
>>    I have the 1.15.2 tag checked out, which is what
>>    Yocto denzil uses.
>>
>>
>> _______________________________________________
>> yocto mailing list
>> yocto at yoctoproject.org
>> https://lists.yoctoproject.org/listinfo/yocto
>>



More information about the yocto mailing list