Development Examples

Building HelloWorld without BitBake

The following example shows how to build a simple C application, transfer it to the device using SCP, and run it over an SSH connection.

# set PATH to include the toolchain 
# (assumes OETREE is set from and build system is x86_64)
export PATH=$PATH:${OETREE}/build/tmp/sysroots/x86_64-linux/usr/armv5te/bin

# compile and link helloworld.c
arm-corecdp-linux-gnueabi-gcc -o helloworld helloworld.c

# copy to device in /usr/bin/
scp helloworld root@

# ssh to device and run it
ssh root@

Building HelloWorld with a BitBake recipe

The following example shows how to package a simple C application using a BitBake recipe. First, the recipe is created. Then the package is built and copied to the device using SCP. Lastly, opkg is used to install the package on the device.

# create a recipe
cd ${OETREE}/user-layer/recipes
mkdir helloworld
cd helloworld

# (create, see below for contents)
# (create helloworld.c)

# build package
cd ${OETREE}
bitbake helloworld

# copy the package to the device
scp build/tmp/deploy/eglibc/ipk/armv5te/helloworld_1.0.0-r0.10_armv5te.ipk  root@

# install the package
ssh root@
cd /var/tmp
opkg install helloworld_1.0.0-r0.10_armv5te.ipk

# run it

To install the helloworld package into a custom filesystem image that can be flashed into the device, see Creating a Custom Image

For further explanation of this recipe, see Writing BitBake Recipes

DESCRIPTION = "HelloWorld"
SECTION = "examples"
SRC_URI = "file://helloworld.c"
S = "${WORKDIR}"
do_compile() {
    ${CC} ${CFLAGS} ${LDFLAGS} helloworld.c -o helloworld
do_install() {
    install -d ${D}${bindir}
    install -m 0755 helloworld ${D}${bindir}