How to add binary files via a custom recipe

From KoanSoftware Wiki
Jump to: navigation, search

How to add binary files via a custom recipe

When using Yocto Project it sometimes may be necessary to insert binary files via a custom recipe.

Below is an example of a recipe to manage that

#
# binary_0.1.bb
#

DESCRIPTION = "Install custom files to /root directory"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""

SRC_URI = "file://my-binary \
	   file://my-config-file"

do_install() {
    # Create the /root directory in the target filesystem
    install -d ${D}${sysconfdir}/root

    # Install your binary and config file
    install -m 0755 ${WORKDIR}/my-binary ${D}/root/my-binary
    install -m 0644 ${WORKDIR}/my-config-file ${D}/root/my-config-file
}

FILES:${PN} = "/root"