Skip to content

Commit d5b7671

Browse files
cjcon90facebook-github-bot
authored andcommitted
Flashy workaround for GTT S356523
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
1 parent 824fc1e commit d5b7671

File tree

2 files changed

+34
-2
lines changed

2 files changed

+34
-2
lines changed

tools/flashy/checks_and_remediations/common/05_ensure_flash_writable.go

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,19 @@ func ensureFlashWritable(stepParams step.StepParams) step.StepExitError {
5959
return nil
6060
}
6161

62+
// S356523 workaround:
63+
// grandteton v2023.25.2 introduced an error whereby mtd0 was set as spi0.1
64+
// this breaks checks and remediations as it thinks flash1 is read-only
65+
// let's put in a workaround so we can upgrade all the affected hosts
66+
cmd := []string{"grep", "mtd0:.*spi0.1 /proc/mtd"}
67+
_, _, stdout, _ := utils.RunCommand(cmd, 30*time.Second)
68+
if strings.Contains(stdout, "mtd0") {
69+
log.Printf("Skipping ensure_flash_writable check for this device due to S356523")
70+
return nil
71+
}
72+
6273
// First up check that fw_printenv works okay and produces output.
63-
cmd := []string{"fw_printenv", "bootargs"}
74+
cmd = []string{"fw_printenv", "bootargs"}
6475
_, err, stdout, stderr := utils.RunCommand(cmd, 30*time.Second)
6576
if err != nil || !strings.Contains(stdout, "bootargs") {
6677
log.Printf("fw_printenv doesn't work: %v, stderr: %v", err, stderr)

tools/flashy/checks_and_remediations/common/05_ensure_flash_writable_test.go

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func TestEnsureFlashWritable(t *testing.T) {
4848
cases := []struct {
4949
name string
5050
vbootUtilExists bool
51+
s356523 string
5152
failPrint bool
5253
failSet bool
5354
failCheck bool
@@ -57,6 +58,7 @@ func TestEnsureFlashWritable(t *testing.T) {
5758
{
5859
name: "non-vboot case",
5960
vbootUtilExists: false,
61+
s356523: "",
6062
failPrint: false,
6163
failSet: false,
6264
failCheck: false,
@@ -66,6 +68,17 @@ func TestEnsureFlashWritable(t *testing.T) {
6668
{
6769
name: "working case",
6870
vbootUtilExists: true,
71+
s356523: "",
72+
failPrint: false,
73+
failSet: false,
74+
failCheck: false,
75+
failClear: false,
76+
want: nil,
77+
},
78+
{
79+
name: "s356523 case",
80+
vbootUtilExists: true,
81+
s356523: "mtd0: 08000000 00010000 \"spi0.1\"",
6982
failPrint: false,
7083
failSet: false,
7184
failCheck: false,
@@ -75,6 +88,7 @@ func TestEnsureFlashWritable(t *testing.T) {
7588
{
7689
name: "fw_printenv broken",
7790
vbootUtilExists: true,
91+
s356523: "",
7892
failPrint: true,
7993
failSet: false,
8094
failCheck: false,
@@ -84,6 +98,7 @@ func TestEnsureFlashWritable(t *testing.T) {
8498
{
8599
name: "set _flashy_test fails",
86100
vbootUtilExists: true,
101+
s356523: "",
87102
failPrint: false,
88103
failSet: true,
89104
failCheck: false,
@@ -93,6 +108,7 @@ func TestEnsureFlashWritable(t *testing.T) {
93108
{
94109
name: "check _flashy_test fails",
95110
vbootUtilExists: true,
111+
s356523: "",
96112
failPrint: false,
97113
failSet: false,
98114
failCheck: true,
@@ -103,6 +119,7 @@ func TestEnsureFlashWritable(t *testing.T) {
103119
{
104120
name: "clear _flashy_test fails",
105121
vbootUtilExists: true,
122+
s356523: "",
106123
failPrint: false,
107124
failSet: false,
108125
failCheck: false,
@@ -141,7 +158,11 @@ func TestEnsureFlashWritable(t *testing.T) {
141158
} else {
142159
return 0, nil, "bootargs=foo", ""
143160
}
144-
} else {
161+
} else if (cmdArr[0] == "grep") {
162+
if (cmdArr[1] == "mtd0:.*spi0.1 /proc/mtd") {
163+
return 0, nil, tc.s356523, ""
164+
}
165+
} else{
145166
if (tc.failSet) {
146167
return 0, errors.Errorf("err2"), "", "err2"
147168
} else {

0 commit comments

Comments
 (0)