> ## 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 Celesto base kernel matching a chosen backend and CPU architecture.

Use `ensure_base_kernel_for_backend(...)` when you bring your own root filesystem but want Celesto'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 celesto 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 Celesto backends. When omitted, Celesto 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 Celesto base kernel.
</ResponseField>

## What it selects

Celesto 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>


## Related topics

- [BootImage and boot helpers](/smolvm/api/bootimage.md)
- [Custom Sandbox Images with Docker](/smolvm/guides/custom-images.md)
- [Firecracker, QEMU, and libkrun backends](/smolvm/concepts/backends.md)
- [Display sandbox object](/smolvm/api/browsersessioninfo.md)
- [Performance benchmarks](/smolvm/advanced/performance.md)
