imagefv-extractor 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,18 @@
1
+ """Extract bootloader and charging images from imagefv firmware blobs"""
2
+
3
+ # Extract bootloader/charging pictures from imagefv blobs
4
+ # Copyright (C) 2026 chkndrp
5
+ #
6
+ # This library is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation; either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+
16
+ from .extract import extract_images
17
+
18
+ __all__ = ["extract_images"]
@@ -0,0 +1,19 @@
1
+ """Extract bootloader and charging images from imagefv firmware blobs"""
2
+
3
+ # Extract bootloader/charging pictures from imagefv blobs
4
+ # Copyright (C) 2026 chkndrp
5
+ #
6
+ # This library is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation; either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+
16
+ from .cli import main
17
+
18
+ if __name__ == "__main__":
19
+ raise SystemExit(main())
@@ -0,0 +1,93 @@
1
+ """CLI interface"""
2
+
3
+ # Extract bootloader/charging pictures from imagefv blobs
4
+ # Copyright (C) 2026 chkndrp
5
+ #
6
+ # This library is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation; either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+
16
+ import argparse
17
+ import logging
18
+
19
+ from collections.abc import Sequence
20
+ from pathlib import Path
21
+ from .extract import extract_images
22
+
23
+ logger = logging.getLogger("imagefv-extractor")
24
+
25
+
26
+ class _PrefixFormatter(logging.Formatter):
27
+ def format(self, record: logging.LogRecord) -> str:
28
+ return f"(x) {super().format(record)}"
29
+
30
+
31
+ def _configure_logging(verbose: bool) -> None:
32
+ logger.setLevel(logging.DEBUG if verbose else logging.INFO)
33
+ logger.propagate = False
34
+
35
+ if not logger.handlers:
36
+ handler = logging.StreamHandler()
37
+ handler.setFormatter(_PrefixFormatter("%(message)s"))
38
+ logger.addHandler(handler)
39
+
40
+
41
+ def main(argv: Sequence[str] | None = None) -> int:
42
+ """CLI main entry"""
43
+
44
+ parser = argparse.ArgumentParser(
45
+ description="Extract bootloader/charging pictures from imagefv blobs",
46
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter,
47
+ )
48
+ parser.add_argument(
49
+ "input",
50
+ nargs="+",
51
+ help="Input file(s) to process"
52
+ )
53
+ parser.add_argument(
54
+ "-o", "--output",
55
+ default="extracted_images",
56
+ help="Output directory",
57
+ )
58
+ parser.add_argument(
59
+ "-v", "--verbose",
60
+ action="store_true",
61
+ help="Enable verbose logging",
62
+ )
63
+ args = parser.parse_args(argv)
64
+
65
+ _configure_logging(args.verbose)
66
+
67
+ failed = False
68
+ for input_file in args.input:
69
+ logger.info("Processing: %s", input_file)
70
+ logger.info("Output directory: %s", args.output)
71
+
72
+ output_dir = Path(args.output)
73
+ if len(args.input) > 1:
74
+ output_dir /= Path(input_file).stem
75
+
76
+ try:
77
+ extracted_files = extract_images(input_file, output_dir)
78
+ except OSError as error:
79
+ logger.error("Could not prepare output for %s: %s", input_file, error)
80
+ failed = True
81
+ continue
82
+
83
+ if extracted_files:
84
+ logger.info(
85
+ "Successfully extracted %d item(s)",
86
+ len(extracted_files),
87
+ )
88
+ else:
89
+ logger.error("Failed to extract images from %s", input_file)
90
+ failed = True
91
+
92
+ logger.info("Extraction complete!")
93
+ return int(failed)
@@ -0,0 +1,348 @@
1
+ """Main entry"""
2
+
3
+ # Extract bootloader/charging pictures from imagefv blobs
4
+ # Copyright (C) 2026 chkndrp
5
+ #
6
+ # This library is free software; you can redistribute it and/or modify it
7
+ # under the terms of the GNU Lesser General Public License as published by
8
+ # the Free Software Foundation; either version 3 of the License, or
9
+ # (at your option) any later version.
10
+ #
11
+ # This library is distributed in the hope that it will be useful,
12
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ # GNU Lesser General Public License for more details.
15
+
16
+ import contextlib
17
+ import gzip
18
+ import tempfile
19
+ import shutil
20
+ import logging
21
+ import io
22
+
23
+ from pathlib import Path
24
+ from uefi_firmware.uefi import FirmwareVolume
25
+ from uefi_firmware.utils import search_firmware_volumes
26
+
27
+ logger = logging.getLogger("imagefv-extractor")
28
+
29
+
30
+ def _get_file_extension(header: bytes) -> str:
31
+ """Determine file extension from magic bytes"""
32
+
33
+ magic_map = {
34
+ b"\x7fELF": "elf",
35
+ b"\x1f\x8b": "gz",
36
+ b"BM": "bmp",
37
+ b"\x89PNG": "png",
38
+ b"GIF": "gif",
39
+ b"PK\x03\x04": "zip",
40
+ b"BZh": "bz2",
41
+ b"<?xml": "xml",
42
+ b"<": "xml",
43
+ }
44
+
45
+ for magic, ext in magic_map.items():
46
+ if header.startswith(magic):
47
+ return ext
48
+
49
+ if header[:4] in {b"\xff\xd8\xff\xe0", b"\xff\xd8\xff\xe1"}:
50
+ return "jpg"
51
+
52
+ return "bin"
53
+
54
+
55
+ def _extract_gzip_stream(data: bytes, output_path: Path) -> bool:
56
+ """Extract gzip data efficiently"""
57
+
58
+ try:
59
+ with gzip.GzipFile(fileobj=io.BytesIO(data)) as gzfile:
60
+ with open(output_path, "wb") as out:
61
+ shutil.copyfileobj(gzfile, out, length=1024*1024)
62
+
63
+ return True
64
+ except OSError as e:
65
+ logger.warning("Failed to decompress gzip: %s", e)
66
+ return False
67
+
68
+
69
+ def _extract_gzip_bounded(data: bytes, start_offset: int,
70
+ next_offset: int | None, output_path: Path) -> bool:
71
+ """Extract single gzip stream bounded by next gzip header"""
72
+
73
+ try:
74
+ gzip_data = data[start_offset:next_offset] if next_offset else data[start_offset:]
75
+
76
+ with gzip.GzipFile(fileobj=io.BytesIO(gzip_data)) as gzfile:
77
+ extracted = gzfile.read()
78
+
79
+ if extracted:
80
+ with open(output_path, "wb") as out:
81
+ out.write(extracted)
82
+
83
+ return True
84
+ except (OSError, EOFError) as e:
85
+ logger.debug("Failed to extract gzip at offset 0x%x: %s", start_offset, e)
86
+
87
+ return False
88
+
89
+
90
+ def _extract_and_rename_archive(section_data: bytes, offset: int,
91
+ next_offset: int | None, output_path: Path, idx: int) -> str | None:
92
+ """Extract and rename archive with proper extension"""
93
+
94
+ if not _extract_gzip_bounded(section_data, offset, next_offset, output_path):
95
+ return None
96
+
97
+ try:
98
+ size = output_path.stat().st_size
99
+
100
+ with open(output_path, "rb") as archive_file:
101
+ header = archive_file.read(4)
102
+
103
+ ext = _get_file_extension(header)
104
+ better_path = output_path.parent / f"archive_{idx:04d}.{ext}"
105
+ output_path.rename(better_path)
106
+
107
+ logger.info(
108
+ "Extracted archive %3d at offset 0x%08x -> %s (%.1f MB)",
109
+ idx,
110
+ offset,
111
+ better_path.name,
112
+ size / 1024 / 1024,
113
+ )
114
+ return str(better_path)
115
+ except OSError as e:
116
+ logger.error("Failed to rename archive at offset 0x%x: %s", offset, e)
117
+ return None
118
+
119
+
120
+ def _find_gzip_offsets(data: bytes) -> list[int]:
121
+ """Find all gzip stream offsets by scanning for magic bytes"""
122
+
123
+ return [
124
+ offset
125
+ for offset in range(len(data) - 1)
126
+ if data[offset:offset + 2] == b"\x1f\x8b"
127
+ ]
128
+
129
+
130
+ def _extract_file_label(parent_dir: Path) -> str | None:
131
+ """Extract file label from UI section if available"""
132
+
133
+ ui_file = parent_dir / "section0.ui"
134
+ if not ui_file.exists():
135
+ return None
136
+
137
+ try:
138
+ with open(ui_file, "rb") as ui_data_file:
139
+ ui_data = ui_data_file.read()
140
+
141
+ if len(ui_data) > 2:
142
+ decoded = ui_data.decode("utf-16-le", errors="ignore")
143
+ file_label = decoded.split("\x00")[0].strip()
144
+
145
+ if file_label and len(file_label) > 1:
146
+ return file_label
147
+
148
+ except (OSError, UnicodeDecodeError) as e:
149
+ logger.debug("Could not extract label from %s: %s", ui_file, e)
150
+
151
+ return None
152
+
153
+
154
+ def _process_large_binary_section(file_label: str, section_data: bytes,
155
+ output_subdir: Path, extracted_files: dict[str, str]) -> int:
156
+ """Process large binary sections with multiple gzip archives"""
157
+
158
+ raw_path = output_subdir / file_label
159
+ output_subdir.mkdir(parents=True, exist_ok=True)
160
+
161
+ try:
162
+ with open(raw_path, "wb") as section_file:
163
+ section_file.write(section_data)
164
+
165
+ logger.info("Saved: %s (%d bytes)", file_label, len(section_data))
166
+ extracted_files[f"{file_label}_raw"] = str(raw_path)
167
+ except OSError as e:
168
+ logger.error("Failed to save %s: %s", file_label, e)
169
+ return 0
170
+
171
+ gzip_offsets = _find_gzip_offsets(section_data)
172
+ logger.info("Found %d gzip stream(s) in %s", len(gzip_offsets), file_label)
173
+
174
+ if not gzip_offsets:
175
+ return 0
176
+
177
+ archives_dir = output_subdir / "images"
178
+ archives_dir.mkdir(parents=True, exist_ok=True)
179
+
180
+ extracted_count = 0
181
+ for idx, offset in enumerate(gzip_offsets):
182
+ next_offset = gzip_offsets[idx + 1] if idx + 1 < len(gzip_offsets) else None
183
+ output_path = archives_dir / f"archive_{idx:04d}.bin"
184
+ extracted_path = _extract_and_rename_archive(
185
+ section_data,
186
+ offset,
187
+ next_offset,
188
+ output_path,
189
+ idx,
190
+ )
191
+ if not extracted_path:
192
+ logger.debug("Could not extract gzip at offset 0x%x", offset)
193
+ else:
194
+ extracted_files[f"{file_label}_archive_{idx}"] = extracted_path
195
+ extracted_count += 1
196
+
197
+ logger.info("Successfully extracted %d archive(s) from %s", extracted_count, file_label)
198
+ return extracted_count
199
+
200
+
201
+ def _extract_from_section(file_label: str, section_data: bytes, output_subdir: Path,
202
+ output_dir: Path, extracted_files: dict[str, str]) -> str | None:
203
+ """Extract images from firmware file section"""
204
+
205
+ if file_label.endswith(".bmp") or len(section_data) < 1024*1024:
206
+ output_path = output_dir / file_label
207
+ try:
208
+ with open(output_path, "wb") as output_file:
209
+ output_file.write(section_data)
210
+
211
+ logger.info("Extracted: %s (%d bytes)", file_label, len(section_data))
212
+ return str(output_path)
213
+ except OSError as e:
214
+ logger.error("Failed to save %s: %s", file_label, e)
215
+ return None
216
+
217
+ output_subdir.mkdir(parents=True, exist_ok=True)
218
+
219
+ if len(section_data) >= 2 and section_data[0:2] == b"\x1f\x8b":
220
+ extracted_path = output_subdir / f"{file_label}.extracted"
221
+
222
+ logger.info("Detected gzip compression in %s", file_label)
223
+
224
+ if _extract_gzip_stream(section_data, extracted_path):
225
+ size = extracted_path.stat().st_size
226
+ logger.info("Extracted: %s (gzip) -> %s (%d bytes)", file_label, extracted_path.name, size)
227
+ return str(extracted_path)
228
+
229
+ if len(section_data) > 1024*1024:
230
+ gzip_offsets = _find_gzip_offsets(section_data)
231
+
232
+ if len(gzip_offsets) > 1:
233
+ logger.info("Detected multiple gzip streams in %s, extracting all...", file_label)
234
+ _process_large_binary_section(file_label, section_data, output_subdir, extracted_files)
235
+ return str(output_subdir / file_label)
236
+
237
+ output_path = output_subdir / file_label
238
+ try:
239
+ with open(output_path, "wb") as output_file:
240
+ output_file.write(section_data)
241
+
242
+ logger.info("Extracted: %s (raw) (%d bytes)", file_label, len(section_data))
243
+ return str(output_path)
244
+ except OSError as e:
245
+ logger.error("Failed to save %s: %s", file_label, e)
246
+ return None
247
+
248
+
249
+ def _process_raw_files(dump_dir: Path, output_dir: Path, extracted_files: dict[str, str]) -> None:
250
+ """Find and process .raw files from dump directory"""
251
+
252
+ for raw_file in dump_dir.rglob("*.raw"):
253
+ try:
254
+ parent_dir = raw_file.parent.name
255
+
256
+ if not parent_dir.startswith("file-"):
257
+ continue
258
+
259
+ file_label = _extract_file_label(raw_file.parent)
260
+
261
+ if not file_label or len(file_label) <= 1:
262
+ file_label = parent_dir[5:].lower()
263
+
264
+ with open(raw_file, "rb") as raw_data_file:
265
+ section_data = raw_data_file.read()
266
+
267
+ output_subdir = output_dir / file_label
268
+ extracted = _extract_from_section(
269
+ file_label,
270
+ section_data,
271
+ output_subdir,
272
+ output_dir,
273
+ extracted_files,
274
+ )
275
+
276
+ if extracted:
277
+ extracted_files[file_label] = extracted
278
+ except OSError as e:
279
+ logger.warning("Error processing %s: %s", raw_file, e)
280
+
281
+
282
+ def extract_images(firmware_file: str | Path, output_dir: str | Path = "extracted_images") -> dict[str, str]:
283
+ """
284
+ Extract images from a firmware file and return their labels and paths
285
+
286
+ :param firmware_file: Path to the imagefv firmware image
287
+ :type firmware_file: str | pathlib.Path
288
+
289
+ :param output_dir: Directory where extracted files will be written
290
+ :type output_dir: str | pathlib.Path
291
+
292
+ :returns: A mapping from extracted image labels to output paths. The mapping is
293
+ empty when no images were extracted
294
+ :rtype: dict[str, str]
295
+ :raises OSError: If the output directory cannot be created
296
+ """
297
+
298
+ output_dir = Path(output_dir)
299
+ output_dir.mkdir(parents=True, exist_ok=True)
300
+ extracted_files: dict[str, str] = {}
301
+ firmware_file = Path(firmware_file)
302
+
303
+ if not firmware_file.exists():
304
+ logger.error("File not found: %s", firmware_file)
305
+ return extracted_files
306
+
307
+ try:
308
+ with firmware_file.open("rb") as elf_data_file:
309
+ data = elf_data_file.read()
310
+
311
+ volumes = search_firmware_volumes(data)
312
+
313
+ if not volumes:
314
+ logger.error("No UEFI firmware volumes found in file")
315
+ return extracted_files
316
+
317
+ logger.info("Found %d firmware volume(s)", len(volumes))
318
+
319
+ with tempfile.TemporaryDirectory() as tmpdir:
320
+ tmpdir_path = Path(tmpdir)
321
+
322
+ for offset in volumes:
323
+ logger.info("Processing FV at offset: 0x%x", offset)
324
+ try:
325
+ fv = FirmwareVolume(
326
+ data[offset-40:],
327
+ name=f"0x{offset-40:x}"
328
+ )
329
+
330
+ if fv.valid_header:
331
+ logger.info("FV Size: %d bytes", fv.size)
332
+
333
+ if fv.process():
334
+ logger.info("FV processed successfully, dumping files...")
335
+ with contextlib.redirect_stdout(io.StringIO()):
336
+ fv.dump(str(tmpdir_path))
337
+ _process_raw_files(tmpdir_path, output_dir, extracted_files)
338
+ else:
339
+ logger.warning("Failed to process FV at 0x%x", offset)
340
+ else:
341
+ logger.debug("Invalid FV header at offset 0x%x", offset)
342
+ except OSError as e:
343
+ logger.warning("Error processing FV at offset 0x%x: %s", offset, e)
344
+
345
+ except OSError as e:
346
+ logger.error("Error processing ELF: %s", e)
347
+
348
+ return extracted_files
File without changes
@@ -0,0 +1,156 @@
1
+ Metadata-Version: 2.4
2
+ Name: imagefv-extractor
3
+ Version: 1.0.0
4
+ Summary: Extract bootloader and charging images from imagefv firmware blobs
5
+ Author-email: chkndrp <chkndrp@gmail.com>
6
+ License-Expression: LGPL-3.0
7
+ Project-URL: Repository, https://github.com/chkndrp/imagefv-extractor
8
+ Project-URL: Issues, https://github.com/chkndrp/imagefv-extractor/issues
9
+ Project-URL: Changelog, https://github.com/chkndrp/imagefv-extractor/blob/master/CHANGELOG.md
10
+ Project-URL: Homepage, https://github.com/chkndrp/imagefv-extractor/blob/master/README.md
11
+ Keywords: android,firmware,imagefv,qcom,qualcomm,uefi,extractor,bootloader
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Development Status :: 5 - Production/Stable
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: End Users/Desktop
16
+ Classifier: Operating System :: OS Independent
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Classifier: Topic :: Utilities
19
+ Classifier: Environment :: Console
20
+ Classifier: Typing :: Typed
21
+ Requires-Python: >=3.10
22
+ Description-Content-Type: text/markdown
23
+ License-File: LICENSE
24
+ Requires-Dist: uefi_firmware==1.16
25
+ Provides-Extra: dev
26
+ Requires-Dist: pylint>=4.1.3; extra == "dev"
27
+ Dynamic: license-file
28
+
29
+ # imagefv-extractor
30
+ ![PyPI - Version](https://img.shields.io/pypi/v/imagefv-extractor?logo=python&logoColor=white) ![PyPI - Downloads](https://img.shields.io/pypi/dm/imagefv-extractor?logo=python&logoColor=white) ![PyPI - Typing](https://img.shields.io/pypi/types/imagefv-extractor?logo=python&logoColor=white)
31
+
32
+ Extract bootloader/charging pictures from `imagefv` blobs
33
+
34
+ ---
35
+
36
+ ## Install
37
+ ```shell
38
+ # With PyPi (recommended)
39
+ pip install fastboot_oem_extractor
40
+ ```
41
+
42
+ ```shell
43
+ # When running from source/clone
44
+ pip install -r requirements.txt
45
+ ```
46
+
47
+ ---
48
+
49
+ ## Using as a CLI tool:
50
+ ```
51
+ usage: extractor.py [-h] [-o OUTPUT] [-v] input [input ...]
52
+
53
+ Extract bootloader/charging pictures from imagefv blobs
54
+
55
+ positional arguments:
56
+ input Input file(s) to process
57
+
58
+ options:
59
+ -h, --help show this help message and exit
60
+ -o, --output OUTPUT Output directory (default: extracted_images)
61
+ -v, --verbose Enable verbose logging (default: False)
62
+ ```
63
+
64
+ 1. Prepare an `imagefv` blob from firmware or pull it from a device via `adb`, then run:
65
+ 2. Run the CLI against the image
66
+
67
+ ```shell
68
+ # PyPi
69
+ python -m imagefv_extractor ./imagefv.bin
70
+ ```
71
+
72
+ ```shell
73
+ # Source/clone
74
+ python ./extractor.py ./imagefv.bin
75
+ ```
76
+
77
+ ---
78
+
79
+ ## Using as a Python library
80
+
81
+ This project can also be used as a library for other tools that want to integrate this.
82
+ There is one public function:
83
+
84
+ ```python
85
+ extract_images(firmware_file, output_dir="extracted_images") -> dict[str, str]
86
+ ```
87
+
88
+ - `firmware_file` (`str | pathlib.Path`): Path to the imagefv firmware image.
89
+ - `output_dir` (`str | pathlib.Path`): Directory where extracted files will be written. Defaults to `"extracted_images"`.
90
+ - **Returns:**
91
+ - A mapping of extracted image labels to their output paths.
92
+ - An empty mapping if the input is unrecognized or no images are extracted.
93
+ - **Raises:** `OSError` if the output directory cannot be created.
94
+
95
+ **Quick example:**
96
+ ```python
97
+ # from pathlib import Path
98
+ from imagefv_extractor import extract_images
99
+
100
+ # extracted = extract_images(
101
+ # Path("./imagefv.elf"),
102
+ # output_dir=Path("./extracted_images"),
103
+ # )
104
+
105
+ extracted = extract_images(
106
+ "./imagefv.elf",
107
+ output_dir="./extracted_images",
108
+ )
109
+
110
+ for label, path in extracted.items():
111
+ print(f"{label}: {path}")
112
+ # Example output:
113
+ # logo.img_raw: extracted_images/logo.img/logo.img
114
+ # logo.img_archive_0: extracted_images/logo.img/images/archive_0000.bmp
115
+ # ...
116
+ ```
117
+
118
+ ## How it works:
119
+ 1. The script scans the input file for `UEFI` structures using the `uefi-firmware` package
120
+ 2. If it finds them, it dumps all files/sections to a temporary directory
121
+ 3. Then it identifies the dumped files for known types (defined in `magic_map` struct) and organizes them
122
+ 4. And also if found, any files containing GZip archives (most commonly `logo.img`) are extracted
123
+
124
+ ## Is it possible to repackage it, and create custom splashes?
125
+ During investigation, i have noticed the `imagefv` blob contains some CoT certificates,
126
+ so it is absolutely possible that this partition is verified during the `XBL` phase,
127
+ causing the device not to boot if it is altered.
128
+
129
+ ```
130
+ DECIMAL HEXADECIMAL DESCRIPTION
131
+ --------------------------------------------------------------------------------
132
+ 0 0x0 ELF, 32-bit LSB executable, ARM, version 1 (SYSV)
133
+ 4096 0x1000 UEFI PI Firmware Volume, volume size: 6291456, header size: 0, revision: 0, EFI Firmware File System v2, GUID: 8C8CE578-8A3D-4F1C-3599-896185C32DD3
134
+ 4216 0x1078 LZMA compressed data, properties: 0x5D, dictionary size: 16777216 bytes, uncompressed size: 7237640 bytes
135
+ 6296088 0x601218 Certificate in DER format (x509 v3), header length: 4, sequence length: 596
136
+ 6296688 0x601470 Certificate in DER format (x509 v3), header length: 4, sequence length: 685
137
+ 6297377 0x601721 Certificate in DER format (x509 v3), header length: 4, sequence length: 720
138
+ ```
139
+
140
+ I also couldn't find any open-source (re)packaging tools for it either, so one would need to be created. However i'm not risking a hard-brick.
141
+
142
+ Here are some references to it being loaded on `xiaomi-amethyst` during `ABL` phase:
143
+ ```
144
+ GetAdjustLogoIndexpDisplayInfo->uDisplayWidth 1220: 2712, country_info = 1, uLogoIndex = 0, realLogoIndex = 128!
145
+ Display_Utils_RenderSplashScreen: load imagefv name is: logo.img
146
+ LoadCompressedImageFromLogoData: Setvariable Logo Image returned eStatus: Success, LogoMagic: LOGO!!!
147
+ LoadCompressedImageFromLogoData: LogoCompressedBlockNum:9 LogoCompressedBytesNum:35458
148
+ Display_Utils_RenderSplashScreen: CompressedData size is: 35458 logo index = 128
149
+ DeCompressLogoData: DecompressBufferSize:9925976 ScratchSize:131072
150
+ DeCompressLogoData: logo decompress done, use time: 19ms
151
+ Display_Utils_RenderSplashScreen: OEM Logo Successfully Loaded
152
+ ```
153
+
154
+ ## Requirements
155
+ - Python 3.10 or newer
156
+ - Installed `uefi_firmware` pip package
@@ -0,0 +1,11 @@
1
+ imagefv_extractor/__init__.py,sha256=ocQIplUaD6Sidc6JgueYBcOBYvw1I5dbETGG3lDAmtk,736
2
+ imagefv_extractor/__main__.py,sha256=vraD2W7ECfCMPXQ7bwwIk4aBQRQsz9IWSP_Hp8flnXY,749
3
+ imagefv_extractor/cli.py,sha256=eS6lBZ2OMIbIAwTAj4jkafkYHJ4YrpeN4KdVPTLEcaI,2816
4
+ imagefv_extractor/extract.py,sha256=r7XwXkDFTLeeJQMF_WD7Qbl_1hpffjwzSKPtckUEcBE,11675
5
+ imagefv_extractor/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ imagefv_extractor-1.0.0.dist-info/licenses/LICENSE,sha256=46mU2C5kSwOnkqkw9XQAJlhBL2JAf1_uCD8lVcXyMRg,7652
7
+ imagefv_extractor-1.0.0.dist-info/METADATA,sha256=RbksG0xnRK1L1IEJIgV6oznmzJv4749sB8mR5iSTDQ8,6131
8
+ imagefv_extractor-1.0.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
9
+ imagefv_extractor-1.0.0.dist-info/entry_points.txt,sha256=pomdGeQJgolEA6PLZtOPq-i4pOcpdvf76BVXBl2s5hg,65
10
+ imagefv_extractor-1.0.0.dist-info/top_level.txt,sha256=pnDHrOv4f11czvxSnDknl9LitFew-guGGfbvELv97gg,18
11
+ imagefv_extractor-1.0.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (84.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ imagefv-extractor = imagefv_extractor.cli:main
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
@@ -0,0 +1 @@
1
+ imagefv_extractor