Skip to content

Run a virtual iPhone on an Apple Silicon Mac.

Swift

Keep the Apple TV 4K userland swap on for tvOS 27

Jacky14d0beeb1cde
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
index a77e1d36..67d6c890 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcher/PatchSets/FirmwareGuestSystemPatchSet.swift
@@ -70,7 +70,7 @@ public enum FirmwareGuestSystemPatchSet {
title: "Apple TV 4K userland from OTA",
summary: "Research: replaces the System volume with the arm64e tvOS userland staged in the VM's OTAUserland folder, extracted with aa so ownership, modes, flags and compression survive.",
target: .guestFile(path: "/"),
- applicability: VPhonePatchApplicability(iOSBase: .major(26)),
+ applicability: VPhonePatchApplicability(iOSBase: .atLeast(major: 26, minor: 0)),
),
VPhonePatchDeclaration(
identifier: locationdCohorting,
diff --git a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift
index 137b9fc1..5ea20573 100644
--- a/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift
+++ b/VPhoneExecutable/VPhoneCommand/FirmwarePatcherTests/PatchSets/FirmwareGuestPatchResolutionTests.swift
@@ -94,6 +94,8 @@ struct FirmwareGuestPatchResolutionTests {
iOSBase: VPhoneVersion("27.0"),
cloudOS: VPhoneVersion("26.4"),
)
+ // The userland swap and the GPU driver carry on to the 27 OTA.
+ #expect(tv4K27.isEnabled(gpu) && tv4K27.isEnabled(ota))
#expect(tv4K27.enabled.isSuperset(of: FirmwarePatchSetCatalog.tvOS27UserlandPatches))
#expect(tv4K27.isEnabled("kernel-boot-iomfb_swapend"))
#expect(FirmwareGuestPatchResolution.unvalidatedTVGuestPatches(enabled: tv4K27.enabled, arm64eUserland: true).isEmpty)
diff --git a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
index 54c8da4b..2598294b 100644
--- a/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
+++ b/VPhoneExecutable/VPhoneCommand/VPhoneCommand/Firmware/VPhoneCustomFirmwareInstaller.swift
@@ -216,6 +216,11 @@ struct VPhoneCustomFirmwareInstaller {
guard unvalidated.isEmpty else {
throw ValidationError("These guest patches have not been validated for tvOS. Block them with `fw set-patches` before installation: \(unvalidated.joined(separator: ", "))")
}
+ // Without the swap the base device's userland would boot on this
+ // one, which panics at first boot.
+ if mode == .full, let base = device.restoreBase, !plan.enabledPatches.contains(FirmwareGuestSystemPatchSet.tvOTAUserland) {
+ throw ValidationError("\(device.productType) has no IPSW of its own, and \(FirmwareGuestSystemPatchSet.tvOTAUserland) is not in its patch plan, so the \(base.productType) userland would boot on it. Allow it with `fw set-patches`, then run `fw patch` again.")
+ }
}
// Before any disk work, so what it says is not buried under it.
recoverBoardDeviceTree(in: bundleDirectory, restore: restore, plan: plan, invokingUser: invokingUser)