From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Tue, 26 Sep 2023 11:27:24 +0200 Received: from metis.whiteo.stw.pengutronix.de ([2a0a:edc0:2:b01:1d::104]) by lore.white.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ql4Lm-00BncH-0q for lore@lore.pengutronix.de; Tue, 26 Sep 2023 11:27:24 +0200 Received: from localhost ([127.0.0.1] helo=metis.whiteo.stw.pengutronix.de) by metis.whiteo.stw.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1ql4Lk-0008N2-3u; Tue, 26 Sep 2023 11:27:24 +0200 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1ql4Le-0008Dx-Qv; Tue, 26 Sep 2023 11:27:18 +0200 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ql4Le-0094aR-EF; Tue, 26 Sep 2023 11:27:18 +0200 Received: from rhi by dude04.red.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1ql4Le-00FZuB-17; Tue, 26 Sep 2023 11:27:18 +0200 From: Roland Hieber To: distrokit@pengutronix.de Date: Tue, 26 Sep 2023 11:27:13 +0200 Message-Id: <20230926092713.3680509-5-rhi@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230926092713.3680509-1-rhi@pengutronix.de> References: <20230926092713.3680509-1-rhi@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH 5/5] v7a: add RAUC support for lxa-mc1 X-BeenThere: distrokit@pengutronix.de X-Mailman-Version: 2.1.29 Precedence: list List-Id: DistroKit Mailinglist List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Roland Hieber Sender: "DistroKit" X-SA-Exim-Connect-IP: 127.0.0.1 X-SA-Exim-Mail-From: distrokit-bounces@pengutronix.de X-SA-Exim-Scanned: No (on metis.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false * 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 --- .../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