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

# Access kernel sources

The Qualcomm<sup>®</sup> Linux kernel source is publicly hosted on GitHub and
requires no special credentials. Choose the access path that matches your
build workflow.

**Table: Kernel branches**

| Branch        | Yocto recipe             | Use case                                                            |
| ------------- | ------------------------ | ------------------------------------------------------------------- |
| `qcom-6.18.y` | `linux-qcom_6.18.bb`     | LTS production builds; recommended for SoC bring-up and integration |
| `qcom-next`   | `linux-qcom-next_git.bb` | Upstream contribution and validation against the latest kernel      |

## Yocto workflow

The Yocto workflow accesses the kernel through the `meta-qcom` layer. The
kernel source is fetched automatically by BitBake during the build.

Get access to the following repository:

* **meta-qcom** (layer): [https://github.com/qualcomm-linux/meta-qcom](https://github.com/qualcomm-linux/meta-qcom)

Release tags follow the `qli-<version>` convention (for example, `qli-2.0`). For
available tags, see the [Qualcomm Linux release notes - Introduction](https://dragonwingdocs.qualcomm.com/Key-Documents/Software-Release-Notes/introduction).

### Sync meta-layers with kas

Run the following commands from your workspace root directory. After syncing,
the workspace contains a `meta-qcom/` directory.

```bash theme={null}
# Clone meta-qcom at the target release tag (e.g. -b qli-2.0)
git clone https://github.com/qualcomm-linux/meta-qcom \
    -b <release-tag>
```

To fetch and unpack the kernel source without running a full build, open a kas
shell (replace `rb3gen2-core-kit.yml` with your machine YML) and run the
`unpack` task:

```bash theme={null}
kas shell meta-qcom/ci/rb3gen2-core-kit.yml:meta-qcom/ci/qcom-distro.yml
```

```bash theme={null}
bitbake -c unpack linux-qcom
```

The kernel source is then available at:

```text theme={null}
build/tmp/work-shared/<machine>/kernel-source/
```

The kernel recipe and version are selected in
`meta-qcom/conf/machine/include/qcom-base.inc`, which every machine
configuration inherits:

```text theme={null}
# Provider for linux kernel
PREFERRED_PROVIDER_virtual/kernel = "linux-qcom"
PREFERRED_VERSION_virtual/kernel = "6.18%"
```

<Note>
  Select `linux-qcom` for LTS BSP or `linux-qcom-next` for mainline BSP, with
  `PREFERRED_VERSION_virtual/kernel` left empty.
</Note>

The recipe files specify the exact `SRCREV` and `SRCBRANCH` for each release:

* LTS recipe: [recipes-kernel/linux/linux-qcom\_6.18.bb](https://github.com/qualcomm-linux/meta-qcom/blob/master/recipes-kernel/linux/linux-qcom_6.18.bb)
* Mainline recipe: [recipes-kernel/linux/linux-qcom-next\_git.bb](https://github.com/qualcomm-linux/meta-qcom/blob/master/recipes-kernel/linux/linux-qcom-next_git.bb)

For the full build steps, see [Build the kernel using Yocto](./build-kernel-yocto).

## Standalone workflow

For the standalone workflow (kernel-only builds without a full Yocto image),
clone the kernel repository:

```bash theme={null}
git clone --branch qcom-6.18.y \
    https://github.com/qualcomm-linux/kernel.git kernel
```

To match the exact source revision used in a release build, check the `SRCREV`
field in `meta-qcom/recipes-kernel/linux/linux-qcom_6.18.bb`.

For the full build steps, see [Build the kernel without Yocto](./build-kernel-standalone).
