summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2023-02-20 14:45:19 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2023-02-20 20:02:22 +0100
commitc87ff622101b82bae7f4c96b59218c7380927375 (patch)
tree416164802deb1eca65a3653de201038613a8ac0a
parentMerge pull request #26508 from poettering/cap-fixes (diff)
downloadsystemd-c87ff622101b82bae7f4c96b59218c7380927375.tar.xz
systemd-c87ff622101b82bae7f4c96b59218c7380927375.zip
ukify: Set fast_load option when parsing PE files
Let's skip parsing of some irrelevant information that we don't use to speed up building UKIs with large initrds from +-15s to less than 1s.
-rwxr-xr-xsrc/ukify/ukify.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/ukify/ukify.py b/src/ukify/ukify.py
index 335de994d8..fc84cd640b 100755
--- a/src/ukify/ukify.py
+++ b/src/ukify/ukify.py
@@ -80,7 +80,7 @@ def path_is_readable(s: typing.Optional[str]) -> typing.Optional[pathlib.Path]:
def pe_next_section_offset(filename):
import pefile
- pe = pefile.PE(filename)
+ pe = pefile.PE(filename, fast_load=True)
section = pe.sections[-1]
return pe.OPTIONAL_HEADER.ImageBase + section.VirtualAddress + section.Misc_VirtualSize
@@ -457,7 +457,7 @@ def pairwise(iterable):
def pe_validate(filename):
import pefile
- pe = pefile.PE(filename)
+ pe = pefile.PE(filename, fast_load=True)
sections = sorted(pe.sections, key=lambda s: (s.VirtualAddress, s.Misc_VirtualSize))