Book Image

Embedded Linux Development with Yocto Project

Book Image

Embedded Linux Development with Yocto Project

Overview of this book

Table of Contents (22 chapters)
Embedded Linux Development with Yocto Project
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
References
Index

Adding a package recipe


A package recipe is how we can instruct BitBake to fetch, unpack, compile, and install our application, kernel module, or any software provided by a project. Poky includes several classes that abstract the process for the most common development tools as projects based on Autotools, CMake, and QMake. A list of classes included in Poky can be seen in the Yocto Project Reference Manual.

One simple recipe that does the compile and install tasks explicitly is provided as follows:

DESCRIPTION = "Simple helloworld application" 
SECTION = "examples" 
LICENSE = "MIT" 
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" 

SRC_URI = "file://helloworld.c" 

S = "${WORKDIR}" 

do_compile() { 
        ${CC} helloworld.c -o helloworld 
} 

do_install() { 
        install -d ${D}${bindir} 
        install -m 0755 helloworld ${D}${bindir} 
} 

The do_compile and do_install code blocks provide the Shell Scripting commands to build and install the...