Skip to content

Commit 41ec637

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 6cd6d6b commit 41ec637

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
@@ -954,8 +954,14 @@ def pe_add_sections(opts: UkifyConfig, uki: UKI, output: str) -> None:
954954
)
955955
pe = pefile.PE(data=pe.write(), fast_load=True)
956956

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

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

0 commit comments

Comments
 (0)