applications, ideas, technology, solutions

Adding a Local Recipe to Angstrom/BeagleBoard

Here’s the directory structure I’ve created for a local overlay, with the name of my application being ptrp:

$ cd ${OETREE}
$ find local -type d
local
local/recipes
local/recipes/ptrp
local/recipes/ptrp/files
local/recipes/images
local/conf

The following changes were made to configuration files mentioned in previous posts (Building OpenEmbedded for BeagleBoard and Building Angstrom…) to support the new local overlay functionality:

~/.bashrc:

export BBPATH="${OETREE}/local:${OETREE}/build:${OETREE}/openembedded:"$BBPATH

(added ${OETREE}/local to BBPATH)

${OETREE}/build/conf/local.conf:

BBFILES += "${OETREE}/openembedded/recipes/*/*.bb"

(Simply replacing the := with += in the assignment)

${OETREE}/source-me.txt:

BBPATH=${OETREE}/:${OETREE}/local:${OETREE}/build/:${OETREE}/openembedded/

(again, added ${OETREE}/local to BBPATH)

The content of the files added to the local tree are shown here:

${OETREE}/local/recipes/ptrp/files/ptrp.c:

#include 

int main(int argc, char** argv)
{
    int i;
    for (i=0;i<10;i++) {
        printf("Hello world!\nFrom the new PTRP application\n\n");
    }
    return 0;
}

${OETREE}/local/recipes/ptrp/files/README.txt:

This is just a doc file in the PTRP application.

${OETREE}/local/recipes/ptrp/ptrp.bb:

DESCRIPTION = "PTRP Application"
PR = "r0.1"

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

S = ${WORKDIR}

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

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

${OETREE}/local/recipes/images/cmma-ptrp-image.bb:

require recipes/images/console-image.bb

ANGSTROM_EXTRA_INSTALL += " ptrp "

export IMAGE_BASENAME = "cmma-ptrp-image"

${OETREE}/local/conf/site.conf:

BBFILES += "${OETREE}/local/recipes/*/*.bb"
BBFILE_COLLECTIONS = "overlay"
BBFILE_PATTERN_overlay = "${OETREE}/local"
BBFILE_PRIORITY_overlay = 5

Once all the files are in place it’s simply a matter of baking eveything:

$ cd ${OETREE}
$ source ./source-me.txt
$ bitbake -c clean -b ${OETREE}/local/recipes/ptrp/ptrp.bb
$ bitbake cmma-ptrp-image

2 Comments

  1. Xu Wei's Gravatar Xu Wei
    September 21, 2010    

    Excellent post.

    I’ve followed your step to build my 1st test app (xwtest). It runs well on my beagleboard.

    However, I notice every time I made some change in my c code, I have to use the clean command “bitbake -c clean -b $(OETREE)/local/recipes/xwtest/xwtest.bb” before “bitbake xwtest-image”, othersize, the modified c code is remain in local, the same c file in “tmp-angstrom_2008_1/work” directory is not updated.

    Do you know any way I can bitbake the image without clean? to fast the build procedure.

    Thanks!

  2. rbw's Gravatar rbw
    October 7, 2010    

    I am sorry, but I have no help to offer.

Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>