Skip to content

Commit 1ae5bb7

Browse files
krystian-hebelmacpijan
authored andcommitted
devnotes/porting.md: add section about testing without flashing
Signed-off-by: Krystian Hebel <[email protected]>
1 parent 2e42555 commit 1ae5bb7

File tree

1 file changed

+68
-0
lines changed

1 file changed

+68
-0
lines changed

Diff for: devnotes/porting.md

+68
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,74 @@ ID=31 BOOTKERNFW 0x03e10000..0x03ff0000 (actual=0x001e0000) [---P------]
275275
ID=32 BACKUP_PART 0x03ff7000..0x03fff000 (actual=0x00000000) [----RB----]
276276
```
277277

278+
### Testing firmware images without flashing
279+
280+
It is possible to test new firmware images without flashing the physical flash
281+
device. This makes testing and switching between two versions (e.g. Hostboot and
282+
coreboot) much faster and safer. There are two ways of doing so, one is
283+
described on [Raptor's wiki](https://wiki.raptorcs.com/wiki/Compiling_Firmware#Running_the_firmware_temporarily)
284+
and requires starting `mboxd` manually, the second one is described below.
285+
v2.00+ BMC firmware requirement still applies.
286+
287+
First, read original flash. For earlier versions it is required to read from
288+
system that booted at least once, since some of the partitions are modified on
289+
the first boot.
290+
291+
```shell
292+
root@talos:~# pflash -r /tmp/talos.pnor
293+
```
294+
295+
> Keep in mind that tmpfs size is limited and exceeding that limit may result in
296+
> unresponsive BMC, which in most severe cases requires hard power cycle.
297+
298+
Next step is "flashing" modified partition, which is similar to flashing real
299+
device with two changes: no need to erase the flash and target file must be
300+
specified. New command looks like this:
301+
302+
```shell
303+
root@talos:~# pflash -P <partition> -p <partition>.bin -F /tmp/talos.pnor
304+
```
305+
306+
> `pflash` can emulate `-e` option when "flashing" to file, but this is not
307+
> required. It only wastes time, as the emulated erase is even slower than the
308+
> real one.
309+
310+
To mount the file as flash device one has to use (on powered down platform):
311+
312+
```shell
313+
root@talos:~# mboxctl --backend file:/tmp/flash.pnor
314+
```
315+
316+
> Partitions can be "flashed" while the file is mounted, as long as host
317+
> platform doesn't try to access it simultaneously.
318+
319+
Optionally, success can be tested with:
320+
321+
```shell
322+
root@talos:~# mboxctl --lpc-state
323+
LPC Bus Maps: BMC Memory
324+
```
325+
326+
`BMC Memory` tells that emulated flash is used instead of real one. Host doesn't
327+
see any difference (except maybe different access times), it still reads and
328+
writes PNOR the same way as with physical device.
329+
330+
To get back to real PNOR one has to use:
331+
332+
```shell
333+
root@talos:~# mboxctl --backend vpnor
334+
Failed to post message: Connection timed out
335+
root@talos:~# mboxctl --lpc-state
336+
LPC Bus Maps: Flash Device
337+
```
338+
339+
Even though that command reports failure, it maps LPC back to flash device. This
340+
can be tested with `mboxctl --lpc-state`.
341+
342+
> There is `mboxctl --point-to-flash` command that is supposed to revert to the
343+
> original mapping, but it doesn't seem to work, neither does `--resume clean`
344+
> nor `--reset`.
345+
278346
## Building OpenPOWER firmware
279347

280348
Sometimes it may be necessary to modify the core OpenPOWER firmware. The easiest

0 commit comments

Comments
 (0)