|
| 1 | +# Support Tools |
| 2 | + |
| 3 | +This directory contain support tools for HoolockLinux. |
| 4 | +They are intended to be ran under jailbroken iOS/tvOS/bridgeOS, or a SSH ramdisk. |
| 5 | + |
| 6 | +Download precompiled tools: [iOS/iPadOS](https://nightly.link/hoolocklinux/docs/workflows/build/master/hoolock-support-iphoneos.zip) | [tvOS](https://nightly.link/hoolocklinux/docs/workflows/build/master/hoolock-support-appletvos.zip) | [bridgeOS](https://nightly.link/hoolocklinux/docs/workflows/build/master/hoolock-support-bridgeOS.zip) |
| 7 | + |
| 8 | +## Disk partition tools |
| 9 | + |
| 10 | +> [!WARNING] |
| 11 | +> These tools could potentially destroy all data on the main disk, so double check. |
| 12 | +
|
| 13 | +### gdisk |
| 14 | + |
| 15 | +This is the usual gpt partitioning tool found on many unixes. |
| 16 | + |
| 17 | +It is used to inspect and modify the partition table. |
| 18 | + |
| 19 | +It should be signed with entitlements in `gdisk.xml`. |
| 20 | + |
| 21 | +### resize.c / resize_apfs |
| 22 | + |
| 23 | +This is an apfs container resize tool. |
| 24 | + |
| 25 | +It should be signed with entitlements in `resize.xml`. |
| 26 | + |
| 27 | +Usage: `./resize_apfs <container BSD name> <size in bytes>` |
| 28 | + |
| 29 | +Resize the container to N bytes, such as 21474836480 in the following example. |
| 30 | +There are alignment restrictions so pick a 1048576-byte aligned size. |
| 31 | + |
| 32 | +``` |
| 33 | +./resize_apfs disk0s1 21474836480 |
| 34 | +``` |
| 35 | + |
| 36 | +It is also possible to resize the container to the max size: |
| 37 | + |
| 38 | +> [!CAUTION] |
| 39 | +> On iOS 13 and below this might ignore the gpt and resize the apfs to max which would break the filesystem. Recommend specifying the exact partition size instead. |
| 40 | +
|
| 41 | +``` |
| 42 | +./resize_apfs disk0s1 0 |
| 43 | +``` |
| 44 | + |
| 45 | +During an online resize, all file system operations will be frozen, so in normal iOS the device will become unresponsive |
| 46 | + |
| 47 | +After resizing, the gpt can be modified with gdisk. |
| 48 | + |
| 49 | + |
| 50 | +### Caveats |
| 51 | + |
| 52 | +On iOS 11-13 the default snapshot makes the container unresizable. |
| 53 | +One can delete and recreate the snapshot with a tool like [`snaputil`](https://github.com/ahl/apfs) from ramdisk and resizing should work. |
| 54 | + |
| 55 | +In order for a resize to work, the SEP firmware must be loaded, and gigalocker |
| 56 | +must be initialized. This is already done in normal iOS. In a ramdisk, this can |
| 57 | +also be done on iOS/iPadOS 15 and below. |
| 58 | +(Might also be possible on higher tvOS/bridgeOS versions) |
| 59 | + |
| 60 | +If you use [SSHRD_Script](https://github.com/verygenericname/SSHRD_Script.git), the following command should do: |
| 61 | + |
| 62 | +``` |
| 63 | +mount_filesystems |
| 64 | +``` |
| 65 | + |
| 66 | +In a ramdisk, you might need somewhere writable to put the tools. On iOS 14 and above this is simple: |
| 67 | + |
| 68 | +``` |
| 69 | +mount_tmpfs /mnt5 |
| 70 | +``` |
| 71 | + |
| 72 | +On iOS 13 and below, tmpfs is not supported, so a ramdisk needs to be created and formatted: |
| 73 | + |
| 74 | +``` |
| 75 | +disk=$(hdik ram://16384) # 16384 KiB |
| 76 | +newfs_hfs $disk |
| 77 | +mount_hfs $disk /mnt5 |
| 78 | +``` |
0 commit comments