Application Development
Whether you are writing an application from scratch or porting some existing code, there are a number of basic steps that should be followed.
Building
Determine which external libraries are required.
- See if they exist as part of the mLinux™ image. If they do, use them.
- If not found, see if BitBake recipes for them exist in the OpenEmbedded Recipe Index.
- If you still can’t find the corresponding library, this may mean that you will have to get the source and make your own custom BitBake recipe.
If no external libraries are required, the GCC toolchain can be used to compile stand-alone C/C++ applications. See C/C++ Toolchain. If your application does require an external library, try building it using bitbake if a recipe exists. This will install the library into the staging/sysroot directory: ${OETREE}/
build/tmp/sysroots/mtcdt
. Headers and library files will be installed in the usr/include
and usr/lib
directories in the previously mentioned mtcdt sysroot area.
Compiling and linking C/C++ applications against external libraries is best accomplished by writing a BitBake recipe for your application and building it within the OpenEmbedded environment. CFLAGS
, LDFLAGS
and other variables will all be appropriately set for cross-compiling and linking against other libraries previously built by BitBake. Refer to the Yocto BitBake documentation and to Yocto Common Tasks documentation for writing custom recipes.
Running
Now that you have your application building, you will want to move it to the hardware platform and test it.
- Since you are developing on a complete Linux platform, you do not need to re-flash the entire image to perform application testing.
- Simply
scp
the resulting package (and dependencies) to the device and install it usingopkg
. Look for your package in${OETREE}/build/tmp/deploy/ipk/
.
Releasing
For a release, you may wish to create a custom firmware image, which will allow you to flash a device with firmware that includes your custom application. Refer to Building a Custom Linux Image .