Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Stop writing boot-args the guest never reads

Jacky47023339354d
diff --git a/Research/Firmware/iboot_patches.md b/Research/Firmware/iboot_patches.md
index 86848f34..259b82d9 100644
--- a/Research/Firmware/iboot_patches.md
+++ b/Research/Firmware/iboot_patches.md
@@ -133,6 +133,17 @@ regardless of validation results.
`"serial=3 -v debug=0x2014e %s"` to enable serial output, verbose boot,
and debug flags.
+This is the only source of the guest's boot-args. iBoot formats the kernel
+command line with this string, and the trailing `%s` takes the `boot-args`
+from iBoot's own NVRAM banks in `nvram.bin`, which are empty after a restore.
+The host cannot add to them: `VZMacAuxiliaryStorage`'s
+`_setDataValue:forNVRAMVariableNamed:` writes a different store, which this
+iBoot never reads. vphone-vm wrote `serial=3 debug=0x104c04` there before every
+boot until 2026-10; the guest never saw it, and the write was removed. A custom
+variable written the same way does not reach the guest's
+`IODeviceTree:/options` either. To change the guest's boot-args, change
+`IBootPatcher.bootArgs` or `extraBootArgs` and run `cfw install` again.
+
**Anchoring:**
1. Find `"rd=md0"` string → search nearby for standalone `"%s"` (NUL-terminated)
diff --git a/Research/VPhoneVirtualMachineRefactored.swift b/Research/VPhoneVirtualMachineRefactored.swift
index f66263d4..bf6d39b2 100644
--- a/Research/VPhoneVirtualMachineRefactored.swift
+++ b/Research/VPhoneVirtualMachineRefactored.swift
@@ -113,8 +113,6 @@ class VPhoneVirtualMachineRefactored: NSObject, VZVirtualMachineDelegate {
)
platform.auxiliaryStorage = auxiliaryStorage
- setBootArgsSerialOutput(auxiliaryStorage)
-
return platform
}
@@ -132,19 +130,6 @@ class VPhoneVirtualMachineRefactored: NSObject, VZVirtualMachineDelegate {
return newID
}
- private func setBootArgsSerialOutput(_ auxiliaryStorage: VZMacAuxiliaryStorage) {
- let bootArgs = "serial=3 debug=0x104c04"
- guard let bootArgsData = bootArgs.data(using: .utf8) else { return }
-
- let success = Dynamic(auxiliaryStorage)
- ._setDataValue(bootArgsData, forNVRAMVariableNamed: "boot-args", error: nil)
- .asBool ?? false
-
- if success {
- print("[vphone] NVRAM boot-args: \(bootArgs)")
- }
- }
-
// MARK: - Bootloader
private func createBootloader(romURL: URL) -> VZMacOSBootLoader {
diff --git a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift
index d3881051..d0e5bfd6 100644
--- a/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift
+++ b/VPhoneExecutable/VPhoneVirtualization/UI/VirtualMachine/VPhoneVirtualMachine.swift
@@ -129,17 +129,11 @@ class VPhoneVirtualMachine: NSObject, VZVirtualMachineDelegate {
platform.auxiliaryStorage = auxStorage
platform.hardwareModel = hwModel
- // Set NVRAM boot-args to enable serial output
- let bootArgs = "serial=3 debug=0x104c04"
- if let bootArgsData = bootArgs.data(using: .utf8) {
- let ok =
- Dynamic(auxStorage)
- ._setDataValue(bootArgsData, forNVRAMVariableNamed: "boot-args", error: nil)
- .asBool ?? false
- if ok {
- print("[vphone] NVRAM boot-args: \(bootArgs)")
- }
- }
+ // No boot-args are set here. The guest's come from the iBEC/LLB patch
+ // (IBootPatcher.bootArgs and extraBootArgs), applied by `cfw install`:
+ // the research iBoot reads its own NVRAM banks in this file, not the
+ // store VZMacAuxiliaryStorage writes, so an NVRAM value set from the
+ // host never reaches the guest.
// --- Boot loader with custom ROM ---
let bootloader = VZMacOSBootLoader()