From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Sun, 12 Feb 2023 23:15:16 +0100 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) 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 1pRKcw-005av6-BV for lore@lore.pengutronix.de; Sun, 12 Feb 2023 23:15:16 +0100 Received: from localhost ([127.0.0.1] helo=metis.ext.pengutronix.de) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pRKcl-0006wq-Fr; Sun, 12 Feb 2023 23:15:07 +0100 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pRKcb-0006o7-UM; Sun, 12 Feb 2023 23:14:57 +0100 Received: from [2a0a:edc0:0:1101:1d::ac] (helo=dude04.red.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pRKca-004WV2-2S; Sun, 12 Feb 2023 23:14:57 +0100 Received: from rhi by dude04.red.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1pRKcZ-006uAh-UR; Sun, 12 Feb 2023 23:14:55 +0100 From: Roland Hieber To: distrokit@pengutronix.de Date: Sun, 12 Feb 2023 23:14:46 +0100 Message-Id: <20230212221449.1644628-6-rhi@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230212221449.1644628-1-rhi@pengutronix.de> References: <20230212221449.1644628-1-rhi@pengutronix.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [DistroKit] [PATCH 5/8] v7a: add RAUC support for riotboard 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.ext.pengutronix.de); SAEximRunCond expanded to false * 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 --- .../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 +Date: Sun, 12 Feb 2023 16:05:23 +0100 +Subject: [PATCH] arm: dts: imx6s-riotboard: add state backend + +Signed-off-by: Roland Hieber +--- + 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