Skip to content

Commit 32caed5

Browse files
committed
ukify: do not fail if pefile complains about hardcoded 256MB limit
pefile has an hardcoded limit to 256MB per section: erocarrera/pefile#396 When building an initrd with large firmware files and lots of kernel modules, this limit can be reached. Skip over those warnings.
1 parent 9876e88 commit 32caed5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/ukify/ukify.py

+7-1
Original file line numberDiff line numberDiff line change
@@ -953,8 +953,14 @@ def pe_add_sections(opts: UkifyConfig, uki: UKI, output: str) -> None:
953953
)
954954
pe = pefile.PE(data=pe.write(), fast_load=True)
955955

956+
# pefile has an hardcoded limit of 256MB, which is not enough when building an initrd with large firmware
957+
# files and all kernel modules. See: https://github.com/erocarrera/pefile/issues/396
956958
warnings = pe.get_warnings()
957-
if warnings:
959+
for w in warnings:
960+
if 'VirtualSize is extremely large' in w:
961+
continue
962+
if 'VirtualAddress is beyond' in w:
963+
continue
958964
raise PEError(f'pefile warnings treated as errors: {warnings}')
959965

960966
# When attaching signatures we are operating on an existing UKI which might be signed

0 commit comments

Comments
 (0)