بهترین روش برای افزودن Recipeهایمان به Yocto، ایجاد لایه خودمان (meta-example) است.
# cd /home/.../fsl-community-bsp/sources
# git clone https://github.com/DynamicDevices/meta-example
افزودن این لایه به فایل پیکربندی Bitbake، است.
$ cd ~/fsl-community-bsp
$ MACHINE=imx28evk source ./setup-environment build
$ gedit conf/local.conf &
IMAGE_INSTALL_append = " bbexample"
$ gedit conf/bblayers.conf &
...
BBLAYERS ?= " \
/home/user/yocto/poky-jethro-14.0.0/meta \
/home/user/yocto/poky-jethro-14.0.0/meta-yocto \
/home/user/yocto/poky-jethro-14.0.0/meta-yocto-bsp \
/home/user/yocto/poky-jethro-14.0.0/meta-example \
"
Build an example package based on a local source
The files you want to install are generally provided in a directory of the same name as the recipe.
bbexample_1.0.bb
DESCRIPTION = "Configuration and extra files for TX28"
LICENSE = "CLOSED"
LIC_FILES_CHKSUM = ""
S = "${WORKDIR}"
SRC_URI += " \
file://ld.so.conf \
file://vsftpd.conf \
file://init.d/myscript.sh \
file://nginx/nginx.conf"
inherit allarch
do_install () {
install -d ${D}${sysconfdir}
install -d ${D}${sysconfdir}/init.d
install -d ${D}${sysconfdir}/nginx
install -m 0755 ${WORKDIR}/ld.so.conf ${D}${sysconfdir}/
install -m 0755 ${WORKDIR}/vsftpd.conf ${D}${sysconfdir}/
install -m 0755 ${WORKDIR}/init.d/myscript.sh ${D}${sysconfdir}/init.d/
install -m 0755 ${WORKDIR}/nginx/nginx.conf ${D}${sysconfdir}/nginx/
}
LIC_FILES_CHKSUM : Checksums of the license text in the recipe source code. Note that LIC_FILES_CHKSUM variable is mandatory for all recipes, unless the LICENSE variable is set to "CLOSED".
S : The location in the Build Directory where unpacked recipe source code resides. This location is within the work directory (WORKDIR), which is not static. The unpacked source location depends on the recipe name (PN) and recipe version (PV) as follows:
${WORKDIR}/${PN}-${PV}
WORKDIR : The pathname of the work directory in which the OpenEmbedded build system builds a recipe. The WORKDIR directory is defined as follows:
${TMPDIR}/work/${MULTIMACH_TARGET_SYS}/${PN}/${EXTENDPE}${PV}-${PR
D : The location in the Build Directory where components are installed by the do_install task. This location defaults to:
${WORKDIR}/image
SRC_URI - BitBake uses the SRC_URI variable to point to source files regardless of their location. Each recipe must have a SRC_URI variable that points to the source.
if you open the bitbake.conf you can see datadir is equal to usr/shar...
sysconfdir |
${base_prefix}/etc |
|
servicedir |
${base_prefix}/srv |
|
sharedstatedir |
${base_prefix}/com |
|
localstatedir |
${base_prefix}/var |
|
datadir |
${prefix}/share |
/usr/share |
infodir |
${datadir}/info |
|
mandir |
${datadir}/man |
|
docdir |
${datadir}/doc |
|
systemd_unitdir |
${nonarch_base_libdir}/systemd |
|
systemd_system_unitdir |
${nonarch_base_libdir}/systemd/system |
|
nonarch_libdir |
${exec_prefix}/lib |
|
systemd_user_unitdir |
${nonarch_libdir}/systemd/user |
|
bindir |
${exec_prefix}/bin |
|
sbindir |
${exec_prefix}/sbin |
|
libdir |
${exec_prefix}/${baselib} |
/usr/lib |
libexecdir |
${exec_prefix}/libexec |
|
includedir |
${exec_prefix}/include |
|
oldincludedir |
${exec_prefix}/include |
|
$ bitbake –c clean core-image-minimal
$ bitbake core-image-minimal
$ cd ~/fsl-community-bsp/build/tmp/deploy/images/imx28evk