@@ -140,6 +140,34 @@ Notes:
this layer, perform the same steps as above except for the step enabling
RK_RAUC_DEMO.
+ /data overlay with RAUC
+ When using RAUC for whole-partition rootfs updates, you will need some
+ way of preserving some pieces of data between updates; this is why the
+ DEMO scheme provided in this layer also includes a /data partition.
+ Now that you have a /data partition that is not updated, you need some
+ way of storing your important data there and making it available,
+ seamlessly, into your system regardless of which slot is running.
+
+ One way of accomplishing this is to move your important files into
+ /data and providing symlinks back into each running bundle. But that
+ requires you to know ahead of time which files will be touched... which
+ quickly can become a game of whack-a-mole. A better alternative is to
+ use a filesystem overlay. With a filesystem overlay, multiple paths are
+ overlaid on top of each other behind the scenes so what you see is one
+ directory containing the aggregation of all layers. Filesystem overlays
+ have a concept of "bottom layers" and "upper layers", if you write a new
+ file into an overlay, the file will be written into the uppermost
+ layer, leaving the lower layers intact. If a file is modified, the
+ modifications are stored in the upper layer, occluding the lower layer.
+ Therefore, creating an overlay using locations in the /data partition
+ as the uppermost layer allows changes to persist across RAUC updates.
+
+ This layer includes a simple overlay scheme to demonstrate one way of
+ making use of this mechanism. To enable the demo included in this layer
+ RAUC must be enabled, then also enable:
+
+ RK_OVERLAY_DEMO
+
HW video decoding with gstreamer
Most Rockchip SoCs have some integrated VPU, either Hantro, RKVDEC or
@@ -2,3 +2,4 @@
# rauc demo configuration from this layer
OVERRIDES .= "${@ ':rk-rauc-demo' if bb.utils.to_boolean(d.getVar('RK_RAUC_DEMO'), False) else ''}"
IMAGE_INSTALL:append:rk-rauc-demo = " abd-partition"
+IMAGE_INSTALL:append:rk-rauc-demo = " ${@ 'data-partition-overlay' if bb.utils.to_boolean(d.getVar('RK_OVERLAY_DEMO'), False) else ''}"
new file mode 100644
@@ -0,0 +1,22 @@
+SUMMARY = "Overlay Logic onto the /data partition"
+LICENSE = "OSL-3.0"
+LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/OSL-3.0;md5=438ec6d864bbb958a49df939a56511cf"
+
+inherit rk-rauc-demo-features-check systemd
+
+SYSTEMD_SERVICE:${PN} = "etc.mount home.mount"
+
+S = "${UNPACKDIR}"
+
+SRC_URI = " \
+ file://etc.mount \
+ file://home.mount \
+ "
+
+do_install() {
+ install -d ${D}${sysconfdir}/systemd/system
+ install -m 0644 ${UNPACKDIR}/etc.mount ${D}${sysconfdir}/systemd/system/
+ install -m 0644 ${UNPACKDIR}/home.mount ${D}${sysconfdir}/systemd/system/
+}
+
+RDEPENDS:${PN} += "abd-partition"
new file mode 100644
@@ -0,0 +1,13 @@
+[Unit]
+Description=OverlayFS mount for /etc to /data/overlay/etc
+Requires=data.mount
+After=data.mount
+
+[Mount]
+What=overlay
+Where=/etc
+Type=overlay
+Options=lowerdir=/etc,upperdir=/data/overlay/etc,workdir=/data/overlay-workdir/etc
+
+[Install]
+WantedBy=multi-user.target
new file mode 100644
@@ -0,0 +1,13 @@
+[Unit]
+Description=OverlayFS mount for /home to /data/overlay/home
+Requires=etc.mount
+After=etc.mount
+
+[Mount]
+What=overlay
+Where=/home
+Type=overlay
+Options=lowerdir=/home,upperdir=/data/overlay/home,workdir=/data/overlay-workdir/home
+
+[Install]
+WantedBy=multi-user.target
Most implementations that use an A/B, full-partition update mechanism (such as RAUC configured for this scenario) need some way of preserving system configurations in a location that survives updates. The RAUC demo provided in this layer is an example of a full-partition update, therefore provide an example of using a filesystem overlay to preserve system configurations. This example is gated by a configuration knob: RK_OVERLAY_DEMO Signed-off-by: Trevor Woerner <twoerner@gmail.com> --- README | 28 +++++++++++++++++++ conf/machine/include/rockchip-rauc.inc | 1 + .../systemd/data-partition-overlay_1.0.bb | 22 +++++++++++++++ .../recipes-core/systemd/files/etc.mount | 13 +++++++++ .../recipes-core/systemd/files/home.mount | 13 +++++++++ 5 files changed, 77 insertions(+) create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/data-partition-overlay_1.0.bb create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/files/etc.mount create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/files/home.mount