Run a virtual iPhone on an Apple Silicon Mac.
Swift
add empty ramdisk + trustcache to testing ramdisk build/send
Lakr53bb0a308e31
diff --git a/scripts/testing_ramdisk_build.py b/scripts/testing_ramdisk_build.pyindex ffb4403b..0f3a0f53 100644--- a/scripts/testing_ramdisk_build.py+++ b/scripts/testing_ramdisk_build.py@@ -1,16 +1,16 @@#!/usr/bin/env python3"""-fw_build_testing_ramdisk.py — Build a minimal signed boot chain for testing.+testing_ramdisk_build.py — Build a minimal signed boot chain for testing.-Packs only firmware components (iBSS, iBEC, SPTM, DeviceTree, SEP, TXM,-kernelcache) into signed IMG4 files. No ramdisk, no trustcache.+Packs firmware components (iBSS, iBEC, SPTM, DeviceTree, SEP, TXM,+kernelcache) and an empty ramdisk into signed IMG4 files. No trustcache.The kernel is expected to boot and then panic (no rootfs). This is usefulfor verifying that patched boot-chain components (iBSS/iBEC/LLB/iBoot/TXM/kernelcache) work correctly.Usage:- python3 fw_build_testing_ramdisk.py [vm_directory]+ python3 testing_ramdisk_build.py [vm_directory]Prerequisites:pip install pyimg4@@ -284,6 +284,59 @@ def main():sign_img4(kc_im4p, os.path.join(output_dir, "krnl.img4"), im4m_path)print(f" [+] krnl.img4")+ # ── 8. Empty ramdisk + trustcache ────────────────────────────+ print(f"\n{'=' * 60}")+ print(f" 8. Empty ramdisk + trustcache")+ print(f"{'=' * 60}")++ # Empty ramdisk DMG+ empty_dmg = os.path.join(temp_dir, "empty.dmg")+ subprocess.run(+ [+ "hdiutil", "create",+ "-size", "4m",+ "-imagekey", "diskimage-class=CRawDiskImage",+ "-format", "UDZO",+ "-fs", "HFS+",+ "-layout", "NONE",+ "-volname", "empty",+ empty_dmg,+ ],+ check=True,+ capture_output=True,+ )+ subprocess.run(+ ["hdiutil", "resize", "-sectors", "min", empty_dmg],+ check=True,+ capture_output=True,+ )+ rd_im4p = os.path.join(temp_dir, "ramdisk.im4p")+ subprocess.run(+ ["pyimg4", "im4p", "create", "-i", empty_dmg, "-o", rd_im4p, "-f", "rdsk"],+ check=True,+ capture_output=True,+ )+ sign_img4(rd_im4p, os.path.join(output_dir, "ramdisk.img4"), im4m_path)+ print(f" [+] ramdisk.img4 (empty)")++ # Empty trustcache (scan empty directory)+ tc_bin = shutil.which("trustcache")+ if not tc_bin:+ print("[-] trustcache not found. Run: make setup_tools")+ sys.exit(1)+ empty_dir = os.path.join(temp_dir, "empty_root")+ os.makedirs(empty_dir, exist_ok=True)+ tc_raw = os.path.join(temp_dir, "empty.tc")+ tc_im4p = os.path.join(temp_dir, "trustcache.im4p")+ subprocess.run([tc_bin, "create", tc_raw, empty_dir], check=True, capture_output=True)+ subprocess.run(+ ["pyimg4", "im4p", "create", "-i", tc_raw, "-o", tc_im4p, "-f", "rtsc"],+ check=True,+ capture_output=True,+ )+ sign_img4(tc_im4p, os.path.join(output_dir, "trustcache.img4"), im4m_path)+ print(f" [+] trustcache.img4 (empty)")+# ── Cleanup ──────────────────────────────────────────────────print(f"\n[*] Cleaning up {TEMP_DIR}/...")shutil.rmtree(temp_dir, ignore_errors=True)diff --git a/scripts/testing_ramdisk_send.sh b/scripts/testing_ramdisk_send.shindex 55de74ab..86c152b4 100644--- a/scripts/testing_ramdisk_send.sh+++ b/scripts/testing_ramdisk_send.sh@@ -1,10 +1,10 @@#!/bin/zsh-# fw_send_testing_ramdisk.sh — Send testing boot chain to device via irecovery.+# testing_ramdisk_send.sh — Send testing boot chain to device via irecovery.#-# Usage: ./fw_send_testing_ramdisk.sh [testing_ramdisk_dir]+# Usage: ./testing_ramdisk_send.sh [testing_ramdisk_dir]## Expects device in DFU mode. Loads iBSS/iBEC, then boots with-# SPTM, TXM, device tree, SEP, and kernel. No ramdisk or trustcache.+# SPTM, TXM, trustcache, ramdisk, device tree, SEP, and kernel.# Kernel will panic after boot (no rootfs — expected).set -euo pipefail@@ -21,36 +21,47 @@ echo "[*] Sending testing boot chain from $RAMDISK_DIR ..."echo " (no rootfs — kernel will panic after boot)"# 1. Load iBSS + iBEC (DFU → recovery)-echo " [1/6] Loading iBSS..."+echo " [1/8] Loading iBSS...""$IRECOVERY" -f "$RAMDISK_DIR/iBSS.vresearch101.RELEASE.img4"-echo " [2/6] Loading iBEC..."+echo " [2/8] Loading iBEC...""$IRECOVERY" -f "$RAMDISK_DIR/iBEC.vresearch101.RELEASE.img4""$IRECOVERY" -c gosleep 1# 2. Load SPTM-echo " [3/6] Loading SPTM..."+echo " [3/8] Loading SPTM...""$IRECOVERY" -f "$RAMDISK_DIR/sptm.vresearch1.release.img4""$IRECOVERY" -c firmware# 3. Load TXM-echo " [4/6] Loading TXM..."+echo " [4/8] Loading TXM...""$IRECOVERY" -f "$RAMDISK_DIR/txm.img4""$IRECOVERY" -c firmware-# 4. Load device tree-echo " [5/6] Loading DeviceTree..."+# 4. Load trustcache+echo " [5/8] Loading trustcache..."+"$IRECOVERY" -f "$RAMDISK_DIR/trustcache.img4"+"$IRECOVERY" -c firmware++# 5. Load ramdisk+echo " [6/8] Loading ramdisk..."+"$IRECOVERY" -f "$RAMDISK_DIR/ramdisk.img4"+sleep 2+"$IRECOVERY" -c ramdisk++# 6. Load device tree+echo " [7/8] Loading device tree...""$IRECOVERY" -f "$RAMDISK_DIR/DeviceTree.vphone600ap.img4""$IRECOVERY" -c devicetree-# 5. Load SEP-echo " [6/6] Loading SEP..."+# 7. Load SEP+echo " [8/8] Loading SEP...""$IRECOVERY" -f "$RAMDISK_DIR/sep-firmware.vresearch101.RELEASE.img4""$IRECOVERY" -c firmware-# 6. Load kernel and boot+# 8. Load kernel and bootecho " [*] Booting kernel...""$IRECOVERY" -f "$RAMDISK_DIR/krnl.img4""$IRECOVERY" -c bootx