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

Patrick Turley PatrickTurley at gamestop.com
Wed Oct 3 15:30:27 PDT 2012


I'll start with my question (so you can decide whether you care to read
the rest):


    What is the BitBake equivalent of "Hello, World!?"

    Specifically, what is the minimum project structure that
    correctly describes a single layer and a single recipe?


--------------------------------------------------


I'm trying to understand Yocto and BitBake thoroughly. As a start, I tried
to construct a "minimal" BitBake project, with no Yocto content.

I began by running BitBake in an empty directory and fixing each error in
turn. Eventually, I was able run BitBake without errors -- even though it
didn't actually *do* anything (which was fine).

After that, I created a single layer, and that worked fine.

Most recently, I tried to create a single recipe within my one layer. I'm
having problems I don't know how to solve.

At the bottom of this message, I show the full structure of my tree and
the contents of all the files. Since the project is "minimal," there isn't
much to show.

>From within the "build" directory of my project, I ran BitBake like this:


    $ ../BitBake/bin/bitbake
    Nothing to do.  Use 'bitbake world' to build everything,
    or run 'bitbake --help' for usage information.


That's what I expected. Then, I tried to examine the layers:


    $ ../BitBake/bin/bitbake-layers show-layers
    layer    path                                    priority
    =========================================================
    LayerA   /home/pturley/Workspace/woohoo/LayerA   0


That's also what I expected. Things went wrong when I tried to examine the
recipes:


    $ ../BitBake/bin/bitbake-layers show-recipes
    Parsing recipes..$


That's wrong. I expected something like this:


    Parsing recipes..done.
    === Available recipes: ===
    a:
      LayerA               1


At first, "base.bbclass" was empty so, on a hunch, I added this:


    do_hello() {
        echo Hello
    }

    addtask hello


That changed the output to this:


    $ ../BitBake/bin/bitbake-layers show-recipes
    Parsing recipes..done.
    === Available recipes: ===
    a:
      ?                    1


This is still wrong, but better (though I can't explain why).

At this point I thought it best to look for experts. I don't need
hand-holding - but I *do* need substantive, accurate hints. If you have
any, I'd be grateful.


--------------------------------------------------


Here is the tree of files in my "minimal" project, along with the contents
of those file:

/home/pturley/Workspace/woohoo
    |
    +-- build
    |   |
    |   +-- classes
    |   |   |
    |   |   +-- base.bbclass
    |   |
    |   |     +-------------------------------------------
    |   |     | do_hello() {
    |   |     |     echo Hello
    |   |     | }
    |   |     |
    |   |     | addtask hello
    |   |     +-------------------------------------------
    |   |
    |   +-- conf
    |   |
    |   +-- bblayers.conf
    |   |
    |   |     +-------------------------------------------
    |   |     | BBLAYERS ?= " \
    |   |     |   /home/pturley/Workspace/woohoo/LayerA \
    |   |     |   "
    |   |     +-------------------------------------------
    |   |
    |   +-- bitbake.conf
    |
    |         +-------------------------------------------
    |         | CACHE = "${TOPDIR}/cache"
    |         +-------------------------------------------
    |
    +-- LayerA
    |   |
    |   +-- a.bb
    |   |
    |   |     +-------------------------------------------
    |   |     | PN = 'a'
    |   |     | PV = '1'
    |   |     +-------------------------------------------
    |   |
    |   +-- conf
    |   |
    |   +-- layer.conf
    |
    |         +-------------------------------------------
    |         | BBPATH .= ":${LAYERDIR}"
    |         | BBFILES += "${LAYERDIR}/*.bb"
    |         +-------------------------------------------
    |
    +-- 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.




More information about the yocto mailing list