diff options
Diffstat (limited to 'distribution/yocto-advanced/meta-schulung-extended/recipes-app')
3 files changed, 73 insertions, 0 deletions
diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/files/hello-init.sh b/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/files/hello-init.sh new file mode 100644 index 0000000..1d40092 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/files/hello-init.sh @@ -0,0 +1,12 @@ +#!/bin/sh + +case $1 in +start) + exec hello + ;; +stop) + exit 0 + ;; +esac + +exit 1 diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/files/hello.c b/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/files/hello.c new file mode 100644 index 0000000..aea8503 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/files/hello.c @@ -0,0 +1,12 @@ +#include <stdio.h> + +/* + * A simple application to greet the world. + */ + +int main(void) +{ + printf("Hello, world!\n"); + return 0; +} + diff --git a/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/hello_1.0.bb b/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/hello_1.0.bb new file mode 100644 index 0000000..3f9b9c2 --- /dev/null +++ b/distribution/yocto-advanced/meta-schulung-extended/recipes-app/greeting/hello_1.0.bb @@ -0,0 +1,49 @@ +# packages require licenses! +LICENSE = "MIT" + +# if the license is not "CLOSED", a checksum is required +# (we are using a common license file since this +# application does not provide LICENSE text) +LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302" + +# specify files needed to build the package +SRC_URI = " \ + file://hello.c \ + file://hello-init.sh \ +" + +S = "${WORKDIR}" + +# specify a new compile task +# - by default, poky calls "make", but we have no Makefile +# - this task is called from the ${S} directory, ${WORKDIR}/${PN}/${PV} +# - poky appropriately sets ${CC}, ${CFLAGS}, ${LDFLAGS} and exports +# them to the shell process environment +do_compile () { + $CC $CFLAGS $LDFLAGS -o${B}/hello ${S}/hello.c +} + +# specify an install task +# - by default, do_install is empty +# - this task is called from the ${S} directory, ${WORKDIR}/${PN}-${PV} +# - anything copy to ${D} will be packaged +# - by default, poky sets ${base_bindir} to "/bin" +do_install () { + install -D -m 0755 ${B}/hello ${D}${base_bindir}/hello + + # install the init script + install -D -m 0755 ${WORKDIR}/hello-init.sh \ + ${D}${sysconfdir}/init.d/hello +} + +# specify the name of the init script +# (it is will be expected to be in /etc/init.d) +INITSCRIPT_NAME="hello" + +# setup the init script +# (this will create the link: /etc/rcS.d/S20hello) +INITSCRIPT_PARAMS = "start 20 S ." + +# use the update-rc.d class to setup the init scripts +# (this class uses INITSCRIPT_NAME and INITSCRIPT_PARAMS) +inherit update-rc.d |
