Compiling a simple command


Paul D. DeRocco
 

I've tried to add a single small executable to my image, based on what it
says in 5.3.1. of the Project Development Manual, and while the image gets
built with no error messages, it never compiles my executable. I'm not doing
_exactly_ what it says, so I assume some difference is accounting for this
failure. What I'm doing different:

1) Since I'm only adding one tiny little program to an otherwise default
image, I'm not creating a separate .bb file for it, but placing it in the
top-level .bb file that I invoke with the bitbake command.

2) Since I only have one .bb file, I'm sticking it in the layer directory,
not two levels down, and adding ${LAYERDIR}/*.bb to BBFILES.

It's finding the recipe okay, because the image is being built, but it's
never executing do_compile or do_install. The recipe looks like this:

--
require recipes-core/images/core-image-base.bb

DESCRIPTION = "A basic image with a realtime kernel."
DEPENDS = "linux-yocto-rt"
LICENSE = "MIT"
PR = "r0"

SRC_URI = "file://fastuart.cpp"

S = "${WORKDIR}"

do_compile() {
${CC} fastuart.cpp -o fastuart
}

do_install() {
install -d ${D}${bindir}
install -m 0755 fastuart ${D}${bindir}
}
--

The source is one level down from the recipe file, in files/fastuart.cpp. Is
there some reason that one can't do a compilation from a top-level recipe
that makes an image? Or is it because of the location of the .bb file in the
tree? Or am I doing something else wrong?

--

Ciao, Paul D. DeRocco
Paul mailto:pderocco@...


Nicolas Dechesne <nicolas.dechesne@...>
 


On Thu, Jun 20, 2013 at 6:08 PM, Paul D. DeRocco <pderocco@...> wrote:
I've tried to add a single small executable to my image, based on what it
says in 5.3.1. of the Project Development Manual, and while the image gets
built with no error messages, it never compiles my executable. I'm not doing
_exactly_ what it says, so I assume some difference is accounting for this
failure. What I'm doing different:

1) Since I'm only adding one tiny little program to an otherwise default
image, I'm not creating a separate .bb file for it, but placing it in the
top-level .bb file that I invoke with the bitbake command.

2) Since I only have one .bb file, I'm sticking it in the layer directory,
not two levels down, and adding ${LAYERDIR}/*.bb to BBFILES.

It's finding the recipe okay, because the image is being built, but it's
never executing do_compile or do_install. The recipe looks like this:

--
require recipes-core/images/core-image-base.bb

DESCRIPTION = "A basic image with a realtime kernel."
DEPENDS = "linux-yocto-rt"
LICENSE = "MIT"
PR = "r0"

SRC_URI = "file://fastuart.cpp"

S = "${WORKDIR}"

do_compile() {
    ${CC} fastuart.cpp -o fastuart
}

do_install() {
    install -d ${D}${bindir}
    install -m 0755 fastuart ${D}${bindir}
}

here you are mixing a recipe for an image with a recipe for a 'package', and that's wrong. you have recipes for images, and recipes for packages.  for package, bitbake will actually do the standard fetch/unpack/patch/configure/compile/package steps, but not for images. all images recipe inherit from image.bbclass, and if you check that file you can see that all 'normal package' tasks are disabled (toward the end of the file)

so, while your recipe is indeed syntactically correct, the do_compile() and do_install() aren't never really called.

you need to make a separate recipe for your package, e.g. fastuart_1.0.bb (and removes the 'require' at the beginning).

then you can create your image recipe, and request your package to be installed in the image , you can do something like that:

require recipes-core/images/core-image-base.bb
IMAGE_INSTALL += 'fastuart'




Paul D. DeRocco
 

From: Nicolas Dechesne

here you are mixing a recipe for an image with a recipe for a
'package', and that's wrong. you have recipes for images, and
recipes for packages. for package, bitbake will actually do
the standard fetch/unpack/patch/configure/compile/package
steps, but not for images. all images recipe inherit from
image.bbclass, and if you check that file you can see that
all 'normal package' tasks are disabled (toward the end of the file)

so, while your recipe is indeed syntactically correct, the
do_compile() and do_install() aren't never really called.

you need to make a separate recipe for your package, e.g.
fastuart_1.0.bb (and removes the 'require' at the beginning).

then you can create your image recipe, and request your
package to be installed in the image , you can do something like that:

require recipes-core/images/core-image-base.bb
<http://core-image-base.bb/>

IMAGE_INSTALL += 'fastuart'
Thanks, that appears to work.

--

Ciao, Paul D. DeRocco
Paul mailto:pderocco@...