From: Roland Hieber <rhi@pengutronix.de>
To: distrokit@pengutronix.de
Cc: Roland Hieber <rhi@pengutronix.de>
Subject: [DistroKit] [PATCH 3/4] v8a: add RAUC support for rock3a
Date: Sat, 4 Nov 2023 01:35:24 +0100 [thread overview]
Message-ID: <20231104003525.1673736-4-rhi@pengutronix.de> (raw)
In-Reply-To: <20231104003525.1673736-1-rhi@pengutronix.de>
* Add a state partition to the genimage configuration (offset is not
needed for the root partition since genimage can calculate that based
on the size of the previous partition and the alignment; and the
barebox-state partition is autodetected based on the partition GUID)
* Add a device tree fragment to barebox containing the state backend
* Add appropriate variables to the barebox defaultenv so the bootchooser
can decide into which partition to boot
* Map boot device (SD card) in rauc-udev compatibility layer
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
---
.../barebox-common-defaultenv/init/bootsource | 6 +-
configs/platform-v8a/barebox.config | 2 +-
.../platform-v8a/config/images/rock3a.config | 6 +-
configs/platform-v8a/dts/bootstate.dtsi | 72 +++++++++++++++++++
.../lib/udev/rules.d/90-rauc-partitions.rules | 1 +
5 files changed, 84 insertions(+), 3 deletions(-)
create mode 100644 configs/platform-v8a/dts/bootstate.dtsi
diff --git a/configs/platform-v8a/barebox-common-defaultenv/init/bootsource b/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
index db1915321531..fe63bbbe099b 100644
--- a/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
+++ b/configs/platform-v8a/barebox-common-defaultenv/init/bootsource
@@ -7,10 +7,14 @@ fi
if [ "$bootsource" = mmc ]; then
detect mmc$bootsource_instance
- global.boot.default="mmc$bootsource_instance net"
+ global.boot.default="bootchooser net"
fi
if [ "${global.model}" = "Radxa ROCK3 Model A" ]; then
+ global bootchooser.state_prefix="state.bootstate"
+ global bootchooser.targets="system0 system1"
+ global bootchooser.system0.boot="mmc1.root-A"
+ global bootchooser.system1.boot="mmc1.root-B"
if [ "$bootsource" = "spi-nor" ]; then
usbgadget -A '/dev/mmc1(sd)'
global.autoboot=abort
diff --git a/configs/platform-v8a/barebox.config b/configs/platform-v8a/barebox.config
index 9ac64ad8a7f4..8b0cb4647239 100644
--- a/configs/platform-v8a/barebox.config
+++ b/configs/platform-v8a/barebox.config
@@ -238,7 +238,7 @@ CONFIG_BOOTCHOOSER=y
CONFIG_RESET_SOURCE=y
# CONFIG_MACHINE_ID is not set
# CONFIG_SYSTEMD_OF_WATCHDOG is not set
-CONFIG_EXTERNAL_DTS_FRAGMENTS=""
+CONFIG_EXTERNAL_DTS_FRAGMENTS="${PTXDIST_PLATFORMCONFIGDIR}/dts/bootstate.dtsi"
#
# OP-TEE loading
diff --git a/configs/platform-v8a/config/images/rock3a.config b/configs/platform-v8a/config/images/rock3a.config
index 4b53e32ced3d..19e8a306861a 100644
--- a/configs/platform-v8a/config/images/rock3a.config
+++ b/configs/platform-v8a/config/images/rock3a.config
@@ -21,8 +21,12 @@ image @IMAGE@ {
in-partition-table = false
image = /dev/null
}
+ partition barebox-state {
+ size = 1M
+ partition-type-uuid = 4778ed65-bf42-45fa-9c5b-287a1dc4aab1 # barebox-state
+ image = /dev/null
+ }
partition root-A {
- offset = 5M
image = "root.ext2"
partition-type-uuid = b921b045-1df0-41c3-af44-4c6f280d3fae # root-arm64
}
diff --git a/configs/platform-v8a/dts/bootstate.dtsi b/configs/platform-v8a/dts/bootstate.dtsi
new file mode 100644
index 000000000000..d5dee2cea8c1
--- /dev/null
+++ b/configs/platform-v8a/dts/bootstate.dtsi
@@ -0,0 +1,72 @@
+/** Radxa ROCK3 Model A *******************************************************/
+#ifdef rk3568_rock_3a_dts
+/ {
+ aliases {
+ state = &state_sd;
+ };
+
+ state_sd: state {
+ #address-cells = <1>;
+ #size-cells = <1>;
+ compatible = "barebox,state";
+ magic = <0xde3e5c14>;
+ backend = <&sdmmc0>; // via GPT Type UUID
+ backend-type = "raw";
+ backend-storage-type = "direct";
+ backend-stridesize = <0x40>;
+ };
+};
+
+#endif
+
+/** Generic bootstate node for all platforms **********************************/
+/ {
+ state: state {
+ bootstate: bootstate {};
+ };
+};
+
+&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/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules
index 64f1aab46ac0..2da28ae5df16 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,7 @@ ENV{OF_BASE_COMPATIBLE}=="*lxa,stm32mp157c-mc1*", ENV{ID_PATH}=="platform-soc-am
ENV{OF_BASE_COMPATIBLE}=="*ti,am335x-bone-black*", ENV{ID_PATH}=="platform-48060000.mmc", TAG+="boot_disk"
ENV{OF_BASE_COMPATIBLE}=="*raspberrypi,3-model-b*", ENV{ID_PATH}=="platform-3f202000.mmc", TAG+="boot_disk"
ENV{OF_BASE_COMPATIBLE}=="*riot,imx6s-riotboard*", ENV{ID_PATH}=="platform-2198000.mmc", TAG+="boot_disk"
+ENV{OF_BASE_COMPATIBLE}=="*radxa,rock3a*", ENV{ID_PATH}=="platform-fe2b0000.mmc", TAG+="boot_disk"
# second part: create /dev/disk/by-usage/ symlinks
ENV{DEVTYPE}!="partition", GOTO="rauc_partitions_end"
--
2.39.2
next prev parent reply other threads:[~2023-11-04 0:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-04 0:35 [DistroKit] [PATCH 0/4] RAUC support for Radxa ROCK3 Model A Roland Hieber
2023-11-04 0:35 ` [DistroKit] [PATCH 1/4] v8a: barebox: version bump 2023.05 -> 2023.09.0 Roland Hieber
2023-11-04 0:35 ` [DistroKit] [PATCH 2/4] v8a: barebox: enable of_compatible and of_fixup commands Roland Hieber
2023-11-04 0:35 ` Roland Hieber [this message]
2023-11-04 0:35 ` [DistroKit] [PATCH 4/4] v8a: build RAUC update bundle Roland Hieber
2023-11-06 11:58 ` [DistroKit] [PATCH 0/4] RAUC support for Radxa ROCK3 Model A 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=20231104003525.1673736-4-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