refactor: drop the sheng- prefix from boot arguments

Every boot argument loses its sheng- prefix (sheng-touch=4 is now
touch=4) in the scripts, the XNU and Mesa patches and the drivers.
No XNU or Apple kext boot argument of iPadOS 27 or macOS 27.3 uses any
of the new names. The Metal plugin and Turnip look a name up as a whole
command line token, so log=1 no longer matches cache-log=1.
This commit is contained in:
rponeawa
2026-11-10 12:00:00 +08:00
Unverified
parent 95ad781292
commit 47ec6a5222
24 changed files with 35 additions and 35 deletions
+2 -2
View File
@@ -344,7 +344,7 @@ index 33a22aa..bc779a7 100644
+static_assert(sizeof(struct tu_pass_rec) == 72, "pass record");
+static struct tu_pass_rec tu_pass_ring[512];
+
+/* The host's diagnostics switch (SHENG_DIAG, set by the plugin from sheng-diag=1): without it no pass is stamped or kept in the ring. */
+/* The host's diagnostics switch (SHENG_DIAG, set by the plugin from diag=1): without it no pass is stamped or kept in the ring. */
+static bool
+tu_pass_trace_on(void)
+{
@@ -702,7 +702,7 @@ index 0209408..c12bd00 100644
+static struct tu_darwin_submit_rec darwin_submit_ring[512];
+static uint32_t darwin_submit_seq;
+
+/* The host's diagnostics switch (SHENG_DIAG, set by the plugin from sheng-diag=1): without it no submission is kept in the ring. */
+/* The host's diagnostics switch (SHENG_DIAG, set by the plugin from diag=1): without it no submission is kept in the ring. */
+static bool
+darwin_submit_trace_on(void)
+{
+4 -4
View File
@@ -120,7 +120,7 @@ diff --git a/src/freedreno/vulkan/tu_cmd_buffer.cc b/src/freedreno/vulkan/tu_cmd
* (tu_allocate_transient_attachments). The autotuner's choice, SYSMEM by default for passes of few draws, is a matter of bandwidth,
* which does not weigh the memory: a 3048x2032 RGBA16F attachment is 48 MiB. */
- for (unsigned i = 0; i < cmd->state.pass->attachment_count; i++) {
+ /* sheng-tum=s (tu_sheng_render_mode) renders even those passes in system memory, backing their transient attachments at the
+ /* tum=s (tu_sheng_render_mode) renders even those passes in system memory, backing their transient attachments at the
+ * pass: the colour reference for the GMEM swap trace. */
+ const bool strict_sysmem = sheng_mode == 's';
+ for (unsigned i = 0; !(forced_sysmem && strict_sysmem) && i < cmd->state.pass->attachment_count; i++) {
@@ -181,7 +181,7 @@ diff --git a/src/freedreno/vulkan/tu_frame_diagnostic.h b/src/freedreno/vulkan/t
struct {uint64_t seq,us;uint32_t event,pid;uint64_t v[12];} rec={0,0,event,0,{a,b,c,d,e,f,g,h,i,j,k,l}};
(void)tu_darwin_frame_diagnostic(0x7102,&rec,sizeof(rec));
}
+/* Boot-arg sheng-tum=g renders every pass that can in GMEM, sheng-tum=s every pass in system memory (transient attachments too):
+/* Boot-arg tum=g renders every pass that can in GMEM, tum=s every pass in system memory (transient attachments too):
+ * the colour runs of the GMEM swap check, set by the boot so their command lines stay short. 0 when absent. */
+#include <sys/sysctl.h>
+static inline char tu_sheng_render_mode() {
@@ -189,8 +189,8 @@ diff --git a/src/freedreno/vulkan/tu_frame_diagnostic.h b/src/freedreno/vulkan/t
+ if (mode == 1) {
+ char args[1100] = {};
+ size_t size = sizeof args - 1;
+ const char *at = sysctlbyname("kern.bootargs", args, &size, nullptr, 0) == 0 ? strstr(args, "sheng-tum=") : nullptr;
+ mode = at && (at[10] == 'g' || at[10] == 's') ? at[10] : 0;
+ const char *at = sysctlbyname("kern.bootargs", args, &size, nullptr, 0) == 0 ? args : nullptr;
+ while (at && (at = strstr(at, "tum=")) && at != args && at[-1] != ' ') at += 4; mode = at && (at[4] == 'g' || at[4] == 's') ? at[4] : 0;
+ }
+ return mode;
+}
@@ -9,7 +9,7 @@ index 9969eb6f..166272c7 100644
+/* Boot-time read-only union views of owner-provided GPU addon content over sealed system directories, mounted after the Data mount and
+ * before launchd starts: the Adreno Metal plugin bundle over /System/Library/Extensions (the original Metal discovery loads
+ * /System/Library/Extensions/<MetalPluginName>.bundle) and an owner launchd job over /System/Library/LaunchDaemons (a process outside
+ * every sandbox profile). Only with boot-arg sheng-gpu-addon=1. Never panics: a missing source directory or a refused mount only
+ * every sandbox profile). Only with boot-arg gpu-addon=1. Never panics: a missing source directory or a refused mount only
+ * records its status. The backing directories are owner Data (not an authenticated immutable volume); code in them still has to
+ * pass AMFI through the loaded trust cache. */
+extern volatile int native_bindfs_boot_mount;
@@ -298,7 +298,7 @@ index 9969eb6f..166272c7 100644
+native_gpu_addon_prepare(proc_t p, user_addr_t scratch)
+{
+ uint32_t enabled = 0;
+ if (!PE_parse_boot_argn("sheng-gpu-addon", &enabled, sizeof(enabled)) || enabled != 1) {
+ if (!PE_parse_boot_argn("gpu-addon", &enabled, sizeof(enabled)) || enabled != 1) {
+ return;
+ }
+ native_gpu_addon_install(p, scratch);
@@ -9,7 +9,7 @@ index 166272c7..6d7777b9 100644
+/* The deletable system apps (Weather, Notes, Calendar, ...) ship in the OS volume's /private/var/staged_system_apps. A restore copies
+ * them into the Data volume, where SystemAppMigrator installs them during the first-boot data migration; until then only the
+ * placeholders in /System/Library/AppPlaceholders exist and the widgets of those apps stay blank. The owner Data mount hides the OS
+ * directory, so with boot-arg sheng-staged-apps=1 it is copied once, through the vnode the Data mount covers, into Data's
+ * directory, so with boot-arg staged-apps=1 it is copied once, through the vnode the Data mount covers, into Data's
+ * /private/var/staged_system_apps before launchd starts. /private/var/db/.sheng-staged-apps marks a complete copy. Directories and
+ * regular files only (the 21H461 set has nothing else), owned by mobile (uid and gid 501): installcoordinationd and the migration plugin,
+ * which move and remove them, run as mobile.
@@ -253,7 +253,7 @@ index 166272c7..6d7777b9 100644
+native_staged_apps_prepare(proc_t p, user_addr_t scratch, mount_t data_mount)
+{
+ uint32_t enabled = 0;
+ if (!PE_parse_boot_argn("sheng-staged-apps", &enabled, sizeof(enabled)) || enabled != 1) {
+ if (!PE_parse_boot_argn("staged-apps", &enabled, sizeof(enabled)) || enabled != 1) {
+ return;
+ }
+ vfs_context_t ctx = vfs_context_current();
@@ -23,7 +23,7 @@ index 51bcf33e..ae7c70bd 100644
mac_proc_check_launch_constraints(proc_t curp, struct image_params *imgp, os_reason_t *reasonp)
{
+ uint32_t skip = 0;
+ if (PE_parse_boot_argn("sheng-no-lc", &skip, sizeof(skip)) && skip != 0) {
+ if (PE_parse_boot_argn("no-lc", &skip, sizeof(skip)) && skip != 0) {
+ return 0;
+ }
char *fatal_failure_desc = NULL;
+2 -2
View File
@@ -9,7 +9,7 @@ index a5ff474..4704203 100644
+/* Boot-time read-only union views of owner-provided GPU addon content over sealed system directories, mounted after the Data mount and
+ * before launchd starts: the Adreno Metal plugin bundle over /System/Library/Extensions (the original Metal discovery loads
+ * /System/Library/Extensions/<MetalPluginName>.bundle) and an owner launchd job over /System/Library/LaunchDaemons (a process outside
+ * every sandbox profile). Only with boot-arg sheng-gpu-addon=1. Never panics: a missing source directory or a refused mount only
+ * every sandbox profile). Only with boot-arg gpu-addon=1. Never panics: a missing source directory or a refused mount only
+ * records its status. The backing directories are owner Data (not an authenticated immutable volume); code in them still has to
+ * pass AMFI through the loaded trust cache. */
+extern volatile int native_bindfs_boot_mount;
@@ -298,7 +298,7 @@ index a5ff474..4704203 100644
+native_gpu_addon_prepare(proc_t p, user_addr_t scratch)
+{
+ uint32_t enabled = 0;
+ if (!PE_parse_boot_argn("sheng-gpu-addon", &enabled, sizeof(enabled)) || enabled != 1) {
+ if (!PE_parse_boot_argn("gpu-addon", &enabled, sizeof(enabled)) || enabled != 1) {
+ return;
+ }
+ native_gpu_addon_install(p, scratch);
+2 -2
View File
@@ -9,7 +9,7 @@ index 4704203..2c6f346 100644
+/* The deletable system apps (Weather, Notes, Calendar, ...) ship in the OS volume's /private/var/staged_system_apps. A restore copies
+ * them into the Data volume, where SystemAppMigrator installs them during the first-boot data migration; until then only the
+ * placeholders in /System/Library/AppPlaceholders exist and the widgets of those apps stay blank. The owner Data mount hides the OS
+ * directory, so with boot-arg sheng-staged-apps=1 it is copied once, through the vnode the Data mount covers, into Data's
+ * directory, so with boot-arg staged-apps=1 it is copied once, through the vnode the Data mount covers, into Data's
+ * /private/var/staged_system_apps before launchd starts. /private/var/db/.sheng-staged-apps marks a complete copy. Directories and
+ * regular files only (the 21H461 set has nothing else), owned by mobile (uid and gid 501): installcoordinationd and the migration plugin,
+ * which move and remove them, run as mobile.
@@ -253,7 +253,7 @@ index 4704203..2c6f346 100644
+native_staged_apps_prepare(proc_t p, user_addr_t scratch, mount_t data_mount)
+{
+ uint32_t enabled = 0;
+ if (!PE_parse_boot_argn("sheng-staged-apps", &enabled, sizeof(enabled)) || enabled != 1) {
+ if (!PE_parse_boot_argn("staged-apps", &enabled, sizeof(enabled)) || enabled != 1) {
+ return;
+ }
+ vfs_context_t ctx = vfs_context_current();
@@ -23,7 +23,7 @@ index b64da95..c548aa1 100644
mac_proc_check_launch_constraints(proc_t curp, struct image_params *imgp, os_reason_t *reasonp)
{
+ uint32_t skip = 0;
+ if (PE_parse_boot_argn("sheng-no-lc", &skip, sizeof(skip)) && skip != 0) {
+ if (PE_parse_boot_argn("no-lc", &skip, sizeof(skip)) && skip != 0) {
+ return 0;
+ }
char *fatal_failure_desc = NULL;
+1 -1
View File
@@ -7,7 +7,7 @@ With --publish the seed also carries /private/var/ngpu/addons/NativeAdrenoMetal.
discovery in backboardd (NativeAdrenoMetalPlugin.mm), so the render server composites through it. Without the file the plugin only runs its tests.
Adds /private/var/ngpu/addons/NativeAdrenoMetal.bundle, /private/var/ngpu/bin/adrenoprobed and /private/var/ngpu/daemons/*.plist (from build/adreno-metal-plugin, see build-adreno-metal-plugin.py). The
kernel's boot-time addon mount (sheng-gpu-addon=1) presents that directory as a read-only union view over
kernel's boot-time addon mount (gpu-addon=1) presents that directory as a read-only union view over
/System/Library/Extensions, which is where the original Metal discovery looks for MetalPluginName. BASE is not modified and the
volume UUID is unchanged. Nothing is written to Git or to the OS inputs."""
import json
+1 -1
View File
@@ -62,7 +62,7 @@ PATCHES = [ROOT / 'drivers/AdrenoMetal/bridge/patches' / name for name in [
# The threads that bring command buffers to their handlers run at the user-interactive class and the compile threads at least at
# the user-initiated class on iOS too, not on macOS alone: on the iPad they ran at the default class and woke up to 50 ms late.
'0023-quality-of-service-on-ios.patch',
# The host's diagnostics switch (SHENG_DIAG, from the boot argument sheng-diag=1): without it the stage ring and the allocation sites
# The host's diagnostics switch (SHENG_DIAG, from the boot argument diag=1): without it the stage ring and the allocation sites
# keep nothing. The stage ring also marks the steps inside a batch's submission (SubmitStep: placed, gathered, vkQueueSubmit, changes).
'0024-diagnostics-switch-and-submit-steps.patch',
# Share large indexed constants, read constant GEP offsets, expose Vulkan allocation sizes and name a made function.
+2 -2
View File
@@ -199,10 +199,10 @@ OSDefineOperatorMethods(IOBlockStorageDevice)
flags.append('-DNATIVE_BOOT_PROCESS_CAPTURE=1')
sources += [device_source(name) for name in
('BootProcessProbe.c', 'BootUiTraceProbe.c', 'BootProcessWorker.c')]
# The launchd job policy (sheng-disable-watchdogd, sheng-lite, sheng-disable-jobs, sheng-setup) that BootProgress carries on
# The launchd job policy (disable-watchdogd, lite, disable-jobs, setup) that BootProgress carries on
# iPadOS 17; the kernel runs it after the Data mount.
sources.append(device_source('BootWatchdogPolicy.c'))
# The diagnostic file export (sheng-diag-export): the unified log, crash reports and a screenshot, read through the VFS.
# The diagnostic file export (diag-export): the unified log, crash reports and a screenshot, read through the VFS.
sources.append(device_source('BootDiagExport.c'))
sources.append(device_source('WifiFirmware.c'))
sources.append(device_source('BluetoothFirmware.c'))
+1 -1
View File
@@ -141,7 +141,7 @@ def main():
for field in ('image_sha256','candidate_sha256','embedded_kernel_sha256'):
require(package[field] == release[field], 'Final-container identity mismatch: '+field)
require(package['patch_reproduction'] == 'byte-for-byte match' and package['owned_memory'] == '0x40000000', 'Wrong packaged kernel/window')
require(package['boot_args'] == ['-v','serial=3','debug=0x14e','kt_fixed_zones=120','sheng-pmgr=2','native-ufs-root=1','native-ufs-diagnostics=1'],
require(package['boot_args'] == ['-v','serial=3','debug=0x14e','kt_fixed_zones=120','pmgr=2','native-ufs-root=1','native-ufs-diagnostics=1'],
'Unexpected probe/reset/security arguments')
log_pass('publication/audit-controls.log', 'PASS: 15 negative packaging controls')
gates.append('actual Android/FAT/kernel/firmware/ADT/root UUID/Data consistency and refusal controls')
+1 -1
View File
@@ -10,7 +10,7 @@ kernel mounts over the default wallpaper's layered animation; --wallpaper-floati
wallpaper's floating layer (iPadOS 27). --prime-list adds FILE (the absolute paths of the OS image's .metallib
files, one per line) as addons/NativeAdrenoMetal.primelist, the libraries the render server compiles ahead (PrimeShaders.h). The payload carries the file next to the kernel (unixnu build payload --gpu-addon), the loader
hands it to the kernel as /chosen/memory-map/GpuAddon, and the kernel writes every file whose content or mode differs into the mounted
Data volume before its addon mounts (sheng-gpu-addon=1). The Data seed then no longer changes with the plugin, so its persistent store
Data volume before its addon mounts (gpu-addon=1). The Data seed then no longer changes with the plugin, so its persistent store
(whose identity is the seed's content) survives a plugin rebuild. The kernel creates missing directories.
The data of every file is zlib-compressed: the payload FAT (the boot image's ramdisk) has to stay at 192 MiB, which the tablet's boot
+2 -2
View File
@@ -80,7 +80,7 @@ parser.add_argument('--read-entry-indirect', action='append', default=[], metava
parser.add_argument('--read-entry-user-vector', action='append', default=[], help='Read an actual bounded user argv vector through ARG:HEX_OFFSET:HEX_COUNT')
parser.add_argument('--read-entry-user-indirect', action='append', default=[], metavar='ARG:OFFSET:LENGTH', help='Read an explicitly user-space pointer field through the bounded observer')
parser.add_argument('--negative-platform-match', action='store_true', help='Supply an explicit unmatched synthetic platform compatible string')
parser.add_argument('--smp', type=int, default=1, help='Offline QEMU CPU count; above 1 enables sheng-smp and the PSCI secondary-start path')
parser.add_argument('--smp', type=int, default=1, help='Offline QEMU CPU count; above 1 enables smp and the PSCI secondary-start path')
parser.add_argument('--armcpu', action='store_true', help='Describe GICv3 resources and inspect real CPU/IRQ initialization')
parser.add_argument('--missing-gic', action='store_true', help='Omit GIC resources to test CPU driver rejection')
parser.add_argument('--check-commpage', action='store_true', help='Require real legacy and RO commpage user page shifts of 12')
@@ -479,7 +479,7 @@ if args.smp > 1:
if not args.armcpu:
parser.error('--smp requires --armcpu')
config=esp/'EFI/UniXNU/unixnu.toml'
config.write_text(config.read_text().replace('args = "','args = "sheng-smp=1 ',1))
config.write_text(config.read_text().replace('args = "','args = "smp=1 ',1))
if args.original_cpu_present:
if not (args.legacy_display_transfer and args.load_mobile_graphics and args.prelink_report) or args.native_air_init or args.native_user:
parser.error('Original CPU presentation requires original system graphics and validated copy, without an owned renderer')
+1 -1
View File
@@ -7,7 +7,7 @@ The same device ships with different storage sizes, so the size is chosen per bu
--gib N a container of exactly N GiB;
--auto sized from the tablet's userdata partition: asks a tablet in fastboot (`fastboot getvar partition-size:userdata`, read only) or takes
--userdata-bytes, and leaves out the root image (build/userdata-root/userdata-root.json), a 4 MiB guard, the log reserve
(--reserve-mib, the sheng-log-reserve value of the image, default 1024; 0 = none) and the store's own header and bitmap, then
(--reserve-mib, the log-reserve value of the image, default 1024; 0 = none) and the store's own header and bitmap, then
rounds down to a whole GiB and keeps one more GiB free.
The container is grown on this Mac (a sparse raw image attached without mounting, `diskutil apfs resizeContainer`), then packed again: the output
keeps only the nonzero pages, so it is about as big as BASE. The volume UUID is unchanged. The result is a different disk for the persistent
+2 -2
View File
@@ -66,8 +66,8 @@ def check_native_root(kernel, arguments, vmm_present=False):
values.setdefault(key, []).append(value)
if '1' not in values.get('native-ufs-root', []):
return
if values.get('sheng-pmgr') != ['2']:
raise Error('native UFS root boot needs exactly one sheng-pmgr=2; the unchanged target AMFI otherwise panics with No PMGR')
if values.get('pmgr') != ['2']:
raise Error('native UFS root boot needs exactly one pmgr=2; the unchanged target AMFI otherwise panics with No PMGR')
symbols = run([tool('llvm-nm', 'brew install llvm'), '--defined-only', kernel], capture=True)
if not any(line.split()[-1:] == ['_sheng_pmgr_run'] for line in symbols.splitlines()):
raise Error('the native UFS root kernel lacks the linked sheng PMGR integration')