Skip to content

Commit fcc30e1

Browse files
zqxwceclaude
andcommitted
general: Remove SSH-ramdisk CFW install path; host-mount is the sole flow
The ramdisk-based install (build/send an SSH ramdisk, iproxy-forward, then push CFW files over SSH and flip the boot snapshot with snaputil in-VM) has been fully replaced by the host-mount path: cfw_install_host.sh mounts the VM's Disk.img on the host, places every file locally, and flips the boot snapshot offline via tools/apfs_snap_rename.py. This removes all remaining ramdisk generation, delivery, and usage — no legacy fallback. Deleted: - scripts/ramdisk_build.py, scripts/ramdisk_send.sh Renamed: - scripts/cfw_host_mode.sh -> scripts/cfw_transport.sh (was a conditional "host-mode override"; now the sole, unconditionally-sourced transport) setup_machine.sh: drop the USE_RAMDISK_CFW=1 branch and every iproxy/ramdisk helper (usbmux UDID resolution, port picking, start/stop iproxy, wait-for- ramdisk-ssh), all RAMDISK_*/IPROXY_* vars, the cleanup() iproxy handling, and the orphaned cfw_install_target var. Only the host-mount cfw_install_host call remains. cfw_install{,_dev,_jb,_exp}.sh: delete the SSH transport (SSH_* vars, SSH_OPTS, sshpass prereq/_sshpass/_ssh_retry, ssh_cmd/scp_to/scp_from/remote_file_exists/ remote_mount, wait_for_device_ssh_ready) and the dead ramdisk-mechanism body blocks (snaputil snapshot flip, dropbearkey host-key pre-generation, halt-over- SSH, CFW_SKIP_HALT). The transport is now sourced unconditionally from cfw_transport.sh. dropbear -R generates host keys at first boot; the offline apfs_snap_rename.py does the boot-source flip. Dropped the vestigial CFW_HOST_MODE gate. Also: pymobiledevice3_bridge.py (ramdisk-send command already gone), Makefile (ramdisk targets/help/IRECOVERY_ECID removed), README + ja/ko/zh (install flow rewritten to host-mount), AGENTS.md/CLAUDE.md architecture tree, and stale comments in vphone_jb_setup.sh, VPhoneCLI.swift, apfs_snap_rename.py, cfw_patch_post_restore_dt.py. Verified booting via make setup_machine. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZVS9oqVNmHJzpb8mFtKJx
1 parent 321c711 commit fcc30e1

20 files changed

Lines changed: 450 additions & 2208 deletions

AGENTS.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,11 +98,11 @@ scripts/
9898
├── patches/ # Build-time patches (libirecovery)
9999
├── fw_prepare.sh # Download IPSWs, merge cloudOS into iPhone
100100
├── fw_manifest.py # Generate hybrid BuildManifest/Restore plists
101-
├── ramdisk_build.py # Build SSH ramdisk with trustcache (reuses Swift patch-component for TXM/base kernel)
102-
├── ramdisk_send.sh # Send ramdisk to device via irecovery
103101
├── cfw_install.sh # Install CFW (regular)
104102
├── cfw_install_dev.sh # Regular + rpcserver daemon
105103
├── cfw_install_jb.sh # Regular + jetsam fix + procursus
104+
├── cfw_install_exp.sh # JB + experimental research patches (hv_vmm rename, DT identity)
105+
├── cfw_install_host.sh # Host-mount CFW driver (attaches Disk.img, VM off; re-execs sudo)
106106
├── vm_create.sh # Create VM directory
107107
├── setup_machine.sh # Full automation (setup → first boot)
108108
├── setup_tools.sh # Install deps, build toolchain from submodules, create venv
@@ -111,6 +111,9 @@ scripts/
111111
├── setup_libimobiledevice.sh # Build libimobiledevice stack from scripts/repos submodules
112112
└── tail_jb_patch_logs.sh # Tail JB patch log output
113113
114+
tools/
115+
└── apfs_snap_rename.py # Offline APFS boot-snapshot flip (used by cfw_install_host.sh)
116+
114117
research/ # Detailed firmware/patch documentation
115118
```
116119

Makefile

Lines changed: 10 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ BACKUP_INCLUDE_IPSW ?= 0
1717
FORCE ?= 0
1818
RESTORE_UDID ?= # UDID for restore operations
1919
RESTORE_ECID ?= # ECID for restore operations
20-
IRECOVERY_ECID ?= # ECID for ramdisk send operations
2120

2221
# ─── Build info ──────────────────────────────────────────────────
2322
GIT_HASH := $(shell git rev-parse --short HEAD 2>/dev/null || echo "unknown")
@@ -121,17 +120,12 @@ help:
121120
@echo " make restore Restore to device (pymobiledevice3 backend)"
122121
@echo " make restore_offline Restore offline — decrypts AEA images in place, uses cached .shsh blob"
123122
@echo ""
124-
@echo "Ramdisk:"
125-
@echo " make ramdisk_build Build signed SSH ramdisk"
126-
@echo " make ramdisk_send Send ramdisk to device"
127-
@echo ""
128-
@echo "CFW:"
129-
@echo " make cfw_install Install CFW mods via SSH"
130-
@echo " make cfw_install_dev Install CFW mods via SSH (dev mode)"
123+
@echo "CFW (host-mount install; VM must be off, re-execs sudo):"
124+
@echo " make cfw_install Install base CFW mods"
125+
@echo " make cfw_install_dev Install CFW mods (dev mode)"
131126
@echo " make cfw_install_jb Install CFW + JB extensions (jetsam/procursus/basebin)"
132127
@echo " make cfw_install_exp Install CFW + JB + EXP experimental (hv_vmm rename, post-restore DT, build spoof)"
133-
@echo " make cfw_install_host Ramdisk-free install: host-mount files + offline snapshot flip"
134-
@echo " Options: VARIANT=regular|dev|jb|exp (default exp) SPOOF_BUILD=<id> (exp)"
128+
@echo " make cfw_install_host Select variant: VARIANT=regular|dev|jb|exp (default exp) SPOOF_BUILD=<id> (exp)"
135129
@echo ""
136130
@echo "Variables: VM_DIR=$(VM_DIR) CPU=$(CPU) MEMORY=$(MEMORY) DISK_SIZE=$(DISK_SIZE)"
137131

@@ -463,39 +457,26 @@ restore_offline:
463457
$(if $(RESTORE_UDID),--udid $(RESTORE_UDID),) \
464458
--ecid "$$ECID"
465459

466-
# ═══════════════════════════════════════════════════════════════════
467-
# Ramdisk
468-
# ═══════════════════════════════════════════════════════════════════
469-
470-
.PHONY: ramdisk_build ramdisk_send
471-
472-
ramdisk_build: patcher_build
473-
cd $(VM_DIR) && RAMDISK_UDID="$(RAMDISK_UDID)" $(PYTHON) "$(CURDIR)/$(SCRIPTS)/ramdisk_build.py" .
474-
475-
ramdisk_send:
476-
cd $(VM_DIR) && PMD3_BRIDGE="$(PMD3_BRIDGE)" PYTHON="$(PYTHON)" IRECOVERY_ECID="$(IRECOVERY_ECID)" RAMDISK_UDID="$(RAMDISK_UDID)" RESTORE_UDID="$(RESTORE_UDID)" \
477-
zsh "$(CURDIR)/$(SCRIPTS)/ramdisk_send.sh"
478-
479460
# ═══════════════════════════════════════════════════════════════════
480461
# CFW
481462
# ═══════════════════════════════════════════════════════════════════
482463

483464
.PHONY: cfw_install cfw_install_dev cfw_install_jb cfw_install_exp cfw_install_host
484465

485466
cfw_install:
486-
cd $(VM_DIR) && $(if $(SSH_PORT),SSH_PORT="$(SSH_PORT)") _VPHONE_PATH="$$PATH" zsh "$(CURDIR)/$(SCRIPTS)/cfw_install.sh" .
467+
$(MAKE) cfw_install_host VARIANT=regular
487468

488469
cfw_install_dev:
489-
cd $(VM_DIR) && $(if $(SSH_PORT),SSH_PORT="$(SSH_PORT)") _VPHONE_PATH="$$PATH" zsh "$(CURDIR)/$(SCRIPTS)/cfw_install_dev.sh" .
470+
$(MAKE) cfw_install_host VARIANT=dev
490471

491472
cfw_install_jb:
492-
cd $(VM_DIR) && $(if $(SSH_PORT),SSH_PORT="$(SSH_PORT)") _VPHONE_PATH="$$PATH" zsh "$(CURDIR)/$(SCRIPTS)/cfw_install_jb.sh" .
473+
$(MAKE) cfw_install_host VARIANT=jb
493474

494475
cfw_install_exp:
495-
cd $(VM_DIR) && $(if $(SSH_PORT),SSH_PORT="$(SSH_PORT)") $(if $(SPOOF_BUILD),SPOOF_BUILD="$(SPOOF_BUILD)") _VPHONE_PATH="$$PATH" zsh "$(CURDIR)/$(SCRIPTS)/cfw_install_exp.sh" .
476+
$(MAKE) cfw_install_host VARIANT=exp SPOOF_BUILD="$(SPOOF_BUILD)"
496477

497-
# Ramdisk-free CFW install: place files via host mount + flip boot snapshot
498-
# offline. No boot_dfu/ramdisk_send/iproxy/SSH. VM must be off. Re-execs sudo.
478+
# CFW install: place files via host mount + flip the boot snapshot offline.
479+
# VM must be off; re-execs under sudo.
499480
# Options: VARIANT=regular|dev|jb|exp (default exp) SPOOF_BUILD=<id> (exp)
500481
cfw_install_host:
501482
$(if $(SPOOF_BUILD),SPOOF_BUILD="$(SPOOF_BUILD)") zsh "$(CURDIR)/$(SCRIPTS)/cfw_install_host.sh" --variant $(if $(VARIANT),$(VARIANT),exp) "$(VM_DIR_ABS)"

README.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ git clone --recurse-submodules https://github.com/Lakr233/vphone-cli.git
115115
## Quick Start
116116

117117
```bash
118-
make setup_machine # full automation through "First Boot" (includes restore/ramdisk/CFW)
118+
make setup_machine # full automation through "First Boot" (includes restore/CFW)
119119
# options: NON_INTERACTIVE=1 SUDO_PASSWORD=...
120120
# LESS=1 for patchless variant (- AMFI, SSV, Img4, TXM bypasses)
121121
# DEV=1 for dev variant (+ TXM entitlement/debug bypasses)
@@ -182,37 +182,23 @@ make restore # flash firmware via pymobiledevice3 restore backe
182182

183183
## Install Custom Firmware
184184

185-
Stop the DFU boot in terminal 1 (Ctrl+C), then boot into DFU again for the ramdisk:
185+
Once the restore completes, stop the DFU boot in terminal 1 (Ctrl+C) so the VM is
186+
fully powered off. The installer mounts the VM's `Disk.img` on the host, places
187+
all CFW files, and flips the boot snapshot offline — no DFU, ramdisk, or SSH — so
188+
it needs exclusive access to the disk.
186189

187190
```bash
188-
# terminal 1
189-
make boot_dfu # keep running
190-
```
191-
192-
```bash
193-
# terminal 2
194-
sudo make ramdisk_build # build signed SSH ramdisk
195-
make ramdisk_send # send to device
196-
```
197-
198-
Once the ramdisk is running (you should see `Running server` in the output), open a **third terminal** for the usbmux tunnel, then install CFW from terminal 2:
199-
200-
```bash
201-
# terminal 3 — keep running
202-
python3 -m pymobiledevice3 usbmux forward 2222 22
203-
```
204-
205-
```bash
206-
# terminal 2
191+
# terminal 2 (re-execs under sudo automatically)
207192
make cfw_install
193+
# or: make cfw_install_dev # development variant
208194
# or: make cfw_install_jb # jailbreak variant
209195
# or: make cfw_install_exp # experimental variant (JB + research stack)
210196
# or: SPOOF_BUILD=23F77 make cfw_install_exp # additionally rewrite ProductBuildVersion
211197
```
212198

213199
## First Boot
214200

215-
Stop the DFU boot in terminal 1 (Ctrl+C), then:
201+
With the DFU boot stopped and CFW installed, boot the VM normally:
216202

217203
```bash
218204
make boot

docs/README_ja.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ git clone --recurse-submodules https://github.com/Lakr233/vphone-cli.git
103103
## クイックスタート
104104

105105
```bash
106-
make setup_machine # 初回起動までを完全自動化(復元/ラムディスク/CFWを含む)
106+
make setup_machine # 初回起動までを完全自動化(復元/CFWを含む)
107107
# オプション:NON_INTERACTIVE=1 SUDO_PASSWORD=...
108108
# LESS=1 で patchless バリアント(- AMFI, SSV, Img4, TXM バイパス)
109109
# DEV=1 で開発バリアント(+ TXM entitlement/デバッグバイパス)
@@ -170,37 +170,20 @@ make restore # pymobiledevice3 restore バックエンドでフ
170170

171171
## カスタムファームウェアのインストール
172172

173-
ターミナル 1 の DFU 起動を停止し(Ctrl+C)、Ramdisk 用に再び DFU で起動します:
173+
復元が完了したら、ターミナル 1 の DFU 起動を停止(Ctrl+C)して VM を完全に電源オフにします。インストーラは VM の `Disk.img` をホスト側でマウントし、すべての CFW ファイルを配置してブートスナップショットをオフラインで切り替えます(DFU / Ramdisk / SSH は不要)。そのためディスクへの排他アクセスが必要です。
174174

175175
```bash
176-
# ターミナル 1
177-
make boot_dfu # 実行したままにする
178-
```
179-
180-
```bash
181-
# ターミナル 2
182-
sudo make ramdisk_build # 署名済みSSH Ramdisk のビルド
183-
make ramdisk_send # デバイスへ送信
184-
```
185-
186-
Ramdisk が起動したら(出力に `Running server` と表示されるはずです)、usbmux トンネル用に **3つ目のターミナル** を開き、ターミナル 2 から CFW をインストールします:
187-
188-
```bash
189-
# ターミナル 3 — 実行したままにする
190-
python3 -m pymobiledevice3 usbmux forward 2222 22
191-
```
192-
193-
```bash
194-
# ターミナル 2
176+
# ターミナル 2(自動的に sudo で再実行されます)
195177
make cfw_install
178+
# または: make cfw_install_dev # 開発バリアント
196179
# または: make cfw_install_jb # 脱獄バリアント
197180
# または: make cfw_install_exp # 実験バリアント(脱獄 + リサーチパッチスタック)
198181
# または: SPOOF_BUILD=23F77 make cfw_install_exp # ProductBuildVersion も書き換え
199182
```
200183

201184
## 初回起動
202185

203-
ターミナル 1 の DFU 起動を停止し(Ctrl+C)、以下を実行します
186+
DFU 起動を停止し CFW をインストールしたら、VM を通常起動します
204187

205188
```bash
206189
make boot

docs/README_ko.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ git clone --recurse-submodules https://github.com/Lakr233/vphone-cli.git
103103
## 빠른 시작
104104

105105
```bash
106-
make setup_machine # "First Boot"까지의 전체 과정 자동화 (복원/Ramdisk/커스텀 펌웨어 포함)
106+
make setup_machine # "First Boot"까지의 전체 과정 자동화 (복원/커스텀 펌웨어 포함)
107107
# 옵션: NON_INTERACTIVE=1 SUDO_PASSWORD=...
108108
# LESS=1 Patchless 변형 (- AMFI, SSV, Img4, TXM 우회)
109109
# DEV=1 개발 변형 (+ TXM 권한/디버그 우회)
@@ -170,37 +170,20 @@ make restore # pymobiledevice3 restore 백엔드로 펌웨어
170170

171171
## 커스텀 펌웨어 설치
172172

173-
터미널 1의 DFU 부팅을 중단(Ctrl+C)한 다음, 램디스크를 위해 다시 DFU로 부팅합니다:
173+
복원이 완료되면 터미널 1의 DFU 부팅을 중단(Ctrl+C)하여 VM을 완전히 종료합니다. 설치 프로그램은 VM의 `Disk.img`를 호스트에 마운트하여 모든 CFW 파일을 배치하고 부팅 스냅샷을 오프라인으로 전환합니다(DFU / 램디스크 / SSH 불필요). 따라서 디스크에 대한 독점 액세스가 필요합니다.
174174

175175
```bash
176-
# 터미널 1
177-
make boot_dfu # 계속 실행 유지
178-
```
179-
180-
```bash
181-
# 터미널 2
182-
sudo make ramdisk_build # 서명된 SSH 램디스크 빌드
183-
make ramdisk_send # 장치로 전송
184-
```
185-
186-
램디스크가 실행되면(출력에 `Running server`가 표시됨), **세 번째 터미널**을 열어 usbmux 터널을 시작한 후, 터미널 2에서 커스텀 펌웨어를 설치합니다:
187-
188-
```bash
189-
# 터미널 3 — 계속 실행 유지
190-
python3 -m pymobiledevice3 usbmux forward 2222 22
191-
```
192-
193-
```bash
194-
# 터미널 2
176+
# 터미널 2 (자동으로 sudo로 재실행됨)
195177
make cfw_install
178+
# 또는: make cfw_install_dev # 개발 변형
196179
# 또는: make cfw_install_jb # 탈옥 변형
197180
# 또는: make cfw_install_exp # 실험 변형 (탈옥 + 연구 패치 스택)
198181
# 또는: SPOOF_BUILD=23F77 make cfw_install_exp # 추가로 ProductBuildVersion 재작성
199182
```
200183

201184
## 첫 부팅
202185

203-
터미널 1의 DFU 부팅을 중단(Ctrl+C)한 후 다음을 실행합니다:
186+
DFU 부팅을 중단하고 CFW를 설치한 후, VM을 정상 부팅합니다:
204187

205188
```bash
206189
make boot

docs/README_zh.md

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ git clone --recurse-submodules https://github.com/Lakr233/vphone-cli.git
103103
## 快速开始
104104

105105
```bash
106-
make setup_machine # 完全自动化完成"首次启动"流程(包含 restore/ramdisk/CFW)
106+
make setup_machine # 完全自动化完成"首次启动"流程(包含 restore/CFW)
107107
# 选项:NON_INTERACTIVE=1 SUDO_PASSWORD=...
108108
# LESS=1 patchless 变体(- AMFI、SSV、Img4、TXM 绕过)
109109
# DEV=1 开发变体(+ TXM 权限/调试绕过)
@@ -170,37 +170,20 @@ make restore # 通过 pymobiledevice3 restore 后端刷写固
170170

171171
## 安装自定义固件
172172

173-
在终端 1 中停止 DFU 引导(Ctrl+C),然后再次进入 DFU,用于 ramdisk
173+
恢复完成后,在终端 1 中停止 DFU 引导(Ctrl+C),使 VM 完全关机。安装程序会在主机上挂载 VM 的 `Disk.img`,放置所有 CFW 文件,并离线切换启动快照(无需 DFU / ramdisk / SSH),因此需要对磁盘的独占访问。
174174

175175
```bash
176-
# 终端 1
177-
make boot_dfu # 保持运行
178-
```
179-
180-
```bash
181-
# 终端 2
182-
sudo make ramdisk_build # 构建签名的 SSH ramdisk
183-
make ramdisk_send # 发送到设备
184-
```
185-
186-
当 ramdisk 运行后(输出中应显示 `Running server`),打开**第三个终端**运行 usbmux 隧道,然后在终端 2 安装 CFW:
187-
188-
```bash
189-
# 终端 3 —— 保持运行
190-
python3 -m pymobiledevice3 usbmux forward 2222 22
191-
```
192-
193-
```bash
194-
# 终端 2
176+
# 终端 2(会自动通过 sudo 重新执行)
195177
make cfw_install
178+
# 或:make cfw_install_dev # 开发变体
196179
# 或:make cfw_install_jb # 越狱变体
197180
# 或:make cfw_install_exp # 实验变体(越狱 + 研究补丁栈)
198181
# 或:SPOOF_BUILD=23F77 make cfw_install_exp # 同时改写 ProductBuildVersion
199182
```
200183

201184
## 首次启动
202185

203-
在终端 1 中停止 DFU 引导(Ctrl+C),然后
186+
停止 DFU 引导并完成 CFW 安装后,正常启动 VM
204187

205188
```bash
206189
make boot

scripts/cfw_host_mode.sh

Lines changed: 0 additions & 52 deletions
This file was deleted.

0 commit comments

Comments
 (0)