Skip to content

Commit 144755f

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 8d01edd commit 144755f

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

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

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

0 commit comments

Comments
 (0)