Google is committed to advancing racial equity for Black communities. See how.

Kernel in the build

Commandline options

Kernel commandline options are declared using the kernel_cmdline template:

import("//build/zbi/kernel_cmdline.gni")

kernel_cmdline("foobar") {
  args = [ "foobar=true" ]
}

A single target may include multiple options:

import("//build/zbi/kernel_cmdline.gni")

kernel_cmdline("debug") {
  args = [
    "debug.this=true",
    "debug.that=false",
  ]
}

The resulting GN labels should then be inserted into the build graph via a GN argument. Note that options will be taken into account if they are within the dependency tree defined by such a GN argument.

Specifying options in board or product files

In the board or product file, add the label(s) for the desired cmdline option(s) to board_bootfs_labels and product_bootfs_labels respectively.

To alter kernel options for the zedboot or recovery build, add the labels respectively to board_zedboot_bootfs_labels and board_recovery_bootfs_labels.

Specifying options locally

Create a BUILD.gn file somewhere under //local to host the options targets. Note that this folder is not tracked by git and therefore might not exist yet in your checkout. Use dev_bootfs_labels to inject the options into the build graph via fx set:

fx set ... --args='dev_bootfs_labels=["//local/path/to/my:options"]'

To locally alter kernel options for the zedboot or recovery build, follow the same procedure but use respectively dev_zedboot_bootfs_labels and dev_recovery_bootfs_labels to introduce the options into the build.