From: Trevor Woerner <twoerner@gmail.com>
To: yocto-patches@lists.yoctoproject.org
Subject: Re: [yocto-patches] [meta-rockchip][PATCH v3] rauc demo: add
Date: Wed, 26 Jun 2024 11:46:44 -0400 [thread overview]
Message-ID: <20240626154644.GA22782@localhost> (raw)
In-Reply-To: <daeccf50-cf37-4ca7-8f08-0daaccf33502@cherry.de>
On Wed 2024-06-26 @ 05:09:14 PM, Quentin Schulz via lists.yoctoproject.org wrote:
> Hi Trevor,
>
> On 6/26/24 3:56 PM, Trevor Woerner via lists.yoctoproject.org wrote:
> > Add an example of implementing rauc on a rockchip board. Adding the meta-rauc
> > layer, adding 'rauc' to DISTRO_FEATURES, and enabling RK_RAUC_DEMO will build
> > an image using the example provided in dynamic-layers/rk-rauc-demo.
> >
> > This example uses a simple A/B + D scheme (i.e. two root partitions and a
> > non-updated /data partition). Repartitioning occurs automatically on first
> > boot thanks to systemd's 'repart' mechanism.
> >
> > NOTE:
> > - this example only works with systemd
> >
> > If you wish to provide your own implementation, simply add the meta-rauc
> > layer, add 'rauc' to DISTRO_FEATURES, don't enable RK_RAUC_DEMO, and provide
> > your own implementation in a separate layer.
> >
> > Signed-off-by: Trevor Woerner <twoerner@gmail.com>
> > ---
> > v3 changes:
> > - change the OVERRIDE mechanism from a class to a config
> > - fix the required features check to include an OVERRIDE
> > - use a systemd mount unit for the /data partition
> > - abd-partition recipe cleanup:
> > - remove extraneous FILESEXTRAPATHS
> > - remove OVERRIDES, this recipe will only be used with rauc
> > - remove extraneous FILES:${PN} for ${sysconfdir}
> >
> > v2 changes:
> > - add information/instructions to README
> > - rauc-conf cleanup:
> > - remove ca.cert.pem from SRC_URI, it's already in parent
> > - rename systemd.conf.in to system.conf so the parent handles it
> > - process the system.conf file as a prepend, leaving it for the parent to manage
> > - use walrus operator with THISDIR
> > - break out the systemd repart config files into their own recipe so they can
> > be updated without triggering a full rebuild of systemd (and its dependents)
> > - class cleanup:
> > - update the classes so they have only 1 job (each)
> > - rename the classes to reflect their jobs
> > - update recipes/configs to use the new classes
> > ---
> > README | 18 +++++
> > .../rk-rauc-demo-features-check.bbclass | 8 ++
> > conf/layer.conf | 4 +
> > conf/machine/include/rockchip-rauc.inc | 4 +
> > conf/machine/include/rockchip-wic.inc | 2 +
> > .../recipes-bsp/u-boot/files/boot.cmd.in | 51 ++++++++++++
> > .../recipes-bsp/u-boot/files/uboot-rauc.cfg | 8 ++
> > .../recipes-bsp/u-boot/u-boot_%.bbappend | 26 ++++++
> > .../base-files/base-files_%.bbappend | 2 +
> > .../recipes-core/base-files/files/fstab | 5 ++
> > .../rauc-bundles/files/development-1.cert.pem | 80 +++++++++++++++++++
> > .../rauc-bundles/files/development-1.key.pem | 28 +++++++
> > .../rauc-bundles/rockchip-rauc-bundle.bb | 14 ++++
> > .../recipes-core/rauc/files/ca.cert.pem | 80 +++++++++++++++++++
> > .../recipes-core/rauc/files/system.conf | 17 ++++
> > .../recipes-core/rauc/rauc-conf.bbappend | 7 ++
> > .../recipes-core/systemd/abd-partition.bb | 26 ++++++
> > .../systemd/files/25-rootfsA.conf | 4 +
> > .../systemd/files/35-rootfsB.conf | 7 ++
> > .../recipes-core/systemd/files/45-data.conf | 6 ++
> > .../recipes-core/systemd/files/data.mount | 10 +++
> > .../recipes-core/systemd/systemd_%.bbappend | 3 +
> > 22 files changed, 410 insertions(+)
> > create mode 100644 classes-recipe/rk-rauc-demo-features-check.bbclass
> > create mode 100644 conf/machine/include/rockchip-rauc.inc
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-bsp/u-boot/files/boot.cmd.in
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-bsp/u-boot/files/uboot-rauc.cfg
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-bsp/u-boot/u-boot_%.bbappend
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/base-files/base-files_%.bbappend
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/base-files/files/fstab
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/rauc-bundles/files/development-1.cert.pem
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/rauc-bundles/files/development-1.key.pem
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/rauc-bundles/rockchip-rauc-bundle.bb
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/rauc/files/ca.cert.pem
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/rauc/files/system.conf
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/rauc/rauc-conf.bbappend
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/abd-partition.bb
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/files/25-rootfsA.conf
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/files/35-rootfsB.conf
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/files/45-data.conf
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/files/data.mount
> > create mode 100644 dynamic-layers/rk-rauc-demo/recipes-core/systemd/systemd_%.bbappend
> >
> > diff --git a/README b/README
> > index 6003e7c652fe..8ff006e942b9 100644
> > --- a/README
> > +++ b/README
> > @@ -85,6 +85,24 @@ Notes:
> > in the configuration (e.g. conf/local.conf).
> > + A/B updates with RAUC
> > + This layer now contains one example of building an A/B update using RAUC.
> > + Users are free to use/test this example, to optionally enable it, to build
> > + their own update strategies based on this one, or to ignore it completely.
> > + This example only works with
> > +
> > + INIT_MANAGER = "systemd"
> > +
> > + If you wish to use this example in your builds:
> > + - enable 'systemd' as your init system
> > + - add the meta-rauc layer to your build (with the corresponding branch)
> > + - add 'rauc' to your DISTRO_FEATURES
> > + - enable RK_RAUC_DEMO in your config
> > +
> > + If you wish to implement your own RAUC update without using the example from
> > + this layer, perform the same steps as above except for the step enabling
> > + RK_RAUC_DEMO.
> > +
> > U-Boot Environment:
> > ------------------
> > In order to configure U-Boot to be able to store its environment into the
> > diff --git a/classes-recipe/rk-rauc-demo-features-check.bbclass b/classes-recipe/rk-rauc-demo-features-check.bbclass
> > new file mode 100644
> > index 000000000000..946091802f8d
> > --- /dev/null
> > +++ b/classes-recipe/rk-rauc-demo-features-check.bbclass
> > @@ -0,0 +1,8 @@
> > +inherit features_check
> > +
> > +REQUIRED_DISTRO_FEATURES:append:rk-rauc-demo = " systemd rauc"
> > +REQUIRED_MACHINE_FEATURES:append:rk-rauc-demo = " rk-u-boot-env"
> > +
> > +# 'RK_RAUC_DEMO' indicates the user wants to use the
> > +# rauc demo configuration from this layer
> > +OVERRIDES .= "${@ ':rk-rauc-demo' if bb.utils.to_boolean(d.getVar('RK_RAUC_DEMO'), False) else ''}"
>
> I don't understand why this is in a recipe bbclass, the one in
> conf/machine/include/rockchip-rauc.inc should already be enough?
Good catch! That wasn't supposed to be there, it must have snuck in with all
the rebasing I was doing late at night.
> [...]
>
> > diff --git a/conf/machine/include/rockchip-rauc.inc b/conf/machine/include/rockchip-rauc.inc
> > new file mode 100644
> > index 000000000000..a6f79503076b
> > --- /dev/null
> > +++ b/conf/machine/include/rockchip-rauc.inc
> > @@ -0,0 +1,4 @@
> > +# 'RK_RAUC_DEMO' indicates the user wants to use the
> > +# rauc demo configuration from this layer
> > +OVERRIDES .= "${@ ':rk-rauc-demo' if bb.utils.to_boolean(d.getVar('RK_RAUC_DEMO'), False) else ''}"
>
> [...]
>
> > +do_compile:append:rk-rauc-demo() {
> > + # create boot script
> > + sed -e 's|@@KERNEL_BOOTFILE@@|${UBOOT_EXTLINUX_KERNEL_IMAGE}|' \
> > + "${UNPACKDIR}/boot.cmd.in" > "${UNPACKDIR}/boot.cmd"
> > + mkimage -A ${UBOOT_ARCH} -T script -C none -n "Boot script" -d "${UNPACKDIR}/boot.cmd" ${UNPACKDIR}/boot.scr
> > +
>
> Richard has said today he'd prefer we don't use UNPACKDIR for that kind of
> things, c.f. https://lore.kernel.org/openembedded-core/20240623213254.3215897-1-leon.anavi@konsulko.com/T/#md4b10cea4af07c1a2e5be43e4ee8c8b1fbc6e420
> (though we "agreed" later in the thread to use ${B} instead of the
> originally suggested ${WORKDIR}).
Alright.
> [...]
>
> > diff --git a/dynamic-layers/rk-rauc-demo/recipes-core/rauc/files/system.conf b/dynamic-layers/rk-rauc-demo/recipes-core/rauc/files/system.conf
> > new file mode 100644
> > index 000000000000..4945c67345c4
> > --- /dev/null
> > +++ b/dynamic-layers/rk-rauc-demo/recipes-core/rauc/files/system.conf
> > @@ -0,0 +1,17 @@
> > +[system]
> > +compatible=@MACHINE@
> > +bootloader=uboot
> > +data-directory=/data/
> > +
> > +[keyring]
> > +path=/etc/rauc/ca.cert.pem
> > +
> > +[slot.rootfs.0]
> > +device=/dev/disk/by-partlabel/rootfsA
> > +type=ext4
> > +bootname=A
> > +
> > +[slot.rootfs.1]
> > +device=/dev/disk/by-partlabel/rootfsB
> > +type=ext4
> > +bootname=B
> > diff --git a/dynamic-layers/rk-rauc-demo/recipes-core/rauc/rauc-conf.bbappend b/dynamic-layers/rk-rauc-demo/recipes-core/rauc/rauc-conf.bbappend
> > new file mode 100644
> > index 000000000000..281eb2c4de91
> > --- /dev/null
> > +++ b/dynamic-layers/rk-rauc-demo/recipes-core/rauc/rauc-conf.bbappend
> > @@ -0,0 +1,7 @@
> > +inherit rk-rauc-demo-features-check
> > +
> > +FILESEXTRAPATHS:prepend:rk-rauc-demo := "${THISDIR}/files:"
> > +
>
> I would recommend renaming the directory to rauc-conf here, but that's just
> up to one's preference.
Hmm... the rauc-conf recipe is in the rauc diretory in meta-rauc so I followed
how the parent layer was doing it. I think I prefer it this way; makes it
slightly easier to find the thing the bbappend is appending when both the
parent and child layers use the same directory structure.
> Looking good otherwise :)
>
> Cheers,
> Quentin
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#381): https://lists.yoctoproject.org/g/yocto-patches/message/381
> Mute This Topic: https://lists.yoctoproject.org/mt/106889680/900817
> Group Owner: yocto-patches+owner@lists.yoctoproject.org
> Unsubscribe: https://lists.yoctoproject.org/g/yocto-patches/leave/13168745/900817/63955952/xyzzy [twoerner@gmail.com]
> -=-=-=-=-=-=-=-=-=-=-=-
>
>
next prev parent reply other threads:[~2024-06-26 15:46 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 13:56 [meta-rockchip][PATCH v3] rauc demo: add Trevor Woerner
2024-06-26 15:09 ` [yocto-patches] " Quentin Schulz
2024-06-26 15:46 ` Trevor Woerner [this message]
2024-06-26 15:53 ` Trevor Woerner
2024-06-26 16:11 ` Quentin Schulz
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=20240626154644.GA22782@localhost \
--to=twoerner@gmail.com \
--cc=yocto-patches@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.