Skip to content

Commit f3465d1

Browse files
committed
stub: Add kernelcache firmware extraction
Signed-off-by: Hector Martin <[email protected]>
1 parent ff1af0c commit f3465d1

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/stub.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,7 @@ def install_files(self, cur_os):
199199
self.extract_tree("Firmware/Manifests/restore/macOS Customer/", restore_bundle)
200200

201201
copied = set()
202+
self.kernel_path = None
202203
for key, val in identity["Manifest"].items():
203204
if key in ("BaseSystem", "OS", "Ap,SystemVolumeCanonicalMetadata"):
204205
continue
@@ -209,6 +210,8 @@ def install_files(self, cur_os):
209210
if path.startswith("kernelcache."):
210211
name = os.path.basename(path)
211212
self.copy_idata.append((os.path.join(restore_bundle, name), name))
213+
if self.kernel_path is None:
214+
self.kernel_path = os.path.join(restore_bundle, name)
212215
copied.add(path)
213216

214217
self.flush_progress()
@@ -333,6 +336,9 @@ def collect_firmware(self, pkg):
333336
logging.info("Collecting Multitouch firmware")
334337
col = MultitouchFWCollection("fud_firmware/")
335338
pkg.add_files(sorted(col.files()))
339+
logging.info("Collecting Kernel firmware")
340+
col = KernelFWCollection(self.kernel_path)
341+
pkg.add_files(sorted(col.files()))
336342
logging.info("Making fallback firmware archive")
337343
subprocess.run(["tar", "czf", "all_firmware.tar.gz",
338344
"fud_firmware",

0 commit comments

Comments
 (0)