diff mbox series

[U-Boot,v1,20/21] display5: config: Add GPT verification and restoration code on SWUpdate entry

Message ID 20180511145119.20942-21-lukma@denx.de
State Accepted
Commit 0f05512d1135b034d09b058e2826d9c59cc26a7d
Delegated to: Stefano Babic
Headers show
Series This patch series brings in sync DISPLAY5 internal | expand

Commit Message

Lukasz Majewski May 11, 2018, 2:51 p.m. UTC
If GPT gets broken, then after N boot attempts we will run the SWUpdate
restoration image.
On its enter we will check GPT and restore it if needed.

To test it:
display5 > mmc write 0x12000000 4 8

It will overwrite the primary GPT table.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---

 include/configs/display5.h | 10 ++++++++++
 1 file changed, 10 insertions(+)
diff mbox series

Patch

diff --git a/include/configs/display5.h b/include/configs/display5.h
index 906345067c..4b6a7cc00e 100644
--- a/include/configs/display5.h
+++ b/include/configs/display5.h
@@ -144,6 +144,16 @@ 
 	"echo '#######################';" \
 	"echo '# RECOVERY SWUupdate  #';" \
 	"echo '#######################';" \
+	"echo '#######################';" \
+	"echo '# GPT verify          #';" \
+	"if gpt verify mmc ${mmcdev} ${partitions}; then " \
+		"echo '# OK !                #';" \
+	"else " \
+		"echo '# FAILED !            #';" \
+		"echo '# GPT RESTORATION     #';" \
+		"gpt write mmc ${mmcdev} ${partitions};" \
+	"fi;" \
+	"echo '#######################';" \
 	"setenv loadaddr_swu_initramfs 0x14000000;" \
 	"setenv bootargs console=${console} " \
 		"ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \