Skip to content

Commit 321c711

Browse files
zqxwceclaude
andcommitted
setup_machine: Set ramdisk-free host-mount CFW install as default
Replace the "Ramdisk + CFW phase" (boot_dfu + ramdisk_build/send + iproxy + wait_ssh + cfw_install*) with cfw_install_host run after the restore phase, while the VM is off. The legacy ramdisk path is kept behind USE_RAMDISK_CFW=1. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XZVS9oqVNmHJzpb8mFtKJx
1 parent d28754e commit 321c711

1 file changed

Lines changed: 36 additions & 18 deletions

File tree

scripts/setup_machine.sh

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55
# 1) Host deps + project setup/build
66
# 2) vm_new + fw_prepare + fw_patch (or fw_patch_dev/ fw_patch_jb with --dev/--jb)
77
# 3) DFU restore (boot_dfu + restore_get_shsh + restore)
8-
# 4) Ramdisk + CFW (boot_dfu + ramdisk_build + ramdisk_send + iproxy + cfw_install / cfw_install_dev / cfw_install_jb)
8+
# 4) CFW install — default: ramdisk-free host-mount install + offline snapshot
9+
# flip (cfw_install_host, VM off). Legacy ramdisk path (boot_dfu +
10+
# ramdisk_build/send + iproxy + cfw_install*) is opt-in via USE_RAMDISK_CFW=1.
911
# 5) First boot launch (`make boot`) with printed in-guest commands
1012

1113
set -euo pipefail
@@ -1018,6 +1020,7 @@ main() {
10181020

10191021
local fw_patch_target="fw_patch"
10201022
local cfw_install_target="cfw_install"
1023+
local cfw_variant="regular" # variant for the ramdisk-free `cfw_install_host`
10211024
local mode_label="base"
10221025

10231026
if (( JB_MODE + DEV_MODE + EXP_MODE + LESS_MODE > 1 )); then
@@ -1027,18 +1030,22 @@ main() {
10271030
if [[ "$JB_MODE" -eq 1 ]]; then
10281031
fw_patch_target="fw_patch_jb"
10291032
cfw_install_target="cfw_install_jb"
1033+
cfw_variant="jb"
10301034
mode_label="jailbreak"
10311035
elif [[ "$DEV_MODE" -eq 1 ]]; then
10321036
fw_patch_target="fw_patch_dev"
10331037
cfw_install_target="cfw_install_dev"
1038+
cfw_variant="dev"
10341039
mode_label="dev"
10351040
elif [[ "$EXP_MODE" -eq 1 ]]; then
10361041
fw_patch_target="fw_patch_exp"
10371042
cfw_install_target="cfw_install_exp"
1043+
cfw_variant="exp"
10381044
mode_label="experimental"
10391045
elif [[ "$LESS_MODE" -eq 1 ]]; then
10401046
fw_patch_target="fw_patch_less"
10411047
cfw_install_target=""
1048+
cfw_variant=""
10421049
mode_label="less"
10431050
fi
10441051

@@ -1081,24 +1088,35 @@ main() {
10811088
stop_boot_dfu
10821089

10831090
if [[ "$LESS_MODE" -eq 0 ]]; then
1084-
echo "[*] Waiting ${POST_KILL_SETTLE_DELAY}s for cleanup before ramdisk stage..."
1091+
echo "[*] Waiting ${POST_KILL_SETTLE_DELAY}s for cleanup before CFW install..."
10851092
sleep "$POST_KILL_SETTLE_DELAY"
1086-
1087-
echo ""
1088-
echo "=== Ramdisk + CFW phase ==="
1089-
start_boot_dfu
1090-
load_device_identity
1091-
wait_for_recovery
1092-
run_make "Ramdisk" ramdisk_build RAMDISK_UDID="$DEVICE_UDID"
1093-
echo "[*] Ramdisk identity context: restore_udid=${DEVICE_UDID} ecid=0x${DEVICE_ECID}"
1094-
run_make "Ramdisk" ramdisk_send IRECOVERY_ECID="0x$DEVICE_ECID" RAMDISK_UDID="$DEVICE_UDID"
1095-
start_iproxy
1096-
1097-
wait_for_ramdisk_ssh
1098-
1099-
run_make "CFW install" "$cfw_install_target" SSH_PORT="$RAMDISK_SSH_PORT"
1100-
stop_boot_dfu
1101-
stop_iproxy
1093+
1094+
if [[ "${USE_RAMDISK_CFW:-0}" == "1" ]]; then
1095+
# ── Legacy ramdisk CFW install (opt-in via USE_RAMDISK_CFW=1) ──
1096+
echo ""
1097+
echo "=== Ramdisk + CFW phase (legacy, USE_RAMDISK_CFW=1) ==="
1098+
start_boot_dfu
1099+
load_device_identity
1100+
wait_for_recovery
1101+
run_make "Ramdisk" ramdisk_build RAMDISK_UDID="$DEVICE_UDID"
1102+
echo "[*] Ramdisk identity context: restore_udid=${DEVICE_UDID} ecid=0x${DEVICE_ECID}"
1103+
run_make "Ramdisk" ramdisk_send IRECOVERY_ECID="0x$DEVICE_ECID" RAMDISK_UDID="$DEVICE_UDID"
1104+
start_iproxy
1105+
wait_for_ramdisk_ssh
1106+
run_make "CFW install" "$cfw_install_target" SSH_PORT="$RAMDISK_SSH_PORT"
1107+
stop_boot_dfu
1108+
stop_iproxy
1109+
else
1110+
# ── Default: ramdisk-free host-mount CFW install + offline snapshot flip.
1111+
# The VM is off after the restore phase, so we attach Disk.img on the
1112+
# host, place all CFW files, and rename the boot snapshot offline — no
1113+
# DFU/ramdisk_send/iproxy/SSH. cfw_install_host re-execs under sudo
1114+
# (SUDO_ASKPASS from setup_sudo_noninteractive when SUDO_PASSWORD is set).
1115+
echo ""
1116+
echo "=== CFW install (host-mount, ramdisk-free) ==="
1117+
check_vm_storage_locks
1118+
run_make "CFW install" cfw_install_host VARIANT="$cfw_variant" SPOOF_BUILD="${SPOOF_BUILD:-}"
1119+
fi
11021120
fi
11031121

11041122
if [[ "$LESS_MODE" -eq 0 || "$NO_BINPACK" -eq 0 ]]; then

0 commit comments

Comments
 (0)