Yocto Project Documentation
 help / color / mirror / Atom feed
From: "Tom Rini" <tom.rini@gmail.com>
To: docs@lists.yoctoproject.org
Subject: [PATCH 3/3] common-tasks: Add an example of using bbappends to add a file
Date: Thu, 12 Aug 2021 12:10:27 -0400	[thread overview]
Message-ID: <20210812161027.580-3-trini@konsulko.com> (raw)
In-Reply-To: <20210812161027.580-1-trini@konsulko.com>

Use the xserver-xf86-config_%.bbappend from meta-raspberrypi to provide
an example of having a bbappend file add files to an existing recipe.

Signed-off-by: Tom Rini <trini@konsulko.com>
---
 documentation/dev-manual/common-tasks.rst | 61 +++++++++++++++++++++++
 1 file changed, 61 insertions(+)

diff --git a/documentation/dev-manual/common-tasks.rst b/documentation/dev-manual/common-tasks.rst
index f15e72887c04..87abef9ad52f 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
 used during ``do_fetch`` and the test for a non-zero file size in
 ``do_install`` will return true, and the file will be installed.
 
+Installing Additional Files Using Your Layer
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+As another example, consider the main xserver-xf86-config recipe and a corresponding
+xserver-xf86-config append file both from the :term:`Source Directory`.
+Here is the main
+xserver-xf86-config recipe, which is named ``xserver-xf86-config_0.1.bb`` and located in
+the "meta" layer at ``meta/recipes-graphics/xorg-xserver``::
+
+   SUMMARY = "X.Org X server configuration file"
+   HOMEPAGE = "http://www.x.org"
+   SECTION = "x11/base"
+   LICENSE = "MIT-X"
+   LIC_FILES_CHKSUM = "file://${COREBASE}/meta/COPYING.MIT;md5=3da9cfbcb788c80a0384361b4de20420"
+   PR = "r33"
+
+   SRC_URI = "file://xorg.conf"
+
+   S = "${WORKDIR}"
+
+   CONFFILES:${PN} = "${sysconfdir}/X11/xorg.conf"
+
+   PACKAGE_ARCH = "${MACHINE_ARCH}"
+   ALLOW_EMPTY:${PN} = "1"
+
+   do_install () {
+	if test -s ${WORKDIR}/xorg.conf; then
+		install -d ${D}/${sysconfdir}/X11
+		install -m 0644 ${WORKDIR}/xorg.conf ${D}/${sysconfdir}/X11/
+	fi
+   }
+
+Following is the append file, which is named ``xserver-xf86-config_%.bbappend``
+and is from the Raspberry Pi BSP Layer named ``meta-raspberrypi``. The
+file is in the layer at ``recipes-graphics/xorg-xserver``::
+
+   FILESEXTRAPATHS:prepend := "${THISDIR}/${PN}:"
+
+   SRC_URI:append:rpi = " \
+       file://xorg.conf.d/98-pitft.conf \
+       file://xorg.conf.d/99-calibration.conf \
+   "
+   do_install:append:rpi () {
+       PITFT="${@bb.utils.contains("MACHINE_FEATURES", "pitft", "1", "0", d)}"
+       if [ "${PITFT}" = "1" ]; then
+           install -d ${D}/${sysconfdir}/X11/xorg.conf.d/
+           install -m 0644 ${WORKDIR}/xorg.conf.d/98-pitft.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
+           install -m 0644 ${WORKDIR}/xorg.conf.d/99-calibration.conf ${D}/${sysconfdir}/X11/xorg.conf.d/
+       fi
+   }
+
+   FILES:${PN}:rpi += "${sysconfdir}/X11/xorg.conf ${sysconfdir}/X11/xorg.conf.d/*"
+
+Building off of the previous example, we once again are setting the
+:term:`FILESEXTRAPATHS` variable.  In this case we are also usine the
+:term:`SRC_URI` to list additional source files to use when ``rpi`` is found in
+the list of :term:`OVERRIDES`.  The ``do_install`` task will then perform a
+check for an additional :term:`MACHINE_FEATURES` that if set will cause these
+additional files to be installed.  These additional files are listed in
+:term:`FILES` so that they will be packaged.
+
 Prioritizing Your Layer
 -----------------------
 
-- 
2.17.1


  parent reply	other threads:[~2021-08-12 16:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-12 16:10 [PATCH 1/3] common-tasks: Add a summary to the end of the bbappend example Tom Rini
2021-08-12 16:10 ` [PATCH 2/3] manuals: Rename the "Using .bbappend Files in Your Layer" section Tom Rini
2021-08-13  8:29   ` [docs] " Quentin Schulz
2021-08-13  9:12     ` Michael Opdenacker
2021-08-12 16:10 ` Tom Rini [this message]
2021-08-13  8:27   ` [docs] [PATCH 3/3] common-tasks: Add an example of using bbappends to add a file Quentin Schulz
2021-08-13  9:15     ` Michael Opdenacker
2021-08-13 14:40       ` Tom Rini
2021-08-13 15:13     ` Tom Rini
2021-08-13  8:16 ` [docs] [PATCH 1/3] common-tasks: Add a summary to the end of the bbappend example Michael Opdenacker
2021-08-13  8:21 ` Quentin Schulz
2021-08-13  8:28   ` Michael Opdenacker
2021-08-13  8:31     ` Quentin Schulz
2021-08-13  8:48       ` Michael Opdenacker

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210812161027.580-3-trini@konsulko.com \
    --to=tom.rini@gmail.com \
    --cc=docs@lists.yoctoproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox