pub fn resolve_kernel_dir_to_entry(
path: &Path,
cli_label: &str,
cpu_cap: Option<CpuCap>,
) -> Result<KernelDirOutcome>Expand description
Resolve a source-tree path through the local-kernel cache,
returning a KernelDirOutcome that carries the boot-image
directory, the cache-hit signal, and the dirty-tree flag.
For a clean source tree:
- Cache hit →
outcome.diris the cache entry directory,outcome.cache_hitisSome(KernelDirCacheHit),outcome.is_dirtyisfalse. The build pipeline does not run. - Cache miss, no mid-build mutation → runs
kernel_build_pipelinewhich builds in the source tree and stores a stripped vmlinux + boot image under the cache entry;outcome.diris the cache entry directory,outcome.cache_hitisNone,outcome.is_dirtyisfalse. - Cache miss, mid-build mutation observed by the pipeline’s
post-build re-check → the cache store is skipped to avoid
recording a stale identity,
outcome.diris the canonical source-tree directory,outcome.cache_hitisNone,outcome.is_dirtyistrue.
For a dirty source tree:
kernel_build_pipelineskips the cache store (is_dirtyshort-circuit at the cache-store boundary) and returns the source-tree image.outcome.diris the canonical source-tree directory (boot image at<source>/arch/x86/boot/bzImage(x86_64) or<source>/arch/arm64/boot/Image(aarch64) — the kernel build-tree arch subdir (x86/arm64), not the arch_info() name),outcome.cache_hitisNone,outcome.is_dirtyistrue. Callers use the dirty flag to mark the run as non-reproducible in test reports — e.g.cargo-ktstr’s Path-spec resolver appends_dirtyto the kernel label so apath_linux_a3b1c2_dirtyrow in the gauntlet output surfaces the divergence from the cache-storedpath_linux_a3b1c2clean variant.
Both directory return shapes are valid inputs to
crate::kernel_path::find_image_in_dir, which probes both
layouts. Callers that need the boot-image FILE path (not the
directory) should use resolve_kernel_dir instead — that
function applies the same pipeline but returns the image path.
Used by cargo-ktstr’s Path-spec resolver to wire --kernel PATH invocations through the same cache pipeline that
Version/CacheKey/Git specs use, so a clean source-tree rebuild
hits the cache instead of re-running make.
cli_label prefixes status output and is threaded into
kernel_build_pipeline’s diagnostic surface. cpu_cap
forwards the resource-budget cap; None keeps the
30%-of-allowed default. See resolve_kernel_dir for the
matching image-returning sibling’s cpu_cap rationale —
identical here because both functions reach the same pipeline.