From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sean Nyekjaer Date: Wed, 11 Dec 2019 09:16:03 +0100 Subject: [U-Boot] [RFC] cmd: add bootslot command to select/boot slot based on boot counts In-Reply-To: <20180713123413.4115-1-martin@geanix.com> References: <20180713123413.4115-1-martin@geanix.com> Message-ID: <24ce29ea-33f2-572f-deb6-e8fb13f64fd2@geanix.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit To: u-boot@lists.denx.de On 13/07/2018 14.34, Martin Hundebøll wrote: > The existing bootcount feature is targeted systems with a primary, and a > rescue boot setup, where the number of boot tries to the primary boot is > tracked. If the number exceeds the limit, the alternative/rescue is > booted. > > This patch adds support for a more sophisticated setup, where more than > two boot slots can exist, and the order of slots can be configured. > > The 'bootcommand' command reads the configured slots (and their > priority/order) from a configured environment variable ("bootslots" by > default). For each conifgured slot, a remaining boot count is maintained > in an evnironment variable ("bootcount_" by default). If the first > boot slot has positive boot count, it is booted using the slot specific > boot command ("bootcmd_" by default). Otherwise the next slot is > checked. > > An example environment when using the bootslot command with two slots > ("a" and "b"): > > bootslots=a b > bootcount_a=3 > bootcount_b=3 > bootcmd_a=setenv bootargs $bootargs root=/dev/mmcblk0p1; booti $loadaddr > bootcmd_b=setenv bootargs $bootargs root=/dev/mmcblk0p2; booti $loadaddr > > Once linux is booted, it resets the bootcount variable for the booted > slot using "fw_setenv": > >> fw_setenv bootcount_a 3 > > When the non-booted slot is updated, the order is updated by setting the > bootslots variable with "fw_setenv": > >> fw_setenv bootslots=b a > > Signed-off-by: Martin Hundebøll > Tested-by: Sean Nyekjaer We have used this for the past 1.5 years. Will you post this as a patch? /Sean