From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Mon, 14 Aug 2023 18:36:35 +0200 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qVaYV-003z3c-Ug for lore@lore.pengutronix.de; Mon, 14 Aug 2023 18:36:35 +0200 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1qVaYU-0007IT-73; Mon, 14 Aug 2023 18:36:34 +0200 Received: from pty.hi.pengutronix.de ([2001:67c:670:100:1d::c5]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qVaYP-0007I2-6z; Mon, 14 Aug 2023 18:36:29 +0200 Received: from rsc by pty.hi.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qVaYO-00CQka-P1; Mon, 14 Aug 2023 18:36:28 +0200 Date: Mon, 14 Aug 2023 18:36:28 +0200 From: Robert Schwebel To: Roland Hieber Message-ID: References: <20230623124755.2292833-1-rhi@pengutronix.de> <20230623124755.2292833-4-rhi@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230623124755.2292833-4-rhi@pengutronix.de> X-Sent-From: Pengutronix Hildesheim X-URL: http://www.pengutronix.de/ X-Accept-Language: de,en X-Accept-Content-Type: text/plain Subject: Re: [DistroKit] [PATCH 03/14] rauc-udev: add a compatibility layer for mapping partitions X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: distrokit@pengutronix.de Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false Applied to next. On Fri, Jun 23, 2023 at 02:47:44PM +0200, Roland Hieber wrote: > When we add RAUC support for different platforms later, we need a way to > specify their respective root partitions in RAUC's system.conf; however, > the names of the actual partitions can differ on different hardware > platforms. Add a short udev rule that can add symlinks to the actual > partitions based on the device tree compatible. This way we can refer to > the partitions in system.conf using the symlinks on all boards that we > want to support. > > This commit only adds a stub for now; we will add the code that creates > the actual symlinks for each hardware in later commits. > > Signed-off-by: Roland Hieber > --- > configs/ptxconfig | 5 ++- > projectroot/usr/lib/udev/of_base_compatible | 4 ++ > .../lib/udev/rules.d/90-rauc-partitions.rules | 15 ++++++++ > rules/rauc-udev.in | 10 +++++ > rules/rauc-udev.make | 37 +++++++++++++++++++ > 5 files changed, 70 insertions(+), 1 deletion(-) > create mode 100755 projectroot/usr/lib/udev/of_base_compatible > create mode 100644 projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules > create mode 100644 rules/rauc-udev.in > create mode 100644 rules/rauc-udev.make > > diff --git a/configs/ptxconfig b/configs/ptxconfig > index 170c12408553..9f4fc06d5138 100644 > --- a/configs/ptxconfig > +++ b/configs/ptxconfig > @@ -3,6 +3,7 @@ > # PTXdist 2023.05.0 > # > PTXCONF_DATAPARTITION=y > +PTXCONF_RAUC_UDEV=y > > # > # ------------------------------------ > @@ -700,7 +701,9 @@ PTXCONF_BUSYBOX_TEST=y > # PTXCONF_BUSYBOX_TIMEOUT is not set > PTXCONF_BUSYBOX_TOUCH=y > PTXCONF_BUSYBOX_FEATURE_TOUCH_SUSV3=y > -# PTXCONF_BUSYBOX_TR is not set > +PTXCONF_BUSYBOX_TR=y > +PTXCONF_BUSYBOX_FEATURE_TR_CLASSES=y > +PTXCONF_BUSYBOX_FEATURE_TR_EQUIV=y > PTXCONF_BUSYBOX_TRUE=y > # PTXCONF_BUSYBOX_TRUNCATE is not set > # PTXCONF_BUSYBOX_TSORT is not set > diff --git a/projectroot/usr/lib/udev/of_base_compatible b/projectroot/usr/lib/udev/of_base_compatible > new file mode 100755 > index 000000000000..07c7f767ad90 > --- /dev/null > +++ b/projectroot/usr/lib/udev/of_base_compatible > @@ -0,0 +1,4 @@ > +#!/bin/sh > +# SPDX-License-Identifier: 0-BSD > +# SPDX-FileCopyrightText: 2021 Roland Hieber, Pengutronix > +printf 'OF_BASE_COMPATIBLE="%s"\n' "$(tr '\0' ' ' < /sys/firmware/devicetree/base/compatible)" > diff --git a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules > new file mode 100644 > index 000000000000..c08f9b5633dc > --- /dev/null > +++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules > @@ -0,0 +1,15 @@ > +# SPDX-License-Identifier: 0-BSD > +# SPDX-FileCopyrightText: 2021 Roland Hieber, Pengutronix > + > +ACTION=="remove", GOTO="rauc_partitions_end" > +SUBSYSTEM!="block", GOTO="rauc_partitions_end" > + > +IMPORT{program}="of_base_compatible" > + > +# Add symlinks named /dev/disk/by-usage/{data,rootfs0,rootfs1} pointing > +# to the correct partitions based on the device tree compatible > + > +# fallback for boards not yet supported by RAUC > +KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data" > + > +LABEL="rauc_partitions_end" > diff --git a/rules/rauc-udev.in b/rules/rauc-udev.in > new file mode 100644 > index 000000000000..f960c537f58f > --- /dev/null > +++ b/rules/rauc-udev.in > @@ -0,0 +1,10 @@ > +## SECTION=project_specific > + > +config RAUC_UDEV > + tristate > + prompt "rauc udev rules" > + select BUSYBOX if RUNTIME > + select BUSYBOX_TR if RUNTIME > + select UDEV if RUNTIME > + help > + udev rules for cross-hardware-compatible partition symlinks > diff --git a/rules/rauc-udev.make b/rules/rauc-udev.make > new file mode 100644 > index 000000000000..6a806fc43e34 > --- /dev/null > +++ b/rules/rauc-udev.make > @@ -0,0 +1,37 @@ > +# -*-makefile-*- > +# > +# Copyright (C) 2021 by Roland Hieber, Pengutronix > +# > +# For further information about the PTXdist project and license conditions > +# see the README file. > +# > + > +# > +# We provide this package > +# > +PACKAGES-$(PTXCONF_RAUC_UDEV) += rauc-udev > + > +RAUC_UDEV_VERSION := 1 > +RAUC_UDEV_LICENSE := 0-BSD > + > +# ---------------------------------------------------------------------------- > +# Target-Install > +# ---------------------------------------------------------------------------- > + > +$(STATEDIR)/rauc-udev.targetinstall: > + @$(call targetinfo) > + > + @$(call install_init, rauc-udev) > + @$(call install_fixup,rauc-udev,PRIORITY,optional) > + @$(call install_fixup,rauc-udev,SECTION,base) > + @$(call install_fixup,rauc-udev,AUTHOR,"Roland Hieber, Pengutronix ") > + @$(call install_fixup,rauc-udev,DESCRIPTION,missing) > + > + @$(call install_alternative, rauc-udev, 0, 0, 0755, /usr/lib/udev/of_base_compatible) > + @$(call install_alternative, rauc-udev, 0, 0, 0644, /usr/lib/udev/rules.d/90-rauc-partitions.rules) > + > + @$(call install_finish,rauc-udev) > + > + @$(call touch) > + > +# vim: syntax=make > -- > 2.39.2 > > > -- Pengutronix e.K. | Dipl.-Ing. Robert Schwebel | Steuerwalder Str. 21 | https://www.pengutronix.de/ | 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-9 |