From: Roland Hieber <rhi@pengutronix.de>
To: distrokit@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [DistroKit] [PATCH v3 08/14] v7a: add RAUC support for riotboard
Date: Thu, 27 Apr 2023 12:01:28 +0200 [thread overview]
Message-ID: <20230427100134.2934937-9-rhi@pengutronix.de> (raw)
In-Reply-To: <20230427100134.2934937-1-rhi@pengutronix.de>
* 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 backend to the device tree fragment
* 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 +++++
configs/platform-v7a/dts/bootstate.dtsi | 27 +++++++++++++++++++
.../lib/udev/rules.d/90-rauc-partitions.rules | 7 +++++
11 files changed, 52 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
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 c0a8faa33292..fb8e3b2f5a86 100644
--- a/configs/platform-v7a/barebox-mx6.config
+++ b/configs/platform-v7a/barebox-mx6.config
@@ -285,7 +285,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
@@ -376,6 +376,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 f51daa42375e..30f6114088f7 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_FCB=y
# CONFIG_CMD_KEYSTORE is not set
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/dts/bootstate.dtsi b/configs/platform-v7a/dts/bootstate.dtsi
index 6415dcc0fa68..b118975f3d28 100644
--- a/configs/platform-v7a/dts/bootstate.dtsi
+++ b/configs/platform-v7a/dts/bootstate.dtsi
@@ -74,6 +74,33 @@
};
#endif
+/** RIoTboard i.MX6S **********************************************************/
+#ifdef imx6s_riotboard_dts
+/ {
+ 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 = "direct";
+ backend-stridesize = <0x40>;
+ };
+};
+
+&usdhc4 {
+ backend_state_usdhc4: partition@100000 {
+ label = "barebox-state";
+ reg = <0x100000 0x40000>;
+ };
+};
+#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 fde6c84b0c05..456aa24b095f 100644
--- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
+++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
@@ -29,6 +29,13 @@ KERNEL=="mmcblk0p4", SYMLINK+="disk/by-usage/data"
GOTO="rauc_partitions_end"
LABEL="rpi3_end"
+ENV{OF_BASE_COMPATIBLE}!="*riot,imx6s-riotboard*", GOTO="riotboard_end"
+KERNEL=="mmcblk2p1", SYMLINK+="disk/by-usage/rootfs0"
+KERNEL=="mmcblk2p2", SYMLINK+="disk/by-usage/rootfs1"
+KERNEL=="mmcblk2p3", SYMLINK+="disk/by-usage/data"
+GOTO="rauc_partitions_end"
+LABEL="riotboard_end"
+
# fallback for boards not yet supported by RAUC
KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data"
--
2.39.2
next prev parent reply other threads:[~2023-04-27 10:01 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-27 10:01 [DistroKit] [PATCH v3 00/14] v7a: add redundant update support via RAUC Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 01/14] platforms: revert to default systemd loglevel Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 02/14] ptxconfig: enable more tools for debugging Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 03/14] rauc-udev: add a compatibility layer for mapping partitions Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 04/14] v7a: barebox: include generic bootstate node in device tree Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 05/14] v7a: add RAUC support for qemu-vexpress Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 06/14] v7a: add RAUC support for beaglebone black Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 07/14] v7a: add RAUC support for rpi3 Roland Hieber
2023-04-27 10:01 ` Roland Hieber [this message]
2023-04-27 10:01 ` [DistroKit] [PATCH v3 09/14] v7a: kernel: enable features necessary for RAUC Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 10/14] rauc: add initial support Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 11/14] v7a: enable RAUC bundle creation Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 12/14] image-rauc: fork config from PTXdist 2023.04.0 Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 13/14] image-rauc: use ext4 rootfs instead of tar.gz Roland Hieber
2023-04-27 10:01 ` [DistroKit] [PATCH v3 14/14] v7a: run: start with barebox by default Roland Hieber
2023-06-20 13:46 ` [DistroKit] [PATCH v3 00/14] v7a: add redundant update support via RAUC Robert Schwebel
2023-06-23 12:50 ` Roland Hieber
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=20230427100134.2934937-9-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