Categories
Embedded

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