summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual
diff options
context:
space:
mode:
authorTom Rini <tom.rini@gmail.com>2021-08-19 11:12:33 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-09-18 13:03:45 +0100
commit353784911260742ebafb91df8ab8e0ec44200c4c (patch)
tree1544de4ee68bbe972e95400f4a4f13ae55519839 /documentation/dev-manual
parent62b13474bfe8a053d34523785c446c5592834adf (diff)
downloadpoky-353784911260742ebafb91df8ab8e0ec44200c4c.tar.gz
common-tasks: Add an example of using bbappends to add a file
Use the xserver-xf86-config_%.bbappend from meta-raspberrypi to provide an example of having a bbappend file add files to an existing recipe. (From yocto-docs rev: f510e748ff3bcbea6e34a7f225e05628303fdd12) Signed-off-by: Tom Rini <trini@konsulko.com> Reviewed-by: Quentin Schulz <foss@0leil.net> Reviewed-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/dev-manual')
-rw-r--r--documentation/dev-manual/common-tasks.rst61
1 files changed, 61 insertions, 0 deletions
diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
index 96b9fcc402..87c5a081ec 100644
--- a/documentation/dev-manual/common-tasks.rst
+++ b/documentation/dev-manual/common-tasks.rst
@@ -554,6 +554,67 @@ The end result of this ``.bbappend`` file is that on a Raspberry Pi, where
554used during :ref:`ref-tasks-fetch` and the test for a non-zero file size in 554used during :ref:`ref-tasks-fetch` and the test for a non-zero file size in
555:ref:`ref-tasks-install` will return true, and the file will be installed. 555:ref:`ref-tasks-install` will return true, and the file will be installed.
556 556
557Installing Additional Files Using Your Layer
558~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
559
560As another example, consider the main ``xserver-xf86-config`` recipe and a
561corresponding ``xserver-xf86-config`` append file both from the :term:`Source
562Directory`. Here is the main ``xserver-xf86-config`` recipe, which is named
563``xserver-xf86-config_0.1.bb`` and located in the "meta" layer at
564``meta/recipes-graphics/xorg-xserver``::
565
566 SUMMARY = "X.Org X server configuration file"
567 HOMEPAGE = "http://www.x.org"
568 SECTION = "x11/base"
569 LICENSE = "MIT-X"
570 LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
571 PR = "r33"
572
573 SRC_URI = "file://xorg.conf"
574
575 S = "${WORKDIR}"
576
577 CONFFILES:${PN} = "${sysconfdir}/X11/xorg.conf"
578
579 PACKAGE_ARCH = "${MACHINE_ARCH}"
580 ALLOW_EMPTY:${PN} = "1"
581
582 do_install () {
583 if test -s ${WORKDIR}/xorg.conf; then
584 install -d ${D}/${sysconfdir}/X11
585 install -m 0644 ${WORKDIR}/xorg.conf ${D}/${sysconfdir}/X11/
586 fi
587 }
588
589Following is the append file, which is named ``xserver-xf86-config_%.bbappend``
590and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The
591file is in the layer at ``recipes-graphics/xorg-xserver``::
592
593 FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
594
595 SRC_URI:append:rpi = " \
596 file://xorg.conf.d/98-pitft.conf \
597 file://xorg.conf.d/99-calibration.conf \
598 "
599 do_install:append:rpi () {
600 PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
601 if [ "${PITFT}" = "1" ]; then
602 install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
603 install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
604 install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
605 fi
606 }
607
608 FILES:${PN}:append:rpi = " ${sysconfdir}/X11/xorg.conf.d/*"
609
610Building off of the previous example, we once again are setting the
611:term:`FILESEXTRAPATHS` variable. In this case we are also using
612:term:`SRC_URI` to list additional source files to use when ``rpi`` is found in
613the list of :term:`OVERRIDES`. The :ref:`ref-tasks-install` task will then perform a
614check for an additional :term:`MACHINE_FEATURES` that if set will cause these
615additional files to be installed. These additional files are listed in
616:term:`FILES` so that they will be packaged.
617
557Prioritizing Your Layer 618Prioritizing Your Layer
558----------------------- 619-----------------------
559 620