DistroKit Mailinglist
 help / color / mirror / Atom feed
From: Roland Hieber <rhi@pengutronix.de>
To: distrokit@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [DistroKit] [PATCH 5/5] v7a: add RAUC support for lxa-mc1
Date: Tue, 26 Sep 2023 11:27:13 +0200	[thread overview]
Message-ID: <20230926092713.3680509-5-rhi@pengutronix.de> (raw)
In-Reply-To: <20230926092713.3680509-1-rhi@pengutronix.de>

* 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 backend to the device tree fragment
* Map partitions in rauc-udev compatibility layer

Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
 .../init/bootsource                           |  2 +-
 .../nv/bootchooser.state_prefix               |  1 +
 .../nv/bootchooser.system0.boot               |  1 +
 .../nv/bootchooser.system1.boot               |  1 +
 .../platform-v7a/config/images/stm32mp.config |  9 ++++++++-
 configs/platform-v7a/dts/bootstate.dtsi       | 20 +++++++++++++++++++
 .../lib/udev/rules.d/90-rauc-partitions.rules |  7 +++++++
 7 files changed, 39 insertions(+), 2 deletions(-)
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.state_prefix
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system0.boot
 create mode 100644 configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system1.boot

diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/init/bootsource b/configs/platform-v7a/barebox-stm32mp-defaultenv/init/bootsource
index b529384e939b..edce471abe78 100755
--- a/configs/platform-v7a/barebox-stm32mp-defaultenv/init/bootsource
+++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/init/bootsource
@@ -5,5 +5,5 @@ if [ -n "$nv.boot.default" ]; then
 fi
 
 if [ $bootsource = mmc ]; then
-	global.boot.default="mmc${bootsource_instance}.root net"
+	global.boot.default="bootchooser net"
 fi
diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.state_prefix b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.state_prefix
new file mode 100644
index 000000000000..6246412a5c27
--- /dev/null
+++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.state_prefix
@@ -0,0 +1 @@
+state.bootstate
diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system0.boot b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system0.boot
new file mode 100644
index 000000000000..f3c4d03bcb3e
--- /dev/null
+++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system0.boot
@@ -0,0 +1 @@
+mmc0.root-a
diff --git a/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system1.boot b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system1.boot
new file mode 100644
index 000000000000..6fab4940a0ba
--- /dev/null
+++ b/configs/platform-v7a/barebox-stm32mp-defaultenv/nv/bootchooser.system1.boot
@@ -0,0 +1 @@
+mmc0.root-b
diff --git a/configs/platform-v7a/config/images/stm32mp.config b/configs/platform-v7a/config/images/stm32mp.config
index 908ed44ce78c..afef06d7e43d 100644
--- a/configs/platform-v7a/config/images/stm32mp.config
+++ b/configs/platform-v7a/config/images/stm32mp.config
@@ -19,7 +19,14 @@ image @IMAGE@ {
 	partition barebox-environment {
 		size = 1M
 	}
-	partition root {
+	partition barebox-state {
+		partition-type-uuid = "4778ed65-bf42-45fa-9c5b-287a1dc4aab1"
+		size = 1M
+	}
+	partition root-a {
+		image = root.ext2
+	}
+	partition root-b {
 		image = root.ext2
 	}
 	partition data {
diff --git a/configs/platform-v7a/dts/bootstate.dtsi b/configs/platform-v7a/dts/bootstate.dtsi
index b118975f3d28..c77df2e19d65 100644
--- a/configs/platform-v7a/dts/bootstate.dtsi
+++ b/configs/platform-v7a/dts/bootstate.dtsi
@@ -101,6 +101,26 @@
 };
 #endif
 
+/** LXA MC1 *******************************************************************/
+#ifdef stm32mp157c_lxa_mc1_dts
+/ {
+	aliases {
+		state = &state_mmc0;
+	};
+
+	state_mmc0: state {
+		#address-cells = <1>;
+		#size-cells = <1>;
+		compatible = "barebox,state";
+		magic = <0x778ec0f4>;
+		backend = <&sdmmc1>;   // via GPT Type UUID
+		backend-type = "raw";
+		backend-storage-type = "direct";
+		backend-stridesize = <0x40>;
+	};
+};
+#endif
+
 /** Generic bootstate node for all platforms **********************************/
 / {
 	state: state {
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 456aa24b095f..e909df01958f 100644
--- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
+++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
@@ -15,6 +15,13 @@ KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data"
 GOTO="rauc_partitions_end"
 LABEL="qemu_vexpress_end"
 
+ENV{OF_BASE_COMPATIBLE}!="*lxa,stm32mp157c-mc1*", GOTO="lxa_mc1_end"
+KERNEL=="mmcblk0p6", SYMLINK+="disk/by-usage/rootfs0"
+KERNEL=="mmcblk0p7", SYMLINK+="disk/by-usage/rootfs1"
+KERNEL=="mmcblk0p8", SYMLINK+="disk/by-usage/data"
+GOTO="rauc_partitions_end"
+LABEL="lxa_mc1_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"
-- 
2.39.2




  parent reply	other threads:[~2023-09-26  9:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-09-26  9:27 [DistroKit] [PATCH 1/5] ptxconfig: use fdisk from util-linux instead of busybox Roland Hieber
2023-09-26  9:27 ` [DistroKit] [PATCH 2/5] v7a: barebox: version bump 2023.02.1 -> 2023.09.0 Roland Hieber
2023-09-26  9:27 ` [DistroKit] [PATCH 3/5] v7a: barebox: enable of_compatible and of_fixup commands Roland Hieber
2023-09-26  9:27 ` [DistroKit] [PATCH 4/5] v7a: barebox-common: enable bootchooser Roland Hieber
2023-09-26  9:27 ` Roland Hieber [this message]
2023-10-18  9:12 ` [DistroKit] [PATCH 1/5] ptxconfig: use fdisk from util-linux instead of busybox Robert Schwebel

Reply instructions:

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

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

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

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

  git send-email \
    --in-reply-to=20230926092713.3680509-5-rhi@pengutronix.de \
    --to=rhi@pengutronix.de \
    --cc=distrokit@pengutronix.de \
    /path/to/YOUR_REPLY

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

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