Skip to content

Commit

Permalink
Flashy workaround for GTT S356523
Browse files Browse the repository at this point in the history
Summary: S356523 - checks and remediations are failing for any gtt running v2023.25.2 and above

Test Plan:
```
$ go test .
ok      github.com/facebook/openbmc/tools/flashy/checks_and_remediations/common
```

Will look to build flashy ASAP and test against a previously failed host

Reviewed By: lsiudut

Differential Revision: D47928352

fbshipit-source-id: 2d654d4476d4ba15307a88d563c4d54b34b9ca7c
  • Loading branch information
cjcon90 authored and facebook-github-bot committed Jul 31, 2023
1 parent 824fc1e commit d5b7671
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,19 @@ func ensureFlashWritable(stepParams step.StepParams) step.StepExitError {
return nil
}

// S356523 workaround:
// grandteton v2023.25.2 introduced an error whereby mtd0 was set as spi0.1
// this breaks checks and remediations as it thinks flash1 is read-only
// let's put in a workaround so we can upgrade all the affected hosts
cmd := []string{"grep", "mtd0:.*spi0.1 /proc/mtd"}
_, _, stdout, _ := utils.RunCommand(cmd, 30*time.Second)
if strings.Contains(stdout, "mtd0") {
log.Printf("Skipping ensure_flash_writable check for this device due to S356523")
return nil
}

// First up check that fw_printenv works okay and produces output.
cmd := []string{"fw_printenv", "bootargs"}
cmd = []string{"fw_printenv", "bootargs"}
_, err, stdout, stderr := utils.RunCommand(cmd, 30*time.Second)
if err != nil || !strings.Contains(stdout, "bootargs") {
log.Printf("fw_printenv doesn't work: %v, stderr: %v", err, stderr)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ func TestEnsureFlashWritable(t *testing.T) {
cases := []struct {
name string
vbootUtilExists bool
s356523 string
failPrint bool
failSet bool
failCheck bool
Expand All @@ -57,6 +58,7 @@ func TestEnsureFlashWritable(t *testing.T) {
{
name: "non-vboot case",
vbootUtilExists: false,
s356523: "",
failPrint: false,
failSet: false,
failCheck: false,
Expand All @@ -66,6 +68,17 @@ func TestEnsureFlashWritable(t *testing.T) {
{
name: "working case",
vbootUtilExists: true,
s356523: "",
failPrint: false,
failSet: false,
failCheck: false,
failClear: false,
want: nil,
},
{
name: "s356523 case",
vbootUtilExists: true,
s356523: "mtd0: 08000000 00010000 \"spi0.1\"",
failPrint: false,
failSet: false,
failCheck: false,
Expand All @@ -75,6 +88,7 @@ func TestEnsureFlashWritable(t *testing.T) {
{
name: "fw_printenv broken",
vbootUtilExists: true,
s356523: "",
failPrint: true,
failSet: false,
failCheck: false,
Expand All @@ -84,6 +98,7 @@ func TestEnsureFlashWritable(t *testing.T) {
{
name: "set _flashy_test fails",
vbootUtilExists: true,
s356523: "",
failPrint: false,
failSet: true,
failCheck: false,
Expand All @@ -93,6 +108,7 @@ func TestEnsureFlashWritable(t *testing.T) {
{
name: "check _flashy_test fails",
vbootUtilExists: true,
s356523: "",
failPrint: false,
failSet: false,
failCheck: true,
Expand All @@ -103,6 +119,7 @@ func TestEnsureFlashWritable(t *testing.T) {
{
name: "clear _flashy_test fails",
vbootUtilExists: true,
s356523: "",
failPrint: false,
failSet: false,
failCheck: false,
Expand Down Expand Up @@ -141,7 +158,11 @@ func TestEnsureFlashWritable(t *testing.T) {
} else {
return 0, nil, "bootargs=foo", ""
}
} else {
} else if (cmdArr[0] == "grep") {
if (cmdArr[1] == "mtd0:.*spi0.1 /proc/mtd") {
return 0, nil, tc.s356523, ""
}
} else{
if (tc.failSet) {
return 0, errors.Errorf("err2"), "", "err2"
} else {
Expand Down

0 comments on commit d5b7671

Please sign in to comment.