The BitBake equivalent of "Hello, World!"
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 0That'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 1At first, "base.bbclass" was empty so, on a hunch, I added this:
do_hello() {
echo Hello
}
addtask helloThat changed the output to this:
$ ../BitBake/bin/bitbake-layers show-recipes
Parsing recipes..done.
=== Available recipes: ===
a:
? 1This 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.In my previous message, some of the indentation in the representation of my file tree was wrong (because we're using Outlook, which destroy all indentation when you paste it into an e-mail message). The errors are small, but I want to avoid annoying anyone who might think I don't even have the file tree constructed correctly.
The following is accurate:
Quoted 58 lines
/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.
Hi Patrick,
I think I understand what you are looking for. I created this Bitbake Hello World for a training class. It just uses 'raw' Bitbake and a very basic recipe to build the Nano editor (including download from the project site).
You need to have a couple of things in place to make this work. I got to run but I will get back to it and post it.
:rjs
Quoted 72 lines · Patrick Turley
In my previous message, some of the indentation in the representation of my file tree was wrong (because we're using Outlook, which destroy all indentation when you paste it into an e-mail message). The errors are small, but I want to avoid annoying anyone who might think I don't even have the file tree constructed correctly.
The following is accurate:
Quoted 52 lines
/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 ...Quoted 6 lines
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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
That is excellent news. I very much look forward to seeing that.
On Oct 3, 2012, at 6:03 PM, Rudolf Streif <[email protected]<mailto:[email protected]>>
wrote:
Hi Patrick,
I think I understand what you are looking for. I created this Bitbake Hello World for a training class. It just uses 'raw' Bitbake and a very basic recipe to build the Nano editor (including download from the project site).
You need to have a couple of things in place to make this work. I got to run but I will get back to it and post it.
:rjs
On Wed, Oct 3, 2012 at 3:56 PM, Patrick Turley <[email protected]<mailto:[email protected]>> wrote:
In my previous message, some of the indentation in the representation of
my file tree was wrong (because we're using Outlook, which destroy all
indentation when you paste it into an e-mail message). The errors are
small, but I want to avoid annoying anyone who might think I don't even
have the file tree constructed correctly.
The following is accurate:
Quoted 52 lines
/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<http://a.bb/> | | | | +------------------------------------------- | | | PN = 'a' | | | PV = '1' | | +------------------------------------------- | | | +-- conf | | | +-- layer.conf | | +------------------------------------------- | | BBPATH .= ":${LAYERDIR}" | | BBFILES += "${LAYERDIR}/*.bb" | +------------------------------------------- | +-- BitBake ...
Quoted 6 lines
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 [email protected]<mailto:[email protected]>
https://lists.yoctoproject.org/listinfo/yocto
[Warning: lengthy post, and probably boring to most.]
My Bitbake "Hello World" is a little more than a basic "Hello World". It's idea is to incorporate a layer and use a structure similar to what OE and Yocto are using. You can do it simpler if you want to. I did this a while ago with Bitbake 1.12.0. I would think it works with newer versions too although I have not tested it. This is the layout I am using:
bbtest/
├── conf │ ├── bblayers.conf │ └── bitbake.conf ├── downloads │ └── /* need to create but will be populated with downloads */ ├── meta-test │ ├── classes │ │ └── base.bbclass │ ├── conf
│ │ └── layer.conf
│ └── recipes-test
│ └── nano
│ └── nano.bb
└── tmp
└── /* will be created and populated when building */
The first thing Bitbake looks for is a conf/bblayers.conf file in the directory you started it from. This file must provide an initial setting for BBPATH:
bblayers.conf:
BBPATH := "${TOPDIR}"
BBFILES ?= ""
BBLAYERS = " \
${TOPDIR}/meta-test \
"
Without BBPATH Bitbake will not find any conf/<filename>.conf files and recipe files at all. It will also not find bitbake.conf. I simply copied bitbake.conf from the Bitbake download and edited DL_DIR:
bitbake.conf:
# comments omitted
B = "${S}"CVSDIR = "${DL_DIR}/cvs"
DEPENDS = ""
DEPLOY_DIR = "${TMPDIR}/deploy"DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images"DL_DIR = "${TOPDIR}/downloads"
FETCHCOMMAND = ""FETCHCOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} co ${CVSCOOPTS}
${CVSMODULE}"FETCHCOMMAND_svn = "/usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT}
${SVNMODULE}"FETCHCOMMAND_wget = "/usr/bin/env wget -t 5 --passive-ftp -P ${DL_DIR}
${URI}"
FILESDIR = "${@bb.utils.which(bb.data.getVar('FILESPATH', d, 1), '.')}"
FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}" FILE_DIRNAME = "${@os.path.dirname(bb.data.getVar('FILE', d))}"
GITDIR = "${DL_DIR}/git"IMAGE_CMD = "_NO_DEFINED_IMAGE_TYPES_"IMAGE_ROOTFS = "${TMPDIR}/rootfs"
MKTEMPCMD = "mktemp -q ${TMPBASE}"
MKTEMPDIRCMD = "mktemp -d -q ${TMPBASE}"
OVERRIDES = "local:${MACHINE}:${TARGET_OS}:${TARGET_ARCH}"
P = "${PN}-${PV}"PERSISTENT_DIR = "${TMPDIR}/cache"
PF = "${PN}-${PV}-${PR}"
PN = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[0]
or 'defaultpkgname'}"
PR = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[2]
or 'r0'}"
PROVIDES = ""
PV = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[1]
or '1.0'}"
RESUMECOMMAND = ""RESUMECOMMAND_wget = "/usr/bin/env wget -c -t 5 --passive-ftp -P ${DL_DIR}
${URI}"
S = "${WORKDIR}/${P}"SRC_URI = "file://${FILE}"
STAMP = "${TMPDIR}/stamps/${PF}"
SVNDIR = "${DL_DIR}/svn"
T = "${WORKDIR}/temp"TARGET_ARCH = "${BUILD_ARCH}"
TMPDIR = "${TOPDIR}/tmp"
UPDATECOMMAND = ""UPDATECOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} update ${CVSCOOPTS}" UPDATECOMMAND_svn = "/usr/bin/env svn update ${SVNCOOPTS}"
WORKDIR = "${TMPDIR}/work/${PF}"PERSISTENT_DIR = "${TMPDIR}/cache"
That's more than you need but it's convenient.
Bitbake will require a base.bbclass file somewhere in a classes subdirectory of BBPATH. I used the base.bbclass file from the Bitbake download. As a minimum it should contain a do_build task. That's the target that Bitbake invokes by default if you do not use the -c option explicitly. It's empty and does not do anything but it functions as an anchor for tasks you define in your recipes:
base.bbclass:
# comments omitted
die() {
bbfatal "$*"
}bbnote() {
echo "NOTE:" "$*"
}bbwarn() {
echo "WARNING:" "$*"
}bbfatal() {
echo "FATAL:" "$*"
exit 1
}addtask showdata
do_showdata[nostamp] = "1"
python do_showdata() {
import sys
# emit variables and shell functions bb.data.emit_env(sys.__stdout__, d, True)
# emit the metadata which isnt valid shell
for e in bb.data.keys(d):
if bb.data.getVarFlag(e, 'python', d):
sys.__stdout__.write("\npython %s () {\n%s}\n" %
(e, bb.data.getVar(e, d, 1)))
}
addtask listtasks
do_listtasks[nostamp] = "1"
python do_listtasks() {
import sys
for e in bb.data.keys(d):
if bb.data.getVarFlag(e, 'task', d):
sys.__stdout__.write("%s\n" % e)
}
addtask build
do_build[dirs] = "${TOPDIR}"
do_build[nostamp] = "1"
python base_do_build () {
bb.note("The included, default BB base.bbclass does not define a
useful default task.")
bb.note("Try running the 'listtasks' task against a .bb to see what
tasks are defined.")
}
EXPORT_FUNCTIONS do_clean do_mrproper do_build
Again, it's more than you need. It's just convenient to use it. I put this file inside the layer but you can also create a classes directory in ${TOPDIR} (bbtest in this example). Next, create a layer (meta-bbtest in my example, name does not matter, meta-* is convention). It needs a conf/layer.con file:
layer.conf:
# We have a metadata layer directory, add to BBPATH BBPATH .= ":${LAYERDIR}"
# We have a recipe directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \
${LAYERDIR}/recipes-*/*/*.bbappend"BBFILE_COLLECTIONS += "test"BBFILE_PATTERN_test := "^${LAYERDIR}/"BBFILE_PRIORITY_test = "5"
The path expression for the recipes is more complex than necessary, it just follows the convention. Finally a recipe to build the Nano editor:
DESCRIPTION = "Recipe to build the 'nano' editor"
PN = "nano"
PV = "2.2.6"
SRC_URI = "http://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz"
python do_fetch() {
bb.note("Downloading source tarball from ${SRC_URI} ...")
src_uri = (bb.data.getVar('SRC_URI', d, True) or "").split() if len(src_uri) == 0:
bb.fatal("Empty URI")
try:
bb.fetch.init(src_uri, d)
bb.fetch.go(d) except FetchError:
bb.fatal("Could not fetch source tarball.")
bb.note("Download successful.")
}
addtask fetch before do_build
python do_unpack() {
bb.note("Unpacking source tarball ...")
os.system("tar x -C ${WORKDIR} -f ${DL_DIR}/${P}.tar.gz") bb.note("Unpacked source tarball.")
}
addtask unpack before do_build after do_fetch
python do_configure() {
bb.note("Configuring source package ...")
os.system("cd ${WORKDIR}/${P} && ./configure") bb.note("Configured source package.")
}
addtask configure before do_build after do_unpack
python do_compile() {
bb.note("Compiling package...")
os.system("cd ${WORKDIR}/${P} && make") bb.note("Compiled package.")
}
addtask compile before do_build after do_configure
Nano is an autotooled package. This recipe simply at a very basic level does what you would do manually. OECore's autotools.bbclass is much more sophisticated and so are the fetcher class files.
:rjs
Thanks, this is great! I was looking for something exactly like this. I'm going to have a play wit it right now. If you (or anyone) can think of any ways this example doesn't adhere to current bitbake best practices (other than not inheriting from OECore's more full-featured base classes), please let me know...
Quoted 250 lines · Rudolf Streif
[Warning: lengthy post, and probably boring to most.]
My Bitbake "Hello World" is a little more than a basic "Hello World". It's idea is to incorporate a layer and use a structure similar to what OE and Yocto are using. You can do it simpler if you want to. I did this a while ago with Bitbake 1.12.0. I would think it works with newer versions too although I have not tested it. This is the layout I am using:
bbtest/
├── conf │ ├── bblayers.conf │ └── bitbake.conf ├── downloads │ └── /* need to create but will be populated with downloads */ ├── meta-test │ ├── classes │ │ └── base.bbclass │ ├── conf │ │ └── layer.conf │ └── recipes-test │ └── nano │ └── nano.bb └── tmp └── /* will be created and populated when building */The first thing Bitbake looks for is a
conf/bblayers.conffile in the directory you started it from. This file must provide an initial setting for BBPATH:bblayers.conf:
BBPATH := "${TOPDIR}"
BBFILES ?= ""
BBLAYERS = " \
${TOPDIR}/meta-test \
"Without BBPATH Bitbake will not find any conf/<filename>.conf files and recipe files at all. It will also not find bitbake.conf. I simply copied bitbake.conf from the Bitbake download and edited
DL_DIR:bitbake.conf:
# comments omitted B = "${S}" CVSDIR = "${DL_DIR}/cvs" DEPENDS = "" DEPLOY_DIR = "${TMPDIR}/deploy" DEPLOY_DIR_IMAGE = "${DEPLOY_DIR}/images" DL_DIR = "${TOPDIR}/downloads" FETCHCOMMAND = "" FETCHCOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} co ${CVSCOOPTS} ${CVSMODULE}" FETCHCOMMAND_svn = "/usr/bin/env svn co ${SVNCOOPTS} ${SVNROOT} ${SVNMODULE}" FETCHCOMMAND_wget = "/usr/bin/env wget -t 5 --passive-ftp -P ${DL_DIR} ${URI}" FILESDIR = "${@bb.utils.which(bb.data.getVar('FILESPATH', d, 1), '.')}" FILESPATH = "${FILE_DIRNAME}/${PF}:${FILE_DIRNAME}/${P}:${FILE_DIRNAME}/${PN}:${FILE_DIRNAME}/files:${FILE_DIRNAME}" FILE_DIRNAME = "${@os.path.dirname(bb.data.getVar('FILE', d))}" GITDIR = "${DL_DIR}/git" IMAGE_CMD = "_NO_DEFINED_IMAGE_TYPES_" IMAGE_ROOTFS = "${TMPDIR}/rootfs" MKTEMPCMD = "mktemp -q ${TMPBASE}" MKTEMPDIRCMD = "mktemp -d -q ${TMPBASE}" OVERRIDES = "local:${MACHINE}:${TARGET_OS}:${TARGET_ARCH}" P = "${PN}-${PV}" PERSISTENT_DIR = "${TMPDIR}/cache" PF = "${PN}-${PV}-${PR}" PN = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[0] or 'defaultpkgname'}" PR = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[2] or 'r0'}" PROVIDES = "" PV = "${@bb.parse.BBHandler.vars_from_file(bb.data.getVar('FILE',d),d)[1] or '1.0'}" RESUMECOMMAND = "" RESUMECOMMAND_wget = "/usr/bin/env wget -c -t 5 --passive-ftp -P ${DL_DIR} ${URI}" S = "${WORKDIR}/${P}" SRC_URI = "file://${FILE}" STAMP = "${TMPDIR}/stamps/${PF}" SVNDIR = "${DL_DIR}/svn" T = "${WORKDIR}/temp" TARGET_ARCH = "${BUILD_ARCH}" TMPDIR = "${TOPDIR}/tmp" UPDATECOMMAND = "" UPDATECOMMAND_cvs = "/usr/bin/env cvs -d${CVSROOT} update ${CVSCOOPTS}" UPDATECOMMAND_svn = "/usr/bin/env svn update ${SVNCOOPTS}" WORKDIR = "${TMPDIR}/work/${PF}" PERSISTENT_DIR = "${TMPDIR}/cache"That's more than you need but it's convenient.
Bitbake will require a base.bbclass file somewhere in a classes subdirectory of BBPATH. I used the base.bbclass file from the Bitbake download. As a minimum it should contain a
do_buildtask. That's the target that Bitbake invokes by default if you do not use the -c option explicitly. It's empty and does not do anything but it functions as an anchor for tasks you define in your recipes:base.bbclass:
# comments omitted die() { bbfatal "$*" }bbnote() { echo "NOTE:" "$*" }bbwarn() { echo "WARNING:" "$*" }bbfatal() { echo "FATAL:" "$*" exit 1 }addtask showdata
do_showdata[nostamp] = "1"
pythondo_showdata(){
import sys
# emit variables and shell functionsbb.data.emit_env(sys.__stdout__, d, True)
# emit the metadata which isnt valid shell
for e inbb.data.keys(d):
ifbb.data.getVarFlag(e, 'python', d):
sys.__stdout__.write("\npython %s () {\n%s}\n" % (e,bb.data.getVar(e, d, 1)))
}addtask listtasks
do_listtasks[nostamp] = "1"
pythondo_listtasks(){
import sys
for e inbb.data.keys(d):
ifbb.data.getVarFlag(e, 'task', d):
sys.__stdout__.write("%s\n" % e)
}addtask build
do_build[dirs] = "${TOPDIR}"
do_build[nostamp] = "1"
pythonbase_do_build() {
bb.note("The included, default BB base.bbclass does not define a
useful default task.")
bb.note("Try running the 'listtasks' task against a .bb to see what
tasks are defined.")
}
EXPORT_FUNCTIONSdo_cleando_mrproperdo_buildAgain, it's more than you need. It's just convenient to use it. I put this file inside the layer but you can also create a classes directory in ${TOPDIR} (bbtest in this example). Next, create a layer (meta-bbtest in my example, name does not matter, meta-* is convention). It needs a conf/layer.con file:
layer.conf:
# We have a metadata layer directory, add to BBPATH BBPATH .= ":${LAYERDIR}"
# We have a recipe directory, add to BBFILES
BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ ${LAYERDIR}/recipes-*/*/*.bbappend"
BBFILE_COLLECTIONS+= "test"BBFILE_PATTERN_test:= "^${LAYERDIR}/"BBFILE_PRIORITY_test= "5"The path expression for the recipes is more complex than necessary, it just follows the convention. Finally a recipe to build the Nano editor:
DESCRIPTION = "Recipe to build the 'nano' editor"
PN = "nano"
PV = "2.2.6"
SRC_URI= "http://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz"python do_fetch() { bb.note("Downloading source tarball from ${SRC_URI} ...") src_uri = (bb.data.getVar('SRC_URI', d, True) or "").split() if len(src_uri) == 0: bb.fatal("Empty URI") try: bb.fetch.init(src_uri, d) bb.fetch.go(d) except FetchError: bb.fatal("Could not fetch source tarball.") bb.note("Download successful.") }addtask fetch before
do_buildpython
do_unpack(){
bb.note("Unpacking source tarball ...")os.system("tar x -C ${WORKDIR} -f ${DL_DIR}/${P}.tar.gz")
bb.note("Unpacked source tarball.")
}addtask unpack before
do_buildafterdo_fetchpython
do_configure(){
bb.note("Configuring source package ...")os.system("cd ${WORKDIR}/${P} && ./configure")
bb.note("Configured source package.")
}addtask configure before
do_buildafterdo_unpackpython do_compile() { bb.note("Compiling package...") os.system("cd ${WORKDIR}/${P} && make") bb.note("Compiled package.") }addtask compile before
do_buildafterdo_configureNano is an autotooled package. This recipe simply at a very basic level does what you would do manually. OECore's autotools.bbclass is much more sophisticated and so are the fetcher class files.
:rjs
_______________________________________________
yocto mailing list
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
*Very* helpful stuff.
I have re-created the tree you described, and everything seems to work. In particular, bitbake-layers seems happy. I tried executing it against BitBake 1.12.0 and it succeeded. FYI, it failed against the current BitBake master, which is 1.16.0.
I have some additional questions below. You've already been so helpful that I'm reluctant to impose … but I'm going to try anyway :)
On Oct 4, 2012, at 1:58 PM, Rudolf Streif <[email protected]<mailto:[email protected]>> wrote:
My Bitbake "Hello World" is a little more than a basic "Hello World".
Indeed it is. One of my first tasks will be to *remove* as much as possible from this until the only thing it does is print out "Hello, World!" I'll be happy to share my results if anyone is interested.
Bitbake will require a base.bbclass file somewhere in a classes subdirectory of BBPATH. I used the base.bbclass file from the Bitbake download. As a minimum it should contain a do_build task. That's the target that Bitbake invokes by default if you do not use the -c option explicitly.
…
addtask build
do_build[dirs] = "${TOPDIR}"
do_build[nostamp] = "1"
python base_do_build () {
bb.note("The included, default BB base.bbclass does not define a useful default task.") bb.note("Try running the 'listtasks' task against a .bb to see what tasks are defined.")
}
If I understand correctly, the name of the task is "build", and the name of the Python function that implements it is "do_build()". So, it appears BitBake prefixes all task names with "do_" to derive the name of the function that implements the task. Have I got that right?
The "build" task is *required*, and it's the *only* one that's required?
I've been looking around in the BitBake source code a lot, so I'm *somewhat* familiar with it. I tried to find the "hard" reference to "do_build" you described, but I couldn't. Can you give me a hint?
Finally a recipe to build the Nano editor:
DESCRIPTION = "Recipe to build the 'nano' editor"
PN = "nano"
PV = "2.2.6"
SRC_URI = "http://www.nano-editor.org/dist/v2.2/nano-2.2.6.tar.gz"
python do_fetch() {
bb.note("Downloading source tarball from ${SRC_URI} ...")
src_uri = (bb.data.getVar('SRC_URI', d, True) or "").split() if len(src_uri) == 0:
bb.fatal("Empty URI")
try:
bb.fetch.init(src_uri, d)
bb.fetch.go(d) except FetchError:
bb.fatal("Could not fetch source tarball.")
bb.note("Download successful.")
}
addtask fetch before do_build
I see here that you're creating the recipe-specific "do_fetch()" function, which seems intended to "override" the default "do_fetch()" provided by the base class. This prompts some questions:
1) Must a "task function" be a Python function? Or will a bash function do?
2) Is it absolutely necessary to follow a recipe-specific task function with an "addtask"? Based on experience from "real" object-oriented languages, a naive observer (like me) would guess the simple presence of "do_fetch()" in the recipe is all that's necessary. Or is it the "addtask" that actually "slots" the new function in?
And one final question: Have I been putting this on the wrong mailing list?
I just discovered the mailing lists at OpenEmbedded, specifically:
Apologies if I've been bothering the wrong people.
Quoted 1 line · Patrick Turley
*Very* helpful stuff.
Disclaimer: I am no Bitbake expert. I just put this together by rummaging through the Bitbake code for a couple of minutes. I am reasonably confident that what I am saying below is rather accurate but the Bitbake experts know better.
Indeed it is. One of my first tasks will be to *remove* as much as
Quoted 4 lines
possible from this until the only thing it does is print out "Hello, World!" I'll be happy to share my results if anyone is interested.
You can just do a recipe and overwrite
do_build()in it e.g.
python do_build() {
bb.note("Hello World")
}
Quoted 6 lines
If I understand correctly, the name of the task is "build", and the name of the Python function that implements it is "
do_build()". So, it appears BitBake prefixes all task names with "do_" to derive the name of the function that implements the task. Have I got that right?
Yes. All tasks defined in recipes or classes have to follow the naming convention do_<taskname> when defining them. However, when adding them to the queue you have to omit the do_ e.g. addtask <taskname>.
Quoted 3 lines
The "build" task is *required*, and it's the *only* one that's required?
No task is really required. The build task is only the default task if you do not specify a specific task with -c. However, if you use -c Bitbake will only execute that task and not check and run any task that this task is depending on. But that's a whole different story.
Quoted 6 lines
I've been looking around in the BitBake source code a lot, so I'm
*somewhat* familiar with it. I tried to find the "hard" reference to "do_build" you described, but I couldn't. Can you give me a hint?In <bitbakedir>/lib/bb/cooker.py:
class BBCooker:
"""
Manages one bitbake build run
"""
def __init__(self, configuration, server_registration_cb):
# stuff omitted
if not self.configuration.cmd:
self.configuration.cmd = bb.data.getVar("BB_DEFAULT_TASK",
self.configuration.data, True) or "build"
# more stuff
Bitbake checks if the variable BB_DEFAULT_TASK is set and if not uses "build" as default task. You could set BB_DEFAULT_TASK in a configuration file e.g. bitbake.conf to any task you like (as long as it is defined).
Quoted 4 lines
I see here that you're creating the recipe-specific "
do_fetch()"
function, which seems intended to "override" the default "do_fetch()" provided by the base class. This prompts some questions:
My base.bbclass file does not have a do_fetch function. What am I missing?
Quoted 4 lines
1) Must a "task function" be a Python function? Or will a bash function
do?
Tasks must be Python functions.
Quoted 8 lines
2) Is it absolutely necessary to follow a recipe-specific task function
with an "addtask"? Based on experience from "real" object-oriented languages, a naive observer (like me) would guess the simple presence of "do_fetch()" in the recipe is all that's necessary. Or is it the "addtask" that actually "slots" the new function in?You have to use addtask to make your Python function, given it follows
the naming convention, known to Bitbake as a task. You can put addtask with the tasks name anywhere in your recipe. It does not need to follow the task but it makes it easier to read. If you just add a task using addtask it is kind of standalone. If you use addtask with the before/after directives you establish an execution order.
:rjs
Quoted 1 line
And one final question: Have I been putting this on the wrong mailing
list?
Kind of, but you would not have gotten my response because I do not subscribe to bitbake-devel :)
:rjs
Quoted 1 line
And one final question: Have I been putting this on the wrong mailing
list?
Possibly, kind of, but you would not have gotten my response because I do not follow to bitbake-devel :)
:rjs
Quoted 13 lines · Rudolf Streif
Disclaimer: I am no Bitbake expert. I just put this together by rummaging through the Bitbake code for a couple of minutes. I am reasonably confident that what I am saying below is rather accurate but the Bitbake experts know better.
Indeed it is. One of my first tasks will be to *remove* as much as possible from this until the only thing it does is print out "Hello, World!" I'll be happy to share my results if anyone is interested.
Quoted 7 lines
You can just do a recipe and overwrite
do_build()in it e.g.python
do_build(){
bb.note("Hello World")
}
That would print:
NOTE: Hello World
and would probably only sent it to the task logfile.
bb.plain("Hello World")
would make it to the console though :)
[...]
Quoted 7 lines
1) Must a "task function" be a Python function? Or will a bash function do?
Tasks must be Python functions.
No, they can be shell functions too.
Cheers,
Richard
Quoted 4 lines
Quoted 3 lines
Tasks must be Python functions.
No, they can be shell functions too.
Probably worth adding that if you are doing an _append() on a task function, you have to match the original function type. E.g., if you want to append a shell snippet to a python task function, you need to do something like this (from the eglibc recipe):
do_unpack_append() {
bb.build.exec_func('do_move_ports', d)
}do_move_ports() {
if test -d ${WORKDIR}/${EGLIBC_BRANCH}/ports ; then
rm -rf ${S}/ports
mv ${WORKDIR}/${EGLIBC_BRANCH}/ports ${S}/
fi
}Tomas
I am continuing my work on creating a "Hello, World!" BitBake project. Because of the excellent help I got before, things have gone reasonably well, but I'm again running into something I don't know how to fix.
As before, the entire contents of my very small project appear at the end of this message. Here's what works fine:
$ ../BitBake/bin/bitbake-layers show-layers
Parsing recipes..done. layer path priority
==========================================================
LayerA /home/pturley/Workspace/Hello/LayerA 1
$ ../BitBake/bin/bitbake-layers show-recipes
Parsing recipes..done.
=== Available recipes: ===
a:
LayerA 1
When I tried this:
../BitBake/bin/bitbake -c listtasks a
I got a Python stack trace that ended here:
File "../BitBake/lib/bb/runqueue.py", line 902, in RunQueue.check_stamp_task(task=0, taskname='do_listtasks', recurse=False):
# If the stamp is missing its not current
> if not os.access(stampfile, os.F_OK):
logger.debug(2, "Stampfile %s not available", stampfile)
TypeError: coercing to Unicode: need string or buffer, NoneType found
This code isn't expecting the "stampfile" variable to be "None" (which it is), so it freaks out. I made a very simple fix to get past the problem:
if not stampfile or not os.access(stampfile, os.F_OK):
That made a dramatic difference, and enabled me to get this far:
$ ../BitBake/bin/bitbake -c listtasks a
Loading cache: 100% |###############################################################| ETA: 00:00:00
Loaded 2 entries from dependency cache.
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_listtasks)
ERROR: T variable not set, unable to build
ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb, do_listtasks) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and 1 failed. Summary: 1 task failed:
/home/pturley/Workspace/Hello/LayerA/a.bb, do_listtasks
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
$ ../BitBake/bin/bitbake a
Loading cache: 100% |###############################################################| ETA: 00:00:00 Loaded 2 entries from dependency cache.
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)
ERROR: T variable not set, unable to build
ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb, do_build) failed with exit code '1'
NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and 1 failed.
Summary: 1 task failed:
/home/pturley/Workspace/Hello/LayerA/a.bb, do_build
Summary: There was 1 ERROR message shown, returning a non-zero exit code.
As you can see, BitBake is expecting the "T" variable to be set. I don't think I've ever seen this variable -- so I don't know what it's for or what I should change.
Can anyone offer a hint?
------------------------------------------------------------
├── build
│ │
│ ├── classes
│ │ │
│ │ └── base.bbclass
│ │
│ │ +-----------------------------------------------
│ │ | addtask listtasks
│ │ |
│ │ | do_listtasks[nostamp] = "1"
│ │ |
│ │ | python do_listtasks() {
│ │ | import sys
│ │ | # emit variables and shell functions
│ │ | #bb.data.emit_env(sys.__stdout__, d)
│ │ | # emit the metadata which isnt valid shell
│ │ | for e in d.keys():
│ │ | if d.getVarFlag(e, 'task'):
│ │ | bb.plain("%s" % e)
│ │ | }
│ │ |
│ │ | addtask build
│ │ |
│ │ | do_build() {
│ │ | echo "Hello"
│ │ | }
│ │ +-----------------------------------------------
│ │
│ └── conf
│ │
│ ├── bblayers.conf
│ │
│ │ +-----------------------------------------------
│ │ | BBLAYERS ?= " \
│ │ | /home/pturley/Workspace/Hello/LayerA \
│ │ | "
│ │ +-----------------------------------------------
│ │
│ └── bitbake.conf
│
│ +-----------------------------------------------
│ | CACHE = "${TOPDIR}/cache"
│ +-----------------------------------------------
│
├── LayerA
│ │
│ ├── a.bb
│ │
│ │ +-----------------------------------------------
│ │ | DESCRIPTION = "Layer A Main Recipe"
│ │ | PN = 'a'
│ │ | PV = '1'
│ │ +-----------------------------------------------
│ │
│ └── conf
│ │
│ └── layer.conf
│
│ +-----------------------------------------------
│ | BBPATH .= ":${LAYERDIR}"
│ |
│ | BBFILES += "${LAYERDIR}/*.bb"
│ |
│ | BBFILE_COLLECTIONS += "A"
│ | BBFILE_PATTERN_A := "^${LAYERDIR}/"
│ +-----------------------------------------------
│
└── BitBakeThe BitBake directory origin is:
http://git.openembedded.org/bitbake/
I have the 1.15.2 tag checked out, which is what Yocto denzil uses.
The T variable points to a directory were Bitbake places temporary files when building a particular package. It is typically set to
T = ${WORKDIR}/temp
WORKDIR is the directory into which Bitbake unpacks and builds a package. The default bitbake.conf file sets this variable.
T is not to be confused with TMPDIR which points to the root of the directory tree where Bitbake puts the output of an entire build.
:rjs
Quoted 186 lines · Patrick Turley
I am continuing my work on creating a "Hello, World!" BitBake project.
Because of the excellent help I got before, things have gone reasonably well, but I'm again running into something I don't know how to fix.As before, the entire contents of my very small project appear at the
end of this message. Here's what works fine:$ ../BitBake/bin/bitbake-layers show-layers Parsing recipes..done.layer path priority
==========================================================
LayerA/home/pturley/Workspace/Hello/LayerA1$ ../BitBake/bin/bitbake-layers show-recipes
Parsing recipes..done.
=== Available recipes: ===
a:
LayerA 1When I tried this:
../BitBake/bin/bitbake -c listtasks a
I got a Python stack trace that ended here:
File "../BitBake/lib/bb/runqueue.py", line 902, in
RunQueue.check_stamp_task(task=0, taskname='do_listtasks', recurse=False):
# If the stamp is missing its not current
> if notos.access(stampfile, os.F_OK):
logger.debug(2, "Stampfile %s not available",
stampfile)
TypeError: coercing to Unicode: need string or buffer, NoneType foundThis code isn't expecting the "stampfile" variable to be "None" (which
it is), so it freaks out. I made a very simple fix to get past the problem:if not stampfile or not
os.access(stampfile, os.F_OK):That made a dramatic difference, and enabled me to get this far:
$ ../BitBake/bin/bitbake -c listtasks a Loading cache: 100% |###############################################################| ETA: 00:00:00 Loaded 2 entries from dependency cache. 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_listtasks) ERROR: T variable not set, unable to build ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb, do_listtasks) failed with exit code '1' NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and 1 failed.Summary: 1 task failed:
/home/pturley/Workspace/Hello/LayerA/a.bb,do_listtasks
Summary: There was 1 ERROR message shown, returning a non-zero exit
code.$ ../BitBake/bin/bitbake a Loading cache: 100% |###############################################################| ETA: 00:00:00 Loaded 2 entries from dependency cache. 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) ERROR: T variable not set, unable to build ERROR: Task 0 (/home/pturley/Workspace/Hello/LayerA/a.bb, do_build) failed with exit code '1' NOTE: Tasks Summary: Attempted 1 tasks of which 0 didn't need to be rerun and 1 failed.Summary: 1 task failed:
/home/pturley/Workspace/Hello/LayerA/a.bb,do_build
Summary: There was 1 ERROR message shown, returning a non-zero exit
code.As you can see, BitBake is expecting the "T" variable to be set. I
don't think I've ever seen this variable -- so I don't know what it's for or what I should change.Can anyone offer a hint?
------------------------------------------------------------
├── build │ │ │ ├── classes │ │ │ │ │ └── base.bbclass │ │ │ │ +----------------------------------------------- │ │ | addtask listtasks │ │ | │ │ | do_listtasks[nostamp] = "1" │ │ | │ │ | python do_listtasks() { │ │ | import sys │ │ | # emit variables and shell functions │ │ | #bb.data.emit_env(sys.__stdout__, d) │ │ | # emit the metadata which isnt valid shell │ │ | for e in d.keys(): │ │ | if d.getVarFlag(e, 'task'): │ │ | bb.plain("%s" % e) │ │ | } │ │ | │ │ | addtask build │ │ | │ │ | do_build() { │ │ | echo "Hello" │ │ | } │ │ +----------------------------------------------- │ │ │ └── conf │ │ │ ├── bblayers.conf │ │ │ │ +----------------------------------------------- │ │ | BBLAYERS ?= " \ │ │ | /home/pturley/Workspace/Hello/LayerA \ │ │ | " │ │ +----------------------------------------------- │ │ │ └── bitbake.conf │ │ +----------------------------------------------- │ | CACHE = "${TOPDIR}/cache" │ +----------------------------------------------- │ ├── LayerA │ │ │ ├── a.bb │ │ │ │ +----------------------------------------------- │ │ | DESCRIPTION = "Layer A Main Recipe" │ │ | PN = 'a' │ │ | PV = '1' │ │ +----------------------------------------------- │ │ │ └── conf │ │ │ └── layer.conf │ │ +----------------------------------------------- │ | BBPATH .= ":${LAYERDIR}" │ | │ | BBFILES += "${LAYERDIR}/*.bb" │ | │ | BBFILE_COLLECTIONS += "A" │ | BBFILE_PATTERN_A := "^${LAYERDIR}/" │ +----------------------------------------------- │ └── BitBakeThe 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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
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}/"
│ +-----------------------------------------------
│
└── BitBakeThe BitBake directory origin is:
http://git.openembedded.org/bitbake/
I have the 1.15.2 tag checked out, which is what Yocto denzil uses.
Quoted 3 lines · Patrick Turley
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:
Perhaps you could push this to github somewhere as an example?
-M
Quoted 112 lines
$ ../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}/" │ +----------------------------------------------- │ └── BitBakeThe 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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
That's a perfectly reasonable suggestion, and a good excuse for me to open a github account and learn how to use it :)
Quoted 121 lines · On Oct 9, 2012, at 5:56 PM, McClintock Matthew-B29882 <[email protected]>…
Quoted 3 lines · Patrick Turley
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:
Perhaps you could push this to github somewhere as an example?
-M
Quoted 111 lines
$ ../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}/" │ +----------------------------------------------- │ └── BitBakeThe 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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
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.
Quoted 115 lines · Patrick Turley
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}/" │ +----------------------------------------------- │ └── BitBakeThe 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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
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!
Quoted 140 lines · Evade Flow
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, MAILI 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.
Quoted 115 lines · Patrick Turley
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}/" │ +----------------------------------------------- │ └── BitBakeThe 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
[email protected]
https://lists.yoctoproject.org/listinfo/yocto
https://github.com/pturley0/bitbake-hello-world
Quoted 9 lines · On Oct 9, 2012, at 5:56 PM, McClintock Matthew-B29882 <[email protected]>…
Quoted 3 lines · Patrick Turley
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:
Perhaps you could push this to github somewhere as an example?
-M