# Bắt đầu với Qualcomm Linux kernel

Thông tin này giải thích cách tải xuống, đặt cấu hình và phát triển Qualcomm^®^ Linux kernel cho Qualcomm Linux development kit cùng các thành phần liên quan để build và flash ảnh hệ thống.

Trước khi bạn bắt đầu tải xuống và đặt cấu hình Qualcomm Linux kernel, hãy thiết lập máy chủ như được mô tả trong [Hướng dẫn build Qualcomm Linux](https://docs.qualcomm.com/doc/80-70020-254/topic/build_landing_page.html), trong đó cũng cung cấp thông tin về quy trình làm việc phổ biến của Qualcomm Linux kernel.

## Truy cập mã nguồn Qualcomm Linux kernel

Để truy cập mã nguồn của Qualcomm Linux kernel, hãy xem [Hướng dẫn biên dịch Qualcomm Linux](https://docs.qualcomm.com/doc/80-70020-254/topic/build_landing_page.html) và tải các lớp meta Qualcomm Linux cần thiết.

Qualcomm Linux sử dụng LTS Linux kernel (6.6.x) và hỗ trợ 2 biến thể phần mềm:

> 
> 
> - Gói hỗ trợ bo mạch (BSP) cơ sở
> - BSP tùy chỉnh

Ghi chú

- Biến thể **BSP cơ sở** sử dụng upstream LTS Linux kernel (6.6.x) với một tập giới hạn các bản vá lỗi downstream. Mã nguồn kernel được lưu trữ tại [kernel/git/stable/linux.git](https://web.git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/?h=linux-6.6.y&amp;id=943e0aeece93a9c2329215d02621e634adf6d790).
- Biển thể **BSP tùy chỉnh** sử dụng LTS Linux kernel (6.6.x) tùy chỉnh và được lưu trong Qualcomm repository trên CodeLinaro. Mã nguồn Kernel được lưu trữ tại [kernel.qclinux.1.0.r1-rel](https://git.codelinaro.org/clo/la/kernel/qcom/-/commits/LKP.QCLINUX.1.0.r1-04800-kernel.0?ref_type=tags).

Bảng: Đường dẫn Kernel recipe của các biến thể

| Biến thể | Đường dẫn kernel recipe |
| --- | --- |
| BSP cơ sở | `recipes-kernel/linux/linux-qcom-base_6.6.bb` |
| BSP tùy chỉnh | `recipes-kernel/linux/linux-qcom-custom_6.6.bb` |

Ghi chú

Các kernel recipe cho BSP cơ sở và BSP tùy chỉnh hiện có trong lớp `meta-qcom-hwe`.

Xem tệp `recipes-kernel/linux/linux-qcom-base_6.6.bb` hoặc `recipes-kernel/linux/linux-qcom-custom_6.6.bb` để biết mã định danh tài nguyên đồng nhất (URI) Git để tải mã nguồn kernel xuống.

Để biết thêm thông tin về các lớp Qualcomm Linux, hãy xem [Tổng quan về các lớp metadata của Qualcomm Linux](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-27/qualcomm_bsp_metadata_layers.html).

> 
> 
> Ghi chú
> 
> 
> Yocto recipe tham chiếu đến mã nguồn Qualcomm Linux kernel được lưu trữ công khai tại [CodeLinaro](https://git.codelinaro.org/clo/la/kernel/qcom).

Ví dụ sau mô tả thông tin URI nguồn của Qualcomm Linux kernel cho BSP cơ sở và BSP tùy chỉnh:

**BSP cơ sở**

Sau đây là thông tin URI nguồn cho biến thể BSP cơ sở:

SECTION = "kernel"
    
    SUMMARY = "Linux kernel for QCOM devices"
    DESCRIPTION = "Recipe to build Linux kernel from 6.6 LTS branch"
    
    LICENSE = "GPL-2.0-only"
    LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
    
    inherit kernel
    
    COMPATIBLE_MACHINE = "(qcom)"
    
    SRC_URI = " git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git;protocol=https;branch=linux-6.6.y \
                file://qcom.cfg \
    "
    Copy to clipboard

**BSP tùy chỉnh**

Sau đây là thông tin URI nguồn cho biến thể BSP tùy chỉnh:

> 
> 
> SECTION = "kernel"
>     
>     SUMMARY = "Linux kernel for QCOM devices"
>     DESCRIPTION = "Recipe to build Linux kernel"
>     
>     LICENSE = "GPLv2.0-with-linux-syscall-note"
>     LIC_FILES_CHKSUM = "file://COPYING;md5=6bc538ed5bd9a7fc9398086aedcd7e46"
>     
>     inherit kernel
>     
>     COMPATIBLE_MACHINE = "(qcom)"
>     
>     SRC_URI = "git://git.codelinaro.org/clo/la/kernel/qcom.git;protocol=https;rev=350dfd604d2ffbe0cac99bf3459b49114aad11f4;branch=kernel.qclinux.1.0.r1-rel \
>       file://QCLINUX-arm64-dts-qcom-sa8775p-ride-add-board-id-and.patch \
>       ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', ' file://selinux.cfg', '', d)} \
>       ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', ' file://selinux_debug.cfg', '', d)} \
>       "
>     Copy to clipboard

## Xác định các máy Qualcomm được hỗ trợ

Các tệp cấu hình máy Qualcomm nằm trong thư mục `meta-qcom-hwe/conf/machine/`.

Các tệp cấu hình máy tuân theo quy ước đặt tên `<SoC>-<board>-<variant>​.conf`, trong đó:

- `SoC` là tên hệ thống trên chip (SoC)
- `board` là loại bo mạch mà phần mêm được build
- `variant` là loại sản phẩm

Ví dụ:

Trong tên tệp `qcs6490-rb3gen2-core-kit.conf`,

- `qcs6490` là SoC
- `rb3gen2` là bo mạch
- `core-kit` là loại sản phẩm

Các tệp device tree dành riêng cho nền tảng cũng tuân thủ quy tắc đặt tên tương tự.

Ví dụ sau đây mô tả danh sách các máy được hỗ trợ và được đặt cấu hình cho Yocto:

ls -l ./LE.QCLINUX.1.0/layers/meta-qcom-hwe/conf/machine/*.conf
    
    meta-qcom-hwe/conf/machine/qcs6490-rb3gen2-core-kit.conf
    meta-qcom-hwe/conf/machine/qcs6490-rb3gen2-vision-kit.conf
    meta-qcom-hwe/conf/machine/qcs9075-ride-sx.conf
    Copy to clipboard

Ví dụ sau đây mô tả lựa chọn cấu hình máy cho bo mạch phát triển với chipset Qualcomm:

less meta-qcom-hwe/conf/machine/<SoC>-<board>-<variant>.conf
    
    #@TYPE: Machine
    #@NAME: <Machine name same as the machine conf file or ``<SoC>-<board>-<variant>`` >
    #@DESCRIPTION: Machine configuration for the development board, with Qualcomm qcs6490
    
    require conf/machine/include/qcom-<SoC>.inc
    Copy to clipboard

Ví dụ sau đây mô tả lựa chọn cấu hình kernel cho các biến thể BSP cơ bản và tùy chỉnh:

less meta-qcom-hwe/conf/machine/include/qcom-base.inc
    
    # Provider for linux kernel
    # qcom-base-bsp uses 'linux-qcom-base' as kernel
    PREFERRED_PROVIDER_virtual/kernel ?= "linux-qcom-custom"
    PREFERRED_PROVIDER_virtual/kernel:qcom-base-bsp ?= "linux-qcom-base"
    Copy to clipboard

Ghi chú

- `linux-qcom-base` được chọn khi biên dịch biến thể BSP cơ sở.
- `linux-qcom-custom` được chọn khi biên dịch BSP tùy chỉnh.

## Build recipe ảnh Yocto và cấu hình kernel

Bạn có thể truy cập recipe Qualcomm Linux để sửa đổi cấu hình kernel. Bảng sau đây liệt kê các ảnh `meta-qcom-hwe` được hỗ trợ:

Bảng: Recipe ảnh được hỗ trợ của Qualcomm Linux

| Tên ảnh | Mô tả |
| --- | --- |
| qcom-console-image<br>    Copy to clipboard | Đây là ảnh boot-to-shell có nhóm gói để đưa vào tất cả các gói cơ bản. |
| qcom-multimedia-image<br>    Copy to clipboard | Recipe ảnh này bao gồm các recipe cho các thành phần phần mềm đa phương tiện, chẳng hạn như âm thanh, Bluetooth^®^, máy ảnh, thị giác máy tính, display và video. |
| qcom-multimedia-test-image<br>    Copy to clipboard | Recipe ảnh này bao gồm các kiểm thử. |

Sau khi tải mã Qualcomm Linux xuống, hãy chạy lệnh `bitbake` để build ảnh.

Ghi chú

Biến thể BSP cơ sở sử dụng tệp cấu hình kernel `arch/arm64/configs/defconfig`. Những thay đổi cục bộ được chồng lên trên `defconfig` từ tệp `meta-qcom-hwe/recipes-kernel/linux/linux-qcom-base-6.6/qcom.cfg`.

Để biên dịch Qualcomm Linux kernel cho biến thể BSP cơ sở, hãy chạy các lệnh sau:

# Use the filename of Machine conf file for MACHINE parameter
    $ MACHINE=<SoC>-<board>-<variant> DISTRO=qcom-wayland QCOM_SELECTED_BSP=base source setup-environment
    
    # build qcom linux console image
    $ bitbake qcom-console-image
    
    # Build Images are produced under "build-qcom-wayland/tmp-glibc/deploy/images/<SoC>-<board>-<variant>/qcom-console-image/"
    Copy to clipboard

Để build các ảnh được liệt kê trong [Bảng: Recipe ảnh được hỗ trợ của Qualcomm Linux](https://docs.qualcomm.com/doc/80-70020-3VI/topic/getting_started_chapter2.html#qualcomm-linux-supported-image-recipes), recipe BSP tùy chỉnh của Qualcomm Linux kernel sử dụng một trong các đoạn cấu hình kernel sau:

Ghi chú

Các tệp cấu hình kernel downstream chứa `addons`.

Bảng: Đoạn cấu hình kernel BSP tùy chỉnh

| Đoạn cấu hình kernel | Mô tả |
| --- | --- |
| <kernel_src>/arch/arm64/configs/qcom_defconfig<br>    Copy to clipboard | Yêu cầu cấu hình cơ sở của sản phẩm phải phù hợp với upstream kernel |
| <kernel_src>/arch/arm64/configs/qcom_debug.config<br>    Copy to clipboard | Gỡ lỗi một đoạn cấu hình từ upstream kernel |
| <kernel_src>/arch/arm64/configs/qcom_addons.config<br>    Copy to clipboard | Thêm các phần bổ sung downstream của Qualcomm vào phần cơ sở được căn chỉnh ở upstream |
| <kernel_src>/arch/arm64/configs/qcom_addons_debug.config<br>    Copy to clipboard | Cho phép gỡ lỗi downstream Qualcomm |

Để build Qualcomm Linux bao gồm cả kernel cho biến thể BSP tùy chỉnh, hãy chạy các lệnh sau:

> 
> 
> # Use the filename of Machine conf file for MACHINE parameter
>       MACHINE=<SoC>-<board>-<variant> DISTRO=qcom-wayland QCOM_SELECTED_BSP=custom source setup-environment
>     
>     # build qcom linux console image
>       bitbake qcom-console-image
>     
>     # Build Images are produced under "build-qcom-wayland/tmp-glibc/deploy/images/<SoC>-<board>-<variant>/qcom-console-image/"
>     Copy to clipboard

Các bản build mặc định của kernel được định nghĩa trong tệp `linux-qcom-base_6.6.bb` hoặc `linux-qcom-custom_6.6.bb`.

Recipe Qualcomm Linux kernel hỗ trợ bản build số 3 (hiệu năng) và số 4 (debug) được đề cập trong bảng sau. Cấu hình bản build mặc định là số 3 (hiệu năng). Các đoạn cấu hình kernel sau đây chỉ áp dụng cho biến thể BSP tùy chỉnh.

> 
> 
> Bảng: Cấu hình và loại cấu hình bản build kernel BSP tùy chỉnh
> 
> 
> | Số sê-ri | Loại cấu hình bản build kernel | Đoạn defconfig/config |
> | --- | --- | --- |
> | 1 | Base | arch/arm64/configs/qcom_defconfig<br>    Copy to clipboard |
> | 2 | Cơ sở được cho phép gỡ lỗi | <ul><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_defconfig<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_debug.config<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br></ul> |
> | 3 | Cơ sở với phần bổ sung downstream | <ul><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_defconfig<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_addons.config<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br></ul> |
> | 4 | Cơ sở cho phép gỡ lỗi với downstream | <ul><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_defconfig<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_debug.config<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_addons.config<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br><li><div class="highlight-pre notranslate"><div class="highlight"><pre class="pre codeblock"><code>arch/arm64/configs/qcom_addons_debug.config<br></code><span class="copyclip"><svg xmlns="http://www.w3.org/2000/svg" class="copyclipicon" width="25px" height="25px" viewbox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><title>Copy to clipboard</title><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></span></pre></div><br></div><br></li><br></ul> |

Để biết thêm thông tin về cách đặt cấu hình kernel, hãy xem Cấu hình kernel.

### Biên dịch bản Qualcomm debug build

Chạy lệnh sau để biên dịch bản debug build:

DEBUG_BUILD=1 bitbake qcom-console-image
    Copy to clipboard

Để sửa đổi cấu hình bản build, hãy cập nhật các biến `KERNEL_CONFIG` và `KERNEL_CONFIG_FRAGMENTS` trong recipe kernel `linux-qcom-base_6.6.bb` hoặc `linux-qcom-custom_6.6.bb` trong lớp `meta-qcom-hwe`.

### Ví dụ về cấu hình kernel

Các ví dụ sau đây mô tả cấu hình kernel của BSP cơ sở và tùy chỉnh:

**BSP cơ sở**

Ví dụ sau đây mô tả cấu hình kernel sử dụng recipe kernel `linux-qcom-base_6.6.bb`:

> 
> 
> KERNEL_CONFIG_FRAGMENTS:append = " ${WORKDIR}/qcom.cfg"
>     
>     S = "${WORKDIR}/git"
>     
>     # 6.6.38
>     SRCREV = "2928631d5304b8fec48bad4c7254ebf230b6cc51"
>     PV = "6.6+git${SRCPV}"
>     
>     KERNEL_CONFIG ??= "defconfig"
>     Copy to clipboard

**BSP tùy chỉnh**

Ví dụ sau đây mô tả cấu hình kernel sử dụng recipe kernel `linux-qcom-custom_6.6.bb`:

> 
> 
> KERNEL_CONFIG ??= "qcom_defconfig"
>     
>     KERNEL_CONFIG_FRAGMENTS:append = " ${S}/arch/arm64/configs/qcom_addons.config"
>     KERNEL_CONFIG_FRAGMENTS:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/arch/arm64/configs/qcom_debug.config', '', d)}"
>     KERNEL_CONFIG_FRAGMENTS:append = " ${@oe.utils.vartrue('DEBUG_BUILD', '${S}/arch/arm64/configs/qcom_addons_debug.config', '', d)}"
>     
>     # Enable selinux support
>     SELINUX_CFG = "${@oe.utils.vartrue('DEBUG_BUILD', 'selinux_debug.cfg', 'selinux.cfg', d)}"
>     KERNEL_CONFIG_FRAGMENTS:append = " ${@bb.utils.contains('DISTRO_FEATURES', 'selinux', '${WORKDIR}/${SELINUX_CFG}', '', d)}"
>     Copy to clipboard

Để biết thêm thông tin về hướng dẫn biên dịch, hãy xem phần [Biên dịch bằng QSC CLI](https://docs.qualcomm.com/bundle/publicresource/topics/80-70020-254/build_frm_source_qsc_cli.html#build-from-source-qsc-cli) trong [Hướng dẫn biên dịch Qualcomm Linux](https://docs.qualcomm.com/doc/80-70020-254/topic/build_landing_page.html).

## Truy cập device tree nền tảng

Các tệp nguồn device tree (DTS) và DTSI Qualcomm dành cho development kit được hỗ trợ nằm trong nguồn kernel trong thư mục `arch/arm64/boot/dts/qcom/`. Các tệp Qualcomm này phân tách các phần bổ sung theo hướng downstream and upstream.

Các tệp device tree có `addons` là các tệp downstream. Phần mềm biến thể BSP cơ sở không sử dụng bất kỳ tệp downstream device tree nào.

`<SoC>-<board>-<variant>​.conf` là tệp cấu hình máy Qualcomm Linux chứa dữ liệu cấu hình lựa chọn device tree blob(DTB) cần thiết.

- `SoC` là bất kỳ SoC Qualcomm Linux nào được hỗ trợ. Ví dụ: QCS6490 và IQ-9075.
- `board` là sản phẩm được hỗ trợ bởi Dragonwing™ RB3 Gen 2.
- `variant` là loại sản phẩm cụ thể, ví dụ như core-kit.

Ví dụ sau đây mô tả việc đưa DTB vào tệp cấu device tree:

KERNEL_DEVICETREE = " \
                         qcom/<SoC>-addons-<variant>.dtb \
                         "
    Copy to clipboard

Tab QCS6490
Tab IQ-9075
Tab IQ-8275
Tab IQ-615

Bảng sau đây liệt kê các tệp device tree Qualcomm^®^ cho Dragonwing™ RB3 Gen 2 Development Kit.

> 
> 
> Bảng: Nguồn device tree Qualcomm
> 
> 
> | Nguồn device tree | Chi tiết |
> | --- | --- |
> | arch/arm64/boot/dts/qcom/sc7280.dtsi<br>    Copy to clipboard | SoC QCS6490 có nguồn gốc từ SoC SC7280. |
> | arch/arm64/boot/dts/qcom/qcm6490.dtsi<br>    Copy to clipboard | DTSI QCM6490/QCS6490 lưu trữ mọi thay đổi khác với SoC SC7280. |
> | arch/arm64/boot/dts/qcom/qcm6490-addons.dtsi<br>    Copy to clipboard | Các phần bổ sung downstream dành riêng cho SoC QCM6490/QCS6490. |
> | arch/arm64/boot/dts/qcom/qcs6490-rb3gen2.dts<br>    Copy to clipboard | Nguồn device tree cho QCS6490 Dragonwing™ RB3 Gen 2 Development Kit. |
> | arch/arm64/boot/dts/qcom/qcs6490-addons-rb3gen2.dts<br>    Copy to clipboard | Các phần bổ sung downstream dành riêng cho QCS6490 của Dragonwing™ RB3 Gen 2 Development Kit. |
> | arch/arm64/boot/dts/qcom/qcs5430-addons-rb3gen2.dts<br>    Copy to clipboard | Các phần bổ sung downstream dành riêng cho gói tính năng 1 QCS5430 của Dragonwing™ RB3 Gen 2 Development Kit. |
> | arch/arm64/boot/dts/qcom/qcs5430-fp2-addons-rb3gen2.dts<br>    Copy to clipboard | Các phần bổ sung downstream cho gói tính năng 2 QCS5430 trong Dragonwing™ RB3 Gen 2 Development Kit. |
> | arch/arm64/boot/dts/qcom/qcs5430-fp2p5-addons-rb3gen2-vision-mezz.dts<br>    Copy to clipboard | Các phần bổ sung downstream cho gói tính năng 2.5 QCS5430 trong Dragonwing™ RB3 Gen 2 vision Mezzanine Development Kit. |
> | arch/arm64/boot/dts/qcom/qcs5430-fp3-addons-rb3gen2-vision-mezz.dts<br>    Copy to clipboard | Các phần bổ sung downstream cho gói tính năng 3 QCS5430 trong Dragonwing™ RB3 Gen 2 vision Mezzanine Development Kit. |

Bảng sau đây liệt kê các tệp device tree Qualcomm cho Qualcomm Dragonwing™ IQ-9075 Development Kit. Theo mặc định, DTB addons được dùng.

> 
> 
> Bảng: Nguồn device tree Qualcomm
> 
> 
> | Nguồn device tree | Chi tiết |
> | --- | --- |
> | arch/arm64/boot/dts/qcom/sa8775p.dtsi<br>    Copy to clipboard | SoC Dragonwing^TM^ IQ-9075 có nguồn gốc từ SA8775P. |
> | arch/arm64/boot/dts/qcom/sa8775p-ride.dtsi<br>    Copy to clipboard | Qualcomm Linux development kit cho Dragonwing IQ-9075. |
> | arch/arm64/boot/dts/qcom/qcs9075-ride.dts<br>    Copy to clipboard | Qualcomm Linux development kit cho Dragonwing^TM^ IQ-9075 ride. |
> | arch/arm64/boot/dts/qcom/qcs9075-addons-ride.dts<br>    Copy to clipboard | Qualcomm Linux development kit cho Dragonwing^TM^ IQ-9075 ride có phần bổ sung downstream. |
> | arch/arm64/boot/dts/qcom/qcs9075-iq-9075-evk.dts<br>    Copy to clipboard | Qualcomm Linux development kit cho Qualcomm Dragonwing^TM^ IQ-9075 EVK. |
> | arch/arm64/boot/dts/qcom/qcs9075-addons-iq-9075-evk.dts<br>    Copy to clipboard | Qualcomm Linux development kit cho Qualcomm Dragonwing^TM^ IQ-9075 EVK có phần bổ sung downstream. |

Bảng sau đây liệt kê các tệp device tree Qualcomm cho Dragonwing^TM^ IQ-8275 development kit. Theo mặc định, DTB addons được dùng.

> 
> 
> Bảng: Nguồn device tree Qualcomm
> 
> 
> | Nguồn device tree | Chi tiết |
> | --- | --- |
> | arch/arm64/boot/dts/qcom/qcs8300.dtsi<br>    Copy to clipboard | Dragonwing IQ-8275 SoC có nguồn gốc từ QCS8300. |
> | arch/arm64/boot/dts/qcom/qcs8300-addons.dtsi<br>    Copy to clipboard | Qualcomm Linux development kit cho Dragonwing IQ-8275 có phần bổ sung downstream. |
> | arch/arm64/boot/dts/qcom/qcs8300-ride.dts<br>    Copy to clipboard | Qualcomm Linux development kit cho Dragonwing IQ-8275 ride. |
> | arch/arm64/boot/dts/qcom/qcs8300-addons-ride.dts<br>    Copy to clipboard | Qualcomm Linux development kit cho Dragonwing IQ-8275 ride có phần bổ sung downstream. |

Bảng sau đây liệt kê các tệp device tree Qualcomm cho Dragonwing IQ-615 development kit. Theo mặc định, DTB addons được dùng.

> 
> 
> Bảng: Nguồn device tree Qualcomm
> 
> 
> | Nguồn device tree | Chi tiết |
> | --- | --- |
> | arch/arm64/boot/dts/qcom/qcs615.dtsi<br>    Copy to clipboard | Tệp cấu hình cơ sở cho SoC Dragonwing IQ-615. |
> | arch/arm64/boot/dts/qcom/qcs615-addons.dtsi<br>    Copy to clipboard | Tệp cấu hình cơ sở cho SoC Dragonwing IQ-615 có phần bổ sung downstream. |
> | arch/arm64/boot/dts/qcom/qcs615-ride.dtsi<br>    Copy to clipboard | Tệp cấu hình cơ sở cho SoC Dragonwing IQ-615 ride. |
> | arch/arm64/boot/dts/qcom/qcs615-addons-ride.dtsi<br>    Copy to clipboard | Tệp cấu hình cơ sở cho SoC Dragonwing IQ-615 ride có các phần bổ sung downstream |

## Quản lý các đoạn DT overlay nằm ngoài mã nguồn chính

Các tệp cấu hình máy SoC bao gồm DTBO không nằm trong cây mã nguồn chính bổ sung.

Các driver đồ họa, camera, mạng không dây (WLAN) và cấu hình device tree của chúng được duy trì bên ngoài mã nguồn kernel. Các đoạn device tree source overlay (DTSO) tương ứng được ghép chồng lên DTB cơ sở tại thời điểm build.

Cấu hình DTBO được thực hiện trong tệp `conf/machine/<SoC>-<board>-<variant>.conf`.

Ví dụ sau đây mô tả cấu hình DTBO:

# OUT_OF_KERNEL_DTSO - qcs6490-rb3gen2-core-kit.conf
    # Additional list of DTBOs to be overlaid on top of base kernel devicetree files
    # Format - KERNEL_TECH_DTBOS[<base-dtb-name>] = "<dtbo1 <dtbo2> ..."
    # For example:
    
    KERNEL_TECH_DTBOS[qcs6490-addons-rb3gen2] = " \
    qcm6490-graphics.dtbo qcm6490-wlan-rb3.dtbo \
    qcm6490-display-rb3.dtbo qcm6490-bt.dtbo \
    qcm6490-video.dtbo qcm6490-wlan-upstream.dtbo \
    "
    Copy to clipboard

## Quản lý mô-đun kernel không nằm trong cây mã nguồn chính

Hầu hết các kernel driver được biên dịch từ các nguồn upstream kernel. Tuy nhiên, một số driver được duy trì bên ngoài mã nguồn kernel và được build dưới dạng mô-đun kernel bằng hệ thống build Yocto.

Trong ví dụ sau, Bluetooth^®^ là một mô-đun kernel không nằm trong cây mã nguồn chính. Recipe trong `recipes-connectivity/bt_dlkm_kernel/bt-dlkm-kernel_git.bb` biên dịch driver thành một mô-đun kernel. Để tự động tải mô-đun kernel khi khởi động, bạn có thể thêm tên mô-đun vào biến `KERNEL_MODULE_AUTOLOAD`.

# Example out-of-tree Kernel module recipe
    DESCRIPTION = "QCOM BT drivers"
    LICENSE = "GPL-2.0-only"
    LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/${LICENSE};md5=801f80980d171dd6425610833a22dbe6"
    
    inherit module
    
    SRC_URI += "git://git.codelinaro.org/clo/le/platform/vendor/qcom-opensource/bt-kernel.git;protocol=https;rev=9e5cf29625d60f78e88440c94d096a9139445c00;branch=bt-performant.qclinux.1.0.r1-rel \
             file://bt_dlkm \
             file://bt_dlkm.service \
             "
    
    S = "${WORKDIR}/git"
    
    RPROVIDES:${PN} += "kernel-module-bt-kernel"
    
    EXTRA_OEMAKE += "MACHINE='${MACHINE}'"
    MAKE_TARGETS = "modules"
    MODULES_INSTALL_TARGET = "modules_install"
    # Kernel module to be autoloaded
    KERNEL_MODULE_AUTOLOAD += "bt_fm_slim"
    Copy to clipboard

## Tạo ảnh thiết bị

Để tạo toàn bộ ảnh và kernel, hãy chạy các lệnh Yocto sau:

# setup the build environment
      export SHELL=/bin/bash
    
      source setup-environment
    # (select "<SoC> meta-qcom" → Enter → select "qcom-wayland meta-qcom-distro" → Enter)
    
    # build qcom linux console image
      bitbake qcom-console-image
    
    # Build kernel only
      bitbake linux-qcom-base
    
    # Build Images are produced under
    # build-qcom-wayland/tmp-glibc/deploy/images/<SoC>-<board>-<variant>/qcom-console-image/
    Copy to clipboard

Để biết thêm thông tin về cách tạo các ảnh khác nhau cho bản phân phối Qualcomm cho SoC được hỗ trợ, hãy xem phần Cấu hình kernel

Ghi chú

Để biên dịch một BSP tùy chỉnh, hãy sử dụng `linux-qcom-custom`.

## Khởi động thiết bị

Tệp `efi.bin` chứa các ảnh systemd-boot (trình quản lý khởi động), kernel và initramfs. Hệ thống build Yocto đóng gói những ảnh này vào `efi.bin` được flash vào phân vùng hệ thống EFI (ESP) để khởi động thiết bị.

Device tree blob được cập nhật hoặc thêm vào biến `KERNEL_DEVICETREE` trong tệp `conf/machine/<SoC>-<board>-<variant>.conf`. Các Device tree blob này được dùng để biên dịch tệp `dtb.bin`.

Flash ảnh `efi.bin` và `dtb.bin` bằng các lệnh fastboot sau:

# Bring the device in fastboot mode
    # cd to the source root location
    $ cd build-qcom-wayland/tmp-glibc/deploy/images/<SoC>/qcom-console-image
    $ fastboot flash efi efi.bin
    $ fastboot flash dtb_a dtb.bin
    $ fastboot reboot
    Copy to clipboard

Sau khi bản build Qualcomm Linux được tạo, bản build  kernel sẽ hoàn tất và các ảnh liên quan đến kernel sẽ được tạo trong thư mục `tmp-glibc/deploy/images/<SoC>-<board>-<variant>/`.

Bảng sau đây liệt kê các kernel build artifacts:

Bảng : Kernel build artifacts

| Ảnh | Tên ảnh | Đường dẫn triển khai bản build | Chi tiết |
| --- | --- | --- | --- |
| Định dạng thực thi và liên kết kernel (ELF) | vmlinux<br>    Copy to clipboard | tmp-glibc/deploy/images/<SoC>-<board>-<variant>/<br>    Copy to clipboard | ELF kernel đầu ra với các debug symbol. |
| Initramfs | initramfs-qcom-image-<SoC>-<board>-<variant>.cpio.gz<br>    Copy to clipboard | tmp-glibc/deploy/images/<SoC>-<board>-<variant>/<br>    Copy to clipboard | Initramfs trong định dạng tệp copy in, copy out (CPIO). |
| Ảnh kernel | Image<br>    Copy to clipboard | tmp-glibc/deploy/images/<SoC>-<board>-<variant>/<br>    Copy to clipboard | Ảnh Kernel raw binary, systemd-boot không hỗ trợ ảnh nén. |
| Mô-đun kernel | Các mô-đun kernel có thể tải động (DLKM) của kernel khác<br><br><br>modules-<SoC>-<board>-<variant>.tgz<br>    Copy to clipboard | tmp-glibc/deploy/images/<SoC>-<board>-<variant>/<br>    Copy to clipboard | Kernel driver Mô-đun. |
| Device tree blobs | <SoC>-addons-<VARIANT>.dtb<br>    Copy to clipboard | tmp-glibc/deploy/images/<SoC>-<board>-<variant>/<br>    Copy to clipboard | Các tệp device tree blob riêng lẻ. |
| Phân vùng ESP | efi.bin<br>    Copy to clipboard | tmp-glibc/deploy/images/<SoC>-<board>-<variant>/<br>    Copy to clipboard | Tất cả các ảnh khởi động cần thiết bao gồm systemd-boot, kernel và initramfs đều được đóng gói vào tệp nhị phân giao diện firmware có thể mở rộng (`efi.bin`). |
| Phân vùng DTB | dtb.bin<br>    Copy to clipboard | tmp-glibc/deploy/images/<SoC>-<board>-<variant>/<br>    Copy to clipboard | Tất cả các tệp DTBO được gộp vào tệp nhị phân `dtb.bin`. |

Last Published: Jan 01, 2026

[Previous Topic
Tổng quan về kernel](https://docs.qualcomm.com/bundle/publicresource/80-70020-3VI/topics/overview.md) [Next Topic
Tổng quan về kiến trúc và quy trình khởi động](https://docs.qualcomm.com/bundle/publicresource/80-70020-3VI/topics/boot-flow-and-architecture-overview.md)