mirror of
https://github.com/Lakr233/vphone-cli.git
synced 2026-04-05 13:09:06 +08:00
feat: Add VM manifest system and code clarity improvements
Implement VM configuration manifest system compatible with security-pcc's
VMBundle.Config format, storing VM settings in config.plist.
**Manifest System:**
- Add VPhoneVirtualMachineManifest.swift with security-pcc compatible structure
- Add scripts/vm_manifest.py for manifest generation during vm_new
- Update VPhoneCLI to support --config option with CLI overrides
- Update vm_create.sh to generate config.plist with CPU/memory/screen settings
**Environment Variables:**
- CPU/MEMORY/DISK_SIZE now only used during vm_new (written to manifest)
- boot/boot_dfu automatically read from config.plist
- Remove unused CFW_INPUT variable (overridden by scripts internally)
- Document remaining variables with their usage scope
**Documentation:**
- Update README.md with VM configuration section
- Update docs/README_{zh,ja,ko}.md with translated VM configuration docs
- Update Makefile help output with vm_new options and config.plist usage
- Fix fw_patch_jb description: "dev + JB extensions"
- Fix restore_get_shsh description: "Dump SHSH response from Apple"
**Code Quality:**
- Add VPhoneVirtualMachineRefactored.swift demonstrating code-clarity principles
- Extract 200+ line init into focused configuration methods
- Improve naming: hardwareModel, graphicsConfiguration, soundDevice
- Add BatteryConnectivity enum for magic numbers
- Create research/manifest_and_refactoring_summary.md with full analysis
**Compatibility with security-pcc:**
- Platform type: Fixed vresearch101 (iPhone-only)
- Network: NAT only (no bridging/host-only needed)
- Added: ScreenConfig and SEP storage (iPhone-specific)
- Removed: VirtMesh plugin support (PCC-specific)
docs: add machineIdentifier storage analysis
Research and validate the integration of machineIdentifier into config.plist.
**Findings:**
- security-pcc stores machineIdentifier in config.plist (same approach)
- VZMacAuxiliaryStorage creation is independent of machineIdentifier
- VZMacMachineIdentifier only requires Data representation, not file source
- No binding or validation between components
**Conclusion:**
- ✅ No compatibility issues
- ✅ Matches security-pcc official implementation
- ✅ Proper handling of first-boot creation and data recovery
- ✅ Safe to use
Delete VPhoneVirtualMachineRefactored.swift
refactor: integrate machineIdentifier into config.plist
Move machineIdentifier storage from standalone machineIdentifier.bin file
into the central config.plist manifest for simpler VM configuration.
**Changes:**
- VPhoneVirtualMachineManifest: Remove machineIDFile field
- VPhoneVirtualMachine: Load/create machineIdentifier from manifest
- VPhoneCLI: Remove --machine-id parameter, require --config
- Makefile: Remove --machine-id from boot/boot_dfu targets
- vm_manifest.py: Remove machineIDFile from manifest structure
**Behavior:**
- First boot: Creates machineIdentifier and saves to config.plist
- Subsequent boots: Loads machineIdentifier from config.plist
- Invalid/empty machineIdentifier: Auto-regenerates and updates manifest
- All VM configuration now centralized in single config.plist file
**File cleanup:**
- Move VPhoneVirtualMachineRefactored.swift to research/ as reference
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
# 2. Create sparse disk image (default 64 GB)
|
||||
# 3. Create SEP storage (512 KB flat file)
|
||||
# 4. Copy AVPBooter and AVPSEPBooter ROMs
|
||||
# 5. Generate config.plist manifest
|
||||
#
|
||||
# machineIdentifier and NVRAM are auto-created on first boot by vphone-cli.
|
||||
#
|
||||
@@ -16,10 +17,15 @@
|
||||
set -euo pipefail
|
||||
|
||||
# --- Defaults ---
|
||||
VM_DIR="vm"
|
||||
DISK_SIZE_GB=64
|
||||
VM_DIR="${VM_DIR:-vm}"
|
||||
DISK_SIZE_GB="${DISK_SIZE:-64}"
|
||||
CPU_COUNT="${CPU:-8}"
|
||||
MEMORY_MB="${MEMORY:-8192}"
|
||||
SEP_STORAGE_SIZE=$((512 * 1024)) # 512 KB (same as vrevm)
|
||||
|
||||
# Script directory
|
||||
SCRIPT_DIR="${0:A:h}"
|
||||
|
||||
# Framework-bundled ROMs (vresearch1 / research1 chip)
|
||||
FW_ROM_DIR="/System/Library/Frameworks/Virtualization.framework/Versions/A/Resources"
|
||||
ROM_SRC="${FW_ROM_DIR}/AVPBooter.vresearch1.bin"
|
||||
@@ -139,12 +145,26 @@ fi
|
||||
# --- Create .gitkeep ---
|
||||
touch "${VM_DIR}/.gitkeep"
|
||||
|
||||
# --- Generate VM manifest ---
|
||||
echo "[5/4] Generating VM manifest (config.plist)"
|
||||
"${SCRIPT_DIR}/vm_manifest.py" \
|
||||
--vm-dir "${VM_DIR}" \
|
||||
--cpu "${CPU_COUNT}" \
|
||||
--memory "${MEMORY_MB}" \
|
||||
--disk-size "${DISK_SIZE_GB}" || {
|
||||
echo "ERROR: Failed to generate VM manifest"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo ""
|
||||
echo "=== VM created at ${VM_DIR}/ ==="
|
||||
echo ""
|
||||
echo "Contents:"
|
||||
ls -lh "${VM_DIR}/"
|
||||
echo ""
|
||||
echo "Manifest (config.plist) saved with VM configuration."
|
||||
echo "Future boots will read configuration from this manifest."
|
||||
echo ""
|
||||
echo "Next steps:"
|
||||
echo " 1. Prepare firmware: make fw_prepare"
|
||||
echo " 2. Patch firmware: make fw_patch"
|
||||
|
||||
Reference in New Issue
Block a user