Skip to content

Conversation

@3mkusiak
Copy link
Contributor

@3mkusiak 3mkusiak commented Oct 8, 2025

Add PSPTool to HCL report and allow running it on user-supplied firmware binaries.

This commit adds psptool support to HCL reports. The psptool is either
run on dumped firmware if available, but users can also place firmware
binaries from elsewhere in /firmware/external. This is a workaround as
on some platforms flashrom does not work under stock firmware.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@3mdeb.com>
@3mkusiak 3mkusiak requested a review from m-iwanicki October 8, 2025 12:11
@3mkusiak
Copy link
Contributor Author

3mkusiak commented Oct 8, 2025

On implementation

Had to workaround this issue: Dasharo/dasharo-issues#1642

  • logs directory get's removed at the beginning of HCL report, so even copying to /logs would not work.

On repro
The following can be used to download the firmware binary and place it in right place

cd /
if [ ! -d mockup-firmware ]; then
    mkdir mockup-firmware && cd mockup-firmware
    wget https://download.gigabyte.com/FileList/BIOS/mb_bios_MZ33-AR1_R05_F04.zip
    unzip mb_*
    cd - > /dev/null
fi
if [ ! -d /firmware/external ]; then
    mkdir -p /firmware/external
    cp mockup-firmware/SPI_UPD/image.bin /firmware/external/
    cd - > /dev/null
fi
pwd

Logs
No external fw-bin:

Details

Do you want to support Dasharo development by sending us logs with your hardware configuration? [y|n]: n
Logs will be saved in root directory.
Please consider supporting Dasharo by sending the logs next time.
Getting hardware information. It will take a few minutes...
Sound card files are missing!
[###################################################################] 28/28

[OK]            PCI configuration space and topology
[OK]            USB devices and topology
[OK]            Super I/O configuration
[OK]            EC configuration
[ERROR]         MSRs
[OK]            SMBIOS tables
[OK]            BIOS information
[OK]            CMOS NVRAM
[UNKNOWN]       Intel configuration registers
[OK]            GPIO configuration C header files
[OK]            kernel dmesg
[OK]            ACPI tables
[UNKNOWN]       Audio devices configuration
[OK]            CPU info
[OK]            I/O ports
[OK]            Input bus types
[ERROR]         Firmware image
[ERROR]         PSPTool
[OK]            I2C bus
[UNKNOWN]       ACPI tables
[OK]            Touchpad information
[ERROR]         DIMMs information
[UNKNOWN]       CBMEM table information
[UNKNOWN]       CBMEM console
[ERROR]         TPM information
[UNKNOWN]       AMT information
[OK]            ME information
[UNKNOWN]       Graphics VBT

External fw-bin:

Details

Do you want to support Dasharo development by sending us logs with your hardware configuration? [y|n]: n
Logs will be saved in root directory.
Please consider supporting Dasharo by sending the logs next time.
Getting hardware information. It will take a few minutes...
Sound card files are missing!
Firmware dump not found, but found user-supplied external binary.
[###################################################################] 28/28

[OK]            PCI configuration space and topology
[OK]            USB devices and topology
[OK]            Super I/O configuration
[OK]            EC configuration
[ERROR]         MSRs
[OK]            SMBIOS tables
[OK]            BIOS information
[OK]            CMOS NVRAM
[UNKNOWN]       Intel configuration registers
[OK]            GPIO configuration C header files
[OK]            kernel dmesg
[OK]            ACPI tables
[UNKNOWN]       Audio devices configuration
[OK]            CPU info
[OK]            I/O ports
[OK]            Input bus types
[ERROR]         Firmware image
[UNKNOWN]       PSPTool
[OK]            I2C bus
[UNKNOWN]       ACPI tables
[OK]            Touchpad information
[ERROR]         DIMMs information
[UNKNOWN]       CBMEM table information
[UNKNOWN]       CBMEM console
[ERROR]         TPM information
[UNKNOWN]       AMT information
[OK]            ME information
[UNKNOWN]       Graphics VBT

Multiple files at /firmware/external:

Details

Do you want to support Dasharo development by sending us logs with your hardware configuration? [y|n]: n
Logs will be saved in root directory.
Please consider supporting Dasharo by sending the logs next time.
Getting hardware information. It will take a few minutes...
Sound card files are missing!
Multiple files found in /firmware/external! Make sure only a single file is present!
[###################################################################] 28/28

[OK]            PCI configuration space and topology
[OK]            USB devices and topology
[OK]            Super I/O configuration
[OK]            EC configuration
[ERROR]         MSRs
[OK]            SMBIOS tables
[OK]            BIOS information
[OK]            CMOS NVRAM
[UNKNOWN]       Intel configuration registers
[OK]            GPIO configuration C header files
[OK]            kernel dmesg
[OK]            ACPI tables
[UNKNOWN]       Audio devices configuration
[OK]            CPU info
[OK]            I/O ports
[OK]            Input bus types
[ERROR]         Firmware image
[ERROR]         PSPTool
[OK]            I2C bus
[UNKNOWN]       ACPI tables
[OK]            Touchpad information
[ERROR]         DIMMs information
[UNKNOWN]       CBMEM table information
[UNKNOWN]       CBMEM console
[ERROR]         TPM information
[UNKNOWN]       AMT information
[OK]            ME information
[UNKNOWN]       Graphics VBT

--Edit--

The UNKNOWN status is due to the tool printing warnings to sterr

root@DasharoToolsSuite:/mockup-firmware# cat psptool.err.log 
Warning: Input  file is 0x2000000, will assume ROM size of 32M
Warning: Could not verify sha256 checksum for HeaderFile(type=0x42, address=0x179a00, size=0xd030, len(references)=1)
Warning: Could not verify sha256 checksum for HeaderFile(type=0x42, address=0x477c00, size=0xd030, len(references)=1)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x1, address=0x131b000, size=0x30000, len(references)=2)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x30, address=0x10fb100, size=0x88b50, len(references)=1)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x76, address=0x11df600, size=0x4050, len(references)=1)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x9f, address=0x1202c00, size=0x3d40, len(references)=1)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x1, address=0x131b000, size=0x30000, len(references)=2)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x30, address=0x13ff100, size=0x88b50, len(references)=1)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x76, address=0x14e2a00, size=0x4050, len(references)=1)
Warning: Could not verify sha384 checksum for HeaderFile(type=0x9f, address=0x1504b00, siz

...which to me is fine. If UNKNOWN status really bothers us, we should fix it for all checks, not workaround this output imo.

@m-iwanicki
Copy link
Contributor

The UNKNOWN status is due to the tool printing warnings to sterr

Maybe update result based on return value instead? Save stderr to temporary file

if psptool (...); then
    touch logs/psptool.err.log
    update_result "PSPTool" logs/psptool.err.log
    mv tmp_stderrlog logs/psptool.err.log
else
    mv tmp_stderrlog logs/psptool.err.log
    update_result "PSPTool" logs/psptool.err.log
fi

@m-iwanicki
Copy link
Contributor

Nvm, psptool doesn't return errors when passing random non-AMD firmware or even file filled with zeroes (unless it has weird size e.g. 100 MB)

Add note that for psptool to return valid "Success" status in the HCL
report, it must be fixed at sources. Current limitations that cause
"UNKNOWN" status:
* All warnings are directed to sterr
* The tool mostly print warnings, not errors. This includes non-AMD
  binaries or just files full of zeros.
* The tool almos allways returns sucess status code, including the
  situtations described above.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@3mdeb.com>
@3mkusiak
Copy link
Contributor Author

3mkusiak commented Oct 8, 2025

@m-iwanicki added fixme

Store default firmware dump path in a variable. This makes logical
connection on which file flashroom shall create and which file is
actualy used by psptool.

Signed-off-by: Mateusz Kusiak <mateusz.kusiak@3mdeb.com>
@m-iwanicki m-iwanicki merged commit 996a8ea into main Oct 9, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants