> ## Documentation Index
> Fetch the complete documentation index at: https://docs.celesto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Kernel helpers

> ensure_base_kernel_for_backend reference for resolving, downloading, and caching the SmolVM base kernel matching a chosen backend and CPU architecture.

Use `ensure_base_kernel_for_backend(...)` when you bring your own root filesystem but want SmolVM's verified base kernel. The helper picks the right kernel artifact for the backend, downloads it on first use, verifies it, and returns the local path.

## ensure\_base\_kernel\_for\_backend

```python theme={null}
from smolvm import ensure_base_kernel_for_backend

kernel = ensure_base_kernel_for_backend("qemu", arch="host")
print(kernel)
```

<ParamField path="backend" type="str | None" default="None">
  Backend that will boot the kernel. Use `"firecracker"` or `"qemu"` for documented SmolVM backends. When omitted, SmolVM uses normal backend selection.
</ParamField>

<ParamField path="arch" type="Literal[&#x22;host&#x22;, &#x22;amd64&#x22;, &#x22;arm64&#x22;, &#x22;x86_64&#x22;, &#x22;aarch64&#x22;] | str" default="host">
  Architecture for the kernel. Use `"host"` to match the current machine.
</ParamField>

<ParamField path="cache_dir" type="Path | None" default="~/.smolvm/images/">
  Cache directory for downloaded kernel files.
</ParamField>

<ResponseField name="return" type="Path">
  Local path to the verified SmolVM base kernel.
</ResponseField>

## What it selects

SmolVM publishes the same kernel build in different container formats:

| Backend     | Kernel artifact      |
| ----------- | -------------------- |
| Firecracker | ELF kernel           |
| QEMU        | Image/bzImage kernel |

<Note>
  The source currently also accepts `libkrun` in this helper. The public docs focus on Firecracker and QEMU because those are the supported paths for most users.
</Note>
