Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Create Launchpad machines on the release's own cloudOS

Maximilian Paßb7d0c63279d4
diff --git a/Documents/Guides/launchpad-cli.md b/Documents/Guides/launchpad-cli.md
index 343fb62b..d6dcb580 100644
--- a/Documents/Guides/launchpad-cli.md
+++ b/Documents/Guides/launchpad-cli.md
@@ -113,7 +113,7 @@ version while a machine is bound to it; rebind or delete those machines first.
| `vm list` | Machines in every library with run state, Core Bundle and log path. Only a VM process holding the disk (`vphone-vm`, or Virtualization's VM service) makes a machine `running`; any other process that has it open (`tail`, Spotlight, a backup tool) is listed in `diskOpenIn` (`12925 tail`) and leaves it `stopped` |
| `vm start <name> [--headless] [--wait]` / `vm stop <name>` | Launch with the machine's bundle, or stop; `--wait` waits for vphoned. Stop asks the guest to shut down (vphoned `system.shutdown`) and waits up to 30 s; when the guest cannot be asked or does not stop, it ends the virtual machine as before. Like `vphone-cli vm launch`, start is not refused by a process that only has the disk open; it prints a note naming it |
| `vm wait <name>` / `vm log <name> [--kind create\|dfu\|patch]` | Wait for vphoned; read a console log |
-| `vm create <name> [--bundle <version>] [...] [--device <product-type>] [--preset <preset>] [--block <patch>]... [--allow <patch>]... [--no-template \| --slim on\|off --trim … --keep-languages … --service-profile … --remove-apps … --keep-apps … --accounts-off] [--from <step>]` | The New Machine pipeline, bound to `--bundle` or the default: cloned from a template, built first when missing (2.9), or restored on its own with `--no-template`; the slimming switches are `vphone-cli vm create`'s, except that Apple Account goes with the trimmed service profile as in New Machine (`--accounts-off` is accepted and changes nothing). `--block`/`--allow` (repeatable) turn one patch of the preset off or on, as New Machine's patch list and `vphone-cli fw set-patches` do (see below). `--device` makes an iPad guest, or with `AppleTV5,3` an Apple TV HD guest, which is always restored on its own without slimming and takes the `tvos` preset unless `--preset` names another, and with `AppleTV14,1` an Apple TV 4K guest, the same with the `tvos-4k` preset and its userland from the catalog's OTA; `--preset minimal` (Minimal: a stock boot chain, kernel and TXM, with the system customised before the restore) is also restored on its own without slimming, and its `fw patch` runs as root through the helper; `--from` retries from a step (`findTemplate` … `firstBoot`) with the options the creation started with; the result names the template, whether this creation built it, and the patches it used |
+| `vm create <name> [--bundle <version>] [...] [--device <product-type>] [--preset <preset>] [--ipsw <path>] [--block <patch>]... [--allow <patch>]... [--no-template \| --slim on\|off --trim … --keep-languages … --service-profile … --remove-apps … --keep-apps … --accounts-off] [--from <step>]` | The New Machine pipeline, bound to `--bundle` or the default: cloned from a template, built first when missing (2.9), or restored on its own with `--no-template`; the slimming switches are `vphone-cli vm create`'s, except that Apple Account goes with the trimmed service profile as in New Machine (`--accounts-off` is accepted and changes nothing). `--block`/`--allow` (repeatable) turn one patch of the preset off or on, as New Machine's patch list and `vphone-cli fw set-patches` do (see below). `--device` makes an iPad guest, or with `AppleTV5,3` an Apple TV HD guest, which is always restored on its own without slimming and takes the `tvos` preset unless `--preset` names another, and with `AppleTV14,1` an Apple TV 4K guest, the same with the `tvos-4k` preset and its userland from the catalog's OTA; `--preset minimal` (Minimal: a stock boot chain, kernel and TXM, with the system customised before the restore) is also restored on its own without slimming, and its `fw patch` runs as root through the helper; `--ipsw` names the ipsw that stages the kernelcache mix of a machine on its release's own cloudOS, as New Machine's ipsw field (the helper links it as root); `--from` retries from a step (`findTemplate` … `firstBoot`) with the options the creation started with; the result names the template, whether this creation built it, and the patches it used |
| `vm set-bundle <name> <version> [--update-environment]` | Bind a machine to another installed version. `--update-environment` also redeploys that version's guest environment and needs a stopped machine; a disk another process has open refuses it, naming that process, before the binding changes. If the update itself fails, the machine stays bound to the new version and `vm list` still shows the old `guestEnvironmentBundle`: run `cfw update-environment` to finish |
| `vm leases [--release]` | DHCP leases on the shared NAT network and the machine that owns each. `--release` frees the ones no machine in any library uses, through the helper (see [Networking](networking.md#addresses-held-by-old-macs)) |
| `cfw install <name>` | Install CFW into a stopped machine with its own bundle, through the helper. The helper puts temporary work files on the VM library's external volume when applicable. It and the two updates below refuse a disk another process has open, naming it (`12925 tail`). |
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/KernelCache/KernelCacheMixer.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/KernelCache/KernelCacheMixer.swift
index 76a60555..fa4e02b0 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/KernelCache/KernelCacheMixer.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/KernelCache/KernelCacheMixer.swift
@@ -147,12 +147,12 @@ public final class KernelCacheMixer {
/// Extracts both kernelcaches and stages the volume kmutil links, as the
/// invoking user: the one step that runs `ipsw`. Does nothing when the mix
/// or its volume is already in the cache.
- public func stage(kernelcache: Data) throws {
+ public func stage(kernelcache: Data, ipsw ipswPath: String? = nil) throws {
let (base, paths) = try locations(for: kernelcache)
guard !FileManager.default.fileExists(atPath: paths.mixed.path), !Self.isStaged(paths.staged) else { return }
try KernelCollectionBuilder.checkLayout(for: base)
let donor = try recipes.donor(id: base.donor)
- let ipsw = try Self.ipsw()
+ let ipsw = try Self.ipsw(ipswPath)
let fm = FileManager.default
try? fm.removeItem(at: paths.staged)
@@ -417,11 +417,11 @@ public final class KernelCacheMixer {
return data
}
- /// The `ipsw` named by `VPHONE_IPSW`, with `kernel extract --kdk`.
- static func ipsw() throws -> (url: URL, hash: String) {
+ /// The `ipsw` given, or else named by `VPHONE_IPSW`, with `kernel extract --kdk`.
+ static func ipsw(_ given: String? = nil) throws -> (url: URL, hash: String) {
let hint = "The kernelcache mix needs an ipsw with `kernel extract --kdk`; set \(ipswEnvironmentVariable) to its path "
+ "(under sudo: `sudo \(ipswEnvironmentVariable)=<path> vphone-cli ...`)."
- guard let path = ProcessInfo.processInfo.environment[ipswEnvironmentVariable], !path.isEmpty else {
+ guard let path = given ?? ProcessInfo.processInfo.environment[ipswEnvironmentVariable], !path.isEmpty else {
throw PatcherError.fileNotFound("ipsw. \(hint)")
}
let url = URL(fileURLWithPath: path)
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift
index b9384ea2..c667c8c3 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneFirmwareCommand.swift
@@ -684,6 +684,8 @@ struct VPhoneFirmwareKernelcacheCommand: ParsableCommand {
visibility: .hidden,
))
var linkOnly = false
+ @Option(help: ArgumentHelp("The ipsw to stage with (default: $VPHONE_IPSW)", valueName: "path"))
+ var ipsw: String?
func run() throws {
let name = try VPhoneVirtualMachineSelection.resolveExisting(name, in: lib.library)
@@ -703,7 +705,7 @@ struct VPhoneFirmwareKernelcacheCommand: ParsableCommand {
guard !linkOnly else {
throw ValidationError("\(name)'s kernelcache mix is not staged. Stage it first, as yourself: \(KernelCacheMixer.ipswEnvironmentVariable)=<ipsw> vphone-cli fw kernelcache \(name)")
}
- try mixer.stage(kernelcache: kernelcache)
+ try mixer.stage(kernelcache: kernelcache, ipsw: ipsw)
}
try mixer.link(kernelcache: kernelcache)
print("[+] The kernelcache mix is ready; `fw patch` takes it from the cache.")
@@ -712,7 +714,7 @@ struct VPhoneFirmwareKernelcacheCommand: ParsableCommand {
guard !linkOnly else {
throw ValidationError("Linking the kernelcache mix needs root. Run this command with sudo.")
}
- try mixer.stage(kernelcache: kernelcache)
+ try mixer.stage(kernelcache: kernelcache, ipsw: ipsw)
print("[+] Staged. Link it with: sudo vphone-cli fw kernelcache \(name)")
}
}
diff --git a/VPhoneLaunchpad/Configuration/Version.xcconfig b/VPhoneLaunchpad/Configuration/Version.xcconfig
index 05d75559..47463f40 100644
--- a/VPhoneLaunchpad/Configuration/Version.xcconfig
+++ b/VPhoneLaunchpad/Configuration/Version.xcconfig
@@ -1,4 +1,4 @@
MARKETING_VERSION = 2.10.1
// Bump whenever the helper changes. The app blesses the helper again when the
// installed helper's version or bytes differ from the copy it embeds.
-CURRENT_PROJECT_VERSION = 18
+CURRENT_PROJECT_VERSION = 19
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
index 5e83326c..6ee74eed 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Control/VPhoneLaunchpadControlCommands.swift
@@ -613,6 +613,13 @@ struct VPhoneLaunchpadControlCommands {
} else {
slimming = try Self.slimming(request, usesTemplate: usesTemplate)
}
+ // A machine on its release's own cloudOS stages its kernelcache mix with
+ // an ipsw, as New Machine's ipsw field; `fw kernelcache` does nothing
+ // on a cloudOS that still has vphone600 components.
+ let kernelcacheIPSW = request.option("ipsw")
+ if let kernelcacheIPSW, !FileManager.default.isExecutableFile(atPath: kernelcacheIPSW) {
+ throw VPhoneLaunchpadError("--ipsw names \(kernelcacheIPSW), which is not an executable.")
+ }
let options = try VPhoneLaunchpadCreationPipeline.Options(
name: machine.name,
libraryRoot: machine.libraryRoot,
@@ -629,6 +636,7 @@ struct VPhoneLaunchpadControlCommands {
keepArtifacts: request.flag("keep-artifacts"),
usesTemplate: usesTemplate,
slimming: slimming,
+ kernelcacheIPSW: kernelcacheIPSW,
)
return library.create(options)
}
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift
index 627e08c9..41b7eea1 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/HostSetup/VPhoneLaunchpadHelperClient.swift
@@ -285,6 +285,25 @@ final class VPhoneLaunchpadHelperClient {
}
}
+ /// Links the kernelcache mix a machine on a research board cloudOS staged,
+ /// as root. Output lines go to `onLine`.
+ func linkKernelcache(
+ bundleVersion: String,
+ machineName: String,
+ libraryRoot: String,
+ onLine: @escaping @Sendable (String) -> Void,
+ ) async throws -> Int32 {
+ try await runFirmware(machineName: machineName, libraryRoot: libraryRoot, onLine: onLine) { proxy, authorization, reply in
+ proxy.linkKernelcache(
+ authorization: authorization,
+ bundleVersion: bundleVersion,
+ machineName: machineName,
+ libraryRoot: libraryRoot,
+ reply: reply,
+ )
+ }
+ }
+
/// Runs `cfw update-environment` as root: redeploys the given bundle's
/// guest resources into a stopped machine. Output lines go to `onLine`.
func updateGuestEnvironment(
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
index e695abb3..160d595d 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadCreationPipeline.swift
@@ -59,6 +59,10 @@ final class VPhoneLaunchpadCreationPipeline {
/// of its own.
var usesTemplate = true
var slimming = VPhoneLaunchpadSlimming()
+ /// The ipsw that stages the kernelcache mix of a machine on its
+ /// release's own cloudOS (`fw kernelcache --ipsw`), whose link the helper
+ /// runs as root. Nil for every other machine.
+ var kernelcacheIPSW: String?
var machine: VPhoneLaunchpadMachinePath {
VPhoneLaunchpadMachinePath(libraryRoot: libraryRoot, name: name)
@@ -440,6 +444,22 @@ final class VPhoneLaunchpadCreationPipeline {
onLine: tee,
)
}
+ let libraryRoot = Self.canonicalPath(URL(fileURLWithPath: options.libraryRoot, isDirectory: true))
+ // On the release's own cloudOS the kernelcache is mixed first: staged
+ // here, as the user, with the chosen ipsw, and linked by the helper as
+ // root, which runs no ipsw. `fw patch` takes the mix from the cache.
+ if let ipsw = options.kernelcacheIPSW {
+ try await run(["fw", "kernelcache", name, "--ipsw", ipsw] + library, onLine: tee)
+ let status = try await helper.linkKernelcache(
+ bundleVersion: version,
+ machineName: name,
+ libraryRoot: libraryRoot,
+ onLine: tee,
+ )
+ guard status == 0 else {
+ throw VPhoneLaunchpadError(String(localized: "Unable to link the kernelcache. Check the log for details."), detail: log.tail)
+ }
+ }
guard options.patches.customisesRestoredSystem else {
try await run(patchArguments(name) + library, onLine: tee)
return
@@ -450,7 +470,7 @@ final class VPhoneLaunchpadCreationPipeline {
let status = try await helper.patchRestoreImage(
bundleVersion: version,
machineName: name,
- libraryRoot: Self.canonicalPath(URL(fileURLWithPath: options.libraryRoot, isDirectory: true)),
+ libraryRoot: libraryRoot,
onLine: tee,
)
guard status == 0 else {
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift
index 334aa991..ebf53200 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadMachine.swift
@@ -232,6 +232,9 @@ nonisolated struct VPhoneLaunchpadFirmwareCatalog: Decodable, Sendable {
struct Pairing: Decodable, Hashable, Identifiable, Sendable {
let ios: Image
let recommendedCloudOS: Image
+ /// The release's own cloudOS, on the research board, from a bundle that
+ /// links its kernelcache mix (`fw kernelcache`).
+ var matchingCloudOS: Image?
var id: String {
ios.url
diff --git a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
index 27e8127e..fae2d083 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpad/Machines/VPhoneLaunchpadNewMachineView.swift
@@ -34,6 +34,11 @@ struct VPhoneLaunchpadNewMachineView: View {
@State private var usesCustomSources = false
@State private var iphoneSource = ""
@State private var cloudOSSource = ""
+ /// Run the release on its own cloudOS, where the research board stands in
+ /// for vphone600 and the kernelcache is mixed (`fw kernelcache`).
+ @State private var usesOwnCloudOS = false
+ /// The ipsw that stages a mix; vphone-cli does not ship one.
+ @AppStorage("KernelcacheIPSW") private var kernelcacheIPSW = ""
@State private var cpu = Self.defaultCPU
@State private var memoryMB = Self.defaultMemoryMB
@State private var diskSizeGB = Self.defaultDiskSizeGB
@@ -78,7 +83,16 @@ struct VPhoneLaunchpadNewMachineView: View {
let cloudOS = cloudOSSource.trimmingCharacters(in: .whitespaces)
return iphone.isEmpty || cloudOS.isEmpty ? nil : (iphone, cloudOS)
}
- return selectedPairing.map { ($0.ios.url, $0.recommendedCloudOS.url) }
+ return selectedPairing.map { ($0.ios.url, ownCloudOS?.url ?? $0.recommendedCloudOS.url) }
+ }
+
+ /// The release's own cloudOS, when chosen and the pairing has one.
+ private var ownCloudOS: VPhoneLaunchpadFirmwareCatalog.Image? {
+ usesOwnCloudOS && !usesCustomSources ? selectedPairing?.matchingCloudOS : nil
+ }
+
+ private var hasKernelcacheIPSW: Bool {
+ FileManager.default.isExecutableFile(atPath: kernelcacheIPSW)
}
private var effectiveName: String {
@@ -168,6 +182,7 @@ struct VPhoneLaunchpadNewMachineView: View {
private var canCreate: Bool {
nameProblem == nil && advancedProblem == nil && sources != nil && bundleVersion != nil
+ && (ownCloudOS == nil || hasKernelcacheIPSW)
}
var body: some View {
@@ -391,6 +406,11 @@ struct VPhoneLaunchpadNewMachineView: View {
} else {
Text("Choose an iPhone IPSW and a cloudOS IPSW in Advanced Options.").foregroundStyle(.red)
}
+ } else if let own = ownCloudOS {
+ Text(hasKernelcacheIPSW
+ ? "On its own cloudOS, \(own.name): the kernelcache is rebuilt, which asks for administrator access once."
+ : "Choose an ipsw with `kernel extract --kdk` in Advanced Options to run on \(own.name).")
+ .foregroundStyle(hasKernelcacheIPSW ? Color.secondary : Color.red)
} else if let selectedGuest, let cloudOS = selectedPairing?.recommendedCloudOS.name {
Text("Recommended firmware pairings for \(selectedGuest.detailedName), with \(cloudOS).")
.foregroundStyle(.secondary)
@@ -564,6 +584,14 @@ struct VPhoneLaunchpadNewMachineView: View {
if usesCustomSources {
sourceField("iPhone IPSW", $iphoneSource)
sourceField("cloudOS IPSW", $cloudOSSource)
+ } else if let pairing = selectedPairing, let own = pairing.matchingCloudOS {
+ Picker("cloudOS", selection: $usesOwnCloudOS) {
+ Text(verbatim: pairing.recommendedCloudOS.name).tag(false)
+ Text(verbatim: own.name).tag(true)
+ }
+ if usesOwnCloudOS {
+ sourceField("ipsw", $kernelcacheIPSW)
+ }
} else {
LabeledContent("cloudOS", value: selectedPairing?.recommendedCloudOS.name ?? "—")
}
@@ -572,6 +600,8 @@ struct VPhoneLaunchpadNewMachineView: View {
} footer: {
Text(usesCustomSources
? "These two files replace the device and version chosen on the basic page."
+ : ownCloudOS != nil
+ ? "On its own cloudOS the release boots its own kernel, rebuilt with the vphone600 virtualisation kexts: the ipsw (with `kernel extract --kdk`) stages it as you, and the helper links it as root."
: "The device and version are chosen on the basic page; cloudOS goes with them.")
.foregroundStyle(.secondary)
}
@@ -784,6 +814,7 @@ struct VPhoneLaunchpadNewMachineView: View {
keepArtifacts: keepArtifacts,
usesTemplate: usesTemplate,
slimming: slimming,
+ kernelcacheIPSW: ownCloudOS == nil ? nil : kernelcacheIPSW,
)
let pipeline = model.machines.create(options)
model.machines.selection = [pipeline.machine]
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift
index 1e052271..39d96c81 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperFirmwareRequest.swift
@@ -17,6 +17,9 @@ struct VPhoneLaunchpadHelperFirmwareRequest {
/// merges and reseals the system image before the restore. `fw patch`
/// refuses to run as root for any other selection.
case patchRestoreImage
+ /// `fw kernelcache --link-only`: links the kernelcache mix the user
+ /// staged. It never stages, so no ipsw runs as root.
+ case linkKernelcache
}
typealias MachineKey = VPhoneLaunchpadHelperFirmwareAdmission.MachineKey
@@ -89,6 +92,8 @@ struct VPhoneLaunchpadHelperFirmwareRequest {
"--work-parent", workParent]
case .patchRestoreImage:
arguments = ["fw", "patch", machineName, "--library-root", libraryRoot, "--restore-image-only"]
+ case .linkKernelcache:
+ arguments = ["fw", "kernelcache", machineName, "--library-root", libraryRoot, "--link-only"]
}
self.executable = executable
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperService.swift b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperService.swift
index b3d0ef9c..46c0bbf4 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperService.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadHelper/VPhoneLaunchpadHelperService.swift
@@ -115,6 +115,23 @@ final class VPhoneLaunchpadHelperService: NSObject, VPhoneLaunchpadHelperProtoco
)
}
+ func linkKernelcache(
+ authorization: Data,
+ bundleVersion: String,
+ machineName: String,
+ libraryRoot: String,
+ reply: @escaping @Sendable (Int32, String?) -> Void,
+ ) {
+ runFirmware(
+ .linkKernelcache,
+ authorization: authorization,
+ bundleVersion: bundleVersion,
+ machineName: machineName,
+ libraryRoot: libraryRoot,
+ reply: reply,
+ )
+ }
+
func updateGuestEnvironment(
authorization: Data,
bundleVersion: String,
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
index 1a356c87..585b65cd 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadControl.swift
@@ -177,10 +177,10 @@ nonisolated struct VPhoneLaunchpadControlCommand: Sendable {
Self(name: "vm.log", arguments: ["name"], options: ["root", "lines", "kind"], flags: [],
summary: "The last lines of the console log (--kind create, dfu or patch for those logs)."),
Self(name: "vm.create", arguments: ["name"], options: [
- "root", "bundle", "iphone-source", "cloudos-source", "device", "cpu", "memory", "disk-size", "network", "preset", "from",
+ "root", "bundle", "iphone-source", "cloudos-source", "device", "cpu", "memory", "disk-size", "network", "preset", "from", "ipsw",
"slim", "trim", "keep-languages", "service-profile", "remove-apps", "keep-apps",
], flags: ["keep-artifacts", "no-wait", "no-template", "accounts-off"], repeated: ["block", "allow"],
- summary: "Create a machine through every step, as New Machine does, bound to --bundle (default: the default bundle): cloned from a template, built first when missing, or restored on its own with --no-template. --block and --allow turn one patch of --preset off or on, as New Machine's patch list and vphone-cli fw set-patches do: boot-chain ones go into the template, guest ones are applied to the clone. --slim, --trim, --keep-languages, --service-profile, --remove-apps, --keep-apps and --accounts-off shape the template, as in vphone-cli vm create. --from <step> retries a failed creation from that step, with the options it started with."),
+ summary: "Create a machine through every step, as New Machine does, bound to --bundle (default: the default bundle): cloned from a template, built first when missing, or restored on its own with --no-template. --block and --allow turn one patch of --preset off or on, as New Machine's patch list and vphone-cli fw set-patches do: boot-chain ones go into the template, guest ones are applied to the clone. --slim, --trim, --keep-languages, --service-profile, --remove-apps, --keep-apps and --accounts-off shape the template, as in vphone-cli vm create. --ipsw <path> stages the kernelcache mix of a machine on its release's own cloudOS, as New Machine's ipsw field. --from <step> retries a failed creation from that step, with the options it started with."),
Self(name: "vm.set-bundle", arguments: ["name", "version"], options: ["root"], flags: ["update-environment"],
summary: "Bind a machine to another installed version; its host programs change at the next start. --update-environment also redeploys that version's guest environment into the stopped machine. The boot chain stays as created."),
Self(name: "vm.leases", arguments: [], options: [], flags: ["release"],
diff --git a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift
index 96aae7b6..ce2dbb84 100644
--- a/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift
+++ b/VPhoneLaunchpad/VPhoneLaunchpadShared/VPhoneLaunchpadHelperProtocol.swift
@@ -76,6 +76,19 @@ nonisolated protocol VPhoneLaunchpadHelperProtocol {
reply: @escaping @Sendable (Int32, String?) -> Void,
)
+ /// Runs `vphone-cli fw kernelcache --link-only` from a store bundle as root:
+ /// links the kernelcache mix the user staged for a machine on a cloudOS
+ /// without vphone600 components. kmutil reads only kexts root owns; the
+ /// child copies the stage into a directory of its own first and runs no
+ /// ipsw. Same output channel and reply as `installCustomFirmware`.
+ func linkKernelcache(
+ authorization: Data,
+ bundleVersion: String,
+ machineName: String,
+ libraryRoot: String,
+ reply: @escaping @Sendable (Int32, String?) -> Void,
+ )
+
/// Runs `vphone-cli cfw update-environment` from a store bundle as root:
/// redeploys the bundle's guest resources into a stopped machine and
/// nothing else. Same output channel and reply as `installCustomFirmware`,