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

Patrick Turley PatrickTurley at gamestop.com
Tue Oct 9 15:31:24 PDT 2012


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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/yocto/attachments/20121009/1d46027a/attachment.html>


More information about the yocto mailing list