Skip to content

Boot arguments ​

The kernel command line comes from [payload] kernel_args in the board file plus every --kernel-arg. The payload step writes the joined line into unixnu.toml, and DarwinBoot copies it into boot_args.

Format ​

An argument matches:

[A-Za-z0-9_.-]+(=[A-Za-z0-9_.,-]+)?

The joined line is at most 1000 bytes. DarwinBoot copies it into a 1024-byte buffer.

sh
./unixnu build payload --kernel-arg serial=3 --kernel-arg debug=0x14e

Common arguments ​

ArgumentPurpose
-vVerbose kernel output
serial=3Selects the serial console
debug=0x14eEnables the debug output mask
kextlog=0xfffVerbose kext logging
-apfs_shared_datavolumeUses the shared APFS data volume
-no_slto_panicSuppresses the SLTO panic
kt_fixed_zones=<n>Fixes the kernel trace zone count
boot-progress=<n>Selects the boot progress display level
cs_debug=<mask>Code signing debug output
amfi_get_out_of_my_way=1Runs without AMFI enforcement
pmap_debug=<mask>Pmap debug output
zlog=<name>Selects the zone log

Use amfi_get_out_of_my_way=1 only in a diagnostic boot. It changes the security policy.

Platform arguments ​

ArgumentPurpose
sheng-platform-stage=<n>Stops the platform expert at a fixed stage
sheng-pmgr=<n>Selects the board PMGR integration
native-ufs-root=1Uses the native UFS root path
native-ufs-stats-delay=<n>Delays the UFS statistics read
armcpu-diagnostics=1Prints the CPU and interrupt state
armcpu-spi-ipi=1Uses the SPI path for inter-processor interrupts
sheng-smp=1Starts the secondary CPUs
sheng-cpufreq=<n>Selects the CPU frequency path
sheng-touch=<n>Runs the touch probe stage
sheng-touch-hz=<n>Selects the touch SPI clock
sheng-touch-mode=<n>Forces the touch SPI mode
sheng-touch-hid=1Publishes touch contacts to HID
sheng-aks=1Enables the AKS path
sheng-gpu-power=<n>Selects the GPU power sequence
sheng-gpu-metal=1Enables the Metal path
sheng-gpu-addon=1Mounts the GPU addon content
sheng-disable-watchdogd=1Stops the watchdog daemon
sheng-disable-jobs=<list>Skips the named launch jobs
offline-legacy-*=1Enables the legacy display and input probes
offline-owner-root-check=1Starts the verified root check
offline-owner-root-audit=1Enables the root binding audit
offline-apfs-load=1Loads APFS at the offline checkpoint
offline-mobile-graphics-*=1Enables the mobile graphics probes
boot-ui-focus=<name>Selects the process for the boot UI trace

The list above includes board specific arguments. Check the device page and the board file for the set a device uses.

Adding an argument ​

  1. Add the default to [payload] kernel_args.
  2. Add a one-off value with --kernel-arg.
  3. Read the value in the kernel with PE_parse_boot_argn:
c
unsigned stage = 0;
if (PE_parse_boot_argn("my-driver-stage", &stage, sizeof(stage))) {
  ...
}
  1. Document the argument in the device page.

Debugging ​

NeedArguments
Early kernel output-v serial=3 debug=0x14e
Kext load detailkextlog=0xfff
Boot progressboot-progress=2
Platform stopsheng-platform-stage=<n>
Storage detailnative-ufs-root=1 native-ufs-stats-delay=30
Display detailoffline-legacy-gop=1 offline-legacy-phase=<n>
Code signing detailcs_debug=<mask>

A panic log records the last kernel output. The embedded panic region is read from the device tree when XNU_DT_PANIC_REGION is set.

Next steps ​

Released under the BSD-2-Clause-Patent License.