[Skiboot] [PATCH 3/3] external/gard: Recover the entire gard partition

Cyril Bur cyril.bur at au1.ibm.com
Thu Sep 3 17:47:09 AEST 2015


If the gard tool detects that the GUARD partition has been corrupted it has
logic to attempt to recover the GUARD partition in a best effort attempt to
leave the GUARD partition in a state that will allow the machine to boot.

It has come to light that Hostboot is more sensitive to what must be in the
GUARD partition in order to be able to bring a machine up, as such, the
gard tool will now fill the entire partition with all 1's and ECC bytes, not
simply the first record as it currently does

Signed-off-by: Cyril Bur <cyril.bur at au1.ibm.com>
---
 external/gard/gard.c | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/external/gard/gard.c b/external/gard/gard.c
index d22df70..fec3101 100644
--- a/external/gard/gard.c
+++ b/external/gard/gard.c
@@ -605,17 +605,9 @@ int check_gard_partition(struct gard_ctx *ctx)
 			return -1;
 		}
 		if (msg[0] == 'y') {
-			rc = blocklevel_erase(ctx->bl, ctx->gard_data_pos, ctx->gard_data_len);
+			rc = reset_partition(ctx);
 			if (rc) {
-				fprintf(stderr, "Couldn't erase flash partition. Bailing out\n");
-				return rc;
-			}
-
-			memset(&gard, INT_MAX, sizeof(gard));
-
-			rc = blocklevel_smart_write(ctx->bl, ctx->gard_data_pos, &gard, sizeof(gard));
-			if (rc) {
-				fprintf(stderr, "Couldn't create a sane first gard record. Bailing out\n");
+				fprintf(stderr, "Couldn't reset the GUARD partition. Bailing out\n");
 				return rc;
 			}
 		}
@@ -627,8 +619,6 @@ int check_gard_partition(struct gard_ctx *ctx)
 	return rc;
 }
 
-
-
 __attribute__ ((unused))
 static int do_nop(struct gard_ctx *ctx, int argc, char **argv)
 {
-- 
2.5.1



More information about the Skiboot mailing list