From df8594c9acfccba983c123a8c4190faaab0844a5 Mon Sep 17 00:00:00 2001 From: Claudius Date: Wed, 18 Nov 2026 21:22:50 +0000 Subject: [PATCH] ios-27: fork pin to Scion-Project/xnu#64 (disk0 in the IORegistry: About > Capacity was 0 KB); notes in SETTINGS.md --- docs/ios27/SETTINGS.md | 25 +++++++++++++++++++++++++ profiles/ios-27.conf | 2 +- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/docs/ios27/SETTINGS.md b/docs/ios27/SETTINGS.md index 004d1bd8c..64787ec8d 100644 --- a/docs/ios27/SETTINGS.md +++ b/docs/ios27/SETTINGS.md @@ -89,3 +89,28 @@ in the order above (the database file, which only `medialibraryd` or a writer ma 18 Nov). - Settings > Bluetooth opens as a blank white page on 24B156 (it drew on 24A446). No Settings abort came with it (boot o272, 13:35). Not investigated. + +## About > Capacity "0 KB" (18 November) + +Seen on the 24B156 port: Settings > General > About shows **Capacity: 0 KB** (iPhone Storage asks the same question). + +Where the number comes from (24B156's `AboutSettings.bundle`, `-[PSGAboutDataSource _loadValues]`, a single-user device): +`MGCopyAnswer("DiskUsage")[kMGQDiskUsageTotalDiskCapacity]`, rounded to whole GB and formatted decimal. The root image being HFSX +instead of APFS is not the cause: Available comes from `NSURLVolumeAvailableCapacityForImportantUsageKey` (statfs), and +`APFSVolumeGetSpaceInfo` is only called for a multi-user iPad. + +libMobileGestalt's `NANDSize()` (strings "`SInt64 NANDSize(void)`", "`IOServiceGetMatchingService() for disk0 failed!`", +"`kIOMediaSizeKey`") takes TotalDiskCapacity from the IORegistry, not from the file system: + + IOServiceGetMatchingService(kIOMasterPortDefault, IOBSDNameMatching(kIOMasterPortDefault, 0, "disk0")) + IORegistryEntryCreateCFProperty(entry, CFSTR("Size"), kCFAllocatorDefault, 0) -> CFNumber SInt64 + +The kernel has no IOStorageFamily, so no IOMedia and no `disk0` (`XNU-MICROSD.md` section 10): the lookup fails, NANDSize is -1, the answer +is 0. (`TotalDataCapacity` and the rest of `DiskUsage` are `statfs("/private/var")` and were not the problem. The MobileGestalt cache +that `94-camera` removes is not involved either: it only holds what the first boot computed.) + +The change is in the kernel, `Scion-Project/xnu` pull request 64: `bsd/dev/herolte_ufs.c` records the LUN's size (the GPT's backup header +LBA + 1) when it finds the root partition and calls `sweet_media_publish()` (`iokit/Kernel/arm/SweetMedia.cpp`), which attaches a plain +IOService named `disk0` under the platform expert with `BSD Name` = `disk0`, `Size`, `Whole`, `Writable`, `Removable`. It is not an IOMedia +(DiskArbitration and IOStorage matching do not see it). A 64 GB S9 should show **64 GB**. The boot log has +`SWEET MEDIA: disk0 registered, Size `. No root step is needed. Built, not yet run on a phone. diff --git a/profiles/ios-27.conf b/profiles/ios-27.conf index bbb58db63..ce7146eb1 100644 --- a/profiles/ios-27.conf +++ b/profiles/ios-27.conf @@ -14,7 +14,7 @@ profile ios-27 xnu_commit ac9718fb1af618d5ce8678d0dc6e8a58f252216f xnu_fork https://github.com/Scion-Project/xnu.git fork_branch scion/xnu-12377 - fork_commit f251408549e5e1063c29fc43faf20eca88a6f69e + fork_commit 5d485cfad6be117fefa7c8e34c36a45e7bb23b26 fork_copy profiles/ios-27.copy fork_stage xnu/stage/00_setup_coreentitlements.sh drivers none