Skip to content

Commit

Permalink
Add Qualcomm XBL support (#115)
Browse files Browse the repository at this point in the history
Co-authored-by: Dil4rd <[email protected]>
  • Loading branch information
Dil4rd and Dil4rd authored Jan 2, 2023
1 parent c7d30aa commit 72a6258
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 6 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,4 @@ or extraction from the distribution update mechanism (typically a PE).
- MSI
- VMware
- Apple
- Qualcomm
2 changes: 2 additions & 0 deletions uefi_firmware/guids/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from . import efiguids_dell
from . import efiguids_lenovo
from . import efiguids_asrock
from . import efiguids_qualcomm

from ..utils import aguid

Expand All @@ -12,6 +13,7 @@
efiguids_dell.GUIDs,
efiguids_lenovo.GUIDs,
efiguids_asrock.GUIDs,
efiguids_qualcomm.GUIDS,
]


Expand Down
8 changes: 8 additions & 0 deletions uefi_firmware/guids/efiguids_qualcomm.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
"""
efiguids_qualcomm.py
"""

GUIDS = {
'QC_ZLIB_CUSTOM_DECOMPRESS_GUID': [0x1d301fe9, 0xbe79, 0x4353, 0x91, 0xc2, 0xd2, 0x3b, 0xc9, 0x59, 0xae, 0x0c],
}
11 changes: 6 additions & 5 deletions uefi_firmware/structs/uefi_structs.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,13 @@
]

FIRMWARE_GUIDED_GUIDS = {
"LZMA_COMPRESSED": "ee4e5898-3914-4259-9d6e-dc7bd79403cf",
"LZMA_COMPRESSED": "ee4e5898-3914-4259-9d6e-dc7bd79403cf",
"LZMA_COMPRESSED_HP": "0ed85e23-f253-413f-a03c-901987b04397",
"TIANO_COMPRESSED": "a31280ad-481e-41b6-95e8-127f4c984779",
"FIRMWARE_VOLUME": "24400798-3807-4a42-b413-a1ecee205dd8",
#"VOLUME_SECTION": "367ae684-335d-4671-a16d-899dbfea6b88",
"STATIC_GUID": "fc1bcdb0-7d31-49aa-936a-a4600d9dd083"
"TIANO_COMPRESSED": "a31280ad-481e-41b6-95e8-127f4c984779",
"FIRMWARE_VOLUME": "24400798-3807-4a42-b413-a1ecee205dd8",
#"VOLUME_SECTION": "367ae684-335d-4671-a16d-899dbfea6b88",
"STATIC_GUID": "fc1bcdb0-7d31-49aa-936a-a4600d9dd083",
"ZLIB_COMPRESSED_QC": "1d301fe9-be79-4353-91c2-d23bc959ae0c"
}

FIRMWARE_FREEFORM_GUIDS = {
Expand Down
16 changes: 15 additions & 1 deletion uefi_firmware/uefi.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import struct
import logging
import zlib

from .base import FirmwareObject, StructuredObject, RawObject, AutoRawObject
from .utils import *
Expand Down Expand Up @@ -631,8 +632,21 @@ def decompress_guid(alg):
status = True
if sguid(self.guid) in [FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED"], FIRMWARE_GUIDED_GUIDS["LZMA_COMPRESSED_HP"]]:
status = decompress_guid(efi_compressor.LzmaDecompress)
if sguid(self.guid) == FIRMWARE_GUIDED_GUIDS["TIANO_COMPRESSED"]:
elif sguid(self.guid) == FIRMWARE_GUIDED_GUIDS["TIANO_COMPRESSED"]:
status = decompress_guid(efi_compressor.TianoDecompress)
elif sguid(self.guid) == FIRMWARE_GUIDED_GUIDS["ZLIB_COMPRESSED_QC"]:
try:
data = zlib.decompress(self.preamble + self.data, 31)
if data is not None:
self.subtype = 0
self.data = data
self.process_subsections()
else:
status = False
dlog(self, sguid(self.guid), 'error, empty zlib decompress')
except zlib.error as err:
status = False
dlog(self, sguid(self.guid), 'zlib error: ' + str(err))
# Todo: check for processing required attribute
elif sguid(self.guid) == FIRMWARE_GUIDED_GUIDS["STATIC_GUID"]:
# Todo: verify this (FirmwareFile hack)
Expand Down

0 comments on commit 72a6258

Please sign in to comment.