From mboxrd@z Thu Jan 1 00:00:00 1970 Delivery-date: Sun, 12 Feb 2023 23:15:10 +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 1pRKcp-005asM-FI for lore@lore.pengutronix.de; Sun, 12 Feb 2023 23:15:09 +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 1pRKcm-00071l-3X; Sun, 12 Feb 2023 23:15:08 +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 1pRKcc-0006pO-Cr; Sun, 12 Feb 2023 23:14:58 +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-004WVE-J5; 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-006uAb-TZ; Sun, 12 Feb 2023 23:14:55 +0100 From: Roland Hieber To: distrokit@pengutronix.de Date: Sun, 12 Feb 2023 23:14:44 +0100 Message-Id: <20230212221449.1644628-4-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 3/8] v7a: add RAUC support for beaglebone black 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-am335x-defaultenv/init/bootsource | 4 +- .../barebox-am335x-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-am335x.config | 3 +- .../platform-v7a/barebox-am335x.config.diff | 2 + .../config/images/beaglebone.config | 4 ++ ...ack-add-beaglebone-black-state-entry.patch | 69 +++++++++++++++++++ .../patches/barebox-2022.09.0/series | 1 + .../lib/udev/rules.d/90-rauc-partitions.rules | 6 ++ 12 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot create mode 100644 configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets create mode 100644 configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource b/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource index 72e71e08c857..b3b73e790334 100644 --- a/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource +++ b/configs/platform-v7a/barebox-am335x-defaultenv/init/bootsource @@ -5,7 +5,7 @@ if [ -n "$nv.boot.default" ]; then fi if [ $bootsource = mmc ]; then - global.boot.default="mmc$bootsource_instance net" + global.boot.default="bootchooser net" else - global.boot.default="net mmc0 mmc1" + global.boot.default="net bootchooser" fi diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default b/configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default new file mode 100644 index 000000000000..d7d9a373c50b --- /dev/null +++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/boot.default @@ -0,0 +1 @@ +bootchooser net diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix new file mode 100644 index 000000000000..6246412a5c27 --- /dev/null +++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.state_prefix @@ -0,0 +1 @@ +state.bootstate diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot new file mode 100644 index 000000000000..a6746c31d982 --- /dev/null +++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system0.boot @@ -0,0 +1 @@ +mmc0.1 diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot new file mode 100644 index 000000000000..ecdf1ba55ad6 --- /dev/null +++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.system1.boot @@ -0,0 +1 @@ +mmc0.2 diff --git a/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets new file mode 100644 index 000000000000..f0fb14eeaad2 --- /dev/null +++ b/configs/platform-v7a/barebox-am335x-defaultenv/nv/bootchooser.targets @@ -0,0 +1 @@ +system0 system1 diff --git a/configs/platform-v7a/barebox-am335x.config b/configs/platform-v7a/barebox-am335x.config index 6f54bea19aa7..e244a8a0dae2 100644 --- a/configs/platform-v7a/barebox-am335x.config +++ b/configs/platform-v7a/barebox-am335x.config @@ -211,7 +211,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 @@ -301,6 +301,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-am335x.config.diff b/configs/platform-v7a/barebox-am335x.config.diff index 936bb661ecba..39918f649f08 100644 --- a/configs/platform-v7a/barebox-am335x.config.diff +++ b/configs/platform-v7a/barebox-am335x.config.diff @@ -15,11 +15,13 @@ CONFIG_ARM_BOARD_APPEND_ATAG=y # CONFIG_BAREBOX_UPDATE_AM33XX_EMMC is not set # CONFIG_BAREBOX_UPDATE_AM33XX_NAND is not set CONFIG_BAREBOX_UPDATE_AM33XX_SPI_NOR_MLO=y +CONFIG_BOOTCHOOSER=y CONFIG_BOOTM_OFTREE_UIMAGE=y CONFIG_BUS_OMAP_GPMC=y # CONFIG_CLKDEV_LOOKUP is undefined # CONFIG_CLOCKSOURCE_BCM283X is undefined CONFIG_CLOCKSOURCE_TI_DM=y +CONFIG_CMD_BOOTCHOOSER=y # CONFIG_CMD_CLK is undefined # CONFIG_CMD_KEYSTORE is not set CONFIG_CMD_NAND=y diff --git a/configs/platform-v7a/config/images/beaglebone.config b/configs/platform-v7a/config/images/beaglebone.config index 7b1c41dfc320..07d251bfbe69 100644 --- a/configs/platform-v7a/config/images/beaglebone.config +++ b/configs/platform-v7a/config/images/beaglebone.config @@ -20,6 +20,10 @@ 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/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch b/configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch new file mode 100644 index 000000000000..a28bf965e6ce --- /dev/null +++ b/configs/platform-v7a/patches/barebox-2022.09.0/0102-arm-dts-boneblack-add-beaglebone-black-state-entry.patch @@ -0,0 +1,69 @@ +From: Rouven Czerwinski +Date: Wed, 16 Jan 2019 14:33:09 +0100 +Subject: [PATCH] arm: dts: boneblack: add beaglebone black state entry + +Signed-off-by: Rouven Czerwinski +--- + arch/arm/dts/am335x-boneblack.dts | 40 +++++++++++++++++++++++++++++++++++++++ + 1 file changed, 40 insertions(+) + +diff --git a/arch/arm/dts/am335x-boneblack.dts b/arch/arm/dts/am335x-boneblack.dts +index 3c286c71bfa2..010cb2a8b892 100644 +--- a/arch/arm/dts/am335x-boneblack.dts ++++ b/arch/arm/dts/am335x-boneblack.dts +@@ -13,8 +13,27 @@ + / { + model = "TI AM335x BeagleBone black"; + compatible = "ti,am335x-bone-black", "ti,am335x-bone", "ti,am33xx"; ++ ++ aliases { ++ state = &state_mmc1; ++ }; ++ ++ state_mmc1: state { ++ #address-cells = <1>; ++ #size-cells = <1>; ++ compatible = "barebox,state"; ++ magic = <0xa9cc3f17>; ++ backend-type = "raw"; ++ backend = <&backend_state_mmc1>; ++ backend-storage-type = "circular"; ++ backend-stridesize = <0x40>; ++ ++ bootstate: bootstate {}; ++ }; + }; + ++#include "generic-bootstate.dtsi" ++ + &{/memory@80000000} { + reg = <0x80000000 0x20000000>; /* 512 MB */ + }; +@@ -75,6 +94,27 @@ + status = "okay"; + }; + ++&mmc1 { ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <2>; ++ #size-cells = <2>; ++ ++ barebox: partition@0 { ++ label = "barebox"; ++ reg = <0x0 0x0 0x0 0xc0000>; ++ }; ++ environment: partition@0xc0000 { ++ label = "barebox-environment"; ++ reg = <0x0 0xc0000 0x0 0x20000>; ++ }; ++ backend_state_mmc1: partition@0xe0000 { ++ label = "state"; ++ reg = <0x0 0xe0000 0x0 0x20000>; ++ }; ++ }; ++}; ++ + / { + hdmi { + compatible = "ti,tilcdc,slave"; diff --git a/configs/platform-v7a/patches/barebox-2022.09.0/series b/configs/platform-v7a/patches/barebox-2022.09.0/series index 5ae996252bb9..14a2ac07a71f 100644 --- a/configs/platform-v7a/patches/barebox-2022.09.0/series +++ b/configs/platform-v7a/patches/barebox-2022.09.0/series @@ -2,3 +2,4 @@ 0002-mci-core-add-broken_cd-device-parameter.patch 0003-mci-core-fixup-broken-cd-information-into-kernel-DT.patch 0101-arm-dts-refactor-bootstate-node-into-a-generic-templ.patch +0102-arm-dts-boneblack-add-beaglebone-black-state-entry.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 32731f8e983a..11b4e1c86a3c 100644 --- a/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules +++ b/projectroot/usr/lib/udev/rules.d/90-rauc-partitions.rules @@ -14,4 +14,10 @@ KERNEL=="mmcblk0p2", SYMLINK+="disk/by-usage/rootfs1" KERNEL=="mmcblk0p3", SYMLINK+="disk/by-usage/data" LABEL="qemu_vexpress_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" +KERNEL=="mmcblk0p4", SYMLINK+="disk/by-usage/data" +LABEL="beaglebone_black_end" + LABEL="rauc_partitions_end" -- 2.30.2