Discussion:
How to require image recipe from another layer?
autif khan
2011-12-28 20:06:39 UTC
Permalink
Hi,

I have the following problem and I am not sure how to resolve it.

I have created my own layer (say) meta-autif

In the layer - I have my recipes (say) helloworld, many more may be

Now I want to add these packages to the core-image-sato recipe for the
image. This recipe resides in meta layer (under recipes-sato/images)

I have the following recipe (say) core-image-autif.bb

require core-image-sato.bb
IMAGE_FEATURES += "helloworld"

When I execute "bitbake core-image-autif", I get the following error

ERROR: Could not include required file core-image-sato.bb

However, when I copy core-image-sato.bb from meta/recipes-sato/images
to the same directory as core-image-autif.bb, I get the image (with my
helloworld and other apps)

My question is - if there is a way to include/require a recipe form a
different directory? If yes, what is it? If not, is there a
recommended solution - that scales (if the core-image-sato.bb changes,
that should be reflected in core-image-autif).

Thanks

Autif
Chris Larson
2011-12-28 20:12:50 UTC
Permalink
Post by autif khan
I have the following problem and I am not sure how to resolve it.
I have created my own layer (say) meta-autif
In the layer - I have my recipes (say) helloworld, many more may be
Now I want to add these packages to the core-image-sato recipe for the
image. This recipe resides in meta layer (under recipes-sato/images)
I have the following recipe (say) core-image-autif.bb
require core-image-sato.bb
IMAGE_FEATURES += "helloworld"
You want something like:

require recipes-core/images/core-image-sato.bb
--
Christopher Larson
autif khan
2011-12-28 20:22:27 UTC
Permalink
Thats right. Accounting for the relative, path, the following recipe
seems to works.

require ../../../meta/recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"

Thanks for the help

Autif
Post by Chris Larson
Post by autif khan
I have the following problem and I am not sure how to resolve it.
I have created my own layer (say) meta-autif
In the layer - I have my recipes (say) helloworld, many more may be
Now I want to add these packages to the core-image-sato recipe for the
image. This recipe resides in meta layer (under recipes-sato/images)
I have the following recipe (say) core-image-autif.bb
require core-image-sato.bb
IMAGE_FEATURES += "helloworld"
require recipes-core/images/core-image-sato.bb
--
Christopher Larson
Chris Larson
2011-12-28 20:31:20 UTC
Permalink
Post by autif khan
Thats right. Accounting for the relative, path, the following recipe
seems to works.
require ../../../meta/recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"
That's not what I was referring to. You don't need the full relative
path. It will automatically search BBPATH if you require a relative
path. if you do require recipes-sato/images/core-image-sato.bb, it
will search your layers and find it.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
autif khan
2011-12-28 20:43:43 UTC
Permalink
Must be the hangover from the holidays!

I typed the path as you suggested (I did replace recipes-core with
recipes-sato), but I must have had a type somewhere and it did not
work and gave the same error. I then tried the relative path - which I
copied and pasted - instead of typing and it worked. So I assumed
thats what it must have been.

Now, I have the following as my recipe and it works just fine. As I
said - must be the hangover from the holidays.

require recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"

Thanks again

Autif
Post by Chris Larson
Post by autif khan
Thats right. Accounting for the relative, path, the following recipe
seems to works.
require ../../../meta/recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"
That's not what I was referring to. You don't need the full relative
path. It will automatically search BBPATH if you require a relative
path. if you do require recipes-sato/images/core-image-sato.bb, it
will search your layers and find it.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
autif khan
2011-12-29 18:14:20 UTC
Permalink
Another recipe question along the same path.

The following recipe does not actually put helloworld in the image -
it does not even build it.

require recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"

The following one does.

require recipes-sato/images/core-image-sato.bb
IMAGE_INSTALL += "helloworld"

I am guessing that if I have several recipes in my layer (say) hw1,
hw2, hw3 etc, I would have to use the following recipe.

require recipes-sato/images/core-image-sato.bb
IMAGE_INSTALL += "hw1 hw2 hw3 etc"

However, I am sure there is a way to ties these up with
"IMAGE_FEATURE" variable.

Can you please help me with setting up my recipes so that all the
hello world apps are included when I use the following recipe.

require recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"

I am guessing that I would have to tell the hw1 recipe that it is a
helloworld feature. How do I go about doing this?

Here it is for reference:

DESCRIPTION = "hello world app"
SECTION = "autif"
LICENSE = "SomeLic"
LIC_FILES_CHKSUM = "file://COPYING;md5=178c09540123ca26c1b9c1ccbfbcde87"
PR = "r0"

SRC_URI = "file://COPYING \
file://helloworld.c"

S = "${WORKDIR}"

do_compile () {
${CC} helloworld.c -o helloworld
}

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


Thanks again!

Autif
Post by autif khan
Must be the hangover from the holidays!
I typed the path as you suggested (I did replace recipes-core with
recipes-sato), but I must have had a type somewhere and it did not
work and gave the same error. I then tried the relative path - which I
copied and pasted - instead of typing and it worked. So I assumed
thats what it must have been.
Now, I have the following as my recipe and it works just fine. As I
said - must be the hangover from the holidays.
require recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"
Thanks again
Autif
Post by Chris Larson
Post by autif khan
Thats right. Accounting for the relative, path, the following recipe
seems to works.
require ../../../meta/recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"
That's not what I was referring to. You don't need the full relative
path. It will automatically search BBPATH if you require a relative
path. if you do require recipes-sato/images/core-image-sato.bb, it
will search your layers and find it.
--
Christopher Larson
clarson at kergoth dot com
Founder - BitBake, OpenEmbedded, OpenZaurus
Maintainer - Tslib
Senior Software Engineer, Mentor Graphics
Paul Eggleton
2011-12-29 18:23:59 UTC
Permalink
Post by autif khan
The following recipe does not actually put helloworld in the image -
it does not even build it.
require recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"
The following one does.
require recipes-sato/images/core-image-sato.bb
IMAGE_INSTALL += "helloworld"
I am guessing that if I have several recipes in my layer (say) hw1,
hw2, hw3 etc, I would have to use the following recipe.
require recipes-sato/images/core-image-sato.bb
IMAGE_INSTALL += "hw1 hw2 hw3 etc"
However, I am sure there is a way to ties these up with
"IMAGE_FEATURE" variable.
IMAGE_FEATURES do not refer to individual packages, they are specially defined
package groups (or behaviours in the case of e.g. package-management). If you
have a look at classes/core-image.bbclass and classes/image.bbclass you can
see how the package groups are set up (PACKAGE_GROUP_featurename). As you
found, at the moment there is nothing checking that features in IMAGE_FEATURES
are valid, thus as there is no PACKAGE_GROUP_helloworld and nothing checking
for "helloworld" in IMAGE_FEATURES, it does nothing.

However, if all you want to do is add a few specific packages it's just fine to
add their names to the end of IMAGE_INSTALL - IMAGE_FEATURES might be
overkill.

Cheers,
Paul
--
Paul Eggleton
Intel Open Source Technology Centre
Chris Larson
2011-12-29 18:27:48 UTC
Permalink
Post by autif khan
Can you please help me with setting up my recipes so that all the
hello world apps are included when I use the following recipe.
require recipes-sato/images/core-image-sato.bb
IMAGE_FEATURES += "helloworld"
I am guessing that I would have to tell the hw1 recipe that it is a
helloworld feature. How do I go about doing this?
commit f9f4416a8cfbd37c7d3a8eb19ee82820e2e6b38cAuthor: Chris Larson
<***@mentor.com>Date:   Mon Aug 8 16:09:37 2011 -0700
    image: implement IMAGE_FEATURES
    IMAGE_FEATURES is analagous to DISTRO_FEATURES and
MACHINE_FEATURES, for    root filesystem construction. Currently, the
only supported features are    any defined package groups, as used by
the oe.packagegroup python    module.
    Example usage:
        PACKAGE_GROUP_myfeature = "vim iptables"        IMAGE_FEATURES
+= "myfeature"
    Signed-off-by: Chris Larson <***@mentor.com>--
Christopher Larson

Continue reading on narkive:
Loading...