Commit 5dea38b
fix(bb64): validate and repair the PocketBeagle2 EEPROM before flashing eMMC
Some industrial boards leave the factory with the identity EEPROM only partly
programmed. u-boot's SPL applies the 1GB DDRSS timings only when the EEPROM
identifies the board as the industrial variant, so those boards come up as the
512MB base board -- and flashing one produced a finished-looking unit that was
wrong in a way nothing downstream would notice.
The eMMC is the tell: only the industrial has it populated, and mmcblk0 is the
only target this profile ever flashes. So flash_storage.sh's bb64 preflight,
previously a no-op, now checks the EEPROM and repairs it where it can, before
anything is written. A preflight die already runs under the same EXIT trap as
every other phase, so an abort ends with all user LEDs blinking rather than
with a board that looks done.
The detect/repair/verify logic moves out of BB64-AutoFlash.sh into a shared
check_pb2_eeprom.sh so the boot-time flasher and the interactive one cannot
drift. BB64-AutoFlash.sh's fail() moves above its first use: the EEPROM check
is now the first thing that can fail, and sh only resolves a function once it
has read the definition.
An EEPROM that cannot be repaired now stops the flash instead of warning and
continuing. There is no EEPROM part on this board -- an MSPM0L1105 emulates a
24c32 at 0x50 -- so when its firmware was never flashed, 0x50 does not ACK,
at24's probe read fails, and the driver never binds. Nothing can be written to
a silent device, so the only honest answer is to refuse. The same MSPM0 also
emulates the ADC at 0x20, which separates three faults that need different
people to look at them: neither bound (MSPM0 not running), ADC bound but 0x50
silent (MSPM0 running, firmware fault), and no i2c client at all (device tree,
not the board). Its own address at 0x48 is useless for this -- it does not ACK
there even on a healthy board.
Also fixed, all of which reported success on boards that were not repaired:
- The repair is now re-read and re-verified. A sysfs write to a write
protected or wedged part looks exactly like a successful dd.
- A read that fails with EIO yielded an empty header, which read as "blank" and
sent the board down the repair path to abort later complaining about the
write. Short reads are now rejected up front.
- A base-board ID programmed on hardware with eMMC now aborts. The fix scripts
merge only over 0xFF bytes, so they cannot correct an EEPROM that is fully
but wrongly programmed; running one would have changed nothing and said it
worked.
- [ $OLDNUMHEX != ... ] was unquoted, so an empty read was a syntax error
rather than a branch.
The two sysfs paths in the fix scripts and the four in the checker are
overridable so the failure modes can be exercised against fixtures; nothing in
FPP sets them. Verified on a PocketBeagle2 Industrial: fixtures byte-identical
to real PB2I and PB20 dumps, and the driver-unbind controls reproduce the real
sysfs shape for each MSPM0 fault.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>1 parent b55176e commit 5dea38b
5 files changed
Lines changed: 318 additions & 101 deletions
File tree
- SD
- capes/drivers/bb64
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | 23 | | |
113 | 24 | | |
114 | 25 | | |
115 | | - | |
| 26 | + | |
116 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
117 | 31 | | |
118 | 32 | | |
119 | 33 | | |
| |||
129 | 43 | | |
130 | 44 | | |
131 | 45 | | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
132 | 67 | | |
133 | 68 | | |
134 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
610 | 610 | | |
611 | 611 | | |
612 | 612 | | |
613 | | - | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
614 | 638 | | |
615 | 639 | | |
616 | 640 | | |
| |||
0 commit comments