LongSoft / UEFITool

UEFI firmware image viewer and editor
BSD 2-Clause "Simplified" License
4.43k stars 629 forks source link

[UEFIExtract] Add support for extracting files from ME region #318

Open miczyg1 opened 1 year ago

miczyg1 commented 1 year ago

ME region follows its own rules for its filesystem. It is entirely not related to UEFI spec. However, despite it is not UEFI-compliant, UEFITool can parse it with ease. In some cases it may be beneficial to extract single files from ME region, e.g. extracting PCIe 5.0 FW to integrate it in coreboot builds: https://review.coreboot.org/c/coreboot/+/68987

The goal of such a procedure is to avoid PCIe 5.0 malfunction when ME is disabled, e.g. by setting HAP bit. PCIe 5.0 requires fetching the PCIe 5.0 FW from ME through MEI/HECI during BIOS POST, which will become impossible when ME is disabled. However, including the extracted binary allows to workaround the disabled ME problem and keep PCIe 5.0 functional.

Currently, the firmware extraction is possible via UEFITool GUI, however, it would be beneficial to have a scriptable method of extracting such blobs with UEFIExtract for automation purposes.

NikolajSchlej commented 1 year ago

Indeed, my usual method would be to extract everything and then use find or bgrep, but it's certainly not scalable.

miczyg1 commented 1 year ago

Add UEFIExtract console UI command to extract an item with a given 'Name' and/or 'Text'.

it could even be a path if it is nested... However, this would make the whole command too long. Names can sometimes be duplicated inside one image.