DistroKit Mailinglist
 help / color / mirror / Atom feed
* [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC
@ 2023-02-12 22:14 Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions Roland Hieber
                   ` (9 more replies)
  0 siblings, 10 replies; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

With this patch series, the first v7a platforms (beaglebone black, riotboard,
rpi3, qemu-vexpress) gain support for redundant boot on two root partitions
which can be updated with RAUC.

Roland Hieber (8):
  rauc-udev: add a compatibility layer for mapping partitions
  v7a: add RAUC support for qemu-vexpress
  v7a: add RAUC support for beaglebone black
  v7a: add RAUC support for rpi3
  v7a: add RAUC support for riotboard
  v7a: kernel: enable features necessary for RAUC
  rauc: add initial support
  v7a: enable RAUC bundle creation

 configs/platform-mips/platformconfig          |  20 ++-
 configs/platform-mipsel/platformconfig        |  20 ++-
 configs/platform-rpi1/platformconfig          |  18 ++-
 .../barebox-am335x-defaultenv/init/bootsource |   4 +-
 .../barebox-am335x-defaultenv/nv/boot.default |   1 +
 .../nv/bootchooser.state_prefix               |   1 +
 .../nv/bootchooser.system0.boot               |   1 +
 .../nv/bootchooser.system1.boot               |   1 +
 .../nv/bootchooser.targets                    |   1 +
 configs/platform-v7a/barebox-am335x.config    |   3 +-
 .../platform-v7a/barebox-am335x.config.diff   |   2 +
 .../barebox-mx6-defaultenv/init/bootsource    |   6 +-
 .../barebox-mx6-defaultenv/nv/boot.default    |   1 +
 .../nv/bootchooser.state_prefix               |   1 +
 .../nv/bootchooser.system0.boot               |   1 +
 .../nv/bootchooser.system1.boot               |   1 +
 .../nv/bootchooser.targets                    |   1 +
 configs/platform-v7a/barebox-mx6.config       |   3 +-
 configs/platform-v7a/barebox-mx6.config.diff  |   2 +
 .../barebox-rpi2-defaultenv/init/bootsource   |   5 +-
 .../barebox-rpi2-defaultenv/nv/boot.default   |   1 +
 .../nv/bootchooser.state_prefix               |   1 +
 .../nv/bootchooser.system0.boot               |   1 +
 .../nv/bootchooser.system1.boot               |   1 +
 .../nv/bootchooser.targets                    |   1 +
 configs/platform-v7a/barebox-rpi2.config      |   3 +-
 configs/platform-v7a/barebox-rpi2.config.diff |   2 +
 .../init/bootsource                           |   2 +-
 .../nv/boot.default                           |   1 +
 .../nv/bootchooser.state_prefix               |   1 +
 .../nv/bootchooser.system0.boot               |   1 +
 .../nv/bootchooser.system1.boot               |   1 +
 .../nv/bootchooser.targets                    |   1 +
 configs/platform-v7a/barebox-vexpress.config  |   3 +-
 .../platform-v7a/barebox-vexpress.config.diff |   2 +
 .../config/images/beaglebone.config           |   4 +
 .../config/images/riotboard.config            |   6 +
 .../platform-v7a/config/images/rpi2.config    |   5 +
 .../config/images/vexpress.config             |   7 +-
 configs/platform-v7a/kernelconfig             |  75 ++++++++++-
 ...-bootstate-node-into-a-generic-templ.patch | 123 ++++++++++++++++++
 ...ack-add-beaglebone-black-state-entry.patch |  69 ++++++++++
 ...ts-bcm2837-rpi-3-b-add-state-support.patch |  59 +++++++++
 ...ts-imx6s-riotboard-add-state-backend.patch |  53 ++++++++
 .../patches/barebox-2022.09.0/series          |   4 +
 configs/platform-v7a/platformconfig           |  31 ++++-
 configs/platform-v7a_noneon/platformconfig    |  20 ++-
 configs/platform-v8a/platformconfig           |  19 ++-
 configs/platform-x86_64/platformconfig        |  20 ++-
 configs/ptxconfig                             | 111 ++++++++++++++--
 projectroot/etc/rauc/system.conf              |  16 +++
 .../lib/systemd/system/rauc-mark-good.service |  14 ++
 projectroot/usr/lib/udev/of_base_compatible   |   4 +
 .../lib/udev/rules.d/90-rauc-partitions.rules |  35 +++++
 rules/rauc-udev.in                            |   8 ++
 rules/rauc-udev.make                          |  37 ++++++
 56 files changed, 799 insertions(+), 36 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0104-arm-dts-imx6s-riotboard-add-state-backend.patch
 create mode 100644 projectroot/etc/rauc/system.conf
 create mode 100644 projectroot/usr/lib/systemd/system/rauc-mark-good.service
 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

-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-02-13  9:43   ` Michael Olbrich
  2023-02-12 22:14 ` [DistroKit] [PATCH 2/8] v7a: add RAUC support for qemu-vexpress Roland Hieber
                   ` (8 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

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 <rhi@pengutronix.de>
---
 configs/ptxconfig                             |  1 +
 projectroot/usr/lib/udev/of_base_compatible   |  4 ++
 .../lib/udev/rules.d/90-rauc-partitions.rules | 12 ++++++
 rules/rauc-udev.in                            |  8 ++++
 rules/rauc-udev.make                          | 37 +++++++++++++++++++
 5 files changed, 62 insertions(+)
 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 3c8c001aaf8e..a6a3f29afb53 100644
--- a/configs/ptxconfig
+++ b/configs/ptxconfig
@@ -3,6 +3,7 @@
 # PTXdist 2022.12.0
 #
 PTXCONF_DATAPARTITION=y
+PTXCONF_RAUC_UDEV=y
 
 #
 # ------------------------------------
diff --git a/projectroot/usr/lib/udev/of_base_compatible b/projectroot/usr/lib/udev/of_base_compatible
new file mode 100755
index 000000000000..6b59c9cc569d
--- /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 <rhi@pengutronix.de>
+printf 'OF_BASE_COMPATIBLE="%s"\n' "$(xargs -0  printf "%s " < /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..0300e8b9daad
--- /dev/null
+++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: 0-BSD
+# SPDX-FileCopyrightText: 2021 Roland Hieber, Pengutronix <rhi@pengutronix.de>
+
+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
+
+LABEL="rauc_partitions_end"
diff --git a/rules/rauc-udev.in b/rules/rauc-udev.in
new file mode 100644
index 000000000000..4e90343ba2dc
--- /dev/null
+++ b/rules/rauc-udev.in
@@ -0,0 +1,8 @@
+## SECTION=project_specific
+
+config RAUC_UDEV
+	tristate
+	prompt "rauc udev rules"
+	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 <rhi@pengutronix.de>
+#
+# 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 <rhi@pengutronix.de>")
+	@$(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.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 2/8] v7a: add RAUC support for qemu-vexpress
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-03-08  9:33   ` Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 3/8] v7a: add RAUC support for beaglebone black Roland Hieber
                   ` (7 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

* Enable barebox bootchooser framework
* Add a redundant root partition to the genimage config. The current
  size of the rootfs is below 98 MiB, so we can add a second root
  partition to the image while keeping the overall image size the same.
* Add appropriate variables to the barebox defaultenv so the bootchooser
  can decide into which partition to boot
* Make the bootstate node in the device tree reusable for more platforms
* Map partitions in rauc-udev compatibility layer

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 .../init/bootsource                           |   2 +-
 .../nv/boot.default                           |   1 +
 .../nv/bootchooser.state_prefix               |   1 +
 .../nv/bootchooser.system0.boot               |   1 +
 .../nv/bootchooser.system1.boot               |   1 +
 .../nv/bootchooser.targets                    |   1 +
 configs/platform-v7a/barebox-vexpress.config  |   3 +-
 .../platform-v7a/barebox-vexpress.config.diff |   2 +
 .../config/images/vexpress.config             |   7 +-
 ...-bootstate-node-into-a-generic-templ.patch | 123 ++++++++++++++++++
 .../patches/barebox-2022.09.0/series          |   1 +
 .../lib/udev/rules.d/90-rauc-partitions.rules |   5 +
 12 files changed, 145 insertions(+), 3 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch

diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource b/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource
index b42659c5e78b..4432e021fb0f 100644
--- a/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource
+++ b/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource
@@ -4,4 +4,4 @@ if [ -n "$nv.boot.default" ]; then
 	exit
 fi
 
-global.boot.default="disk0.0 net"
+global.boot.default="bootchooser net"
diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
new file mode 100644
index 000000000000..d7d9a373c50b
--- /dev/null
+++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
@@ -0,0 +1 @@
+bootchooser net
diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
new file mode 100644
index 000000000000..6246412a5c27
--- /dev/null
+++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
@@ -0,0 +1 @@
+state.bootstate
diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
new file mode 100644
index 000000000000..961e29fe981b
--- /dev/null
+++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
@@ -0,0 +1 @@
+disk0.0
diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
new file mode 100644
index 000000000000..5676f868b380
--- /dev/null
+++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
@@ -0,0 +1 @@
+disk0.1
diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
new file mode 100644
index 000000000000..f0fb14eeaad2
--- /dev/null
+++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
@@ -0,0 +1 @@
+system0 system1
diff --git a/configs/platform-v7a/barebox-vexpress.config b/configs/platform-v7a/barebox-vexpress.config
index 9503d59b04af..443d2c2d82f2 100644
--- a/configs/platform-v7a/barebox-vexpress.config
+++ b/configs/platform-v7a/barebox-vexpress.config
@@ -188,7 +188,7 @@ CONFIG_BTHREAD=y
 CONFIG_STATE=y
 # CONFIG_STATE_CRYPTO is not set
 # CONFIG_STATE_BACKWARD_COMPATIBLE is not set
-# CONFIG_BOOTCHOOSER is not set
+CONFIG_BOOTCHOOSER=y
 CONFIG_RESET_SOURCE=y
 # CONFIG_MACHINE_ID is not set
 # CONFIG_SYSTEMD_OF_WATCHDOG is not set
@@ -277,6 +277,7 @@ CONFIG_CMD_GO=y
 # CONFIG_CMD_LOADY is not set
 CONFIG_CMD_RESET=y
 CONFIG_CMD_UIMAGE=y
+CONFIG_CMD_BOOTCHOOSER=y
 # end of Boot
 
 #
diff --git a/configs/platform-v7a/barebox-vexpress.config.diff b/configs/platform-v7a/barebox-vexpress.config.diff
index c9c2cc471980..8811f82ccd04 100644
--- a/configs/platform-v7a/barebox-vexpress.config.diff
+++ b/configs/platform-v7a/barebox-vexpress.config.diff
@@ -8,8 +8,10 @@ CONFIG_ARCH_VEXPRESS=y
 # CONFIG_ARM_SECURE_MONITOR is undefined
 # CONFIG_ARM_SMCCC is undefined
 # CONFIG_ARM_USE_COMPRESSED_DTB is undefined
+CONFIG_BOOTCHOOSER=y
 # CONFIG_CFI_BUFFER_WRITE is not set
 # CONFIG_CLOCKSOURCE_BCM283X is undefined
+CONFIG_CMD_BOOTCHOOSER=y
 # CONFIG_CMD_GPIO is undefined
 # CONFIG_CMD_SMC is undefined
 CONFIG_CONSOLE_ACTIVATE_ALL=y
diff --git a/configs/platform-v7a/config/images/vexpress.config b/configs/platform-v7a/config/images/vexpress.config
index d51a58be2893..3aa64a4299ce 100644
--- a/configs/platform-v7a/config/images/vexpress.config
+++ b/configs/platform-v7a/config/images/vexpress.config
@@ -6,7 +6,12 @@ image @IMAGE@ {
 	partition root-A {
 		image = root.ext2
 		partition-type = 0x83
-		size = 192M
+		size = 96M
+	}
+	partition root-B {
+		image = root.ext2
+		partition-type = 0x83
+		size = 96M
 	}
 	partition data {
 		partition-type = 0x83
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch b/configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
new file mode 100644
index 000000000000..a735d0449de3
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
@@ -0,0 +1,123 @@
+From: Roland Hieber <rhi@pengutronix.de>
+Date: Mon, 25 Jan 2021 00:24:21 +0100
+Subject: [PATCH] arm: dts: refactor bootstate node into a generic template
+
+The existing bootstate node can be used as-is for other A/B redundancy
+setups with the bootchooser framework too. Refactor it into an include
+file which can be simply re-used in other device trees.
+
+Signed-off-by: Roland Hieber <rhi@pengutronix.de>
+---
+ arch/arm/dts/generic-bootstate.dtsi | 44 +++++++++++++++++++++++++++++++++++++
+ arch/arm/dts/vexpress-v2p-ca9.dts   | 44 +++----------------------------------
+ 2 files changed, 47 insertions(+), 41 deletions(-)
+ create mode 100644 arch/arm/dts/generic-bootstate.dtsi
+
+diff --git a/arch/arm/dts/generic-bootstate.dtsi b/arch/arm/dts/generic-bootstate.dtsi
+new file mode 100644
+index 000000000000..5cf9d1640d5c
+--- /dev/null
++++ b/arch/arm/dts/generic-bootstate.dtsi
+@@ -0,0 +1,44 @@
++&bootstate {
++	#address-cells = <1>;
++	#size-cells = <1>;
++
++	system0 {
++		#address-cells = <1>;
++		#size-cells = <1>;
++
++		remaining_attempts@0 {
++			reg = <0x0 0x4>;
++			type = "uint32";
++			default = <3>;
++		};
++
++		priority@4 {
++			reg = <0x4 0x4>;
++			type = "uint32";
++			default = <20>;
++		};
++	};
++
++	system1 {
++		#address-cells = <1>;
++		#size-cells = <1>;
++
++		remaining_attempts@8 {
++			reg = <0x8 0x4>;
++			type = "uint32";
++			default = <3>;
++		};
++
++		priority@c {
++			reg = <0xc 0x4>;
++			type = "uint32";
++			default = <10>;
++		};
++	};
++
++	last_chosen@10 {
++		reg = <0x10 0x4>;
++		type = "uint32";
++	};
++};
++
+diff --git a/arch/arm/dts/vexpress-v2p-ca9.dts b/arch/arm/dts/vexpress-v2p-ca9.dts
+index a43628e7ce15..b7962c363a7b 100644
+--- a/arch/arm/dts/vexpress-v2p-ca9.dts
++++ b/arch/arm/dts/vexpress-v2p-ca9.dts
+@@ -25,50 +25,12 @@
+ 		#address-cells = <1>;
+ 		#size-cells = <1>;
+ 
+-		bootstate {
+-			#address-cells = <1>;
+-			#size-cells = <1>;
+-
+-			system0 { /* the node's name here must match the subnode's name in the 'bootstate' node */
+-				#address-cells = <1>;
+-				#size-cells = <1>;
+-
+-				remaining_attempts@0 {
+-					reg = <0x0 0x4>;
+-					type = "uint32";
+-					default = <3>;
+-				};
+-				priority@4 {
+-					reg = <0x4 0x4>;
+-					type = "uint32";
+-					default = <20>;
+-				};
+-			};
+-
+-			system1 { /* the node's name here must match the subnode's name in the 'bootstate' node */
+-				#address-cells = <1>;
+-				#size-cells = <1>;
+-
+-				remaining_attempts@8 {
+-					reg = <0x8 0x4>;
+-					type = "uint32";
+-					default = <3>;
+-				};
+-				priority@c {
+-					reg = <0xC 0x4>;
+-					type = "uint32";
+-					default = <20>;
+-				};
+-			};
+-
+-			last_chosen@10 {
+-				reg = <0x10 0x4>;
+-				type = "uint32";
+-			};
+-		};
++		bootstate: bootstate {};
+ 	};
+ };
+ 
++#include "generic-bootstate.dtsi"
++
+ &{/bus@40000000/motherboard-bus@40000000/flash@0,00000000} {
+ 	partitions {
+ 		compatible = "fixed-partitions";
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/series b/configs/platform-v7a/patches/barebox-2022.09.0/series
index 26c8a02e7caa..5ae996252bb9 100644
--- a/configs/platform-v7a/patches/barebox-2022.09.0/series
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/series
@@ -1,3 +1,4 @@
 0001-mci-core-act-upon-broken-cd-device-tree-property.patch
 0002-mci-core-add-broken_cd-device-parameter.patch
 0003-mci-core-fixup-broken-cd-information-into-kernel-DT.patch
+0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
diff --git a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
index 0300e8b9daad..32731f8e983a 100644
--- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
+++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
@@ -8,5 +8,10 @@ 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
+ENV{OF_BASE_COMPATIBLE}!="*arm,vexpress,v2p-ca9*", GOTO="qemu_vexpress_end"
+KERNEL=="mmcblk0p1", SYMLINK+="disk/by-usage/rootfs0"
+KERNEL=="mmcblk0p2", SYMLINK+="disk/by-usage/rootfs1"
+KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data"
+LABEL="qemu_vexpress_end"
 
 LABEL="rauc_partitions_end"
-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 3/8] v7a: add RAUC support for beaglebone black
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 2/8] v7a: add RAUC support for qemu-vexpress Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 4/8] v7a: add RAUC support for rpi3 Roland Hieber
                   ` (6 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

* Enable barebox bootchooser framework
* Add a redundant root partition to the genimage config
* Add appropriate variables to the barebox defaultenv so the bootchooser
  can decide into which partition to boot
* Add a state partition to the device tree
* Map partitions in rauc-udev compatibility layer

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 .../barebox-am335x-defaultenv/init/bootsource |  4 +-
 .../barebox-am335x-defaultenv/nv/boot.default |  1 +
 .../nv/bootchooser.state_prefix               |  1 +
 .../nv/bootchooser.system0.boot               |  1 +
 .../nv/bootchooser.system1.boot               |  1 +
 .../nv/bootchooser.targets                    |  1 +
 configs/platform-v7a/barebox-am335x.config    |  3 +-
 .../platform-v7a/barebox-am335x.config.diff   |  2 +
 .../config/images/beaglebone.config           |  4 ++
 ...ack-add-beaglebone-black-state-entry.patch | 69 +++++++++++++++++++
 .../patches/barebox-2022.09.0/series          |  1 +
 .../lib/udev/rules.d/90-rauc-partitions.rules |  6 ++
 12 files changed, 91 insertions(+), 3 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch

diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource b/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource
index 72e71e08c857..b3b73e790334 100644
--- a/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource
@@ -5,7 +5,7 @@ if [ -n "$nv.boot.default" ]; then
 fi
 
 if [ $bootsource = mmc ]; then
-	global.boot.default="mmc$bootsource_instance net"
+	global.boot.default="bootchooser net"
 else
-	global.boot.default="net mmc0 mmc1"
+	global.boot.default="net bootchooser"
 fi
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default b/configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default
new file mode 100644
index 000000000000..d7d9a373c50b
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default
@@ -0,0 +1 @@
+bootchooser net
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix
new file mode 100644
index 000000000000..6246412a5c27
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix
@@ -0,0 +1 @@
+state.bootstate
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot
new file mode 100644
index 000000000000..a6746c31d982
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot
@@ -0,0 +1 @@
+mmc0.1
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot
new file mode 100644
index 000000000000..ecdf1ba55ad6
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot
@@ -0,0 +1 @@
+mmc0.2
diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets
new file mode 100644
index 000000000000..f0fb14eeaad2
--- /dev/null
+++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets
@@ -0,0 +1 @@
+system0 system1
diff --git a/configs/platform-v7a/barebox-am335x.config b/configs/platform-v7a/barebox-am335x.config
index 6f54bea19aa7..e244a8a0dae2 100644
--- a/configs/platform-v7a/barebox-am335x.config
+++ b/configs/platform-v7a/barebox-am335x.config
@@ -211,7 +211,7 @@ CONFIG_BTHREAD=y
 CONFIG_STATE=y
 # CONFIG_STATE_CRYPTO is not set
 # CONFIG_STATE_BACKWARD_COMPATIBLE is not set
-# CONFIG_BOOTCHOOSER is not set
+CONFIG_BOOTCHOOSER=y
 CONFIG_RESET_SOURCE=y
 # CONFIG_MACHINE_ID is not set
 # CONFIG_SYSTEMD_OF_WATCHDOG is not set
@@ -301,6 +301,7 @@ CONFIG_CMD_GO=y
 # CONFIG_CMD_LOADY is not set
 CONFIG_CMD_RESET=y
 CONFIG_CMD_UIMAGE=y
+CONFIG_CMD_BOOTCHOOSER=y
 # end of Boot
 
 #
diff --git a/configs/platform-v7a/barebox-am335x.config.diff b/configs/platform-v7a/barebox-am335x.config.diff
index 936bb661ecba..39918f649f08 100644
--- a/configs/platform-v7a/barebox-am335x.config.diff
+++ b/configs/platform-v7a/barebox-am335x.config.diff
@@ -15,11 +15,13 @@ CONFIG_ARM_BOARD_APPEND_ATAG=y
 # CONFIG_BAREBOX_UPDATE_AM33XX_EMMC is not set
 # CONFIG_BAREBOX_UPDATE_AM33XX_NAND is not set
 CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO=y
+CONFIG_BOOTCHOOSER=y
 CONFIG_BOOTM_OFTREE_UIMAGE=y
 CONFIG_BUS_OMAP_GPMC=y
 # CONFIG_CLKDEV_LOOKUP is undefined
 # CONFIG_CLOCKSOURCE_BCM283X is undefined
 CONFIG_CLOCKSOURCE_TI_DM=y
+CONFIG_CMD_BOOTCHOOSER=y
 # CONFIG_CMD_CLK is undefined
 # CONFIG_CMD_KEYSTORE is not set
 CONFIG_CMD_NAND=y
diff --git a/configs/platform-v7a/config/images/beaglebone.config b/configs/platform-v7a/config/images/beaglebone.config
index 7b1c41dfc320..07d251bfbe69 100644
--- a/configs/platform-v7a/config/images/beaglebone.config
+++ b/configs/platform-v7a/config/images/beaglebone.config
@@ -20,6 +20,10 @@ image @IMAGE@ {
 		image = root.ext2
 		partition-type = 0x83
 	}
+	partition root-B {
+		image = root.ext2
+		partition-type = 0x83
+	}
 	partition data {
 		partition-type = 0x83
 		size = 512M
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch b/configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
new file mode 100644
index 000000000000..a28bf965e6ce
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
@@ -0,0 +1,69 @@
+From: Rouven Czerwinski <r.czerwinski@pengutronix.de>
+Date: Wed, 16 Jan 2019 14:33:09 +0100
+Subject: [PATCH] arm: dts: boneblack: add beaglebone black state entry
+
+Signed-off-by: Rouven Czerwinski <r.czerwinski@pengutronix.de>
+---
+ arch/arm/dts/am335x-boneblack.dts | 40 +++++++++++++++++++++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+diff --git a/arch/arm/dts/am335x-boneblack.dts b/arch/arm/dts/am335x-boneblack.dts
+index 3c286c71bfa2..010cb2a8b892 100644
+--- a/arch/arm/dts/am335x-boneblack.dts
++++ b/arch/arm/dts/am335x-boneblack.dts
+@@ -13,8 +13,27 @@
+ / {
+ 	model = "TI AM335x BeagleBone black";
+ 	compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx";
++
++	aliases {
++		state = &state_mmc1;
++	};
++
++	state_mmc1: state {
++		#address-cells = <1>;
++		#size-cells = <1>;
++		compatible = "barebox,state";
++		magic = <0xa9cc3f17>;
++		backend-type = "raw";
++		backend = <&backend_state_mmc1>;
++		backend-storage-type = "circular";
++		backend-stridesize = <0x40>;
++
++		bootstate: bootstate {};
++	};
+ };
+ 
++#include "generic-bootstate.dtsi"
++
+ &{/memory@80000000} {
+ 	reg = <0x80000000 0x20000000>; /* 512 MB */
+ };
+@@ -75,6 +94,27 @@
+ 	status = "okay";
+ };
+ 
++&mmc1 {
++	partitions {
++		compatible = "fixed-partitions";
++		#address-cells = <2>;
++		#size-cells = <2>;
++
++		barebox: partition@0 {
++			label = "barebox";
++			reg = <0x0 0x0 0x0 0xc0000>;
++		};
++		environment: partition@0xc0000 {
++			label = "barebox-environment";
++			reg = <0x0 0xc0000 0x0 0x20000>;
++		};
++		backend_state_mmc1: partition@0xe0000 {
++			label = "state";
++			reg = <0x0 0xe0000 0x0 0x20000>;
++		};
++	};
++};
++
+ / {
+ 	hdmi {
+ 		compatible = "ti,tilcdc,slave";
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/series b/configs/platform-v7a/patches/barebox-2022.09.0/series
index 5ae996252bb9..14a2ac07a71f 100644
--- a/configs/platform-v7a/patches/barebox-2022.09.0/series
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/series
@@ -2,3 +2,4 @@
 0002-mci-core-add-broken_cd-device-parameter.patch
 0003-mci-core-fixup-broken-cd-information-into-kernel-DT.patch
 0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
+0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
diff --git a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
index 32731f8e983a..11b4e1c86a3c 100644
--- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
+++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
@@ -14,4 +14,10 @@ KERNEL=="mmcblk0p2", SYMLINK+="disk/by-usage/rootfs1"
 KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data"
 LABEL="qemu_vexpress_end"
 
+ENV{OF_BASE_COMPATIBLE}!="*ti,am335x-bone-black*", GOTO="beaglebone_black_end"
+KERNEL=="mmcblk0p2", SYMLINK+="disk/by-usage/rootfs0"
+KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/rootfs1"
+KERNEL=="mmcblk0p4", SYMLINK+="disk/by-usage/data"
+LABEL="beaglebone_black_end"
+
 LABEL="rauc_partitions_end"
-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 4/8] v7a: add RAUC support for rpi3
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
                   ` (2 preceding siblings ...)
  2023-02-12 22:14 ` [DistroKit] [PATCH 3/8] v7a: add RAUC support for beaglebone black Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 5/8] v7a: add RAUC support for riotboard Roland Hieber
                   ` (5 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

* Enable barebox bootchooser framework
* Add a redundant root partition to the genimage config. The state and
  environment partitions can live in the first 4 MiB of the SD card, so
  move the the boot partition by the same amount.
* Add appropriate variables to the barebox defaultenv so the bootchooser
  can decide into which partition to boot
* Add a state partition to the device tree
* Map partitions in rauc-udev compatibility layer

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 .../barebox-rpi2-defaultenv/init/bootsource   |  5 +-
 .../barebox-rpi2-defaultenv/nv/boot.default   |  1 +
 .../nv/bootchooser.state_prefix               |  1 +
 .../nv/bootchooser.system0.boot               |  1 +
 .../nv/bootchooser.system1.boot               |  1 +
 .../nv/bootchooser.targets                    |  1 +
 configs/platform-v7a/barebox-rpi2.config      |  3 +-
 configs/platform-v7a/barebox-rpi2.config.diff |  2 +
 .../platform-v7a/config/images/rpi2.config    |  5 ++
 ...ts-bcm2837-rpi-3-b-add-state-support.patch | 59 +++++++++++++++++++
 .../patches/barebox-2022.09.0/series          |  1 +
 .../lib/udev/rules.d/90-rauc-partitions.rules |  6 ++
 12 files changed, 82 insertions(+), 4 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch

diff --git a/configs/platform-v7a/barebox-rpi2-defaultenv/init/bootsource b/configs/platform-v7a/barebox-rpi2-defaultenv/init/bootsource
index 4de71635720a..50f505f6266b 100644
--- a/configs/platform-v7a/barebox-rpi2-defaultenv/init/bootsource
+++ b/configs/platform-v7a/barebox-rpi2-defaultenv/init/bootsource
@@ -6,8 +6,7 @@ fi
 
 if [ $bootsource = mmc ]; then
 	global.boot.default="bootchooser net"
-elif [ $bootsource = net ]; then
-	global.boot.default="net bootchooser"
 else
-	global.boot.default="disk0.1 net"
+	global.boot.default="net bootchooser"
 fi
+
diff --git a/configs/platform-v7a/barebox-rpi2-defaultenv/nv/boot.default b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/boot.default
new file mode 100644
index 000000000000..d7d9a373c50b
--- /dev/null
+++ b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/boot.default
@@ -0,0 +1 @@
+bootchooser net
diff --git a/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.state_prefix b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.state_prefix
new file mode 100644
index 000000000000..6246412a5c27
--- /dev/null
+++ b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.state_prefix
@@ -0,0 +1 @@
+state.bootstate
diff --git a/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system0.boot b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system0.boot
new file mode 100644
index 000000000000..5676f868b380
--- /dev/null
+++ b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system0.boot
@@ -0,0 +1 @@
+disk0.1
diff --git a/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system1.boot b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system1.boot
new file mode 100644
index 000000000000..1851d291c58c
--- /dev/null
+++ b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system1.boot
@@ -0,0 +1 @@
+disk0.2
diff --git a/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.targets b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.targets
new file mode 100644
index 000000000000..f0fb14eeaad2
--- /dev/null
+++ b/configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.targets
@@ -0,0 +1 @@
+system0 system1
diff --git a/configs/platform-v7a/barebox-rpi2.config b/configs/platform-v7a/barebox-rpi2.config
index 4788ff19a692..c8c92385382f 100644
--- a/configs/platform-v7a/barebox-rpi2.config
+++ b/configs/platform-v7a/barebox-rpi2.config
@@ -208,7 +208,7 @@ CONFIG_BTHREAD=y
 CONFIG_STATE=y
 # CONFIG_STATE_CRYPTO is not set
 # CONFIG_STATE_BACKWARD_COMPATIBLE is not set
-# CONFIG_BOOTCHOOSER is not set
+CONFIG_BOOTCHOOSER=y
 CONFIG_RESET_SOURCE=y
 # CONFIG_MACHINE_ID is not set
 # CONFIG_SYSTEMD_OF_WATCHDOG is not set
@@ -290,6 +290,7 @@ CONFIG_CMD_GO=y
 # CONFIG_CMD_LOADY is not set
 CONFIG_CMD_RESET=y
 CONFIG_CMD_UIMAGE=y
+CONFIG_CMD_BOOTCHOOSER=y
 # end of Boot
 
 #
diff --git a/configs/platform-v7a/barebox-rpi2.config.diff b/configs/platform-v7a/barebox-rpi2.config.diff
index 534b657b7448..a65fef755868 100644
--- a/configs/platform-v7a/barebox-rpi2.config.diff
+++ b/configs/platform-v7a/barebox-rpi2.config.diff
@@ -1,5 +1,7 @@
 44749ac3167836cbc7b473f78c4e9fea
 CONFIG_ARM_ASM_UNIFIED=y
+CONFIG_BOOTCHOOSER=y
+CONFIG_CMD_BOOTCHOOSER=y
 # CONFIG_CMD_NVMEM is not set
 # CONFIG_CMD_USBGADGET is undefined
 CONFIG_DRIVER_SERIAL_NS16550=y
diff --git a/configs/platform-v7a/config/images/rpi2.config b/configs/platform-v7a/config/images/rpi2.config
index 3dc404d36379..80f004e03bde 100644
--- a/configs/platform-v7a/config/images/rpi2.config
+++ b/configs/platform-v7a/config/images/rpi2.config
@@ -13,6 +13,7 @@ image @IMAGE@ {
 		disk-signature = 0xbedf7893
 	}
 	partition boot {
+		offset = 4M
 		image = rpi2-boot.vfat
 		partition-type = 0xc
 		bootable = true
@@ -21,6 +22,10 @@ image @IMAGE@ {
 		image = root.ext2
 		partition-type = 0x83
 	}
+	partition root-B {
+		image = root.ext2
+		partition-type = 0x83
+	}
 	partition data {
 		partition-type = 0x83
 		size = 512M
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch b/configs/platform-v7a/patches/barebox-2022.09.0/0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch
new file mode 100644
index 000000000000..ec49b669e995
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch
@@ -0,0 +1,59 @@
+From: Enrico Joerns <ejo@pengutronix.de>
+Date: Thu, 5 Jan 2017 17:46:36 +0100
+Subject: [PATCH] arm: dts: bcm2837-rpi-3-b: add state support
+
+Signed-off-by: Enrico Joerns <ejo@pengutronix.de>
+---
+ arch/arm/dts/bcm2837-rpi-3.dts | 36 ++++++++++++++++++++++++++++++++++++
+ 1 file changed, 36 insertions(+)
+
+diff --git a/arch/arm/dts/bcm2837-rpi-3.dts b/arch/arm/dts/bcm2837-rpi-3.dts
+index e82d518fa551..086397ba35f5 100644
+--- a/arch/arm/dts/bcm2837-rpi-3.dts
++++ b/arch/arm/dts/bcm2837-rpi-3.dts
+@@ -1,5 +1,26 @@
+ #include <arm64/broadcom/bcm2837-rpi-3-b.dts>
+ 
++/ {
++	aliases {
++		state = &state;
++	};
++
++	state: state {
++		magic = <0x11fb08ef>;
++		compatible = "barebox,state";
++		backend-type = "raw";
++		backend = <&statepart>;
++		backend-stridesize = <0x80>;
++		backend-storage-type = "direct";
++		#address-cells = <1>;
++		#size-cells = <1>;
++
++		bootstate: bootstate {};
++	};
++};
++
++#include "generic-bootstate.dtsi"
++
+ &{/memory@0} {
+ 	reg = <0x0 0x0>;
+ };
+@@ -7,3 +28,18 @@
+ &sdhci {
+ 	status = "disabled";
+ };
++
++&sdhost {
++        #address-cells = <1>;
++        #size-cells = <1>;
++
++        statepart: partition@100000 {
++                label = "barebox-state";
++                reg = <0x100000 0x100000>;
++        };
++
++        partition@200000 {
++                label = "barebox-environment";
++                reg = <0x200000 0x100000>;
++        };
++};
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/series b/configs/platform-v7a/patches/barebox-2022.09.0/series
index 14a2ac07a71f..24a6b4c9896b 100644
--- a/configs/platform-v7a/patches/barebox-2022.09.0/series
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/series
@@ -3,3 +3,4 @@
 0003-mci-core-fixup-broken-cd-information-into-kernel-DT.patch
 0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
 0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
+0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch
diff --git a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
index 11b4e1c86a3c..87575bc15273 100644
--- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
+++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
@@ -20,4 +20,10 @@ KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/rootfs1"
 KERNEL=="mmcblk0p4", SYMLINK+="disk/by-usage/data"
 LABEL="beaglebone_black_end"
 
+ENV{OF_BASE_COMPATIBLE}!="*raspberrypi,3-model-b*", GOTO="rpi3_end"
+KERNEL=="mmcblk0p2", SYMLINK+="disk/by-usage/rootfs0"
+KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/rootfs1"
+KERNEL=="mmcblk0p4", SYMLINK+="disk/by-usage/data"
+LABEL="rpi3_end"
+
 LABEL="rauc_partitions_end"
-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 5/8] v7a: add RAUC support for riotboard
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
                   ` (3 preceding siblings ...)
  2023-02-12 22:14 ` [DistroKit] [PATCH 4/8] v7a: add RAUC support for rpi3 Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-02-12 22:14 ` [DistroKit] [PATCH 6/8] v7a: kernel: enable features necessary for RAUC Roland Hieber
                   ` (4 subsequent siblings)
  9 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

* Enable barebox bootchooser framework
* Add a redundant root partition to the genimage config
* Add appropriate variables to the barebox defaultenv so the bootchooser
  can decide into which partition to boot
* Add a state partition to the device tree
* Map partitions in rauc-udev compatibility layer

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 .../barebox-mx6-defaultenv/init/bootsource    |  6 +--
 .../barebox-mx6-defaultenv/nv/boot.default    |  1 +
 .../nv/bootchooser.state_prefix               |  1 +
 .../nv/bootchooser.system0.boot               |  1 +
 .../nv/bootchooser.system1.boot               |  1 +
 .../nv/bootchooser.targets                    |  1 +
 configs/platform-v7a/barebox-mx6.config       |  3 +-
 configs/platform-v7a/barebox-mx6.config.diff  |  2 +
 .../config/images/riotboard.config            |  6 +++
 ...ts-imx6s-riotboard-add-state-backend.patch | 53 +++++++++++++++++++
 .../patches/barebox-2022.09.0/series          |  1 +
 .../lib/udev/rules.d/90-rauc-partitions.rules |  6 +++
 12 files changed, 78 insertions(+), 4 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/boot.default
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system1.boot
 create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.targets
 create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0104-arm-dts-imx6s-riotboard-add-state-backend.patch

diff --git a/configs/platform-v7a/barebox-mx6-defaultenv/init/bootsource b/configs/platform-v7a/barebox-mx6-defaultenv/init/bootsource
index ba0480949ec8..852cfd7d9611 100644
--- a/configs/platform-v7a/barebox-mx6-defaultenv/init/bootsource
+++ b/configs/platform-v7a/barebox-mx6-defaultenv/init/bootsource
@@ -4,10 +4,10 @@ if [ -n "$nv.boot.default" ]; then
 	exit
 fi
 
-
 if [ $bootsource = mmc ]; then
 	detect mmc$bootsource_instance
-	global.boot.default="mmc$bootsource_instance net"
+	global.boot.default="bootchooser net"
 else
-	global.boot.default="net mmc1 mmc2 mmc3"
+	global.boot.default="net bootchooser"
 fi
+
diff --git a/configs/platform-v7a/barebox-mx6-defaultenv/nv/boot.default b/configs/platform-v7a/barebox-mx6-defaultenv/nv/boot.default
new file mode 100644
index 000000000000..d7d9a373c50b
--- /dev/null
+++ b/configs/platform-v7a/barebox-mx6-defaultenv/nv/boot.default
@@ -0,0 +1 @@
+bootchooser net
diff --git a/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.state_prefix b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.state_prefix
new file mode 100644
index 000000000000..6246412a5c27
--- /dev/null
+++ b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.state_prefix
@@ -0,0 +1 @@
+state.bootstate
diff --git a/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system0.boot b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system0.boot
new file mode 100644
index 000000000000..597dd55b4974
--- /dev/null
+++ b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system0.boot
@@ -0,0 +1 @@
+mmc2.0
diff --git a/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system1.boot b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system1.boot
new file mode 100644
index 000000000000..069ba3685643
--- /dev/null
+++ b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system1.boot
@@ -0,0 +1 @@
+mmc2.1
diff --git a/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.targets b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.targets
new file mode 100644
index 000000000000..f0fb14eeaad2
--- /dev/null
+++ b/configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.targets
@@ -0,0 +1 @@
+system0 system1
diff --git a/configs/platform-v7a/barebox-mx6.config b/configs/platform-v7a/barebox-mx6.config
index d62cd2bf8ab1..ab2c77cb1889 100644
--- a/configs/platform-v7a/barebox-mx6.config
+++ b/configs/platform-v7a/barebox-mx6.config
@@ -283,7 +283,7 @@ CONFIG_BTHREAD=y
 CONFIG_STATE=y
 # CONFIG_STATE_CRYPTO is not set
 # CONFIG_STATE_BACKWARD_COMPATIBLE is not set
-# CONFIG_BOOTCHOOSER is not set
+CONFIG_BOOTCHOOSER=y
 CONFIG_RESET_SOURCE=y
 # CONFIG_MACHINE_ID is not set
 # CONFIG_SYSTEMD_OF_WATCHDOG is not set
@@ -373,6 +373,7 @@ CONFIG_CMD_GO=y
 # CONFIG_CMD_LOADY is not set
 CONFIG_CMD_RESET=y
 CONFIG_CMD_UIMAGE=y
+CONFIG_CMD_BOOTCHOOSER=y
 # end of Boot
 
 #
diff --git a/configs/platform-v7a/barebox-mx6.config.diff b/configs/platform-v7a/barebox-mx6.config.diff
index 9efdf8c30380..93317b38199a 100644
--- a/configs/platform-v7a/barebox-mx6.config.diff
+++ b/configs/platform-v7a/barebox-mx6.config.diff
@@ -21,10 +21,12 @@ CONFIG_AT803X_PHY=y
 CONFIG_BAREBOX_UPDATE_IMX_NAND_FCB=y
 CONFIG_BCH=y
 # CONFIG_BMP is not set
+CONFIG_BOOTCHOOSER=y
 CONFIG_BOOTM_OFTREE_UIMAGE=y
 # CONFIG_CACHE_L2X0 is not set
 # CONFIG_CLOCKSOURCE_BCM283X is undefined
 CONFIG_CLOCKSOURCE_IMX_GPT=y
+CONFIG_CMD_BOOTCHOOSER=y
 # CONFIG_CMD_FBTEST is not set
 # CONFIG_CMD_KEYSTORE is not set
 CONFIG_CMD_MMC_EXTCSD=y
diff --git a/configs/platform-v7a/config/images/riotboard.config b/configs/platform-v7a/config/images/riotboard.config
index 32ca817e7362..f311fd5e41b0 100644
--- a/configs/platform-v7a/config/images/riotboard.config
+++ b/configs/platform-v7a/config/images/riotboard.config
@@ -15,6 +15,12 @@ image @IMAGE@ {
 		image = root.ext2
 		partition-type = 0x83
 	}
+
+	partition root-B {
+		image = root.ext2
+		partition-type = 0x83
+	}
+
 	partition data {
 		partition-type = 0x83
 		size = 512M
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/0104-arm-dts-imx6s-riotboard-add-state-backend.patch b/configs/platform-v7a/patches/barebox-2022.09.0/0104-arm-dts-imx6s-riotboard-add-state-backend.patch
new file mode 100644
index 000000000000..1ba9897d98d7
--- /dev/null
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/0104-arm-dts-imx6s-riotboard-add-state-backend.patch
@@ -0,0 +1,53 @@
+From: Roland Hieber <rhi@pengutronix.de>
+Date: Sun, 12 Feb 2023 16:05:23 +0100
+Subject: [PATCH] arm: dts: imx6s-riotboard: add state backend
+
+Signed-off-by: Roland Hieber <rhi@pengutronix.de>
+---
+ arch/arm/dts/imx6s-riotboard.dts | 24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+diff --git a/arch/arm/dts/imx6s-riotboard.dts b/arch/arm/dts/imx6s-riotboard.dts
+index 9efef039a7eb..c0420a91a40e 100644
+--- a/arch/arm/dts/imx6s-riotboard.dts
++++ b/arch/arm/dts/imx6s-riotboard.dts
+@@ -17,8 +17,27 @@
+ 			device-path = &environment_usdhc4;
+ 		};
+ 	};
++
++	aliases {
++		state = &state_usdhc4;
++	};
++
++	state_usdhc4: state {
++		#address-cells = <1>;
++		#size-cells = <1>;
++		compatible = "barebox,state";
++		magic = <0x95ab2de7>;
++		backend-type = "raw";
++		backend = <&backend_state_usdhc4>;
++		backend-storage-type = "circular";
++		backend-stridesize = <0x40>;
++
++		bootstate: bootstate {};
++	};
+ };
+ 
++#include "generic-bootstate.dtsi"
++
+ &fec {
+ 	phy-reset-duration = <2>;
+ };
+@@ -36,6 +55,11 @@
+ 		label = "barebox-environment";
+ 		reg = <0xe0000 0x20000>;
+ 	};
++
++	backend_state_usdhc4: partition@100000 {
++		label = "barebox-state";
++		reg = <0x100000 0x40000>;
++	};
+ };
+ 
+ &ocotp {
diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/series b/configs/platform-v7a/patches/barebox-2022.09.0/series
index 24a6b4c9896b..999bb06b4e15 100644
--- a/configs/platform-v7a/patches/barebox-2022.09.0/series
+++ b/configs/platform-v7a/patches/barebox-2022.09.0/series
@@ -4,3 +4,4 @@
 0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
 0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
 0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch
+0104-arm-dts-imx6s-riotboard-add-state-backend.patch
diff --git a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
index 87575bc15273..970fc517edca 100644
--- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
+++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
@@ -26,4 +26,10 @@ KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/rootfs1"
 KERNEL=="mmcblk0p4", SYMLINK+="disk/by-usage/data"
 LABEL="rpi3_end"
 
+ENV{OF_BASE_COMPATIBLE}!="*riot,imx6s-riotboard*", GOTO="riotboard_end"
+KERNEL=="mmcblk0p1", SYMLINK+="disk/by-usage/rootfs0"
+KERNEL=="mmcblk0p2", SYMLINK+="disk/by-usage/rootfs1"
+KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data"
+LABEL="riotboard_end"
+
 LABEL="rauc_partitions_end"
-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 6/8] v7a: kernel: enable features necessary for RAUC
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
                   ` (4 preceding siblings ...)
  2023-02-12 22:14 ` [DistroKit] [PATCH 5/8] v7a: add RAUC support for riotboard Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-02-13  7:33   ` Jan Lübbe
  2023-02-12 22:14 ` [DistroKit] [PATCH 7/8] rauc: add initial support Roland Hieber
                   ` (3 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

Enable the following kernel features:

* ARM SHA256 acceleration (CRYPTO_SHA256_ARM)
* Device mapper support (MD, BLK_DEV_DM)
* Verity target support (DM_VERITY)
* squashfs file system (MISC_FILESYSTEMS, SQUASHFS*, ZLIB_INFLATE)

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 configs/platform-v7a/kernelconfig | 75 +++++++++++++++++++++++++++++--
 1 file changed, 72 insertions(+), 3 deletions(-)

diff --git a/configs/platform-v7a/kernelconfig b/configs/platform-v7a/kernelconfig
index 636aad4a27dd..c0c534b92ca1 100644
--- a/configs/platform-v7a/kernelconfig
+++ b/configs/platform-v7a/kernelconfig
@@ -683,7 +683,7 @@ CONFIG_ARM_CRYPTO=y
 # CONFIG_CRYPTO_SHA1_ARM_NEON is not set
 # CONFIG_CRYPTO_SHA1_ARM_CE is not set
 # CONFIG_CRYPTO_SHA2_ARM_CE is not set
-# CONFIG_CRYPTO_SHA256_ARM is not set
+CONFIG_CRYPTO_SHA256_ARM=y
 # CONFIG_CRYPTO_SHA512_ARM is not set
 CONFIG_CRYPTO_BLAKE2S_ARM=y
 # CONFIG_CRYPTO_BLAKE2B_NEON is not set
@@ -818,6 +818,7 @@ CONFIG_EFI_PARTITION=y
 
 CONFIG_BLK_MQ_VIRTIO=y
 CONFIG_BLK_PM=y
+CONFIG_BLOCK_HOLDER_DEPRECATED=y
 
 #
 # IO Schedulers
@@ -1444,7 +1445,37 @@ CONFIG_SCSI_MOD=y
 
 CONFIG_HAVE_PATA_PLATFORM=y
 # CONFIG_ATA is not set
-# CONFIG_MD is not set
+CONFIG_MD=y
+# CONFIG_BLK_DEV_MD is not set
+# CONFIG_BCACHE is not set
+CONFIG_BLK_DEV_DM_BUILTIN=y
+CONFIG_BLK_DEV_DM=y
+# CONFIG_DM_DEBUG is not set
+CONFIG_DM_BUFIO=y
+# CONFIG_DM_DEBUG_BLOCK_MANAGER_LOCKING is not set
+# CONFIG_DM_UNSTRIPED is not set
+# CONFIG_DM_CRYPT is not set
+# CONFIG_DM_SNAPSHOT is not set
+# CONFIG_DM_THIN_PROVISIONING is not set
+# CONFIG_DM_CACHE is not set
+# CONFIG_DM_WRITECACHE is not set
+# CONFIG_DM_ERA is not set
+# CONFIG_DM_CLONE is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_RAID is not set
+# CONFIG_DM_ZERO is not set
+# CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
+# CONFIG_DM_DUST is not set
+# CONFIG_DM_INIT is not set
+# CONFIG_DM_UEVENT is not set
+# CONFIG_DM_FLAKEY is not set
+CONFIG_DM_VERITY=y
+# CONFIG_DM_VERITY_VERIFY_ROOTHASH_SIG is not set
+# CONFIG_DM_VERITY_FEC is not set
+# CONFIG_DM_SWITCH is not set
+# CONFIG_DM_LOG_WRITES is not set
+# CONFIG_DM_INTEGRITY is not set
 # CONFIG_TARGET_CORE is not set
 CONFIG_NETDEVICES=y
 CONFIG_MII=y
@@ -3480,7 +3511,44 @@ CONFIG_MEMFD_CREATE=y
 CONFIG_CONFIGFS_FS=y
 # end of Pseudo filesystems
 
-# CONFIG_MISC_FILESYSTEMS is not set
+CONFIG_MISC_FILESYSTEMS=y
+# CONFIG_ORANGEFS_FS is not set
+# CONFIG_ADFS_FS is not set
+# CONFIG_AFFS_FS is not set
+# CONFIG_ECRYPT_FS is not set
+# CONFIG_HFS_FS is not set
+# CONFIG_HFSPLUS_FS is not set
+# CONFIG_BEFS_FS is not set
+# CONFIG_BFS_FS is not set
+# CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
+# CONFIG_CRAMFS is not set
+CONFIG_SQUASHFS=y
+CONFIG_SQUASHFS_FILE_CACHE=y
+# CONFIG_SQUASHFS_FILE_DIRECT is not set
+CONFIG_SQUASHFS_DECOMP_SINGLE=y
+# CONFIG_SQUASHFS_DECOMP_MULTI is not set
+# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set
+# CONFIG_SQUASHFS_XATTR is not set
+CONFIG_SQUASHFS_ZLIB=y
+# CONFIG_SQUASHFS_LZ4 is not set
+# CONFIG_SQUASHFS_LZO is not set
+# CONFIG_SQUASHFS_XZ is not set
+# CONFIG_SQUASHFS_ZSTD is not set
+# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set
+# CONFIG_SQUASHFS_EMBEDDED is not set
+CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3
+# CONFIG_VXFS_FS is not set
+# CONFIG_MINIX_FS is not set
+# CONFIG_OMFS_FS is not set
+# CONFIG_HPFS_FS is not set
+# CONFIG_QNX4FS_FS is not set
+# CONFIG_QNX6FS_FS is not set
+# CONFIG_ROMFS_FS is not set
+# CONFIG_PSTORE is not set
+# CONFIG_SYSV_FS is not set
+# CONFIG_UFS_FS is not set
+# CONFIG_EROFS_FS is not set
 CONFIG_NETWORK_FILESYSTEMS=y
 CONFIG_NFS_FS=y
 CONFIG_NFS_V2=y
@@ -3829,6 +3897,7 @@ CONFIG_CRC32_SLICEBY8=y
 # CONFIG_LIBCRC32C is not set
 # CONFIG_CRC8 is not set
 # CONFIG_RANDOM32_SELFTEST is not set
+CONFIG_ZLIB_INFLATE=y
 # CONFIG_XZ_DEC is not set
 CONFIG_GENERIC_ALLOCATOR=y
 CONFIG_ASSOCIATIVE_ARRAY=y
-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 7/8] rauc: add initial support
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
                   ` (5 preceding siblings ...)
  2023-02-12 22:14 ` [DistroKit] [PATCH 6/8] v7a: kernel: enable features necessary for RAUC Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-02-13  7:37   ` Jan Lübbe
  2023-02-12 22:14 ` [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation Roland Hieber
                   ` (2 subsequent siblings)
  9 siblings, 1 reply; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

Set up RAUC with a shared system.conf that uses the /dev symlinks which
the rauc-udev package creates based on the Device Tree compatible. Also
add a unit file that marks the booted partition as good after systemd
startup has finished successfully.

The key material for signing the RAUC bundles is provided by the
ptx-code-signing provider used for development, which we need to enable
in all platformconfigs.

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 configs/platform-mips/platformconfig          |  20 +++-
 configs/platform-mipsel/platformconfig        |  20 +++-
 configs/platform-rpi1/platformconfig          |  18 ++-
 configs/platform-v7a/platformconfig           |  19 ++-
 configs/platform-v7a_noneon/platformconfig    |  20 +++-
 configs/platform-v8a/platformconfig           |  19 ++-
 configs/platform-x86_64/platformconfig        |  20 +++-
 configs/ptxconfig                             | 110 ++++++++++++++++--
 projectroot/etc/rauc/system.conf              |  16 +++
 .../lib/systemd/system/rauc-mark-good.service |  14 +++
 10 files changed, 258 insertions(+), 18 deletions(-)
 create mode 100644 projectroot/etc/rauc/system.conf
 create mode 100644 projectroot/usr/lib/systemd/system/rauc-mark-good.service

diff --git a/configs/platform-mips/platformconfig b/configs/platform-mips/platformconfig
index bf324314663d..37d1a63f7276 100644
--- a/configs/platform-mips/platformconfig
+++ b/configs/platform-mips/platformconfig
@@ -19,6 +19,7 @@ PTXCONF_PLATFORM="mips"
 PTXCONF_PLATFORM_VERSION="-${PTXDIST_BSP_AUTOVERSION}"
 PTXCONF_RUNTIME=y
 PTXCONF_BUILDTIME=y
+PTXCONF_VIRTUAL=y
 PTXCONF_PLATFORMCONFIG_VERSION="2022.12.0"
 
 #
@@ -202,16 +203,33 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # PTXCONF_KERNEL_FIT is not set
 # end of image creation options        
 
-# PTXCONF_CODE_SIGNING is not set
+PTXCONF_CODE_SIGNING=y
+PTXCONF_CODE_SIGNING_PROVIDER="devel"
+PTXCONF_CODE_SIGNING_PROVIDER_DEVEL=y
+PTXCONF_HOST_PTX_CODE_SIGNING_DEV=y
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_E2FSPROGS=y
+PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
 PTXCONF_HOST_LIBCONFUSE=y
+PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
 PTXCONF_HOST_LIBLZO=y
+PTXCONF_HOST_LIBP11=y
+PTXCONF_HOST_LIBTASN1=y
 PTXCONF_HOST_LZOP=y
 PTXCONF_HOST_M4=y
+PTXCONF_HOST_MESON=y
+PTXCONF_HOST_NINJA=y
+PTXCONF_HOST_OPENSC=y
+PTXCONF_HOST_OPENSSL=y
+PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_SOFTHSM=y
+PTXCONF_HOST_SQLITE=y
+PTXCONF_HOST_SYSTEM_PYTHON3=y
+PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
 
 #
diff --git a/configs/platform-mipsel/platformconfig b/configs/platform-mipsel/platformconfig
index 5c4672ee5f30..d578c9357ed3 100644
--- a/configs/platform-mipsel/platformconfig
+++ b/configs/platform-mipsel/platformconfig
@@ -19,6 +19,7 @@ PTXCONF_PLATFORM="mipsel"
 PTXCONF_PLATFORM_VERSION="-${PTXDIST_BSP_AUTOVERSION}"
 PTXCONF_RUNTIME=y
 PTXCONF_BUILDTIME=y
+PTXCONF_VIRTUAL=y
 PTXCONF_PLATFORMCONFIG_VERSION="2022.12.0"
 
 #
@@ -198,16 +199,33 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # PTXCONF_KERNEL_FIT is not set
 # end of image creation options        
 
-# PTXCONF_CODE_SIGNING is not set
+PTXCONF_CODE_SIGNING=y
+PTXCONF_CODE_SIGNING_PROVIDER="devel"
+PTXCONF_CODE_SIGNING_PROVIDER_DEVEL=y
+PTXCONF_HOST_PTX_CODE_SIGNING_DEV=y
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_E2FSPROGS=y
+PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
 PTXCONF_HOST_LIBCONFUSE=y
+PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
 PTXCONF_HOST_LIBLZO=y
+PTXCONF_HOST_LIBP11=y
+PTXCONF_HOST_LIBTASN1=y
 PTXCONF_HOST_LZOP=y
 PTXCONF_HOST_M4=y
+PTXCONF_HOST_MESON=y
+PTXCONF_HOST_NINJA=y
+PTXCONF_HOST_OPENSC=y
+PTXCONF_HOST_OPENSSL=y
+PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_SOFTHSM=y
+PTXCONF_HOST_SQLITE=y
+PTXCONF_HOST_SYSTEM_PYTHON3=y
+PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
 
 #
diff --git a/configs/platform-rpi1/platformconfig b/configs/platform-rpi1/platformconfig
index 3cb1ec1af6e5..c8202be97db1 100644
--- a/configs/platform-rpi1/platformconfig
+++ b/configs/platform-rpi1/platformconfig
@@ -269,20 +269,36 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # PTXCONF_KERNEL_FIT is not set
 # end of image creation options        
 
-# PTXCONF_CODE_SIGNING is not set
+PTXCONF_CODE_SIGNING=y
+PTXCONF_CODE_SIGNING_PROVIDER="devel"
+PTXCONF_CODE_SIGNING_PROVIDER_DEVEL=y
+PTXCONF_HOST_PTX_CODE_SIGNING_DEV=y
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_DOSFSTOOLS=y
 PTXCONF_HOST_E2FSPROGS=y
+PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
 PTXCONF_HOST_LIBCONFUSE=y
+PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
 PTXCONF_HOST_LIBLZO=y
+PTXCONF_HOST_LIBP11=y
+PTXCONF_HOST_LIBTASN1=y
 PTXCONF_HOST_LZOP=y
 PTXCONF_HOST_M4=y
+PTXCONF_HOST_MESON=y
 PTXCONF_HOST_MTOOLS=y
+PTXCONF_HOST_NINJA=y
+PTXCONF_HOST_OPENSC=y
 PTXCONF_HOST_OPENSSL=y
+PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_SOFTHSM=y
+PTXCONF_HOST_SQLITE=y
 PTXCONF_HOST_SYSTEM_BC=y
+PTXCONF_HOST_SYSTEM_PYTHON3=y
+PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
 
 #
diff --git a/configs/platform-v7a/platformconfig b/configs/platform-v7a/platformconfig
index ac43dbf1d9b1..5bd6cebcbf9c 100644
--- a/configs/platform-v7a/platformconfig
+++ b/configs/platform-v7a/platformconfig
@@ -19,6 +19,7 @@ PTXCONF_PLATFORM="v7a"
 PTXCONF_PLATFORM_VERSION="-${PTXDIST_BSP_AUTOVERSION}"
 PTXCONF_RUNTIME=y
 PTXCONF_BUILDTIME=y
+PTXCONF_VIRTUAL=y
 PTXCONF_PLATFORMCONFIG_VERSION="2022.12.0"
 
 #
@@ -304,20 +305,36 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # PTXCONF_KERNEL_FIT is not set
 # end of image creation options        
 
-# PTXCONF_CODE_SIGNING is not set
+PTXCONF_CODE_SIGNING=y
+PTXCONF_CODE_SIGNING_PROVIDER="devel"
+PTXCONF_CODE_SIGNING_PROVIDER_DEVEL=y
+PTXCONF_HOST_PTX_CODE_SIGNING_DEV=y
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_DOSFSTOOLS=y
 PTXCONF_HOST_E2FSPROGS=y
+PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
 PTXCONF_HOST_LIBCONFUSE=y
+PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
 PTXCONF_HOST_LIBLZO=y
+PTXCONF_HOST_LIBP11=y
+PTXCONF_HOST_LIBTASN1=y
 PTXCONF_HOST_LZOP=y
 PTXCONF_HOST_M4=y
+PTXCONF_HOST_MESON=y
 PTXCONF_HOST_MTOOLS=y
+PTXCONF_HOST_NINJA=y
+PTXCONF_HOST_OPENSC=y
 PTXCONF_HOST_OPENSSL=y
+PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_SOFTHSM=y
+PTXCONF_HOST_SQLITE=y
 PTXCONF_HOST_SYSTEM_BC=y
+PTXCONF_HOST_SYSTEM_PYTHON3=y
+PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
 PTXCONF_HOST_TF_A=y
 
diff --git a/configs/platform-v7a_noneon/platformconfig b/configs/platform-v7a_noneon/platformconfig
index d4ba2e6e191c..ee9fbe56efd2 100644
--- a/configs/platform-v7a_noneon/platformconfig
+++ b/configs/platform-v7a_noneon/platformconfig
@@ -19,6 +19,7 @@ PTXCONF_PLATFORM="v7a_noneon"
 PTXCONF_PLATFORM_VERSION="-${PTXDIST_BSP_AUTOVERSION}"
 PTXCONF_RUNTIME=y
 PTXCONF_BUILDTIME=y
+PTXCONF_VIRTUAL=y
 PTXCONF_PLATFORMCONFIG_VERSION="2022.12.0"
 
 #
@@ -251,19 +252,36 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # PTXCONF_KERNEL_FIT is not set
 # end of image creation options        
 
-# PTXCONF_CODE_SIGNING is not set
+PTXCONF_CODE_SIGNING=y
+PTXCONF_CODE_SIGNING_PROVIDER="devel"
+PTXCONF_CODE_SIGNING_PROVIDER_DEVEL=y
+PTXCONF_HOST_PTX_CODE_SIGNING_DEV=y
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_DOSFSTOOLS=y
 PTXCONF_HOST_E2FSPROGS=y
+PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
 PTXCONF_HOST_LIBCONFUSE=y
+PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
 PTXCONF_HOST_LIBLZO=y
+PTXCONF_HOST_LIBP11=y
+PTXCONF_HOST_LIBTASN1=y
 PTXCONF_HOST_LZOP=y
 PTXCONF_HOST_M4=y
+PTXCONF_HOST_MESON=y
 PTXCONF_HOST_MTOOLS=y
+PTXCONF_HOST_NINJA=y
+PTXCONF_HOST_OPENSC=y
+PTXCONF_HOST_OPENSSL=y
+PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_SOFTHSM=y
+PTXCONF_HOST_SQLITE=y
 PTXCONF_HOST_SYSTEM_BC=y
+PTXCONF_HOST_SYSTEM_PYTHON3=y
+PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
 
 #
diff --git a/configs/platform-v8a/platformconfig b/configs/platform-v8a/platformconfig
index 36708d6aa47b..8882d58fede0 100644
--- a/configs/platform-v8a/platformconfig
+++ b/configs/platform-v8a/platformconfig
@@ -19,6 +19,7 @@ PTXCONF_PLATFORM="v8a"
 PTXCONF_PLATFORM_VERSION="-${PTXDIST_BSP_AUTOVERSION}"
 PTXCONF_RUNTIME=y
 PTXCONF_BUILDTIME=y
+PTXCONF_VIRTUAL=y
 PTXCONF_PLATFORMCONFIG_VERSION="2022.12.0"
 
 #
@@ -247,19 +248,35 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # PTXCONF_KERNEL_FIT is not set
 # end of image creation options        
 
-# PTXCONF_CODE_SIGNING is not set
+PTXCONF_CODE_SIGNING=y
+PTXCONF_CODE_SIGNING_PROVIDER="devel"
+PTXCONF_CODE_SIGNING_PROVIDER_DEVEL=y
+PTXCONF_HOST_PTX_CODE_SIGNING_DEV=y
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_E2FSPROGS=y
+PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
 PTXCONF_HOST_LIBCONFUSE=y
+PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
 PTXCONF_HOST_LIBLZO=y
+PTXCONF_HOST_LIBP11=y
+PTXCONF_HOST_LIBTASN1=y
 PTXCONF_HOST_LIBUSB=y
 PTXCONF_HOST_LZOP=y
 PTXCONF_HOST_M4=y
+PTXCONF_HOST_MESON=y
+PTXCONF_HOST_NINJA=y
+PTXCONF_HOST_OPENSC=y
 PTXCONF_HOST_OPENSSL=y
+PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_SOFTHSM=y
+PTXCONF_HOST_SQLITE=y
 PTXCONF_HOST_SYSTEM_BC=y
+PTXCONF_HOST_SYSTEM_PYTHON3=y
+PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
 PTXCONF_FIRMWARE_IMX=y
 # PTXCONF_FIRMWARE_IMX_VPU_IMX27 is not set
diff --git a/configs/platform-x86_64/platformconfig b/configs/platform-x86_64/platformconfig
index 2de5047ad84e..233914ffaf33 100644
--- a/configs/platform-x86_64/platformconfig
+++ b/configs/platform-x86_64/platformconfig
@@ -19,6 +19,7 @@ PTXCONF_PLATFORM="x86_64"
 PTXCONF_PLATFORM_VERSION="-${PTXDIST_BSP_AUTOVERSION}"
 PTXCONF_RUNTIME=y
 PTXCONF_BUILDTIME=y
+PTXCONF_VIRTUAL=y
 PTXCONF_PLATFORMCONFIG_VERSION="2022.12.0"
 
 #
@@ -235,16 +236,33 @@ PTXCONF_IMAGE_XPKG_EXTRA_ARGS=""
 # PTXCONF_KERNEL_FIT is not set
 # end of image creation options        
 
-# PTXCONF_CODE_SIGNING is not set
+PTXCONF_CODE_SIGNING=y
+PTXCONF_CODE_SIGNING_PROVIDER="devel"
+PTXCONF_CODE_SIGNING_PROVIDER_DEVEL=y
+PTXCONF_HOST_PTX_CODE_SIGNING_DEV=y
+PTXCONF_HOST_CMAKE=y
 PTXCONF_HOST_E2FSPROGS=y
+PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
 PTXCONF_HOST_LIBCONFUSE=y
 PTXCONF_HOST_LIBELF=y
+PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
 PTXCONF_HOST_LIBLZO=y
+PTXCONF_HOST_LIBP11=y
+PTXCONF_HOST_LIBTASN1=y
 PTXCONF_HOST_LZOP=y
+PTXCONF_HOST_MESON=y
+PTXCONF_HOST_NINJA=y
+PTXCONF_HOST_OPENSC=y
+PTXCONF_HOST_OPENSSL=y
+PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_SOFTHSM=y
+PTXCONF_HOST_SQLITE=y
 PTXCONF_HOST_SYSTEM_BC=y
+PTXCONF_HOST_SYSTEM_PYTHON3=y
+PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
 PTXCONF_HOST_ZLIB=y
 
diff --git a/configs/ptxconfig b/configs/ptxconfig
index a6a3f29afb53..fbacdcdfb126 100644
--- a/configs/ptxconfig
+++ b/configs/ptxconfig
@@ -124,6 +124,7 @@ PTXCONF_HOST_SYSTEM_PYTHON3_JINJA2=y
 PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_XORGPROTO=y
 PTXCONF_HOST_ZLIB=y
+PTXCONF_CODE_SIGNING=y
 PTXCONF_HOST_AUTOTOOLS_AUTOCONF=y
 PTXCONF_HOST_AUTOTOOLS_AUTOMAKE=y
 PTXCONF_HOST_AUTOTOOLS_LIBTOOL=y
@@ -535,7 +536,7 @@ PTXCONF_BUSYBOX_FEATURE_GZIP_DECOMPRESS=y
 PTXCONF_BUSYBOX_TAR=y
 PTXCONF_BUSYBOX_FEATURE_TAR_LONG_OPTIONS=y
 PTXCONF_BUSYBOX_FEATURE_TAR_CREATE=y
-# PTXCONF_BUSYBOX_FEATURE_TAR_AUTODETECT is not set
+PTXCONF_BUSYBOX_FEATURE_TAR_AUTODETECT=y
 PTXCONF_BUSYBOX_FEATURE_TAR_FROM=y
 # PTXCONF_BUSYBOX_FEATURE_TAR_OLDGNU_COMPATIBILITY is not set
 # PTXCONF_BUSYBOX_FEATURE_TAR_OLDSUN_COMPATIBILITY is not set
@@ -922,7 +923,8 @@ PTXCONF_BUSYBOX_SULOGIN=y
 #
 # PTXCONF_BUSYBOX_ACPID is not set
 # PTXCONF_BUSYBOX_BLKDISCARD is not set
-# PTXCONF_BUSYBOX_BLKID is not set
+PTXCONF_BUSYBOX_BLKID=y
+PTXCONF_BUSYBOX_FEATURE_BLKID_TYPE=y
 # PTXCONF_BUSYBOX_BLOCKDEV is not set
 # PTXCONF_BUSYBOX_CAL is not set
 # PTXCONF_BUSYBOX_CHRT is not set
@@ -995,6 +997,38 @@ PTXCONF_BUSYBOX_RENICE=y
 # PTXCONF_BUSYBOX_UMOUNT is not set
 # PTXCONF_BUSYBOX_UNSHARE is not set
 # PTXCONF_BUSYBOX_WALL is not set
+PTXCONF_BUSYBOX_VOLUMEID=y
+
+#
+# Filesystem/Volume identification
+#
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_BCACHE=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_BTRFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_CRAMFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_EROFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_EXFAT=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_EXT=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_F2FS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_FAT=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_HFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_ISO9660=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_JFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_LFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_LINUXRAID=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_LINUXSWAP=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_LUKS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_MINIX=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_NILFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_NTFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_OCFS2=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_REISERFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_ROMFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_SQUASHFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_SYSV=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_UBIFS=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_UDF=y
+PTXCONF_BUSYBOX_FEATURE_VOLUMEID_XFS=y
+# end of Filesystem/Volume identification
 # end of Linux System Utilities
 
 #
@@ -1293,7 +1327,8 @@ PTXCONF_BUSYBOX_LOGGER=y
 # PTXCONF_DFU_UTIL is not set
 # PTXCONF_DIALOG is not set
 # PTXCONF_DIFFUTILS is not set
-# PTXCONF_DT_UTILS is not set
+PTXCONF_DT_UTILS=y
+# PTXCONF_DT_UTILS_STATE_COMPAT is not set
 # PTXCONF_EFIBOOTMGR is not set
 # PTXCONF_EFIVAR is not set
 # PTXCONF_FIGLET is not set
@@ -1532,7 +1567,10 @@ PTXCONF_UTIL_LINUX_SFDISK=y
 #
 # misc-utils
 #
-# PTXCONF_UTIL_LINUX_BLKID is not set
+
+#
+# BusyBox' blkid is selected!
+#
 # PTXCONF_UTIL_LINUX_FINDFS is not set
 # PTXCONF_UTIL_LINUX_GETOPT is not set
 # PTXCONF_UTIL_LINUX_LSBLK is not set
@@ -1737,7 +1775,11 @@ PTXCONF_ZSTD=y
 # PTXCONF_BOA is not set
 # PTXCONF_BRIDGE_UTILS is not set
 # PTXCONF_C_ARES is not set
-# PTXCONF_CA_CERTIFICATES is not set
+PTXCONF_CA_CERTIFICATES=y
+PTXCONF_CA_CERTIFICATES_SELECT_BUNDLE=y
+# PTXCONF_CA_CERTIFICATES_SELECT_CERTS is not set
+# PTXCONF_CA_CERTIFICATES_SELECT_BOTH is not set
+PTXCONF_CA_CERTIFICATES_BUNDLE=y
 # PTXCONF_CANFESTIVAL is not set
 # PTXCONF_CHRONY is not set
 # PTXCONF_COMGT is not set
@@ -1794,7 +1836,29 @@ PTXCONF_IPROUTE2_IP=y
 # PTXCONF_LIBCGICC is not set
 # PTXCONF_LIBCOAP is not set
 # PTXCONF_LIBCOAP2 is not set
-# PTXCONF_LIBCURL is not set
+PTXCONF_LIBCURL=y
+# PTXCONF_LIBCURL_CURL is not set
+# PTXCONF_LIBCURL_C_ARES is not set
+PTXCONF_LIBCURL_HTTP=y
+# PTXCONF_LIBCURL_COOKIES is not set
+PTXCONF_LIBCURL_FTP=y
+# PTXCONF_LIBCURL_TFTP is not set
+# PTXCONF_LIBCURL_FILE is not set
+# PTXCONF_LIBCURL_SMTP is not set
+# PTXCONF_LIBCURL_VERBOSE is not set
+PTXCONF_LIBCURL_SSL=y
+PTXCONF_LIBCURL_SSL_OPENSSL=y
+# PTXCONF_LIBCURL_SSL_GNUTLS is not set
+# PTXCONF_LIBCURL_SSL_NOCA is not set
+# PTXCONF_LIBCURL_SSL_CAPATH is not set
+# PTXCONF_LIBCURL_SSL_CABUNDLE is not set
+PTXCONF_LIBCURL_SSL_CA_CERTIFICATES=y
+PTXCONF_LIBCURL_SSL_DEFAULT_BACKEND="openssl"
+PTXCONF_LIBCURL_SSL_CAPATH_PATH="no"
+PTXCONF_LIBCURL_SSL_CABUNDLE_PATH="/etc/ssl/certs/ca-certificates.crt"
+# PTXCONF_LIBCURL_CRYPTO_AUTH is not set
+# PTXCONF_LIBCURL_LIBSSH2 is not set
+# PTXCONF_LIBCURL_MIME is not set
 # PTXCONF_LIBMBIM is not set
 # PTXCONF_LIBMICROHTTPD is not set
 # PTXCONF_LIBMMS is not set
@@ -1935,6 +1999,7 @@ PTXCONF_E2FSPROGS=y
 #
 # build options                 
 #
+PTXCONF_E2FSPROGS_RESIZER=y
 # end of build options                 
 
 #
@@ -1970,7 +2035,7 @@ PTXCONF_E2FSPROGS_INSTALL_MKFS_EXT2=y
 PTXCONF_E2FSPROGS_INSTALL_MKFS_EXT3=y
 PTXCONF_E2FSPROGS_INSTALL_MKFS_EXT4=y
 # PTXCONF_E2FSPROGS_INSTALL_MKLOSTANDFOUND is not set
-# PTXCONF_E2FSPROGS_INSTALL_RESIZE2FS is not set
+PTXCONF_E2FSPROGS_INSTALL_RESIZE2FS=y
 # PTXCONF_E2FSPROGS_INSTALL_TUNE2FS is not set
 # end of binaries                      
 
@@ -1989,7 +2054,18 @@ PTXCONF_E2FSPROGS_INSTALL_MKFS_EXT4=y
 # PTXCONF_QUOTA_TOOLS is not set
 # PTXCONF_SAMBA is not set
 # PTXCONF_SDPARM is not set
-# PTXCONF_SQUASHFS_TOOLS is not set
+PTXCONF_SQUASHFS_TOOLS=y
+
+#
+# build options
+#
+# PTXCONF_SQUASHFS_TOOLS_ZSTD_SUPPORT is not set
+
+#
+# install options
+#
+# PTXCONF_SQUASHFS_TOOLS_MKSQUASHFS is not set
+PTXCONF_SQUASHFS_TOOLS_UNSQUASHFS=y
 # PTXCONF_SSHFS is not set
 # PTXCONF_UNZIP is not set
 # PTXCONF_XFSPROGS is not set
@@ -2032,7 +2108,19 @@ PTXCONF_E2FSPROGS_INSTALL_MKFS_EXT4=y
 # PTXCONF_LPC21ISP is not set
 # PTXCONF_MYSQLDB is not set
 # PTXCONF_RAUC_HAWKBIT_UPDATER is not set
-# PTXCONF_RAUC is not set
+PTXCONF_RAUC=y
+# PTXCONF_RAUC_CREATE is not set
+PTXCONF_RAUC_SERVICE=y
+PTXCONF_RAUC_NETWORK=y
+PTXCONF_RAUC_STREAMING=y
+PTXCONF_RAUC_JSON=y
+# PTXCONF_RAUC_GPT is not set
+PTXCONF_RAUC_CONFIGURATION=y
+PTXCONF_RAUC_COMPATIBLE="${PTXCONF_PROJECT_VENDOR} ${PTXCONF_PROJECT}"
+PTXCONF_RAUC_BUNDLE_VERSION="${PTXDIST_BSP_AUTOVERSION}"
+PTXCONF_RAUC_BAREBOX=y
+# PTXCONF_RAUC_U_BOOT is not set
+# PTXCONF_RAUC_EFI is not set
 # end of Applications                  
 
 #
@@ -2433,11 +2521,11 @@ PTXCONF_DBUS_SYSTEMD_UNIT=y
 # PTXCONF_GLIB_NETWORKING is not set
 PTXCONF_GLIB=y
 # PTXCONF_GLIB_GDBUS is not set
-# PTXCONF_GLIB_LIBMOUNT is not set
+PTXCONF_GLIB_LIBMOUNT=y
 # PTXCONF_GOBJECT_INTROSPECTION_HELPER is not set
 # PTXCONF_GTK_ENGINES is not set
 # PTXCONF_GTK is not set
-# PTXCONF_JSON_GLIB is not set
+PTXCONF_JSON_GLIB=y
 # PTXCONF_LIBGEE is not set
 # PTXCONF_LIBRSVG is not set
 # PTXCONF_PANGO is not set
diff --git a/projectroot/etc/rauc/system.conf b/projectroot/etc/rauc/system.conf
new file mode 100644
index 000000000000..1c6233b5403e
--- /dev/null
+++ b/projectroot/etc/rauc/system.conf
@@ -0,0 +1,16 @@
+[system]
+compatible=@RAUC_BUNDLE_COMPATIBLE@
+bootloader=barebox
+
+[keyring]
+path=/etc/rauc/ca.cert.pem
+
+[slot.rootfs.0]
+device=/dev/disk/by-usage/rootfs0
+type=ext4
+bootname=system0
+
+[slot.rootfs.1]
+device=/dev/disk/by-usage/rootfs1
+type=ext4
+bootname=system1
diff --git a/projectroot/usr/lib/systemd/system/rauc-mark-good.service b/projectroot/usr/lib/systemd/system/rauc-mark-good.service
new file mode 100644
index 000000000000..89f56594766a
--- /dev/null
+++ b/projectroot/usr/lib/systemd/system/rauc-mark-good.service
@@ -0,0 +1,14 @@
+[Unit]
+Description=RAUC Good-marking Service
+ConditionKernelCommandLine=|bootchooser.active
+ConditionKernelCommandLine=|rauc.slot
+Requires=boot-complete.target
+After=boot-complete.target
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/bin/rauc status mark-good
+
+[Install]
+WantedBy=multi-user.target
-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
                   ` (6 preceding siblings ...)
  2023-02-12 22:14 ` [DistroKit] [PATCH 7/8] rauc: add initial support Roland Hieber
@ 2023-02-12 22:14 ` Roland Hieber
  2023-02-13  7:42   ` Jan Lübbe
  2023-02-13  7:48 ` [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Marco Felsch
  2023-03-07 12:04 ` Ahmad Fatoum
  9 siblings, 1 reply; 24+ messages in thread
From: Roland Hieber @ 2023-02-12 22:14 UTC (permalink / raw)
  To: distrokit; +Cc: Roland Hieber

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 configs/platform-v7a/platformconfig | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/configs/platform-v7a/platformconfig b/configs/platform-v7a/platformconfig
index 5bd6cebcbf9c..ec430ff1e5e5 100644
--- a/configs/platform-v7a/platformconfig
+++ b/configs/platform-v7a/platformconfig
@@ -269,7 +269,12 @@ PTXCONF_IMAGE_KERNEL_INSTALL_EARLY=y
 # end of Generate images/linuximage    
 
 PTXCONF_IMAGE_LXA_MC1=y
-# PTXCONF_IMAGE_RAUC is not set
+PTXCONF_IMAGE_RAUC=y
+PTXCONF_IMAGE_RAUC_DESCRIPTION="DistroKit"
+# PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_PLAIN is not set
+PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_VERITY=y
+# PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_CRYPT is not set
+# PTXCONF_IMAGE_RAUC_INTERMEDIATE is not set
 PTXCONF_IMAGE_RIOTBOARD=y
 # PTXCONF_IMAGE_ROOT_CPIO is not set
 PTXCONF_IMAGE_ROOT_EXT=y
@@ -316,6 +321,7 @@ PTXCONF_HOST_EXTRACT_CERT=y
 PTXCONF_HOST_FLEX=y
 PTXCONF_HOST_GENEXT2FS=y
 PTXCONF_HOST_GENIMAGE=y
+PTXCONF_HOST_GLIB=y
 PTXCONF_HOST_LIBCONFUSE=y
 PTXCONF_HOST_LIBFFI=y
 PTXCONF_HOST_LIBKMOD=y
@@ -330,12 +336,16 @@ PTXCONF_HOST_NINJA=y
 PTXCONF_HOST_OPENSC=y
 PTXCONF_HOST_OPENSSL=y
 PTXCONF_HOST_P11_KIT=y
+PTXCONF_HOST_PCRE2=y
+PTXCONF_HOST_RAUC=y
 PTXCONF_HOST_SOFTHSM=y
 PTXCONF_HOST_SQLITE=y
+PTXCONF_HOST_SQUASHFS_TOOLS=y
 PTXCONF_HOST_SYSTEM_BC=y
 PTXCONF_HOST_SYSTEM_PYTHON3=y
 PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
 PTXCONF_HOST_UTIL_LINUX=y
+PTXCONF_HOST_ZLIB=y
 PTXCONF_HOST_TF_A=y
 
 #
-- 
2.30.2




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 6/8] v7a: kernel: enable features necessary for RAUC
  2023-02-12 22:14 ` [DistroKit] [PATCH 6/8] v7a: kernel: enable features necessary for RAUC Roland Hieber
@ 2023-02-13  7:33   ` Jan Lübbe
  0 siblings, 0 replies; 24+ messages in thread
From: Jan Lübbe @ 2023-02-13  7:33 UTC (permalink / raw)
  To: Roland Hieber, distrokit

On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> +CONFIG_SQUASHFS=y
> +CONFIG_SQUASHFS_FILE_CACHE=y
> +# CONFIG_SQUASHFS_FILE_DIRECT is not set

Use SQUASHFS_FILE_DIRECT for better performance.

> +CONFIG_SQUASHFS_DECOMP_SINGLE=y
> +# CONFIG_SQUASHFS_DECOMP_MULTI is not set

Enable DECOMP_MULTI for better performance.

> +# CONFIG_SQUASHFS_DECOMP_MULTI_PERCPU is not set
> +# CONFIG_SQUASHFS_XATTR is not set
> +CONFIG_SQUASHFS_ZLIB=y
> +# CONFIG_SQUASHFS_LZ4 is not set
> +# CONFIG_SQUASHFS_LZO is not set
> +# CONFIG_SQUASHFS_XZ is not set
> +# CONFIG_SQUASHFS_ZSTD is not set

Please enable LZ4, XZ and ZSTD. This makes it easy to change the bundle
compression later. It's also very useful for benchmarking.

> +# CONFIG_SQUASHFS_4K_DEVBLK_SIZE is not set

Enable this for better performance.

> +# CONFIG_SQUASHFS_EMBEDDED is not set
> +CONFIG_SQUASHFS_FRAGMENT_CACHE_SIZE=3

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 7/8] rauc: add initial support
  2023-02-12 22:14 ` [DistroKit] [PATCH 7/8] rauc: add initial support Roland Hieber
@ 2023-02-13  7:37   ` Jan Lübbe
  2023-03-02  9:41     ` Roland Hieber
  0 siblings, 1 reply; 24+ messages in thread
From: Jan Lübbe @ 2023-02-13  7:37 UTC (permalink / raw)
  To: Roland Hieber, distrokit

On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> +++ b/projectroot/etc/rauc/system.conf
> @@ -0,0 +1,16 @@
> +[system]
> +compatible=@RAUC_BUNDLE_COMPATIBLE@
> +bootloader=barebox
> +

Please disable support for plain bundles.

Also, add a rauc data directory on the data partition so that we can use
adaptive updates and keep a global slot status file.

Jan

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation
  2023-02-12 22:14 ` [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation Roland Hieber
@ 2023-02-13  7:42   ` Jan Lübbe
  2023-04-25 18:38     ` Roland Hieber
  0 siblings, 1 reply; 24+ messages in thread
From: Jan Lübbe @ 2023-02-13  7:42 UTC (permalink / raw)
  To: Roland Hieber, distrokit

On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> ---
>  configs/platform-v7a/platformconfig | 12 +++++++++++-
>  1 file changed, 11 insertions(+), 1 deletion(-)
> 
> diff --git a/configs/platform-v7a/platformconfig b/configs/platform-v7a/platformconfig
> index 5bd6cebcbf9c..ec430ff1e5e5 100644
> --- a/configs/platform-v7a/platformconfig
> +++ b/configs/platform-v7a/platformconfig
> @@ -269,7 +269,12 @@ PTXCONF_IMAGE_KERNEL_INSTALL_EARLY=y
>  # end of Generate images/linuximage    
>  
>  PTXCONF_IMAGE_LXA_MC1=y
> -# PTXCONF_IMAGE_RAUC is not set
> +PTXCONF_IMAGE_RAUC=y
> +PTXCONF_IMAGE_RAUC_DESCRIPTION="DistroKit"
> +# PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_PLAIN is not set
> +PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_VERITY=y
> +# PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_CRYPT is not set

Does this use ext4 or tar? If ext4, you should enable adaptive updates:
https://rauc.readthedocs.io/en/latest/advanced.html#adaptive-updates

You only need to set adaptive=block-hash-index in the [image.*] section of the
manifest. Depending on how your ext4 is configured, you may need to align the
size to 4KiB.

> +# PTXCONF_IMAGE_RAUC_INTERMEDIATE is not set
>  PTXCONF_IMAGE_RIOTBOARD=y
>  # PTXCONF_IMAGE_ROOT_CPIO is not set
>  PTXCONF_IMAGE_ROOT_EXT=y
> @@ -316,6 +321,7 @@ PTXCONF_HOST_EXTRACT_CERT=y
>  PTXCONF_HOST_FLEX=y
>  PTXCONF_HOST_GENEXT2FS=y
>  PTXCONF_HOST_GENIMAGE=y
> +PTXCONF_HOST_GLIB=y
>  PTXCONF_HOST_LIBCONFUSE=y
>  PTXCONF_HOST_LIBFFI=y
>  PTXCONF_HOST_LIBKMOD=y
> @@ -330,12 +336,16 @@ PTXCONF_HOST_NINJA=y
>  PTXCONF_HOST_OPENSC=y
>  PTXCONF_HOST_OPENSSL=y
>  PTXCONF_HOST_P11_KIT=y
> +PTXCONF_HOST_PCRE2=y
> +PTXCONF_HOST_RAUC=y
>  PTXCONF_HOST_SOFTHSM=y
>  PTXCONF_HOST_SQLITE=y
> +PTXCONF_HOST_SQUASHFS_TOOLS=y
>  PTXCONF_HOST_SYSTEM_BC=y
>  PTXCONF_HOST_SYSTEM_PYTHON3=y
>  PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
>  PTXCONF_HOST_UTIL_LINUX=y
> +PTXCONF_HOST_ZLIB=y
>  PTXCONF_HOST_TF_A=y
>  
>  #

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
                   ` (7 preceding siblings ...)
  2023-02-12 22:14 ` [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation Roland Hieber
@ 2023-02-13  7:48 ` Marco Felsch
  2023-02-13  9:35   ` Roland Hieber
  2023-03-07 12:04 ` Ahmad Fatoum
  9 siblings, 1 reply; 24+ messages in thread
From: Marco Felsch @ 2023-02-13  7:48 UTC (permalink / raw)
  To: Roland Hieber; +Cc: distrokit

Hi Roland,

On 23-02-12, Roland Hieber wrote:
> With this patch series, the first v7a platforms (beaglebone black, riotboard,
> rpi3, qemu-vexpress) gain support for redundant boot on two root partitions
> which can be updated with RAUC.

can we move the projectroot stuff within the platform-v7a?

Regards,
  Marco



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC
  2023-02-13  7:48 ` [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Marco Felsch
@ 2023-02-13  9:35   ` Roland Hieber
  0 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-02-13  9:35 UTC (permalink / raw)
  To: Marco Felsch; +Cc: distrokit

On Mon, Feb 13, 2023 at 08:48:38AM +0100, Marco Felsch wrote:
> Hi Roland,
> 
> On 23-02-12, Roland Hieber wrote:
> > With this patch series, the first v7a platforms (beaglebone black, riotboard,
> > rpi3, qemu-vexpress) gain support for redundant boot on two root partitions
> > which can be updated with RAUC.
> 
> can we move the projectroot stuff within the platform-v7a?

Indeed, that would be a better place for the rauc files. We cannot disable
it in ptxconfig for single platforms though, but it also doesnt' hurt
much.

 - Roland

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions
  2023-02-12 22:14 ` [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions Roland Hieber
@ 2023-02-13  9:43   ` Michael Olbrich
  2023-03-02  9:33     ` Roland Hieber
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Olbrich @ 2023-02-13  9:43 UTC (permalink / raw)
  To: Roland Hieber; +Cc: distrokit

On Sun, Feb 12, 2023 at 11:14:42PM +0100, 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 <rhi@pengutronix.de>
> ---
>  configs/ptxconfig                             |  1 +
>  projectroot/usr/lib/udev/of_base_compatible   |  4 ++
>  .../lib/udev/rules.d/90-rauc-partitions.rules | 12 ++++++
>  rules/rauc-udev.in                            |  8 ++++
>  rules/rauc-udev.make                          | 37 +++++++++++++++++++
>  5 files changed, 62 insertions(+)
>  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 3c8c001aaf8e..a6a3f29afb53 100644
> --- a/configs/ptxconfig
> +++ b/configs/ptxconfig
> @@ -3,6 +3,7 @@
>  # PTXdist 2022.12.0
>  #
>  PTXCONF_DATAPARTITION=y
> +PTXCONF_RAUC_UDEV=y
>  
>  #
>  # ------------------------------------
> diff --git a/projectroot/usr/lib/udev/of_base_compatible b/projectroot/usr/lib/udev/of_base_compatible
> new file mode 100755
> index 000000000000..6b59c9cc569d
> --- /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 <rhi@pengutronix.de>
> +printf 'OF_BASE_COMPATIBLE="%s"\n' "$(xargs -0  printf "%s " < /sys/firmware/devicetree/base/compatible)"

This seems overly complicated. Why do you need xargs and two printf here?

Michael

> 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..0300e8b9daad
> --- /dev/null
> +++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
> @@ -0,0 +1,12 @@
> +# SPDX-License-Identifier: 0-BSD
> +# SPDX-FileCopyrightText: 2021 Roland Hieber, Pengutronix <rhi@pengutronix.de>
> +
> +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
> +
> +LABEL="rauc_partitions_end"
> diff --git a/rules/rauc-udev.in b/rules/rauc-udev.in
> new file mode 100644
> index 000000000000..4e90343ba2dc
> --- /dev/null
> +++ b/rules/rauc-udev.in
> @@ -0,0 +1,8 @@
> +## SECTION=project_specific
> +
> +config RAUC_UDEV
> +	tristate
> +	prompt "rauc udev rules"
> +	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 <rhi@pengutronix.de>
> +#
> +# 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 <rhi@pengutronix.de>")
> +	@$(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.30.2
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions
  2023-02-13  9:43   ` Michael Olbrich
@ 2023-03-02  9:33     ` Roland Hieber
  0 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-03-02  9:33 UTC (permalink / raw)
  To: distrokit

On Mon, Feb 13, 2023 at 10:43:43AM +0100, Michael Olbrich wrote:
> On Sun, Feb 12, 2023 at 11:14:42PM +0100, 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 <rhi@pengutronix.de>
> > ---
> >  configs/ptxconfig                             |  1 +
> >  projectroot/usr/lib/udev/of_base_compatible   |  4 ++
> >  .../lib/udev/rules.d/90-rauc-partitions.rules | 12 ++++++
> >  rules/rauc-udev.in                            |  8 ++++
> >  rules/rauc-udev.make                          | 37 +++++++++++++++++++
> >  5 files changed, 62 insertions(+)
> >  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 3c8c001aaf8e..a6a3f29afb53 100644
> > --- a/configs/ptxconfig
> > +++ b/configs/ptxconfig
> > @@ -3,6 +3,7 @@
> >  # PTXdist 2022.12.0
> >  #
> >  PTXCONF_DATAPARTITION=y
> > +PTXCONF_RAUC_UDEV=y
> >  
> >  #
> >  # ------------------------------------
> > diff --git a/projectroot/usr/lib/udev/of_base_compatible b/projectroot/usr/lib/udev/of_base_compatible
> > new file mode 100755
> > index 000000000000..6b59c9cc569d
> > --- /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 <rhi@pengutronix.de>
> > +printf 'OF_BASE_COMPATIBLE="%s"\n' "$(xargs -0  printf "%s " < /sys/firmware/devicetree/base/compatible)"
> 
> This seems overly complicated. Why do you need xargs and two printf here?

Hmmm yes. In udev I'm matching for *string* anyways. So my current,
simpler, working version is:

  printf 'OF_BASE_COMPATIBLE="%s"\n' "$(tr '\0' ' ' < /sys/firmware/devicetree/base/compatible)"

(Turns out, busybox's sed cannot cope with null bytes at all…)

 - Roland

> Michael
> 
> > 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..0300e8b9daad
> > --- /dev/null
> > +++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
> > @@ -0,0 +1,12 @@
> > +# SPDX-License-Identifier: 0-BSD
> > +# SPDX-FileCopyrightText: 2021 Roland Hieber, Pengutronix <rhi@pengutronix.de>
> > +
> > +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
> > +
> > +LABEL="rauc_partitions_end"
> > diff --git a/rules/rauc-udev.in b/rules/rauc-udev.in
> > new file mode 100644
> > index 000000000000..4e90343ba2dc
> > --- /dev/null
> > +++ b/rules/rauc-udev.in
> > @@ -0,0 +1,8 @@
> > +## SECTION=project_specific
> > +
> > +config RAUC_UDEV
> > +	tristate
> > +	prompt "rauc udev rules"
> > +	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 <rhi@pengutronix.de>
> > +#
> > +# 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 <rhi@pengutronix.de>")
> > +	@$(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.30.2
> > 
> > 
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 7/8] rauc: add initial support
  2023-02-13  7:37   ` Jan Lübbe
@ 2023-03-02  9:41     ` Roland Hieber
  2023-03-02 10:34       ` Jan Lübbe
  0 siblings, 1 reply; 24+ messages in thread
From: Roland Hieber @ 2023-03-02  9:41 UTC (permalink / raw)
  To: Jan Lübbe; +Cc: distrokit

On Mon, Feb 13, 2023 at 08:37:25AM +0100, Jan Lübbe wrote:
> On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> > +++ b/projectroot/etc/rauc/system.conf
> > @@ -0,0 +1,16 @@
> > +[system]
> > +compatible=@RAUC_BUNDLE_COMPATIBLE@
> > +bootloader=barebox
> > +
> 
> Please disable support for plain bundles.

ACK.

> Also, add a rauc data directory on the data partition so that we can use
> adaptive updates and keep a global slot status file.

Okay, this turned out to be a bit more involved, because although there
is a data partition, it currently not mounted, because there is no mount
unit for it and also no fstab entry, and it also there's no file system
on it because systemd-autoformat@mmcblk3.service fails to run because
mkfs cannot find the partition because after the previous steps which
resize the partition to fill the maximum space on the SD card result in
the partition table needing to be re-read by the kernel, which fails
because the rootfs from the same block device is already mounted.

And that is my current yak shaving status… I think the 'correct' way to
do this would be using systemd-repart [1] before the rootfs is mounted
(but maybe we need an initrd for that…? not sure…), or simply use the
existing 512 MB data partition generated by genimage and let the user
resize it manually when needed.

[1]: https://www.freedesktop.org/software/systemd/man/systemd-repart.html

 - Roland



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 7/8] rauc: add initial support
  2023-03-02  9:41     ` Roland Hieber
@ 2023-03-02 10:34       ` Jan Lübbe
  2023-03-02 16:09         ` Michael Olbrich
  0 siblings, 1 reply; 24+ messages in thread
From: Jan Lübbe @ 2023-03-02 10:34 UTC (permalink / raw)
  To: Roland Hieber; +Cc: distrokit

On Thu, 2023-03-02 at 10:41 +0100, Roland Hieber wrote:
> On Mon, Feb 13, 2023 at 08:37:25AM +0100, Jan Lübbe wrote:
> > On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> > > +++ b/projectroot/etc/rauc/system.conf
> > > @@ -0,0 +1,16 @@
> > > +[system]
> > > +compatible=@RAUC_BUNDLE_COMPATIBLE@
> > > +bootloader=barebox
> > > +
> > 
> > Please disable support for plain bundles.
> 
> ACK.
> 
> > Also, add a rauc data directory on the data partition so that we can use
> > adaptive updates and keep a global slot status file.
> 
> Okay, this turned out to be a bit more involved, because although there
> is a data partition, it currently not mounted, because there is no mount
> unit for it and also no fstab entry, and it also there's no file system
> on it because systemd-autoformat@mmcblk3.service fails to run because
> mkfs cannot find the partition because after the previous steps which
> resize the partition to fill the maximum space on the SD card result in
> the partition table needing to be re-read by the kernel, which fails
> because the rootfs from the same block device is already mounted.
> 
> And that is my current yak shaving status… I think the 'correct' way to
> do this would be using systemd-repart [1] before the rootfs is mounted
> (but maybe we need an initrd for that…? not sure…), or simply use the
> existing 512 MB data partition generated by genimage and let the user
> resize it manually when needed.
> 
> [1]: https://www.freedesktop.org/software/systemd/man/systemd-repart.html

On the LXA TAC we currently use systemd-repart for this:
https://github.com/linux-automation/meta-lxatac/tree/langdale/meta-lxatac-bsp/recipes-core/lxatac-repart

We use it from the running system (not initramfs).

Jan

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 7/8] rauc: add initial support
  2023-03-02 10:34       ` Jan Lübbe
@ 2023-03-02 16:09         ` Michael Olbrich
  2023-03-08  9:45           ` Roland Hieber
  0 siblings, 1 reply; 24+ messages in thread
From: Michael Olbrich @ 2023-03-02 16:09 UTC (permalink / raw)
  To: Jan Lübbe; +Cc: distrokit, Roland Hieber

Hi,

On Thu, Mar 02, 2023 at 11:34:53AM +0100, Jan Lübbe wrote:
> On Thu, 2023-03-02 at 10:41 +0100, Roland Hieber wrote:
> > On Mon, Feb 13, 2023 at 08:37:25AM +0100, Jan Lübbe wrote:
> > > On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> > > > +++ b/projectroot/etc/rauc/system.conf
> > > > @@ -0,0 +1,16 @@
> > > > +[system]
> > > > +compatible=@RAUC_BUNDLE_COMPATIBLE@
> > > > +bootloader=barebox
> > > > +
> > > 
> > > Please disable support for plain bundles.
> > 
> > ACK.
> > 
> > > Also, add a rauc data directory on the data partition so that we can use
> > > adaptive updates and keep a global slot status file.
> > 
> > Okay, this turned out to be a bit more involved, because although there
> > is a data partition, it currently not mounted, because there is no mount
> > unit for it and also no fstab entry, and it also there's no file system
> > on it because systemd-autoformat@mmcblk3.service fails to run because
> > mkfs cannot find the partition because after the previous steps which
> > resize the partition to fill the maximum space on the SD card result in
> > the partition table needing to be re-read by the kernel, which fails
> > because the rootfs from the same block device is already mounted.
> > 
> > And that is my current yak shaving status… I think the 'correct' way to
> > do this would be using systemd-repart [1] before the rootfs is mounted
> > (but maybe we need an initrd for that…? not sure…), or simply use the
> > existing 512 MB data partition generated by genimage and let the user
> > resize it manually when needed.
> > 
> > [1]: https://www.freedesktop.org/software/systemd/man/systemd-repart.html
> 
> On the LXA TAC we currently use systemd-repart for this:
> https://github.com/linux-automation/meta-lxatac/tree/langdale/meta-lxatac-bsp/recipes-core/lxatac-repart
> 
> We use it from the running system (not initramfs).

Userspace can change the partition layout manually. systemd-repart does
this internally via fdisk_reread_changes(). That in turn calls the BLKPG
ioctl. So with the right tool you can resize a partition at runtime even if
it's on the same device as the root partition.

Michael

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC
  2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
                   ` (8 preceding siblings ...)
  2023-02-13  7:48 ` [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Marco Felsch
@ 2023-03-07 12:04 ` Ahmad Fatoum
  2023-03-08 10:11   ` Roland Hieber
  9 siblings, 1 reply; 24+ messages in thread
From: Ahmad Fatoum @ 2023-03-07 12:04 UTC (permalink / raw)
  To: Roland Hieber, distrokit

Hello Roland,

On 12.02.23 23:14, Roland Hieber wrote:
> With this patch series, the first v7a platforms (beaglebone black, riotboard,
> rpi3, qemu-vexpress) gain support for redundant boot on two root partitions
> which can be updated with RAUC.

Thanks for your patches.

I don't like the prospect of having permanent patches in DistroKit to enable
redundant boot. With CONFIG_EXTERNAL_DTS_FRAGMENTS, you can have barebox
append device tree files specified by the BSP after the device trees
built by barebox. With e.g. an #ifdef imx6s_riotboard_dts include guard,
you can ensure you don't break multi-image setups.

This should make any patches to barebox source unnecessary.
What do you think?

Cheers,
Ahmad

> 
> Roland Hieber (8):
>   rauc-udev: add a compatibility layer for mapping partitions
>   v7a: add RAUC support for qemu-vexpress
>   v7a: add RAUC support for beaglebone black
>   v7a: add RAUC support for rpi3
>   v7a: add RAUC support for riotboard
>   v7a: kernel: enable features necessary for RAUC
>   rauc: add initial support
>   v7a: enable RAUC bundle creation
> 
>  configs/platform-mips/platformconfig          |  20 ++-
>  configs/platform-mipsel/platformconfig        |  20 ++-
>  configs/platform-rpi1/platformconfig          |  18 ++-
>  .../barebox-am335x-defaultenv/init/bootsource |   4 +-
>  .../barebox-am335x-defaultenv/nv/boot.default |   1 +
>  .../nv/bootchooser.state_prefix               |   1 +
>  .../nv/bootchooser.system0.boot               |   1 +
>  .../nv/bootchooser.system1.boot               |   1 +
>  .../nv/bootchooser.targets                    |   1 +
>  configs/platform-v7a/barebox-am335x.config    |   3 +-
>  .../platform-v7a/barebox-am335x.config.diff   |   2 +
>  .../barebox-mx6-defaultenv/init/bootsource    |   6 +-
>  .../barebox-mx6-defaultenv/nv/boot.default    |   1 +
>  .../nv/bootchooser.state_prefix               |   1 +
>  .../nv/bootchooser.system0.boot               |   1 +
>  .../nv/bootchooser.system1.boot               |   1 +
>  .../nv/bootchooser.targets                    |   1 +
>  configs/platform-v7a/barebox-mx6.config       |   3 +-
>  configs/platform-v7a/barebox-mx6.config.diff  |   2 +
>  .../barebox-rpi2-defaultenv/init/bootsource   |   5 +-
>  .../barebox-rpi2-defaultenv/nv/boot.default   |   1 +
>  .../nv/bootchooser.state_prefix               |   1 +
>  .../nv/bootchooser.system0.boot               |   1 +
>  .../nv/bootchooser.system1.boot               |   1 +
>  .../nv/bootchooser.targets                    |   1 +
>  configs/platform-v7a/barebox-rpi2.config      |   3 +-
>  configs/platform-v7a/barebox-rpi2.config.diff |   2 +
>  .../init/bootsource                           |   2 +-
>  .../nv/boot.default                           |   1 +
>  .../nv/bootchooser.state_prefix               |   1 +
>  .../nv/bootchooser.system0.boot               |   1 +
>  .../nv/bootchooser.system1.boot               |   1 +
>  .../nv/bootchooser.targets                    |   1 +
>  configs/platform-v7a/barebox-vexpress.config  |   3 +-
>  .../platform-v7a/barebox-vexpress.config.diff |   2 +
>  .../config/images/beaglebone.config           |   4 +
>  .../config/images/riotboard.config            |   6 +
>  .../platform-v7a/config/images/rpi2.config    |   5 +
>  .../config/images/vexpress.config             |   7 +-
>  configs/platform-v7a/kernelconfig             |  75 ++++++++++-
>  ...-bootstate-node-into-a-generic-templ.patch | 123 ++++++++++++++++++
>  ...ack-add-beaglebone-black-state-entry.patch |  69 ++++++++++
>  ...ts-bcm2837-rpi-3-b-add-state-support.patch |  59 +++++++++
>  ...ts-imx6s-riotboard-add-state-backend.patch |  53 ++++++++
>  .../patches/barebox-2022.09.0/series          |   4 +
>  configs/platform-v7a/platformconfig           |  31 ++++-
>  configs/platform-v7a_noneon/platformconfig    |  20 ++-
>  configs/platform-v8a/platformconfig           |  19 ++-
>  configs/platform-x86_64/platformconfig        |  20 ++-
>  configs/ptxconfig                             | 111 ++++++++++++++--
>  projectroot/etc/rauc/system.conf              |  16 +++
>  .../lib/systemd/system/rauc-mark-good.service |  14 ++
>  projectroot/usr/lib/udev/of_base_compatible   |   4 +
>  .../lib/udev/rules.d/90-rauc-partitions.rules |  35 +++++
>  rules/rauc-udev.in                            |   8 ++
>  rules/rauc-udev.make                          |  37 ++++++
>  56 files changed, 799 insertions(+), 36 deletions(-)
>  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default
>  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix
>  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot
>  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot
>  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets
>  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/boot.default
>  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.state_prefix
>  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system0.boot
>  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system1.boot
>  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.targets
>  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/boot.default
>  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.state_prefix
>  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system0.boot
>  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system1.boot
>  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.targets
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
>  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
>  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
>  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch
>  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0104-arm-dts-imx6s-riotboard-add-state-backend.patch
>  create mode 100644 projectroot/etc/rauc/system.conf
>  create mode 100644 projectroot/usr/lib/systemd/system/rauc-mark-good.service
>  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
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |




^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 2/8] v7a: add RAUC support for qemu-vexpress
  2023-02-12 22:14 ` [DistroKit] [PATCH 2/8] v7a: add RAUC support for qemu-vexpress Roland Hieber
@ 2023-03-08  9:33   ` Roland Hieber
  0 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-03-08  9:33 UTC (permalink / raw)
  To: distrokit

On Sun, Feb 12, 2023 at 11:14:43PM +0100, Roland Hieber wrote:
> * Enable barebox bootchooser framework
> * Add a redundant root partition to the genimage config. The current
>   size of the rootfs is below 98 MiB, so we can add a second root
>   partition to the image while keeping the overall image size the same.
> * Add appropriate variables to the barebox defaultenv so the bootchooser
>   can decide into which partition to boot
> * Make the bootstate node in the device tree reusable for more platforms
> * Map partitions in rauc-udev compatibility layer
> 
> Signed-off-by: Roland Hieber <rhi@pengutronix.de>

I just tried to test this again, but it turns out that with the update
to host-qemu 7.2 in ptxdist 2023.01.0, our qemu wrapper no longer works:

  $ ./configs/platform-v7a/run
  Forwarding SSH port 127.0.0.1:9910 -> qemu:22
  qemu-system-arm: -netdev user,id=net1,hostfwd=tcp:127.0.0.1:9910-:22,hostfwd=tcp:127.0.0.1:12345-:12345:
  network backend 'user' is not compiled into this binary

…because host-qemu now needs libslirp for that:
<https://wiki.qemu.org/ChangeLog/7.2#SLIRP_module_(user-mode_networking)>

I guess I'll add two more patches to my series to enable user networking
in qemu again.

 - Roland

> ---
>  .../init/bootsource                           |   2 +-
>  .../nv/boot.default                           |   1 +
>  .../nv/bootchooser.state_prefix               |   1 +
>  .../nv/bootchooser.system0.boot               |   1 +
>  .../nv/bootchooser.system1.boot               |   1 +
>  .../nv/bootchooser.targets                    |   1 +
>  configs/platform-v7a/barebox-vexpress.config  |   3 +-
>  .../platform-v7a/barebox-vexpress.config.diff |   2 +
>  .../config/images/vexpress.config             |   7 +-
>  ...-bootstate-node-into-a-generic-templ.patch | 123 ++++++++++++++++++
>  .../patches/barebox-2022.09.0/series          |   1 +
>  .../lib/udev/rules.d/90-rauc-partitions.rules |   5 +
>  12 files changed, 145 insertions(+), 3 deletions(-)
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
>  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
>  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
> 
> diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource b/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource
> index b42659c5e78b..4432e021fb0f 100644
> --- a/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource
> +++ b/configs/platform-v7a/barebox-vexpress-defaultenv/init/bootsource
> @@ -4,4 +4,4 @@ if [ -n "$nv.boot.default" ]; then
>  	exit
>  fi
>  
> -global.boot.default="disk0.0 net"
> +global.boot.default="bootchooser net"
> diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
> new file mode 100644
> index 000000000000..d7d9a373c50b
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
> @@ -0,0 +1 @@
> +bootchooser net
> diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
> new file mode 100644
> index 000000000000..6246412a5c27
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
> @@ -0,0 +1 @@
> +state.bootstate
> diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
> new file mode 100644
> index 000000000000..961e29fe981b
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
> @@ -0,0 +1 @@
> +disk0.0
> diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
> new file mode 100644
> index 000000000000..5676f868b380
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
> @@ -0,0 +1 @@
> +disk0.1
> diff --git a/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
> new file mode 100644
> index 000000000000..f0fb14eeaad2
> --- /dev/null
> +++ b/configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
> @@ -0,0 +1 @@
> +system0 system1
> diff --git a/configs/platform-v7a/barebox-vexpress.config b/configs/platform-v7a/barebox-vexpress.config
> index 9503d59b04af..443d2c2d82f2 100644
> --- a/configs/platform-v7a/barebox-vexpress.config
> +++ b/configs/platform-v7a/barebox-vexpress.config
> @@ -188,7 +188,7 @@ CONFIG_BTHREAD=y
>  CONFIG_STATE=y
>  # CONFIG_STATE_CRYPTO is not set
>  # CONFIG_STATE_BACKWARD_COMPATIBLE is not set
> -# CONFIG_BOOTCHOOSER is not set
> +CONFIG_BOOTCHOOSER=y
>  CONFIG_RESET_SOURCE=y
>  # CONFIG_MACHINE_ID is not set
>  # CONFIG_SYSTEMD_OF_WATCHDOG is not set
> @@ -277,6 +277,7 @@ CONFIG_CMD_GO=y
>  # CONFIG_CMD_LOADY is not set
>  CONFIG_CMD_RESET=y
>  CONFIG_CMD_UIMAGE=y
> +CONFIG_CMD_BOOTCHOOSER=y
>  # end of Boot
>  
>  #
> diff --git a/configs/platform-v7a/barebox-vexpress.config.diff b/configs/platform-v7a/barebox-vexpress.config.diff
> index c9c2cc471980..8811f82ccd04 100644
> --- a/configs/platform-v7a/barebox-vexpress.config.diff
> +++ b/configs/platform-v7a/barebox-vexpress.config.diff
> @@ -8,8 +8,10 @@ CONFIG_ARCH_VEXPRESS=y
>  # CONFIG_ARM_SECURE_MONITOR is undefined
>  # CONFIG_ARM_SMCCC is undefined
>  # CONFIG_ARM_USE_COMPRESSED_DTB is undefined
> +CONFIG_BOOTCHOOSER=y
>  # CONFIG_CFI_BUFFER_WRITE is not set
>  # CONFIG_CLOCKSOURCE_BCM283X is undefined
> +CONFIG_CMD_BOOTCHOOSER=y
>  # CONFIG_CMD_GPIO is undefined
>  # CONFIG_CMD_SMC is undefined
>  CONFIG_CONSOLE_ACTIVATE_ALL=y
> diff --git a/configs/platform-v7a/config/images/vexpress.config b/configs/platform-v7a/config/images/vexpress.config
> index d51a58be2893..3aa64a4299ce 100644
> --- a/configs/platform-v7a/config/images/vexpress.config
> +++ b/configs/platform-v7a/config/images/vexpress.config
> @@ -6,7 +6,12 @@ image @IMAGE@ {
>  	partition root-A {
>  		image = root.ext2
>  		partition-type = 0x83
> -		size = 192M
> +		size = 96M
> +	}
> +	partition root-B {
> +		image = root.ext2
> +		partition-type = 0x83
> +		size = 96M
>  	}
>  	partition data {
>  		partition-type = 0x83
> diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch b/configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
> new file mode 100644
> index 000000000000..a735d0449de3
> --- /dev/null
> +++ b/configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
> @@ -0,0 +1,123 @@
> +From: Roland Hieber <rhi@pengutronix.de>
> +Date: Mon, 25 Jan 2021 00:24:21 +0100
> +Subject: [PATCH] arm: dts: refactor bootstate node into a generic template
> +
> +The existing bootstate node can be used as-is for other A/B redundancy
> +setups with the bootchooser framework too. Refactor it into an include
> +file which can be simply re-used in other device trees.
> +
> +Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> +---
> + arch/arm/dts/generic-bootstate.dtsi | 44 +++++++++++++++++++++++++++++++++++++
> + arch/arm/dts/vexpress-v2p-ca9.dts   | 44 +++----------------------------------
> + 2 files changed, 47 insertions(+), 41 deletions(-)
> + create mode 100644 arch/arm/dts/generic-bootstate.dtsi
> +
> +diff --git a/arch/arm/dts/generic-bootstate.dtsi b/arch/arm/dts/generic-bootstate.dtsi
> +new file mode 100644
> +index 000000000000..5cf9d1640d5c
> +--- /dev/null
> ++++ b/arch/arm/dts/generic-bootstate.dtsi
> +@@ -0,0 +1,44 @@
> ++&bootstate {
> ++	#address-cells = <1>;
> ++	#size-cells = <1>;
> ++
> ++	system0 {
> ++		#address-cells = <1>;
> ++		#size-cells = <1>;
> ++
> ++		remaining_attempts@0 {
> ++			reg = <0x0 0x4>;
> ++			type = "uint32";
> ++			default = <3>;
> ++		};
> ++
> ++		priority@4 {
> ++			reg = <0x4 0x4>;
> ++			type = "uint32";
> ++			default = <20>;
> ++		};
> ++	};
> ++
> ++	system1 {
> ++		#address-cells = <1>;
> ++		#size-cells = <1>;
> ++
> ++		remaining_attempts@8 {
> ++			reg = <0x8 0x4>;
> ++			type = "uint32";
> ++			default = <3>;
> ++		};
> ++
> ++		priority@c {
> ++			reg = <0xc 0x4>;
> ++			type = "uint32";
> ++			default = <10>;
> ++		};
> ++	};
> ++
> ++	last_chosen@10 {
> ++		reg = <0x10 0x4>;
> ++		type = "uint32";
> ++	};
> ++};
> ++
> +diff --git a/arch/arm/dts/vexpress-v2p-ca9.dts b/arch/arm/dts/vexpress-v2p-ca9.dts
> +index a43628e7ce15..b7962c363a7b 100644
> +--- a/arch/arm/dts/vexpress-v2p-ca9.dts
> ++++ b/arch/arm/dts/vexpress-v2p-ca9.dts
> +@@ -25,50 +25,12 @@
> + 		#address-cells = <1>;
> + 		#size-cells = <1>;
> + 
> +-		bootstate {
> +-			#address-cells = <1>;
> +-			#size-cells = <1>;
> +-
> +-			system0 { /* the node's name here must match the subnode's name in the 'bootstate' node */
> +-				#address-cells = <1>;
> +-				#size-cells = <1>;
> +-
> +-				remaining_attempts@0 {
> +-					reg = <0x0 0x4>;
> +-					type = "uint32";
> +-					default = <3>;
> +-				};
> +-				priority@4 {
> +-					reg = <0x4 0x4>;
> +-					type = "uint32";
> +-					default = <20>;
> +-				};
> +-			};
> +-
> +-			system1 { /* the node's name here must match the subnode's name in the 'bootstate' node */
> +-				#address-cells = <1>;
> +-				#size-cells = <1>;
> +-
> +-				remaining_attempts@8 {
> +-					reg = <0x8 0x4>;
> +-					type = "uint32";
> +-					default = <3>;
> +-				};
> +-				priority@c {
> +-					reg = <0xC 0x4>;
> +-					type = "uint32";
> +-					default = <20>;
> +-				};
> +-			};
> +-
> +-			last_chosen@10 {
> +-				reg = <0x10 0x4>;
> +-				type = "uint32";
> +-			};
> +-		};
> ++		bootstate: bootstate {};
> + 	};
> + };
> + 
> ++#include "generic-bootstate.dtsi"
> ++
> + &{/bus@40000000/motherboard-bus@40000000/flash@0,00000000} {
> + 	partitions {
> + 		compatible = "fixed-partitions";
> diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/series b/configs/platform-v7a/patches/barebox-2022.09.0/series
> index 26c8a02e7caa..5ae996252bb9 100644
> --- a/configs/platform-v7a/patches/barebox-2022.09.0/series
> +++ b/configs/platform-v7a/patches/barebox-2022.09.0/series
> @@ -1,3 +1,4 @@
>  0001-mci-core-act-upon-broken-cd-device-tree-property.patch
>  0002-mci-core-add-broken_cd-device-parameter.patch
>  0003-mci-core-fixup-broken-cd-information-into-kernel-DT.patch
> +0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
> diff --git a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
> index 0300e8b9daad..32731f8e983a 100644
> --- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
> +++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
> @@ -8,5 +8,10 @@ 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
> +ENV{OF_BASE_COMPATIBLE}!="*arm,vexpress,v2p-ca9*", GOTO="qemu_vexpress_end"
> +KERNEL=="mmcblk0p1", SYMLINK+="disk/by-usage/rootfs0"
> +KERNEL=="mmcblk0p2", SYMLINK+="disk/by-usage/rootfs1"
> +KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data"
> +LABEL="qemu_vexpress_end"
>  
>  LABEL="rauc_partitions_end"
> -- 
> 2.30.2
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 7/8] rauc: add initial support
  2023-03-02 16:09         ` Michael Olbrich
@ 2023-03-08  9:45           ` Roland Hieber
  0 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-03-08  9:45 UTC (permalink / raw)
  To: distrokit

On Thu, Mar 02, 2023 at 05:09:21PM +0100, Michael Olbrich wrote:
> Hi,
> 
> On Thu, Mar 02, 2023 at 11:34:53AM +0100, Jan Lübbe wrote:
> > On Thu, 2023-03-02 at 10:41 +0100, Roland Hieber wrote:
> > > On Mon, Feb 13, 2023 at 08:37:25AM +0100, Jan Lübbe wrote:
> > > > On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> > > > > +++ b/projectroot/etc/rauc/system.conf
> > > > > @@ -0,0 +1,16 @@
> > > > > +[system]
> > > > > +compatible=@RAUC_BUNDLE_COMPATIBLE@
> > > > > +bootloader=barebox
> > > > > +
> > > > 
> > > > Please disable support for plain bundles.
> > > 
> > > ACK.
> > > 
> > > > Also, add a rauc data directory on the data partition so that we can use
> > > > adaptive updates and keep a global slot status file.
> > > 
> > > Okay, this turned out to be a bit more involved, because although there
> > > is a data partition, it currently not mounted, because there is no mount
> > > unit for it and also no fstab entry, and it also there's no file system
> > > on it because systemd-autoformat@mmcblk3.service fails to run because
> > > mkfs cannot find the partition because after the previous steps which
> > > resize the partition to fill the maximum space on the SD card result in
> > > the partition table needing to be re-read by the kernel, which fails
> > > because the rootfs from the same block device is already mounted.

This turned out to be the wrong interpretation of mine. The autoformat
service did not run because the data partition is the last partition in
the image, and only contains null bytes, which genimage cleverly strips
from the generated hdimage. So when I dd the image to the SD card
without changing the partition sizes, the old ext4 superblock which was
created on the data partition during previous test runs was not
overwritten, so libblkid thinks there is still a file system on the
partition, and the ENV{ID_FS_USAGE}!="filesystem" in udev doesn't
trigger.

I've fixed up the genimage config to zero out the first few kilobytes on
the data partitions now and will include that patch in my next series.

The part with mkfs not finding the partition was because I had
refactored the service unit, and was missing a set of braces around the
partx calls, so the second partx call to re-add the partition didn't
happen. So the current solution with sfdisk and partx did work in
principle.

 - Roland

> > > 
> > > And that is my current yak shaving status… I think the 'correct' way to
> > > do this would be using systemd-repart [1] before the rootfs is mounted
> > > (but maybe we need an initrd for that…? not sure…), or simply use the
> > > existing 512 MB data partition generated by genimage and let the user
> > > resize it manually when needed.
> > > 
> > > [1]: https://www.freedesktop.org/software/systemd/man/systemd-repart.html
> > 
> > On the LXA TAC we currently use systemd-repart for this:
> > https://github.com/linux-automation/meta-lxatac/tree/langdale/meta-lxatac-bsp/recipes-core/lxatac-repart
> > 
> > We use it from the running system (not initramfs).
> 
> Userspace can change the partition layout manually. systemd-repart does
> this internally via fdisk_reread_changes(). That in turn calls the BLKPG
> ioctl. So with the right tool you can resize a partition at runtime even if
> it's on the same device as the root partition.
> 
> Michael
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC
  2023-03-07 12:04 ` Ahmad Fatoum
@ 2023-03-08 10:11   ` Roland Hieber
  0 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-03-08 10:11 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: distrokit

On Tue, Mar 07, 2023 at 01:04:46PM +0100, Ahmad Fatoum wrote:
> Hello Roland,
> 
> On 12.02.23 23:14, Roland Hieber wrote:
> > With this patch series, the first v7a platforms (beaglebone black, riotboard,
> > rpi3, qemu-vexpress) gain support for redundant boot on two root partitions
> > which can be updated with RAUC.
> 
> Thanks for your patches.
> 
> I don't like the prospect of having permanent patches in DistroKit to enable
> redundant boot. With CONFIG_EXTERNAL_DTS_FRAGMENTS, you can have barebox
> append device tree files specified by the BSP after the device trees
> built by barebox. With e.g. an #ifdef imx6s_riotboard_dts include guard,
> you can ensure you don't break multi-image setups.
> 
> This should make any patches to barebox source unnecessary.
> What do you think?

Makes sense to me, I didn't know about CONFIG_EXTERNAL_DTS_FRAGMENTS yet!

 - Roland

> Cheers,
> Ahmad
> 
> > 
> > Roland Hieber (8):
> >   rauc-udev: add a compatibility layer for mapping partitions
> >   v7a: add RAUC support for qemu-vexpress
> >   v7a: add RAUC support for beaglebone black
> >   v7a: add RAUC support for rpi3
> >   v7a: add RAUC support for riotboard
> >   v7a: kernel: enable features necessary for RAUC
> >   rauc: add initial support
> >   v7a: enable RAUC bundle creation
> > 
> >  configs/platform-mips/platformconfig          |  20 ++-
> >  configs/platform-mipsel/platformconfig        |  20 ++-
> >  configs/platform-rpi1/platformconfig          |  18 ++-
> >  .../barebox-am335x-defaultenv/init/bootsource |   4 +-
> >  .../barebox-am335x-defaultenv/nv/boot.default |   1 +
> >  .../nv/bootchooser.state_prefix               |   1 +
> >  .../nv/bootchooser.system0.boot               |   1 +
> >  .../nv/bootchooser.system1.boot               |   1 +
> >  .../nv/bootchooser.targets                    |   1 +
> >  configs/platform-v7a/barebox-am335x.config    |   3 +-
> >  .../platform-v7a/barebox-am335x.config.diff   |   2 +
> >  .../barebox-mx6-defaultenv/init/bootsource    |   6 +-
> >  .../barebox-mx6-defaultenv/nv/boot.default    |   1 +
> >  .../nv/bootchooser.state_prefix               |   1 +
> >  .../nv/bootchooser.system0.boot               |   1 +
> >  .../nv/bootchooser.system1.boot               |   1 +
> >  .../nv/bootchooser.targets                    |   1 +
> >  configs/platform-v7a/barebox-mx6.config       |   3 +-
> >  configs/platform-v7a/barebox-mx6.config.diff  |   2 +
> >  .../barebox-rpi2-defaultenv/init/bootsource   |   5 +-
> >  .../barebox-rpi2-defaultenv/nv/boot.default   |   1 +
> >  .../nv/bootchooser.state_prefix               |   1 +
> >  .../nv/bootchooser.system0.boot               |   1 +
> >  .../nv/bootchooser.system1.boot               |   1 +
> >  .../nv/bootchooser.targets                    |   1 +
> >  configs/platform-v7a/barebox-rpi2.config      |   3 +-
> >  configs/platform-v7a/barebox-rpi2.config.diff |   2 +
> >  .../init/bootsource                           |   2 +-
> >  .../nv/boot.default                           |   1 +
> >  .../nv/bootchooser.state_prefix               |   1 +
> >  .../nv/bootchooser.system0.boot               |   1 +
> >  .../nv/bootchooser.system1.boot               |   1 +
> >  .../nv/bootchooser.targets                    |   1 +
> >  configs/platform-v7a/barebox-vexpress.config  |   3 +-
> >  .../platform-v7a/barebox-vexpress.config.diff |   2 +
> >  .../config/images/beaglebone.config           |   4 +
> >  .../config/images/riotboard.config            |   6 +
> >  .../platform-v7a/config/images/rpi2.config    |   5 +
> >  .../config/images/vexpress.config             |   7 +-
> >  configs/platform-v7a/kernelconfig             |  75 ++++++++++-
> >  ...-bootstate-node-into-a-generic-templ.patch | 123 ++++++++++++++++++
> >  ...ack-add-beaglebone-black-state-entry.patch |  69 ++++++++++
> >  ...ts-bcm2837-rpi-3-b-add-state-support.patch |  59 +++++++++
> >  ...ts-imx6s-riotboard-add-state-backend.patch |  53 ++++++++
> >  .../patches/barebox-2022.09.0/series          |   4 +
> >  configs/platform-v7a/platformconfig           |  31 ++++-
> >  configs/platform-v7a_noneon/platformconfig    |  20 ++-
> >  configs/platform-v8a/platformconfig           |  19 ++-
> >  configs/platform-x86_64/platformconfig        |  20 ++-
> >  configs/ptxconfig                             | 111 ++++++++++++++--
> >  projectroot/etc/rauc/system.conf              |  16 +++
> >  .../lib/systemd/system/rauc-mark-good.service |  14 ++
> >  projectroot/usr/lib/udev/of_base_compatible   |   4 +
> >  .../lib/udev/rules.d/90-rauc-partitions.rules |  35 +++++
> >  rules/rauc-udev.in                            |   8 ++
> >  rules/rauc-udev.make                          |  37 ++++++
> >  56 files changed, 799 insertions(+), 36 deletions(-)
> >  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default
> >  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix
> >  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot
> >  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot
> >  create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets
> >  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/boot.default
> >  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.state_prefix
> >  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system0.boot
> >  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.system1.boot
> >  create mode 100644 configs/platform-v7a/barebox-mx6-defaultenv/nv/bootchooser.targets
> >  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/boot.default
> >  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.state_prefix
> >  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system0.boot
> >  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.system1.boot
> >  create mode 100644 configs/platform-v7a/barebox-rpi2-defaultenv/nv/bootchooser.targets
> >  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/boot.default
> >  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.state_prefix
> >  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system0.boot
> >  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.system1.boot
> >  create mode 100644 configs/platform-v7a/barebox-vexpress-defaultenv/nv/bootchooser.targets
> >  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch
> >  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch
> >  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0103-arm-dts-bcm2837-rpi-3-b-add-state-support.patch
> >  create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0104-arm-dts-imx6s-riotboard-add-state-backend.patch
> >  create mode 100644 projectroot/etc/rauc/system.conf
> >  create mode 100644 projectroot/usr/lib/systemd/system/rauc-mark-good.service
> >  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
> > 
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

* Re: [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation
  2023-02-13  7:42   ` Jan Lübbe
@ 2023-04-25 18:38     ` Roland Hieber
  0 siblings, 0 replies; 24+ messages in thread
From: Roland Hieber @ 2023-04-25 18:38 UTC (permalink / raw)
  To: Jan Lübbe; +Cc: distrokit

On Mon, Feb 13, 2023 at 08:42:19AM +0100, Jan Lübbe wrote:
> On Sun, 2023-02-12 at 23:14 +0100, Roland Hieber wrote:
> > Signed-off-by: Roland Hieber <rhi@pengutronix.de>
> > ---
> >  configs/platform-v7a/platformconfig | 12 +++++++++++-
> >  1 file changed, 11 insertions(+), 1 deletion(-)
> > 
> > diff --git a/configs/platform-v7a/platformconfig b/configs/platform-v7a/platformconfig
> > index 5bd6cebcbf9c..ec430ff1e5e5 100644
> > --- a/configs/platform-v7a/platformconfig
> > +++ b/configs/platform-v7a/platformconfig
> > @@ -269,7 +269,12 @@ PTXCONF_IMAGE_KERNEL_INSTALL_EARLY=y
> >  # end of Generate images/linuximage    
> >  
> >  PTXCONF_IMAGE_LXA_MC1=y
> > -# PTXCONF_IMAGE_RAUC is not set
> > +PTXCONF_IMAGE_RAUC=y
> > +PTXCONF_IMAGE_RAUC_DESCRIPTION="DistroKit"
> > +# PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_PLAIN is not set
> > +PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_VERITY=y
> > +# PTXCONF_IMAGE_RAUC_BUNDLE_FORMAT_CRYPT is not set
> 
> Does this use ext4 or tar? If ext4, you should enable adaptive updates:
> https://rauc.readthedocs.io/en/latest/advanced.html#adaptive-updates
> 
> You only need to set adaptive=block-hash-index in the [image.*] section of the
> manifest. Depending on how your ext4 is configured, you may need to align the
> size to 4KiB.

Currently PTXdist configures genimage to use root.tar.gz in the bundle.
I think it would be possible to configure it to use the ext4 too, but
a patch in PTXdist would be necessary.

 - Roland

> > +# PTXCONF_IMAGE_RAUC_INTERMEDIATE is not set
> >  PTXCONF_IMAGE_RIOTBOARD=y
> >  # PTXCONF_IMAGE_ROOT_CPIO is not set
> >  PTXCONF_IMAGE_ROOT_EXT=y
> > @@ -316,6 +321,7 @@ PTXCONF_HOST_EXTRACT_CERT=y
> >  PTXCONF_HOST_FLEX=y
> >  PTXCONF_HOST_GENEXT2FS=y
> >  PTXCONF_HOST_GENIMAGE=y
> > +PTXCONF_HOST_GLIB=y
> >  PTXCONF_HOST_LIBCONFUSE=y
> >  PTXCONF_HOST_LIBFFI=y
> >  PTXCONF_HOST_LIBKMOD=y
> > @@ -330,12 +336,16 @@ PTXCONF_HOST_NINJA=y
> >  PTXCONF_HOST_OPENSC=y
> >  PTXCONF_HOST_OPENSSL=y
> >  PTXCONF_HOST_P11_KIT=y
> > +PTXCONF_HOST_PCRE2=y
> > +PTXCONF_HOST_RAUC=y
> >  PTXCONF_HOST_SOFTHSM=y
> >  PTXCONF_HOST_SQLITE=y
> > +PTXCONF_HOST_SQUASHFS_TOOLS=y
> >  PTXCONF_HOST_SYSTEM_BC=y
> >  PTXCONF_HOST_SYSTEM_PYTHON3=y
> >  PTXCONF_HOST_SYSTEM_PYTHON3_SETUPTOOLS=y
> >  PTXCONF_HOST_UTIL_LINUX=y
> > +PTXCONF_HOST_ZLIB=y
> >  PTXCONF_HOST_TF_A=y
> >  
> >  #
> 
> -- 
> Pengutronix e.K.                           |                             |
> Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
> 31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
> Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
> 
> 

-- 
Roland Hieber, Pengutronix e.K.          | r.hieber@pengutronix.de     |
Steuerwalder Str. 21                     | https://www.pengutronix.de/ |
31137 Hildesheim, Germany                | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686         | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2023-04-25 18:38 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-12 22:14 [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 1/8] rauc-udev: add a compatibility layer for mapping partitions Roland Hieber
2023-02-13  9:43   ` Michael Olbrich
2023-03-02  9:33     ` Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 2/8] v7a: add RAUC support for qemu-vexpress Roland Hieber
2023-03-08  9:33   ` Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 3/8] v7a: add RAUC support for beaglebone black Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 4/8] v7a: add RAUC support for rpi3 Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 5/8] v7a: add RAUC support for riotboard Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 6/8] v7a: kernel: enable features necessary for RAUC Roland Hieber
2023-02-13  7:33   ` Jan Lübbe
2023-02-12 22:14 ` [DistroKit] [PATCH 7/8] rauc: add initial support Roland Hieber
2023-02-13  7:37   ` Jan Lübbe
2023-03-02  9:41     ` Roland Hieber
2023-03-02 10:34       ` Jan Lübbe
2023-03-02 16:09         ` Michael Olbrich
2023-03-08  9:45           ` Roland Hieber
2023-02-12 22:14 ` [DistroKit] [PATCH 8/8] v7a: enable RAUC bundle creation Roland Hieber
2023-02-13  7:42   ` Jan Lübbe
2023-04-25 18:38     ` Roland Hieber
2023-02-13  7:48 ` [DistroKit] [PATCH 0/8] v7a: add redundant update support via RAUC Marco Felsch
2023-02-13  9:35   ` Roland Hieber
2023-03-07 12:04 ` Ahmad Fatoum
2023-03-08 10:11   ` Roland Hieber

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox