Question

I am working with the "Hello World" example from the OpenEmbedded User Manual and the Dora release of the Yocto Project tools. The bitbake build works fine, but the executable is not getting installed in the image. Basically I created my own meta layer with two receipes. One is an Autotools version of "Hello World" that builds and installs itself into the image. The second is a Makefile version of "Hello World". That's what I'm having trouble with.

The source is as you would expect:


#include <stdio.h>

int main(int argc, char** argv)
{
    printf("Hello world 2!\n");
    return 0;
}

There is also a README.txt file:


Readme file for Hello World 2.

The recipe is as follows:


DESCRIPTION = "Hello World 2 Program"
PR = "r0"
LICENSE = "CLOSED"
RM_WORK_EXCLUDE += "hello2"

SRC_URI = "file://hello2.c \
           file://README.txt"

do_compile() {
    ${CC} ${CFLAGS} ${LDFLAGS} ${WORKDIR}/hello2.c -o hello2
}

do_install() {
    install -m 0755 -d ${D}${bindir} ${D}${docdir}/hello2
    install -m 0644 ${S}/hello2 ${D}${bindir}
    install -m 0644 ${WORKDIR}/README.txt ${D}${docdir}/hello2
}

When I look at the work directory, I see the executable has built and the resulting package files. There is nothing in the log files that indicates (to me, a novice) why the install didn't happen. Is there something wrong with the recipe or is there something I can check to figure this out?

Était-ce utile?

La solution

Well it seems like you successfully built the hello world demo, and as you indicate you found the files in WORKDIR. But that's all a package recipe does. It builds a package. You need to tell your image recipe to include your new package in the final image. You can "cheat" and put those instructions into your local.conf file, using something like:

IMAGE_INSTALL_append += " hello"

However beware that this technique only works if you are using a standard image recipe based on image.bbclass.

Better yet, modify the image recipe you are using in a custom layer of your own creation, and add the package in an image .bbappend.

For example, if you are using core-image-base, create your own custom layer and create a core-image-base.bbappend in that layer, and inside that bbappend, add the dependency for your newly created "hello" package.

There are many examples in the metadata. Take a look at core-image-base.bb and image.bbclass to get some clues how images are created. Take a look at any packagegroup-core*.bb for examples of how to specify your "hello" world as a runtime dependency so that the package gets installed in your image.

Note also that the Yocto Project has a mailing list with lots of friendly folks on it, and would be happy to answer your questions. There is also #yocto and #oe on freenode.net. Check out yoctoproject.org for specifics.

Hope this helps.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top