Skip to contentSkip to conversation

cmd: ubi: add a command to swap volumes

PATCH In review Ayoub Zaki 3 participants 3 messages Sep 9, 2021 – Sep 28, 2021

lore
Share & tools
lore

Ayoub Zaki

author
#0 lore raw

PATCH v2 1/1 cmd: ubi: add a command to swap volumes

This commit adds the command ubi swap to swap an ubi volumes. The format of the command is: ubi swap <volume_a> <volume_b>. To enable this command, the option CMD_UBI_SWAPVOL must be selected.

---
 cmd/Kconfig |  8 ++++++++
 cmd/ubi.c   | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)
cmd/Kconfig +8 -0
index ffef3cc76c..ae0edc9cb1 100644
@@ -2381,6 +2381,14 @@ config CMD_UBI_RENAME
          Enable a "ubi" command to rename ubi volume:
 	   ubi rename <oldname> <newname>
 
+config CMD_UBI_SWAPVOL
+       bool "Enable swap volumes"
+       depends on CMD_UBI
+       default n
+       help
+         Enable a "ubi" command to swap ubi volumes:
+	   ubi swap <volume_a> <volume_b>
+
 config CMD_UBIFS
 	tristate "Enable UBIFS - Unsorted block images filesystem commands"
 	depends on CMD_UBI
cmd/ubi.c +54 -0

72 lines not on this page · raw message

Signature · 1 line
2.17.1
#1 lore raw

Hello Ayoub,

Quoted 7 lines · Ayoub Zaki

This commit adds the command ubi swap to swap an ubi volumes. The format of the command is: ubi swap <volume_a> <volume_b>. To enable this command, the option CMD_UBI_SWAPVOL must be selected.

---
 cmd/Kconfig |  8 ++++++++
 cmd/ubi.c   | 54 +++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 62 insertions(+)

Could you please add a Signed-off-by line?

And please add in further patches a change log [1], may you want to use patman u-boot:/tools/patman/README

Thanks!

bye,
Heiko
[1] https://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-52   Fax: +49-8142-66989-80   Email: [email protected]
#2 lore raw
In reply to Ayoub Zaki

Dear Ayoub,

Quoted 3 lines · In message <[email protected]> you wrote:

This commit adds the command ubi swap to swap an ubi volumes. The format of the command is: ubi swap <volume_a> <volume_b>. To enable this command, the option CMD_UBI_SWAPVOL must be selected.

May I ask what this command is good for, i. e. what is the intended use case?

I have the feeling that you might want to do something which requires an atomic operation, but you should be aware that the implementation is NOT atomic - even worse: in case of problems there is not even a way to fall back to the old state.

So if you think to use this for example for reliable software updates, then you have a big problem here.

Or am I missing something?

Best regards,

Wolfgang Denk

Signature · 7 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: [email protected]
Niklaus Wirth has lamented that, whereas Europeans pronounce his name
correctly  (Ni-klows  Virt),  Americans  invariably  mangle  it  into
(Nick-les  Worth).  Which  is to say that Europeans call him by name,
but Americans call him by value.