1# Zircon Kernel Commandline Options
2
3The Zircon kernel receives a textual commandline from the bootloader,
4which can be used to alter some behaviours of the system.  Kernel commandline
5parameters are in the form of *option* or *option=value*, separated by
6spaces, and may not contain spaces.
7
8For boolean options, *option=0*, *option=false*, or *option=off* will
9disable the option.  Any other form (*option*, *option=true*, *option=wheee*,
10etc) will enable it.
11
12The kernel commandline is passed from the kernel to the userboot process
13and the device manager, so some of the options described below apply to
14those userspace processes, not the kernel itself.
15
16The devmgr reads the file /boot/config/devmgr (if it exists) at startup
17and imports name=value lines into its environment, augmenting or overriding
18the values from the kernel commandline.  Leading whitespace is ignored and
19lines starting with # are ignored.  Whitespace is not allowed in names.
20
21## aslr.disable
22
23If this option is set, the system will not use Address Space Layout
24Randomization.
25
26## bootsvc.next=\<bootfs path\>
27Controls what program is executed by bootsvc to continue the boot process.
28If this is not specified, the default next program will be used.
29
30## devmgr\.epoch=\<seconds\>
31
32Sets the initial offset (from the Unix epoch, in seconds) for the UTC clock.
33This is useful for platforms lacking an RTC, where the UTC offset would
34otherwise remain at 0.
35
36## devmgr\.require-system=\<bool\>
37
38Instructs the devmgr that a /system volume is required.  Without this,
39devmgr assumes this is a standalone Zircon build and not a full Fuchsia
40system.
41
42## devmgr\.suspend-timeout-debug
43
44If this option is set, the system prints out debugging when mexec, suspend,
45reboot, or power off did not finish in 10 seconds.
46
47## devmgr\.suspend-timeout-fallback
48
49If this option is set, the system invokes kernel fallback to reboot or poweroff
50the device when the operation did not finish in 10 seconds.
51
52## devmgr\.devhost\.asan
53
54This option must be set if any drivers not included directly in /boot are built
55with `-fsanitize=address`.  If there are `-fsanitize=address` drivers in /boot,
56then all `-fsanitize=address` drivers will be supported regardless of this
57option.  If this option is not set and there are no such drivers in /boot, then
58drivers built with `-fsanitize=address` cannot be loaded and will be rejected.
59
60## devmgr\.verbose
61
62Turn on verbose logging.
63
64## driver.\<name>.disable
65
66Disables the driver with the given name. The driver name comes from the
67zircon\_driver\_info, and can be found as the first argument to the
68ZIRCON\_DRIVER\_BEGIN macro.
69
70Example: `driver.usb_audio.disable`
71
72## driver.\<name>.log=\<flags>
73
74Set the log flags for a driver.  Flags are one or more comma-separated
75values which must be preceded by a "+" (in which case that flag is enabled)
76or a "-" (in which case that flag is disabled).  The textual constants
77"error", "warn", "info", "trace", "spew", "debug1", "debug2", "debug3", and "debug4"
78may be used, and they map to the corresponding bits in DDK_LOG_... in `ddk/debug.h`
79The default log flags for a driver is "error", "warn", and "info".
80
81Individual drivers may define their own log flags beyond the eight mentioned
82above.
83
84Example: `driver.usb_audio.log=-error,+info,+0x1000`
85
86Note again that the name of the driver is the "Driver" argument to the
87ZIRCON\_DRIVER\_BEGIN macro. It is not, for example, the name of the device,
88which for some drivers is almost identical, except that the device may be
89named "foo-bar" whereas the driver name must use underscores, e.g., "foo_bar".
90
91## driver.tracing.enable=\<bool>
92
93Enable or disable support for tracing drivers.
94When enabled drivers may participate in [Fuchsia tracing](ddk/tracing.md).
95
96Implementation-wise, what this option does is tell each devhost whether to
97register as "trace provider".
98
99The default is enabled. This options exists to provide a quick fallback should
100a problem arise.
101
102## gfxconsole.early=\<bool>
103
104This option (disabled by default) requests that the kernel start a graphics
105console during early boot (if possible), to display kernel debug print
106messages while the system is starting.  When userspace starts up, a usermode
107graphics console driver takes over.
108
109The early kernel console can be slow on some platforms, so if it is not
110needed for debugging it may speed up boot to disable it.
111
112## gfxconsole.font=\<name>
113
114This option asks the graphics console to use a specific font.  Currently
115only "9x16" (the default) and "18x32" (a double-size font) are supported.
116
117## iommu.enable=\<bool>
118
119This option (disabled by default) allows the system to use a hardware IOMMU
120if present.
121
122## kernel.bypass-debuglog=\<bool>
123
124When enabled, forces output to the console instead of buffering it. The reason
125we have both a compile switch and a cmdline parameter is to facilitate prints
126in the kernel before cmdline is parsed to be forced to go to the console.
127The compile switch setting overrides the cmdline parameter (if both are present).
128Note that both the compile switch and the cmdline parameter have the side effect
129of disabling irq driven uart Tx.
130
131## kernel.entropy-mixin=\<hex>
132
133Provides entropy to be mixed into the kernel's CPRNG.
134
135## kernel.entropy-test.len=\<len>
136
137When running an entropy collector quality test, collect the provided number of
138bytes. Defaults to the maximum value `ENTROPY_COLLECTOR_TEST_MAXLEN`.
139
140The default value for the compile-time constant `ENTROPY_COLLECTOR_TEST_MAXLEN`
141is 1MiB.
142
143## kernel.entropy-test.src=\<source>
144
145When running an entropy collector quality test, use the provided entropy source.
146Currently recognized sources: `hw_rng`, `jitterentropy`. This option is ignored
147unless the kernel was built with `ENABLE_ENTROPY_COLLECTOR_TEST=1`.
148
149## kernel.halt-on-panic=\<bool>
150If this option is set (disabled by default), the system will halt on
151a kernel panic instead of rebooting.
152
153## kernel.jitterentropy.bs=\<num>
154
155Sets the "memory block size" parameter for jitterentropy (the default is 64).
156When jitterentropy is performing memory operations (to increase variation in CPU
157timing), the memory will be accessed in blocks of this size.
158
159## kernel.jitterentropy.bc=\<num>
160
161Sets the "memory block count" parameter for jitterentropy (the default is 512).
162When jitterentropy is performing memory operations (to increase variation in CPU
163timing), this controls how many blocks (of size `kernel.jitterentropy.bs`) are
164accessed.
165
166## kernel.jitterentropy.ml=\<num>
167
168Sets the "memory loops" parameter for jitterentropy (the default is 32). When
169jitterentropy is performing memory operations (to increase variation in CPU
170timing), this controls how many times the memory access routine is repeated.
171This parameter is only used when `kernel.jitterentropy.raw` is true. If the
172value of this parameter is `0` or if `kernel.jitterentropy.raw` is `false`,
173then jitterentropy chooses the number of loops is a random-ish way.
174
175## kernel.jitterentropy.ll=\<num>
176
177Sets the "LFSR loops" parameter for jitterentropy (the default is 1). When
178jitterentropy is performing CPU-intensive LFSR operations (to increase variation
179in CPU timing), this controls how many times the LFSR routine is repeated.  This
180parameter is only used when `kernel.jitterentropy.raw` is true. If the value of
181this parameter is `0` or if `kernel.jitterentropy.raw` is `false`, then
182jitterentropy chooses the number of loops is a random-ish way.
183
184## kernel.jitterentropy.raw=\<bool>
185
186When true (the default), the jitterentropy entropy collector will return raw,
187unprocessed samples. When false, the raw samples will be processed by
188jitterentropy, producing output data that looks closer to uniformly random. Note
189that even when set to false, the CPRNG will re-process the samples, so the
190processing inside of jitterentropy is somewhat redundant.
191
192## kernel.memory-limit-dbg=\<bool>
193
194This option enables verbose logging from the memory limit library.
195
196## kernel.memory-limit-mb=\<num>
197
198This option tells the kernel to limit system memory to the MB value specified
199by 'num'. Using this effectively allows a user to simulate the system having
200less physical memory than physically present.
201
202## kernel.oom.enable=\<bool>
203
204This option (true by default) turns on the out-of-memory (OOM) kernel thread,
205which kills processes when the PMM has less than `kernel.oom.redline_mb` free
206memory, sleeping for `kernel.oom.sleep_sec` between checks.
207
208The OOM thread can be manually started/stopped at runtime with the `k oom start`
209and `k oom stop` commands, and `k oom info` will show the current state.
210
211See `k oom` for a list of all OOM kernel commands.
212
213## kernel.oom.redline-mb=\<num>
214
215This option (50 MB by default) specifies the free-memory threshold at which the
216out-of-memory (OOM) thread will trigger a low-memory event and begin killing
217processes.
218
219The `k oom info` command will show the current value of this and other
220parameters.
221
222## kernel.oom.sleep-sec=\<num>
223
224This option (1 second by default) specifies how long the out-of-memory (OOM)
225kernel thread should sleep between checks.
226
227The `k oom info` command will show the current value of this and other
228parameters.
229
230## kernel.mexec-pci-shutdown=\<bool>
231
232If false, this option leaves PCI devices running when calling mexec. Defaults
233to true.
234
235## kernel.serial=\<string\>
236
237This controls what serial port is used.  If provided, it overrides the serial
238port described by the system's bootdata.
239
240If set to "none", the kernel debug serial port will be disabled.
241
242### x64 specific values
243
244On x64, some additional values are supported for configuring 8250-like UARTs:
245- If set to "legacy", the legacy COM1 interface is used.
246- A port-io UART can be specified using "ioport,\<portno>,\<irq>".
247- An MMIO UART can be specified using "mmio,\<physaddr>,\<irq>".
248
249For example, "ioport,0x3f8,4" would describe the legacy COM1 interface.
250
251All numbers may be in any base accepted by *strtoul*().
252
253All other values are currently undefined.
254
255## kernel.shell=\<bool>
256
257This option tells the kernel to start its own shell on the kernel console
258instead of a userspace sh.
259
260## kernel.smp.maxcpus=\<num>
261
262This option caps the number of CPUs to initialize.  It cannot be greater than
263*SMP\_MAX\_CPUS* for a specific architecture.
264
265## kernel.smp.ht=\<bool>
266
267This option can be used to disable the initialization of hyperthread logical
268CPUs.  Defaults to true.
269
270## kernel.wallclock=\<name>
271
272This option can be used to force the selection of a particular wall clock.  It
273only is used on pc builds.  Options are "tsc", "hpet", and "pit".
274
275## ktrace.bufsize
276
277This option specifies the size of the buffer for ktrace records, in megabytes.
278The default is 32MB.
279
280## ktrace.grpmask
281
282This option specifies what ktrace records are emitted.
283The value is a bitmask of KTRACE\_GRP\_\* values from zircon/ktrace.h.
284Hex values may be specified as 0xNNN.
285
286## ldso.trace
287
288This option (disabled by default) turns on dynamic linker trace output.
289The output is in a form that is consumable by clients like Intel
290Processor Trace support.
291
292## thread.set.priority.disable=\<bool>
293
294This option (false by default) prevents the syscall that increases
295a thread priority (`zx_thread_set_priority`) from taking effect.
296
297## zircon.autorun.boot=\<command>
298
299This option requests that *command* be run at boot, after devmgr starts up.
300
301Any `+` characters in *command* are treated as argument separators, allowing
302you to pass arguments to an executable.
303
304### Sidebar: Injecting a personal autorun script <a name="autorun"></a>
305
306It's often useful to inject a personal autorun script into the boot filesystem,
307especially for running tests or setup tasks. You can do this with the zircon
308build system's `EXTRA_USER_MANIFEST_LINES` make variable.
309
3101.  Create a local shell script with the commands you want to run; for this
311    example, call it `${HOME}/my_local_script.sh`. \
312    **NOTE**: The first line must be a `#!` line, typically `#!/boot/bin/sh`.
3132.  Add your script to the boot filesystem by invoking `make` (or one of the
314    `//zircon/scripts/build-*` scripts) with \
315    `EXTRA_USER_MANIFEST_LINES="my_installed_script=${HOME}/my_local_script.sh"`
316    \
317    This will copy your local script into the boot filesystem at the path
318    `/boot/my_installed_script`. (You can change the `my_installed_script` part
319    to change the basename of the installed script, though it will always appear
320    under `/boot`.)
3213.  Tell `devmgr` to invoke your script by passing a commandline like
322    `zircon.autorun.boot=/boot/my_installed_script`
323
324## zircon.autorun.system=\<command>
325
326This option requests that *command* be run once the system partition is mounted
327and *init* is launched.  If there is no system bootfs or system partition, it
328will never be launched.
329
330Any `+` characters in *command* are treated as argument separators, allowing
331you to pass arguments to an executable.
332
333## zircon.system.blob-init=\<command>
334
335**DEPRECATED** See [`zircon.system.pkgfs.cmd`](#zircon.system.pkgfs.cmd).
336
337This option requests that *command* be run once the blob partition is
338mounted. The given command is expected to mount /system, and then signal its
339process handle with `ZX_USER_SIGNAL_0`.
340
341*command* may not assume that any other filesystem has been mounted. If
342`zircon.system.blob-init-arg` is set, it will be provided as the first
343argument.
344
345A ramdisk containing `/system` takes precedence over
346`zircon.system.blob-init` and *command* will not be run if a system
347ramdisk is present. blob init will take precedence over a minfs
348partition with the system GUID, and the minfs partition will not be mounted
349if `zircon.system.blob-init` is set.
350
351## zircon.system.disable-automount=\<bool>
352
353This option prevents the fshost from auto-mounting any disk filesystems
354(/system, /data, etc), which can be useful for certain low level test setups.
355It is false by default.  It is implied by **netsvc.netboot=true**
356
357## zircon.system.pkgfs.cmd=\<command>
358
359This option requests that *command* be run once the blob partition is mounted.
360Any `+` characters in *command* are treated as argument separators, allowing
361you to pass arguments to an executable.
362
363The executable and its dependencies (dynamic linker and shared libraries) are
364found in the blob filesystem.  The executable *path* is *command* before the
365first `+`.  The dynamic linker (`PT_INTERP`) and shared library (`DT_NEEDED`)
366name strings sent to the loader service are prefixed with `lib/` to produce a
367*path*.  Each such *path* is resolved to a blob ID (i.e. merkleroot in ASCII
368hex) using the `zircon.system.pkgfs.file.`*path* command line argument.  In
369this way, `/boot/config/devmgr` contains a fixed manifest of files used to
370start the process.
371
372The new process receives a `PA_USER0` channel handle at startup that will be
373used as the client filesystem handle mounted at `/pkgfs`.  The command is
374expected to start serving on this channel and then signal its process handle
375with `ZX_USER_SIGNAL_0`.  Then `/pkgfs/system` will be mounted as `/system`.
376
377## zircon.system.pkgfs.file.*path*=\<blobid>
378
379Used with [`zircon.system.pkgfs.cmd`](#zircon.system.pkgfs.cmd), above.
380
381## zircon.system.writable=\<bool>
382
383This option requests that if a minfs partition with the system type GUID is
384found, it is to be mounted read-write rather than read-only.
385
386## zircon.system.volume=\<arg>
387
388This option specifies where to find the "/system" volume.
389
390It may be set to:
391"any", in which case the first volume of the appropriate type will be used.
392"local" in which the first volume that's non-removable of the appropriate type
393  will be used.
394"none" (default) which avoids mounting anything.
395
396A "/system" ramdisk provided by bootdata always supersedes this option.
397
398## zircon.system.filesystem-check=\<bool>
399
400This option requests that filesystems automatically mounted by the system
401are pre-verified using a filesystem consistency checker before being mounted.
402
403By default, this option is set to false.
404
405## netsvc.netboot=\<bool>
406
407If true, zircon will attempt to netboot into another instance of zircon upon
408booting.
409
410More specifically, zircon will fetch a new zircon system from a bootserver on
411the local link and attempt to kexec into the new image, thereby replacing the
412currently running instance of zircon.
413
414This setting implies **zircon.system.disable-automount=true**
415
416## netsvc.advertise=\<bool>
417
418If true, netsvc will seek a bootserver by sending netboot advertisements.
419Defaults to true.
420
421## netsvc.interface=\<path>
422
423This option instructs netsvc to use only the ethernet device at the given
424topological path. All other ethernet devices are ignored by netsvc. The
425topological path for a device can be determined from the shell by running the
426`lsdev` command on the ethernet class device (e.g., `/dev/class/ethernet/000`).
427
428This is useful for configuring network booting for a device with multiple
429ethernet ports which may be enumerated in a non-deterministic order.
430
431## userboot=\<path>
432
433This option instructs the userboot process (the first userspace process) to
434execute the specified binary within the bootfs, instead of following the
435normal userspace startup process (launching the device manager, etc).
436
437It is useful for alternate boot modes (like a factory test or system
438unit tests).
439
440The pathname used here is relative to `/boot`, so it should not start with
441a `/` prefix.
442
443Note that this option does not work for executables that are linked with
444libraries other than libc and the dynamic linker.
445
446Example: `userboot=bin/core-tests`
447
448## userboot.reboot
449
450If this option is set, userboot will attempt to reboot the machine after
451waiting 3 seconds when the process it launches exits.
452
453*If running with userboot=bin/core-tests in QEMU, this will cause the system to
454continually run tests and reboot.*
455
456## userboot.shutdown
457
458If this option is set, userboot will attempt to power off the machine
459when the process it launches exits.
460
461## vdso.soft_ticks=\<bool>
462
463If this option is set, the `zx_ticks_get` and `zx_ticks_per_second` system
464calls will use `zx_clock_get_monotonic()` in nanoseconds rather than
465hardware cycle counters in a hardware-based time unit.  Defaults to false.
466
467## virtcon.disable
468
469Do not launch the virtual console service if this option is present.
470
471## virtcon.hide-on-boot
472
473If this option is present, the virtual console will not take ownership of any
474displays until the user switches to it with a device control key combination.
475
476## virtcon.keep-log-visible
477
478If this option is present, the virtual console service will keep the
479debug log (vc0) visible instead of switching to the first shell (vc1) at startup.
480
481## virtcon.keymap=\<name>
482
483Specify the keymap for the virtual console.  "qwerty" and "dvorak" are supported.
484
485## virtcon.font=\<name>
486
487Specify the font for the virtual console.  "9x16" and "18x32" are supported.
488
489## zircon.nodename=\<name>
490
491Set the system nodename, as used by `bootserver`, `loglistener`, and the
492`net{addr,cp,ls,runcmd}` tools.  If omitted, the system will generate a
493human-readable nodename from its MAC address.  This cmdline is honored by
494GigaBoot and Zircon.
495
496## console.path=\<path>
497
498Specify console device path. If not specified device manager will open
499`/dev/misc/console`. Only has effect if kernel.shell=false.
500
501# Additional Gigaboot Commandline Options
502
503## bootloader.timeout=\<num>
504This option sets the boot timeout in the bootloader, with a default of 3
505seconds. Set to zero to skip the boot menu.
506
507## bootloader.fbres=\<w>x\<h>
508This option sets the framebuffer resolution. Use the bootloader menu to display
509available resolutions for the device.
510
511Example: `bootloader.fbres=640x480`
512
513## bootloader.default=\<network|local|zedboot>
514This option sets the default boot device to netboot, use a local zircon.bin or to netboot via zedboot.
515
516# How to pass the commandline to the kernel
517
518## in Qemu, using scripts/run-zircon*
519
520Pass each option using -c, for example:
521```
522./scripts/run-zircon-x64 -c gfxconsole.font=18x32 -c gfxconsole.early=false
523```
524
525## in GigaBoot20x6, when netbooting
526
527Pass the kernel commandline at the end, after a -- separator, for example:
528```
529bootserver zircon.bin bootfs.bin -- gfxconsole.font=18x32 gfxconsole.early=false
530```
531
532## in GigaBoot20x6, when booting from USB flash
533
534Create a text file named "cmdline" in the root of the USB flash drive's
535filesystem containing the command line.
536