Dasharo / osfv-scripts

Various scripts (not tests) more or leess related to the Dasharo Open Source Firmware Validation ecosystem
MIT License
0 stars 0 forks source link

Confusing output while doing flash write on apu2 #41

Open pietrushnic opened 3 months ago

pietrushnic commented 3 months ago
% osfv_cli rte --rte_ip 192.168.10.172 flash write --rom apu2_v24.05.00.01.rom
DUT model retrieved from snipeit: APU2
Writing apu2_v24.05.00.01.rom to flash...
Executing command: flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=16000 -c W25Q64JV-.Q -w /tmp/write.rom
flashrom v1.3.0 on Linux 5.4.69 (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).

No EEPROM/flash device found.
Note: flashrom can never write if the flash chip isn't found automatically.

Flash written
SergiiDmytruk commented 3 months ago

This looks like a duplicate of #15.

pietrushnic commented 3 months ago

This is a different problem. What I'm reporting here is not that it didn't flash but that it reports the confusing status Flash written despite the fact that it was not written because of bug #15. Of course, the correct implementation of #15 could solve this issue, but it does not guarantee it. We essentially should test against output for the cases for both successful and unsuccessful outcomes of the tool while flashing.

macpijan commented 3 months ago

We always print it no matter what the result was: https://github.com/Dasharo/osfv-scripts/blob/main/osfv_cli/osfv_cli/osfv_cli.py#L253

Should be an easy fix to pass (return) flashing result from the library to the CLI.

JanPrusinowski commented 2 months ago

This issue still occurs when flash device is not found:

osfv_cli rte --rte_ip 192.168.10.110 flash write --rom /home/janprusinowski/Downloads/protectli_vp66xx_v0.9.0-rc5.rom
DUT model retrieved from snipeit: VP6670
Writing /home/janprusinowski/Downloads/protectli_vp66xx_v0.9.0-rc5.rom to flash...
Executing command: flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=16000 -c MX25L12833F/MX25L12835F/MX25L12845E/MX25L12865E/MX25L12873F -w /tmp/write.rom
flashrom v1.3.0 on Linux 5.4.69 (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).

No EEPROM/flash device found.
Note: flashrom can never write if the flash chip isn't found automatically.

Flash written
SebastianCzapla commented 1 week ago

https://github.com/Dasharo/osfv-scripts/pull/62

Added PR which makes the script respect flashrom's return code. Here's an example of failure when provided with invalid ROM size.

(venv) sczapla in ~/Dasharo/osfv-scripts/osfv_cli on fix_flashing_messages λ osfv_cli rte --rte_ip 192.168.10.225 flash write --rom /home/sczapla/Dasharo/coreboot/xad
DUT model retrieved from snipeit: Optiplex 7010
Using rte command is invasive action, checking first if the device is not used...
Asset 105 is already checked out by you
Writing /home/sczapla/Dasharo/coreboot/xad to flash...
Executing command: flashrom -p linux_spi:dev=/dev/spidev1.0,spispeed=16000 -c MX25L3205D/MX25L3208D -w /tmp/write.rom
flashrom v1.3.0 on Linux 5.4.69 (armv7l)
flashrom is free software, get the source code at https://flashrom.org

Using clock_gettime for delay loops (clk_id: 1, resolution: 1ns).
Found Macronix flash chip "MX25L3205D/MX25L3208D" (4096 kB, SPI) on linux_spi.
===
This flash part has status UNTESTED for operations: WP
The test status of this chip may have been updated in the latest development
version of flashrom. If you are running the latest development version,
please email a report to flashrom@flashrom.org if any of the above operations
work correctly for you with this flash chip. Please include the flashrom log
file for all operations you tested (see the man page for details), and mention
which mainboard or programmer you tested in the subject line.
Thanks for your help!
Error: Image size (8388608 B) doesn't match the expected size (4194304 B)!
Flash write failed with code 1
Since the asset 105 has been checkout manually by you prior running this script, it will NOT be checked in automatically. Please return the device when work is finished.