kernel_build_pipeline

Function kernel_build_pipeline 

Source
pub fn kernel_build_pipeline(
    acquired: &AcquiredSource,
    cache: &CacheDir,
    cli_label: &str,
    clean: bool,
    is_local_source: bool,
    cpu_cap: Option<CpuCap>,
    extra_kconfig: Option<&str>,
    progress: Option<&FetchProgress>,
) -> Result<KernelBuildResult>
Expand description

Post-acquisition kernel build pipeline.

Handles: clean, configure, build, validate config, generate compile_commands.json for local trees, find image, strip vmlinux, compute metadata, cache store, and remote cache store (when enabled). Callers handle source acquisition.

cli_label prefixes diagnostic status output (e.g. "ktstr" or "cargo ktstr").

is_local_source should be true when the source is a local kernel source tree, regardless of how the caller arrived there (kernel build --kernel <path>, cargo ktstr test --kernel <path>, or any other Path-spec entry that funnels through super::super::resolve_kernel_dir / super::super::resolve_kernel_dir_to_entry). It controls the mrproper warning and source_tree_path in metadata.

extra_kconfig is an optional user-supplied kconfig fragment merged on top of EMBEDDED_KCONFIG before configure_kernel (which runs olddefconfig only when new lines are needed). Some(content) appends the fragment AFTER the baked-in fragment so kbuild’s last-occurrence-wins semantics (scripts/kconfig/confdata.c::conf_read_simple) make user values override baked-in ones on conflict, and forces a re-configure pass even when .config already carries CONFIG_SCHED_CLASS_EXT=y (the user fragment may add or invert symbols the baked-in pass alone wouldn’t have produced).

Two metadata fields capture the build inputs separately:

  • ktstr_kconfig_hash always holds the bare baked-in hash (crate::kconfig_hash() of EMBEDDED_KCONFIG) so KconfigStatus::Matches/Stale/Untracked keeps comparing against the live baked-in fragment.
  • extra_kconfig_hash holds Some(crate::extra_kconfig_hash(content)) when extras were supplied, None otherwise. Drives the (extra kconfig) tag in kernel list.

Callers that don’t expose --extra-kconfig (test/coverage/ shell/verifier) pass None.