(!) Please ask about problems and questions regarding this tutorial on answers.ros.org. Don't forget to include in your question the link to this page, the versions of your OS & ROS, and also add appropriate tags.

Creating your own layer

Description: Create a new layer and add files to the Yocto image.

Tutorial Level: INTERMEDIATE

create your own layer

This example will add a custom .bashrc file to the image.

  • cd ..

yocto-layer create mine
cd meta-mine
mkdir recipes-mine
cd recipes-mine
mkdir envfiles
cd envfiles
mkdir envfiles-0.1

Edit a new file called "envfiles_0.1.bb":

DESCRIPTION = "Environment customizations"
SECTION = "examples"
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/MIT;md5=0835ade698e0bcf8506ecda2f7b4f302"

FILES_${PN} += "/home/root/.bashrc"

PR = "r0"

SRC_URI = "file://bashrc_root"

S = "${WORKDIR}"

do_install() {
             mkdir -p ${D}/home/root
             cp ${S}/bashrc_root ${D}/home/root/.bashrc

Also create envfiles-0.1/bashrc_root:

# this is the bashrcfile from my yocto recipe
PS1="[\[\033[01;33m\]\u@\h \W\[\033[00m\]]$ "
if [ -n "$SSH_CLIENT" ]; then
    PS1="[\[\033[01;34m\]\u@\h \W\[\033[00m\]] \[\033[01;31m\]#\[\033[00m\] "

Wiki: IntelGalileo/IntelGalileoYoctoNewLayer (last edited 2014-02-09 00:56:10 by JonStephan)